:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --panel: rgba(255, 255, 255, 0.92);
  --text: #0f172a;
  --muted: #475569;
  --soft: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0ea5e9;
  --accent-2: #2563eb;
  --accent-3: #14b8a6;
  --accent-soft: rgba(14, 165, 233, 0.14);
  --danger: #dc2626;
  --warning: #b45309;
  --editor-bg: #f8fafc;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius: 6px;
  --radius-lg: 8px;
  --app-inset: clamp(18px, 2.2vw, 32px);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020617;
  --surface: #0f172a;
  --surface-2: #111827;
  --surface-3: #1e293b;
  --panel: rgba(15, 23, 42, 0.88);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --soft: #94a3b8;
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(203, 213, 225, 0.32);
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #2dd4bf;
  --accent-soft: rgba(56, 189, 248, 0.18);
  --danger: #f87171;
  --warning: #fbbf24;
  --editor-bg: #020617;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 54%, transparent), transparent 360px),
    radial-gradient(circle at 86px 48px, color-mix(in srgb, var(--accent) 9%, transparent), transparent 220px),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  height: 100%;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr) 316px;
  grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar workspace context";
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-width: 100vw;
  overflow: hidden;
}

.topbar {
  grid-area: topbar;
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 520px) minmax(180px, 1fr);
  align-items: center;
  column-gap: 14px;
  padding: 8px var(--app-inset);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(22px) saturate(120%);
}

.topbar-row {
  display: contents;
}

.brand {
  display: inline-flex;
  order: 1;
  align-items: center;
  gap: 10px;
  min-width: 208px;
  text-decoration: none;
  color: var(--text);
  font-weight: 680;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 50%, var(--surface-3)), color-mix(in srgb, var(--accent-2) 34%, var(--surface)));
  color: #101009;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-text {
  white-space: nowrap;
}

.global-search {
  position: relative;
  order: 2;
  min-width: 0;
  width: 100%;
  max-width: none;
  justify-self: center;
}

.topbar-actions {
  display: flex;
  order: 3;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  justify-self: end;
}

.language-toggle {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  padding: 3px;
}

.language-toggle .tool-button {
  min-width: 38px;
  height: 30px;
  border-color: transparent;
  background: transparent;
  padding: 0 8px;
}

.global-search input,
.command-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 74%, transparent);
  color: var(--text);
  height: 34px;
  padding: 6px 54px 6px 32px;
  font-size: 14px;
  outline: 0;
  min-width: 0;
}

.global-search input {
  cursor: pointer;
}

.search-shortcut {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  padding: 1px 6px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.4;
}

.global-search input:focus,
.command-box input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.icon-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  cursor: pointer;
}

.tool-button {
  gap: 6px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}

.tool-button:hover,
.icon-button:hover,
.filter-chip:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface-3) 84%, transparent);
}

.tool-button:focus-visible,
.icon-button:focus-visible,
.settings-segmented button:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tool-button:disabled,
.icon-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.tool-button.primary,
.tool-button.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 90%, #fff 10%), color-mix(in srgb, var(--accent) 72%, #000 28%));
  color: #111109;
  border-color: color-mix(in srgb, var(--accent) 74%, #fff 10%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 8px 20px color-mix(in srgb, var(--accent) 15%, transparent);
}

.mobile-only {
  display: none;
}

.sidebar,
.context-panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(120%);
}

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  padding: 14px 10px 24px;
}

.context-panel {
  grid-area: context;
  border-left: 1px solid var(--line);
  padding: 14px 12px 24px;
}

.sidebar-section,
.context-panel section {
  margin-bottom: 18px;
}

.context-panel section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  padding: 12px;
}

.section-title {
  margin: 0 0 8px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tree a,
.link-list a,
.outline a {
  display: block;
  border-radius: var(--radius);
  padding: 7px 8px;
  text-decoration: none;
}

.tree a {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  font-size: 13px;
}

.tree a:hover,
.tree a.active,
.link-list a:hover,
.outline a:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  color: var(--text);
}

.tree a.active {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 78%, transparent);
}

.tree a small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

details {
  margin: 7px 0;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 690;
  padding: 6px 8px;
}

details div {
  margin-left: 10px;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
}

.filter-chip span {
  color: var(--muted);
}

.workspace {
  grid-area: workspace;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: auto;
  padding: 32px clamp(16px, 2vw, 32px) 44px;
}

.dashboard-mode {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 54px minmax(0, 1fr);
  grid-template-areas:
    "topbar"
    "workspace";
}

.dashboard-mode .sidebar,
.dashboard-mode .context-panel,
.dashboard-mode .language-toggle,
.dashboard-mode #edit-toggle,
.dashboard-mode .breadcrumbs,
.dashboard-mode .note-meta {
  display: none;
}

.dashboard-mode .workspace {
  padding: 24px var(--app-inset) 56px;
}

.dashboard-mode .reader {
  max-width: none;
  width: 100%;
}

.reader,
.editor {
  max-width: min(880px, 100%);
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--soft);
  font-size: 12px;
}

.breadcrumbs b {
  color: var(--line-strong);
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.type-chip,
.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 76%, transparent);
  padding: 3px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.type-principle { --type: #f06f8f; }
.type-pattern { --type: #d9d2c4; }
.type-research { --type: #b4c7c0; }
.type-decision { --type: #e7a3ad; }
.type-project { --type: #c7beb0; }
.type-worklog { --type: #b5ad9f; }
.type-reference { --type: #968f84; }

.type-chip[class*="type-"] {
  border-color: color-mix(in srgb, var(--type) 34%, var(--line));
  color: var(--type);
  background: color-mix(in srgb, var(--type) 12%, transparent);
}

.draft-chip {
  color: var(--warning);
}

.note {
  color: var(--text);
  font-size: 16px;
  max-width: 100%;
  overflow-wrap: break-word;
}

.note h1 {
  max-width: 800px;
  margin: 0 0 30px;
  font-size: clamp(32px, 3.3vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 760;
}

.note h2 {
  margin: 42px 0 12px;
  padding-top: 8px;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: 0;
  font-weight: 730;
  scroll-margin-top: 84px;
}

.note h3 {
  margin: 28px 0 10px;
  font-size: 18px;
  scroll-margin-top: 84px;
}

.note p,
.note li {
  max-width: 100%;
}

.note p {
  margin: 12px 0;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}

.note ul,
.note ol {
  max-width: 760px;
  padding-left: 24px;
}

.note a {
  color: var(--accent);
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.heading-anchor {
  margin-left: 8px;
  color: var(--soft);
  opacity: 0;
  text-decoration: none;
}

.note h2:hover .heading-anchor,
.note h3:hover .heading-anchor {
  opacity: 1;
}

.note pre {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
}

.note code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.note :not(pre) > code {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  padding: 1px 5px;
}

.note blockquote {
  max-width: 760px;
  margin: 18px 0;
  border-left: 3px solid var(--accent-2);
  padding: 8px 0 8px 16px;
  color: var(--muted);
}

.note table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
  margin: 20px 0;
}

.note th,
.note td {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.note th {
  background: var(--surface-2);
}

.broken-link {
  color: var(--danger);
  font-weight: 760;
}

.mermaid-block {
  max-width: 100%;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
  padding: 14px;
  margin: 18px 0;
}

.mermaid-block svg {
  display: block;
  min-width: 720px;
}

.mermaid-error {
  color: var(--danger);
}

.outline a {
  color: var(--muted);
  font-size: 13px;
}

.outline .depth-3 {
  padding-left: 20px;
}

.link-list a {
  color: var(--text);
  font-size: 14px;
}

.link-list a small {
  display: block;
  margin-top: 2px;
  color: var(--soft);
  font-size: 11px;
}

.health-list {
  display: grid;
  gap: 7px;
}

.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 54%, transparent);
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
}

.health-row strong {
  color: var(--text);
}

.dashboard-link {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.dashboard-shell {
  width: 100%;
  max-width: none;
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  max-width: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 4px 0 22px;
  margin-bottom: 14px;
}

.dashboard-hero .eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 740;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.dashboard-hero h1 {
  max-width: 680px;
  margin: 0 0 8px;
  font-size: clamp(26px, 2.35vw, 38px);
  line-height: 1.12;
}

.dashboard-hero p:last-child {
  max-width: 580px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.dashboard-status {
  flex: 0 0 210px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  padding: 12px 14px;
}

.dashboard-status span,
.runtime-strip span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 720;
  text-transform: uppercase;
}

.dashboard-status strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: none;
  margin: 0;
}

.health-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  padding: 13px 14px;
}

.health-grid span,
.dashboard-card span,
.review-item span,
.dashboard-card em {
  display: block;
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
}

.health-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 23px;
  line-height: 1;
}

.dashboard-section {
  max-width: none;
  margin-top: 30px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(400px, 0.85fr);
  gap: 14px;
  max-width: none;
  margin-top: 14px;
}

.dashboard-main,
.dashboard-side section,
.runtime-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  padding: 15px;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.dashboard-heading p {
  max-width: 360px;
  margin: 0;
  color: var(--soft);
  font-size: 13px;
  text-align: right;
}

.compact-heading {
  display: block;
}

.compact-heading p {
  max-width: none;
  margin-top: 4px;
  text-align: left;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.dashboard-cards,
.review-list {
  display: grid;
  gap: 8px;
}

.dashboard-card,
.review-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 54%, transparent);
  padding: 12px;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.dashboard-card:hover,
.review-item:hover {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  transform: translateY(-1px);
}

.dashboard-card strong,
.review-item strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.dashboard-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-card em {
  margin-top: 8px;
  color: var(--accent);
}

.review-item span {
  margin-top: 5px;
}

.review-item em {
  display: block;
  margin-top: 5px;
  color: var(--warning);
  font-size: 12px;
  font-style: normal;
}

.runtime-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.runtime-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.stats {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat-row strong {
  color: var(--text);
  text-align: right;
}

.graph-dock {
  min-width: 0;
}

.graph-header {
  display: block;
  margin: 0 0 12px;
}

.graph-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.graph-actions .tool-button {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.graph-insights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.graph-insight-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 58%, transparent);
  padding: 9px 10px;
}

.graph-insight-card span {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.graph-insight-card strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-insight-card small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 46%),
    var(--surface);
  overflow: hidden;
}

.graph-large {
  max-width: min(880px, 100%);
  margin: 0 auto;
}

.graph-small {
  height: 220px;
}

.graph svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 210px;
}

.graph-large svg {
  min-height: 340px;
}

.graph-edges line {
  stroke: color-mix(in srgb, var(--line-strong) 74%, var(--accent));
  stroke-width: 1;
}

.graph-node {
  fill: var(--type, var(--accent-3));
  opacity: 0.82;
}

.graph-node-active {
  stroke: #ffffff;
  stroke-width: 2.4;
  opacity: 1;
}

.graph text {
  fill: var(--muted);
  font-size: 11px;
  text-anchor: middle;
  pointer-events: none;
}

.graph-small text {
  display: none;
}

.editor {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.editor-toolbar p {
  margin: 2px 0 0;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 620px;
}

textarea {
  width: 100%;
  min-height: 620px;
  resize: vertical;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--editor-bg);
  color: var(--text);
  padding: 18px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  outline: 0;
}

.preview {
  min-width: 0;
  max-height: 720px;
  overflow: auto;
  padding: 18px;
  font-size: 15px;
}

.preview h1 {
  font-size: 30px;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: 10vh 14px 0;
  background: rgba(5, 5, 5, 0.62);
  backdrop-filter: blur(18px) saturate(120%);
}

.command-box {
  width: min(640px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, #000 4%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  padding: 8px;
}

.command-box input {
  height: 42px;
  border-color: transparent;
  background: transparent;
  padding: 8px 14px;
  font-size: 15px;
}

.command-results {
  margin-top: 4px;
  max-height: min(520px, 62vh);
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.command-group {
  padding: 7px 4px 4px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 740;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.command-results button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  align-items: start;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
}

.command-results button:hover,
.command-results button.active {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.command-results span {
  min-width: 0;
}

.command-results strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-results small {
  color: var(--muted);
}

.command-results p {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.command-empty {
  padding: 26px 12px 30px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.command-kbd {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--soft);
  font-size: 11px;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: start center;
  padding: 9vh 14px 0;
  background: rgba(5, 5, 5, 0.62);
  backdrop-filter: blur(18px) saturate(120%);
}

.settings-card {
  width: min(640px, 100%);
  max-height: min(720px, 82vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, #000 4%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 18px 14px;
}

.settings-header h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.settings-body {
  padding: 6px 18px 18px;
}

.settings-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-copy {
  min-width: 0;
}

.settings-copy h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.settings-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-segmented {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 68%, transparent);
  padding: 3px;
}

.settings-segmented button {
  min-width: 68px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.settings-segmented button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-3) 70%, transparent);
}

.settings-segmented button.active {
  background: var(--accent);
  color: #111109;
}

.hover-preview {
  position: fixed;
  z-index: 60;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  pointer-events: none;
}

.hover-preview strong,
.hover-preview span {
  display: block;
}

.hover-preview span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hover-preview p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 13px;
}

.muted,
.empty {
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  html,
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    position: static;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: 54px auto auto;
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace"
      "context context";
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .sidebar {
    position: sticky;
    top: 54px;
    height: calc(100vh - 54px);
  }

  .workspace {
    overflow: visible;
  }

  .context-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 780px) {
  :root {
    --app-inset: 12px;
  }

  html,
  body,
  .app-shell {
    height: auto;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "row"
      "search";
    gap: 8px;
    width: 100vw;
    max-width: 100vw;
    overflow: visible;
    padding: 8px var(--app-inset) 10px;
  }

  .topbar-row {
    grid-area: row;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 8px;
    padding: 0;
  }

  .mobile-only {
    display: inline-flex;
  }

  #nav-toggle {
    flex: 0 0 38px;
  }

  .brand {
    flex: 0 0 42px;
    min-width: 0;
    width: 42px;
  }

  .brand-text {
    display: none;
  }

  .global-search {
    grid-area: search;
    min-width: 0;
    max-width: none;
  }

  .global-search input {
    height: 34px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .search-shortcut {
    display: none;
  }

  .topbar-actions {
    position: static;
    z-index: auto;
    margin-left: 0;
    margin-inline-start: auto;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    padding-right: 0;
  }

  .language-toggle {
    gap: 2px;
    padding: 2px;
  }

  .language-toggle .tool-button.active {
    display: none;
  }

  .language-toggle .tool-button {
    min-width: 34px;
    height: 30px;
    padding: 0 7px;
  }

  .tool-button {
    height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  #command-open {
    display: none;
  }

  #edit-toggle {
    position: static;
    min-width: 50px;
    height: 34px;
    padding: 0 10px;
    box-shadow: none;
  }

  #theme-toggle {
    display: none;
  }

  .sidebar {
    position: fixed;
    inset: 104px auto 0 0;
    z-index: 30;
    width: min(320px, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .context-panel {
    position: static;
    display: block;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .workspace {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 20px var(--app-inset);
    overflow: hidden;
  }

  .graph-dock {
    padding: 12px;
  }

  .dashboard-mode .workspace {
    padding: 22px var(--app-inset) 42px;
  }

  .reader,
  .editor {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .note {
    font-size: 15.5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .note h1 {
    max-width: 100%;
    font-size: 29px;
    line-height: 1.08;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .note h2,
  .note h3 {
    scroll-margin-top: 122px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .note p,
  .note li {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .note ul,
  .note ol {
    max-width: 100%;
    padding-left: 22px;
  }

  .editor-toolbar {
    display: block;
  }

  .editor-actions {
    margin-top: 12px;
    justify-content: flex-start;
  }

  .editor-grid {
    display: block;
  }

  .dashboard-hero {
    display: block;
    padding: 10px 0 18px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .dashboard-status {
    width: 100%;
    margin-top: 16px;
  }

  .dashboard-hero p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-grid,
  .dashboard-columns,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-main,
  .dashboard-side section,
  .runtime-strip {
    max-width: calc(100vw - (var(--app-inset) * 2));
  }

  .dashboard-heading {
    display: block;
  }

  .dashboard-heading p {
    margin-top: 6px;
    text-align: left;
  }

  .runtime-strip {
    display: block;
  }

  .runtime-strip .tool-button {
    width: 100%;
    margin-top: 14px;
  }

  .mermaid-block {
    max-width: calc(100vw - (var(--app-inset) * 2));
  }

  .mermaid-block svg {
    min-width: 760px;
  }

  .context-panel {
    padding: 16px;
  }

  .context-panel section {
    margin-bottom: 18px;
  }

  .settings-modal {
    padding-top: 7vh;
  }

  .settings-card {
    max-height: 86vh;
  }

  .settings-section {
    display: block;
  }

  .settings-segmented,
  .settings-section > .tool-button {
    margin-top: 12px;
  }

  .settings-segmented {
    width: 100%;
  }

  .settings-segmented button {
    flex: 1;
    min-width: 0;
  }

  .hover-preview {
    display: none;
  }

  textarea {
    min-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 360px) {
  #theme-toggle {
    display: none;
  }

  .language-toggle .tool-button {
    min-width: 32px;
  }
}

/* Product documentation redesign */
body {
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 40px), color-mix(in srgb, var(--surface-2) 88%, transparent) calc(100% - 40px)),
    var(--bg);
  color: var(--text);
  font-size: 15px;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(90deg, transparent 0, transparent calc(100% - 40px), rgba(15, 23, 42, 0.46) calc(100% - 40px)),
    var(--bg);
}

.app-shell {
  grid-template-columns: 288px minmax(0, 1fr) 276px;
  grid-template-rows: 58px minmax(0, 1fr);
}

.topbar {
  grid-template-columns: 288px minmax(260px, 1fr) auto;
  gap: 20px;
  min-height: 58px;
  padding: 10px 22px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(145%);
}

.brand {
  min-width: 0;
  gap: 11px;
  font-size: 16px;
  font-weight: 760;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-size: 10px;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

.global-search {
  max-width: 360px;
  justify-self: center;
}

.global-search input,
.command-box input {
  height: 36px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 68%, transparent);
  color: var(--text);
}

:root[data-theme="dark"] .global-search input,
:root[data-theme="dark"] .command-box input {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.search-shortcut,
.command-kbd {
  background: var(--surface);
  color: var(--soft);
}

.topbar-actions {
  gap: 7px;
}

.icon-button,
.tool-button,
.filter-chip {
  min-height: 34px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
  color: var(--muted);
  box-shadow: none;
}

.icon-button {
  min-width: 34px;
  width: 34px;
  height: 34px;
}

.tool-button {
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 700;
}

.tool-button:hover,
.icon-button:hover,
.filter-chip:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

.tool-button.primary,
.tool-button.active,
.settings-segmented button.active {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}

.language-toggle,
.settings-segmented {
  border-color: var(--line);
  background: var(--surface-2);
  padding: 3px;
}

.language-toggle .tool-button {
  color: var(--soft);
}

.sidebar,
.context-panel {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: none;
}

.sidebar {
  padding: 18px 14px 28px;
}

.context-panel {
  padding: 18px 16px 28px;
}

.sidebar-section {
  margin-bottom: 26px;
}

.context-panel section {
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 15px 0;
}

.context-panel section:first-child {
  padding-top: 0;
}

.context-panel section:last-child {
  border-bottom: 0;
}

.section-title {
  color: var(--soft);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.tree a,
.link-list a,
.outline a {
  border-radius: 6px;
  padding: 7px 9px;
}

.tree a {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

summary {
  color: var(--soft);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
}

details div {
  margin-left: 11px;
  border-left: 1px solid var(--line);
  padding-left: 7px;
}

.tree a:hover,
.tree a.active,
.link-list a:hover,
.outline a:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
}

.tree a.active {
  border: 0;
  background: transparent;
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.dashboard-link {
  border: 0;
  background: transparent;
}

.filter-list {
  gap: 6px;
}

.filter-chip {
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.workspace {
  padding: 44px clamp(32px, 5vw, 72px) 72px;
  background: var(--surface);
}

.reader {
  max-width: min(800px, 100%);
  margin: 0 auto;
}

.editor {
  max-width: min(1180px, 100%);
}

.breadcrumbs {
  margin-bottom: 12px;
  color: var(--soft);
}

.note-meta {
  gap: 7px;
  margin-bottom: 28px;
}

.type-chip,
.meta-chip {
  min-height: 24px;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--soft);
  font-size: 11px;
}

.type-principle { --type: #0ea5e9; }
.type-pattern { --type: #6366f1; }
.type-research { --type: #14b8a6; }
.type-decision { --type: #f59e0b; }
.type-project { --type: #2563eb; }
.type-worklog { --type: #64748b; }
.type-reference { --type: #8b5cf6; }

.note {
  font-size: 16px;
  line-height: 1.72;
}

.note h1 {
  max-width: 720px;
  margin: 0 0 30px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.02;
  font-weight: 780;
  letter-spacing: 0;
}

.note h2 {
  margin: 48px 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 760;
}

.note h3 {
  margin: 32px 0 10px;
  font-size: 18px;
  line-height: 1.35;
}

.note p,
.note li {
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
}

.note p {
  margin: 13px 0;
}

.note ul,
.note ol {
  max-width: 720px;
  margin: 14px 0;
  padding-left: 23px;
}

.note li + li {
  margin-top: 4px;
}

.note a {
  color: color-mix(in srgb, var(--accent-2) 82%, var(--accent));
  font-weight: 680;
  text-decoration-thickness: 1px;
}

.note pre {
  border-color: #020617;
  border-radius: 10px;
  background: #020617;
  color: #e2e8f0;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.note :not(pre) > code {
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
  color: color-mix(in srgb, var(--accent-2) 74%, var(--text));
}

.note blockquote {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  padding: 10px 14px;
}

.mermaid-block,
.graph {
  border-color: var(--line);
  background: var(--surface-2);
}

.outline a,
.link-list a {
  color: var(--muted);
  font-size: 13px;
}

.outline a:hover,
.link-list a:hover {
  color: var(--text);
}

.health-row,
.graph-insight-card,
.stat-row {
  border-color: var(--line);
  background: var(--surface-2);
}

.graph-insights {
  gap: 7px;
}

.graph-insight-card {
  padding: 8px 9px;
}

.graph {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 50%),
    var(--surface-2);
}

.graph-node-active {
  stroke: var(--text);
}

.dashboard-mode {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 58px minmax(0, 1fr);
  grid-template-areas:
    "topbar"
    "workspace";
}

.dashboard-mode .workspace {
  padding: 42px clamp(28px, 5vw, 72px) 72px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 82%, transparent), transparent 420px),
    var(--surface);
}

.dashboard-mode .reader {
  max-width: 1180px;
}

.dashboard-shell {
  display: grid;
  gap: 24px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: end;
  gap: 40px;
  border-bottom: 1px solid var(--line);
  padding: 6px 0 30px;
  margin-bottom: 0;
}

.dashboard-hero .eyebrow {
  color: var(--accent-2);
  letter-spacing: 0.16em;
}

.dashboard-hero h1 {
  max-width: 720px;
  margin-bottom: 10px;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

.dashboard-hero p:last-child {
  max-width: 690px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.dashboard-status {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.health-grid {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.health-grid div {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 18px 20px;
}

.health-grid div:last-child {
  border-right: 0;
}

.health-grid span,
.dashboard-card span,
.review-item span,
.dashboard-card em {
  color: var(--soft);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.health-grid strong {
  font-size: 28px;
}

.dashboard-layout {
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.72fr);
  gap: 28px;
  margin-top: 28px;
}

.dashboard-main,
.dashboard-side section,
.runtime-strip {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.dashboard-main {
  padding: 20px;
}

.dashboard-side {
  gap: 18px;
}

.dashboard-side section {
  padding: 18px;
}

.dashboard-heading {
  margin-bottom: 18px;
}

.dashboard-heading h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 18px;
  font-weight: 760;
}

.note .dashboard-heading h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 18px;
  line-height: 1.25;
}

.dashboard-heading p {
  color: var(--muted);
  font-size: 13px;
}

.review-list,
.dashboard-cards {
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.dashboard-card,
.review-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 14px 15px;
  transform: none;
}

.dashboard-card:last-child,
.review-item:last-child {
  border-bottom: 0;
}

.dashboard-card:hover,
.review-item:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-2));
  transform: none;
}

.dashboard-card strong,
.review-item strong {
  margin-top: 5px;
  font-size: 14px;
}

.dashboard-card p {
  color: var(--muted);
}

.runtime-strip {
  margin-top: 28px;
  padding: 18px 20px;
}

.editor {
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.command-palette,
.settings-modal {
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(16px) saturate(120%);
}

.command-box,
.settings-card,
.hover-preview {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.command-box {
  padding: 10px;
}

.command-results button:hover,
.command-results button.active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.settings-section {
  border-color: var(--line);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: 58px auto auto;
  }

  .topbar {
    grid-template-columns: 260px minmax(220px, 1fr) auto;
  }

  .context-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 18px;
    padding: 18px var(--app-inset) 26px;
  }

  .context-panel section {
    border-bottom: 0;
  }
}

@media (max-width: 780px) {
  :root {
    --app-inset: 16px;
  }

  body {
    width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    min-height: 92px;
    width: 100%;
    max-width: 100%;
    padding: 10px var(--app-inset);
  }

  .brand {
    flex-basis: 34px;
    width: 34px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .language-toggle {
    display: none;
  }

  #settings-open {
    display: inline-flex;
  }

  .global-search input {
    height: 38px;
  }

  .sidebar {
    inset: 102px auto 0 0;
    background: var(--surface);
  }

  .workspace,
  .dashboard-mode .workspace {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    padding: 28px var(--app-inset) 46px;
  }

  .reader,
  .editor {
    width: 100%;
    max-width: 100%;
  }

  .note {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .note > * {
    max-width: 100%;
  }

  .note h1 {
    max-width: 100%;
    font-size: clamp(31px, 9vw, 40px);
    line-height: 1.04;
  }

  .note h2 {
    margin-top: 40px;
    font-size: 21px;
  }

  .note p,
  .note li {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .note pre,
  .note table,
  .mermaid-block {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .mermaid-block svg {
    max-width: none;
  }

  .dashboard-shell {
    gap: 18px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-bottom: 22px;
  }

  .dashboard-hero h1 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .dashboard-hero p:last-child {
    font-size: 15px;
  }

  .dashboard-status {
    width: 100%;
    margin-top: 0;
  }

  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-grid div {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .health-grid div:nth-child(2n) {
    border-right: 0;
  }

  .health-grid div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 20px;
  }

  .dashboard-main,
  .dashboard-side section,
  .runtime-strip {
    max-width: none;
    border-radius: 10px;
  }

  .context-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 18px var(--app-inset) 32px;
  }

  .context-panel section {
    border-bottom: 1px solid var(--line);
  }

  .mermaid-block {
    max-width: 100%;
  }

  .command-palette,
  .settings-modal {
    padding: 8vh 10px 0;
  }

  .settings-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .settings-segmented,
  .settings-section > .tool-button {
    width: 100%;
  }

  .settings-segmented button {
    flex: 1;
  }
}
