/* Neuro-Viewer: Storybook-style chrome around the theme's own rendering. Tokens first; components below. */
@font-face { font-family: 'Nunito Sans'; font-weight: 400; font-display: swap; src: url('vendor/fonts/nunito-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 600; font-display: swap; src: url('vendor/fonts/nunito-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 700; font-display: swap; src: url('vendor/fonts/nunito-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-weight: 800; font-display: swap; src: url('vendor/fonts/nunito-sans-latin-800-normal.woff2') format('woff2'); }

:root {
  --font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ink: #2e3438;
  --ink-2: #5c6870;          /* all secondary and hint text: 5.72:1 on white, 5.42:1 on --app */
  --ink-3: #737f88;          /* icons only (4.10:1 on white): never text */
  --surface: #ffffff;
  --app: #f6f9fc;            /* sidebar, canvas backdrop */
  --line: #e1e6ea;
  --line-2: #d0d7dd;
  --hover: #edf2f6;
  --accent: #00706d;         /* Natus teal, darkened: 5.93:1 with white */
  --accent-ink: #00605d;
  --accent-soft: #e2f3f2;
  --ok: #136f36;  --ok-soft: #e3f4e8;  /* 5.48:1 on its soft */
  --warn: #8a5300; --warn-soft: #fdf1dc;
  --bad: #b42318;  --bad-soft: #fde7e5;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .08);
  --sidebar-w: 256px;
  --bar-h: 40px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--app); -webkit-font-smoothing: antialiased; }
body.dragging { cursor: row-resize; user-select: none; }
body.dragging iframe { pointer-events: none; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--app); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; overflow-wrap: anywhere; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); font-size: 11px; line-height: 16px; text-align: center; color: var(--ink-2); }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.nv-icon { flex: none; }
#root, .app { height: 100%; }

/* App grid */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.app.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100vh; background: var(--surface); border-left: 1px solid var(--line); }
.stage { flex: 1; min-height: 0; position: relative; overflow: auto; background: var(--app); }
.stage:has(> .docs) { background: var(--surface); }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; min-height: 0; height: 100vh; background: var(--app); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--accent); display: flex; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand-health { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-left: auto; }
.brand-health.ok { background: #22a35a; }
.brand-health.bad { background: var(--bad); }
.brand { flex-wrap: wrap; }
.brand-instance { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-top: 2px; padding: 2px 0 2px 8px; border-left: 3px solid var(--inst, var(--line-2)); font-size: 11px; color: var(--ink-2, var(--ink)); }
.brand-instance-name { font-weight: 800; font-size: 12px; color: var(--ink); }
.brand-instance-name::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--inst, var(--line-2)); }
.brand-instance-commit, .brand-instance-db { font-family: ui-monospace, Menlo, monospace; }
.search { position: relative; display: flex; align-items: center; margin: 0 12px 8px; color: var(--ink-3); }
.search .nv-icon { position: absolute; left: 10px; pointer-events: none; }
.search input { width: 100%; height: 32px; padding: 0 30px 0 32px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); outline: none; }
.search input:focus { border-color: var(--accent); }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 9px; }
.tree { flex: 1; overflow: auto; padding: 4px 8px 16px; }
.tree-empty { margin: 4px 10px 8px; font-size: 12px; color: var(--ink-2); }
.tree-note { margin: 4px 10px 8px; font-size: 12px; color: var(--ink-2); display: flex; gap: 4px; white-space: nowrap; }
.tree-count { flex: none; }
.tree-enter { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tree-empty code { font-size: 11px; }
.level { margin-top: 10px; }
.level-head { display: flex; align-items: center; gap: 4px; width: 100%; border: 0; background: none; padding: 4px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); cursor: pointer; border-radius: 4px; }
.level-head:hover { color: var(--ink); }
.level-head:disabled, .group-head:disabled { cursor: default; }
.level-head:disabled:hover { color: var(--ink-2); }
.chev { transition: transform .12s ease-out; color: var(--ink-3); }
.chev.open { transform: rotate(90deg); }
.group-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 4px 6px 4px 8px; font-weight: 700; font-size: 13px; cursor: pointer; border-radius: 4px; text-align: left; text-transform: capitalize; }
.group-head:hover { background: var(--hover); }
.group-head:disabled { color: var(--ink); }
.group-head:disabled:hover { background: none; }
.ic-group { color: var(--ink-2); }
.story { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 38px; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: 13px; }
.story:hover { background: var(--hover); }
.story.active { background: var(--accent); color: #fff; font-weight: 700; }
.story.active .ic-story, .story.active .ic-docs { color: #fff; }
.story.broken { color: var(--bad); }
.ic-story { color: #0e9f97; }
.ic-docs { color: var(--ink-3); margin-left: auto; }
.story-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 4px; height: var(--bar-h); padding: 0 8px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; overflow-x: auto; overflow-y: hidden; }
.tabs { display: flex; height: 100%; }
.tab { white-space: nowrap; border: 0; background: none; padding: 0 12px; height: 100%; font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab:focus-visible, .atab:focus-visible { outline-offset: -2px; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }
.tb-fill { flex: 1; }
.tool { display: flex; align-items: center; }
/* Tight enough that the toolbar, with its labels on one line, fits a 1440 px window beside the sidebar. */
.toolbar > .tool + .tool { margin-left: 4px; padding-left: 4px; border-left: 1px solid var(--line); }
.toolbar .tab { padding: 0 10px; }
.vp-label { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-left: 6px; white-space: nowrap; }
.icon-btn.quiet[aria-pressed="true"] { background: none; color: var(--accent-ink); }
.seg { display: flex; align-items: center; gap: 2px; }
.seg-label { white-space: nowrap; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 0 4px 0 6px; }
.icon-btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; min-width: 28px; justify-content: center; padding: 0 6px; border: 0; border-radius: 4px; background: none; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on, .icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.ib-label { font-size: 12px; font-weight: 700; }
.chip-btn { height: 24px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.chip-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.select-tool { display: flex; align-items: center; gap: 4px; color: var(--ink-2); padding: 0 4px; }
.select-tool select { height: 28px; border: 1px solid transparent; border-radius: 4px; background: none; font-size: 13px; font-weight: 600; cursor: pointer; }
.select-tool select:hover { background: var(--hover); }
.view-chips { display: flex; gap: 4px; }
.vchip { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 2px 0 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.vchip button { display: flex; border: 0; background: none; color: inherit; cursor: pointer; padding: 3px; border-radius: 50%; }
.vchip button:hover { background: rgba(0, 112, 109, .15); }

/* Canvas */
.canvas { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 24px 24px 0; overflow: hidden; }
.frame-wrap { position: relative; flex: none; background: var(--surface); box-shadow: var(--shadow); border-radius: 2px; overflow: hidden; }
.frame-wrap iframe { border: 0; display: block; transform-origin: 0 0; background: #fff; }
.frame-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(255,255,255,.85); color: var(--ink-2); font-weight: 600; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .chev { transition: none; } }
.frame-meta { display: flex; align-items: center; gap: 6px; position: absolute; right: 12px; bottom: 6px; font-size: 11px; color: var(--ink-2); font-weight: 600; background: var(--app); padding: 1px 6px; border-radius: 4px; }

/* Addons panel */
.addons { position: relative; flex: none; display: flex; flex-direction: column; border-top: 1px solid var(--line); background: var(--surface); min-height: 0; }
.addons-drag { position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: row-resize; z-index: 2; }
.addons-drag:hover { background: linear-gradient(transparent 3px, var(--accent) 3px, var(--accent) 5px, transparent 5px); }
.addons-tabs { display: flex; align-items: center; height: var(--bar-h); padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.atab { display: inline-flex; align-items: center; gap: 6px; height: 100%; border: 0; background: none; padding: 0 12px; font-weight: 700; font-size: 13px; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.atab:hover { color: var(--ink); }
.atab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--hover); color: var(--ink-2); font-size: 11px; line-height: 18px; text-align: center; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.addons-body { flex: 1; overflow: auto; padding: 12px 16px 24px; }
.addons-tabs .addons-check-status { flex: 0 1 auto; min-width: 0; margin-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addons-tabs .btn { margin-right: 4px; flex: none; }
.run-interrupted-row { display: flex; align-items: center; gap: 8px; }
.run-interrupted-row > span { flex: 1; }
.addons-body h3 { font-size: 13px; font-weight: 800; margin: 14px 0 6px; }
.addons-body h3:first-child, .addons-body section:first-child h3 { margin-top: 0; }
.addons-body h4 { font-size: 13px; margin: 10px 0 4px; text-transform: capitalize; }
.panel-error { color: var(--bad); }

/* Shared bits */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-ink); }
.btn.accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: transparent; }
.pill { display: inline-block; padding: 0 7px; border-radius: 9px; background: var(--hover); color: var(--ink-2); font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: 1px; white-space: nowrap; }
.pill.theme, .pill.current { background: #e8eef4; color: #3a5068; }
.pill.viewer, .pill.next, .pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.missing, .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.chip { display: inline-block; margin: 1px 4px 1px 0; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; color: var(--ink-2); background: var(--app); }
.callout { padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; font-size: 13px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th { text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.grid-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid-table td.actions { white-space: nowrap; text-align: right; }
.grid-table th.actions { text-align: right; }
.grid-table td.actions .btn { margin-left: 4px; }
.grid-table td.n { width: 28px; color: var(--ink-2); }
.grid-table tr.on td { background: var(--accent-soft); }
.grid-table tr.sub > td { background: var(--app); }
.fileref { display: inline-flex; align-items: center; gap: 4px; }
.fileref a { text-decoration: none; }
.fileref a:hover code { border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--ink-2); font-weight: 700; }
.kv dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.kv dd.url code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 32px; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.controls-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.controls-bar.wrap { flex-wrap: wrap; }
.control-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px 20px; }
.control { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.control label { font-size: 12px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.control label code { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; overflow-wrap: normal; }
.control-group { grid-column: 1 / -1; margin: 8px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.control-group code { text-transform: none; letter-spacing: 0; font-weight: 600; }
.control.edited label code { color: var(--accent-ink); }
.control-input { display: flex; gap: 4px; align-items: flex-start; }
.control input[type=text], .control input[type=number], .control textarea, .state-add input, .state-add select { width: 100%; min-height: 30px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.control textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
.control.edited input, .control.edited textarea { border-color: var(--accent); background: #f7fcfc; }
.options { margin-top: 14px; }
.options .control-list { margin-top: 10px; }
.state-list li { display: flex; align-items: center; gap: 6px; }
.state-add { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.state-add select { width: auto; }
.states section, .snapshots section { margin-bottom: 16px; }
.thumb { height: 34px; border: 1px solid var(--line); border-radius: 3px; vertical-align: middle; background: var(--app); }
.thumbs { display: flex; gap: 12px; flex-wrap: wrap; }
.thumb-card { display: flex; flex-direction: column; gap: 4px; width: 200px; text-decoration: none; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.thumb-card img { width: 100%; height: 130px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 4px; background: var(--app); }
.thumb-card:hover img { border-color: var(--accent); }
.console { margin-top: 8px; }
.console li { color: var(--warn); overflow-wrap: anywhere; }
.fidelity { margin-bottom: 8px; }
.fidelity .thumbs { margin-top: 6px; }
.findings li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Docs */
.docs { max-width: 960px; margin: 0 auto; padding: 40px 40px 80px; background: var(--surface); min-height: 100%; }
.docs-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.docs h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 8px; }
.docs-lede { font-size: 16px; color: var(--ink-2); margin: 0 0 24px; max-width: 70ch; }
.docs-empty { padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); background: var(--app); }
.docs-section { margin-top: 36px; }
.docs-section h2 { font-size: 20px; font-weight: 800; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.docs-section h3 { font-size: 15px; margin: 16px 0 4px; }
.docs-files, .docs-sub { font-size: 13px; color: var(--ink-2); }
.doc-story { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.doc-story iframe { width: 100%; border: 0; display: block; }
.doc-story figcaption { padding: 6px 12px; font-size: 12px; border-top: 1px solid var(--line); background: var(--app); }
.markdown { font-size: 15px; line-height: 1.65; max-width: 75ch; }
.markdown h1 { font-size: 26px; } .markdown h2 { font-size: 20px; margin-top: 28px; } .markdown h3 { font-size: 16px; }
.markdown pre { background: #1f2933; color: #e4e9ee; padding: 12px 14px; border-radius: var(--radius); overflow: auto; }
.markdown pre code { background: none; border: 0; color: inherit; }
.markdown table { border-collapse: collapse; } .markdown th, .markdown td { border: 1px solid var(--line); padding: 4px 10px; }
.markdown blockquote { margin: 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.markdown .doc-story { max-width: none; }

/* Welcome */
.welcome { max-width: 1040px; margin: 0 auto; padding: 48px 40px 80px; overflow: auto; }
.welcome h1 { font-size: 36px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.welcome .lede { font-size: 17px; color: var(--ink-2); max-width: 70ch; margin: 0 0 28px; }
.level-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 36px; }
.level-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; box-shadow: var(--shadow); }
.level-card:hover:not(:disabled) { border-color: var(--accent); }
.level-card:disabled { cursor: default; opacity: .6; box-shadow: none; }
.lc-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--accent-ink); }
.lc-count { margin-left: auto; font-size: 12px; color: var(--ink-2); background: var(--app); border-radius: 9px; padding: 0 7px; }
.lc-text { font-size: 13px; color: var(--ink-2); }
.welcome-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.welcome h2 { font-size: 16px; font-weight: 800; margin: 0 0 8px; }
.welcome ol { padding-left: 18px; margin: 0; } .welcome li { margin-bottom: 6px; font-size: 14px; }
.welcome pre { background: #1f2933; color: #e4e9ee; padding: 12px; border-radius: var(--radius); overflow: auto; font-size: 12px; white-space: pre; }
.welcome code { overflow-wrap: normal; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.shortcuts dt { text-align: right; } .shortcuts dd { margin: 0; color: var(--ink-2); }

/* Palette, dialogs, toasts */
.palette-backdrop { position: fixed; inset: 0; background: rgba(32, 40, 48, .35); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 50; }
.palette { width: min(640px, calc(100vw - 32px)); background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.palette-input input { flex: 1; height: 50px; border: 0; outline: none; font-size: 16px; color: var(--ink); }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; color: var(--ink); }
.palette-item.sel { background: var(--accent); color: #fff; }
.palette-item.sel .pi-sub, .palette-item.sel kbd { color: #fff; border-color: rgba(255,255,255,.5); background: transparent; }
.pi-title { font-weight: 600; } .pi-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item kbd { margin-left: auto; }
.palette-empty { padding: 16px; color: var(--ink-2); }
.palette-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.shortcuts-dialog { padding: 20px 24px; max-width: 420px; }
.shortcuts-dialog h2 { margin: 0 0 12px; font-size: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(440px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: var(--radius); background: #24303a; color: #fff; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; white-space: pre-line; border-left: 4px solid #6b7c88; }
.toast.ok { border-left-color: #3ccf7a; } .toast.warn { border-left-color: #f0b44c; } .toast.bad { border-left-color: #ff6b5e; }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; width: min(300px, 86vw); box-shadow: var(--shadow-lg); }
  .welcome, .docs { padding: 24px 16px 60px; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.choice { display: inline-flex; align-items: center; gap: 4px; }
.control select { width: 100%; min-height: 30px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.control input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.control .pill { font-weight: 600; }
.console.known li { color: var(--ink-2); }
.state-chain { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; }

/* Sidebar: Docs nested under its story; the site map link */
.story-docs { padding-left: 58px; font-size: 12.5px; }
.ic-docs-item { color: var(--ink-2); }
.story.active .ic-docs-item { color: #fff; }
.story.guide-item { padding-left: 22px; }
.story.active .ic-docs-item { color: #fff; }
.map-link { margin: 0 8px 4px; padding-left: 12px; font-weight: 700; }

/* Usage: panel and site map */
.usage-filters { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.usage-filters select, .usage-filters input { height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.usage-filters input { min-width: 240px; }
.usage section { margin-bottom: 18px; }
.usage-table td.actions .btn { margin-left: 2px; }
.usage-map { padding: 32px 40px 80px; max-width: 1280px; }
.usage-map h1 { font-size: 30px; font-weight: 800; margin: 0 0 6px; }
.usage-map .lede { color: var(--ink-2); margin: 0 0 16px; max-width: 90ch; }
.map-tabs { height: 38px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.page-rows { margin: 0; padding-left: 18px; }
.stage:has(> .usage-map), .main:has(> .usage-map) { background: var(--surface); }
.main > .usage-map { overflow: auto; height: 100vh; }

.usage-page { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; background: var(--surface); min-height: 100%; }
.usage-title { font-size: 24px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.stage:has(> .usage-page) { background: var(--surface); }

.hot-note { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 70; padding: 5px 12px; border-radius: 999px; background: #24303a; color: #fff; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); pointer-events: none; }

/* Menus (Export) */
.menu-wrap { position: relative; }
.chev-down { transform: rotate(90deg); margin-left: -2px; }
.menu { position: fixed; right: 8px; top: 46px; z-index: 55; max-height: calc(100vh - 60px); overflow: auto; min-width: 300px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); }
.menu-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.menu-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius); background: none; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item .nv-icon { margin-top: 2px; color: var(--ink-2); }
.menu-item span { display: flex; flex-direction: column; }
.menu-item strong { font-size: 13px; }
.menu-item small { font-size: 12px; color: var(--ink-2); }
/* Motion panel: one run button, everything else folds */
.motion { max-width: 1100px; }
.motion-block { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.motion-block > summary { color: var(--ink); font-size: 13px; font-weight: 800; }
.motion-block[open] > summary { margin-bottom: 8px; }
.motion-block summary .muted { font-weight: 600; margin-left: 4px; }
.motion-sub { margin-top: 6px; }
.motion-sub > summary { font-size: 12px; }
.motion-plan-list { margin: 6px 0 10px; }
.motion-plan-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.motion-plan-list li:last-child { border-bottom: 0; }
.motion-summary { margin: 4px 0 12px; }
.motion-range { font-size: 18px; margin: 6px 0 4px; max-width: 80ch; }
.motion-decision { padding: 10px 14px; border-radius: var(--radius); margin: 6px 0 10px; background: var(--hover); color: var(--ink); max-width: 80ch; }
.motion-decision.ok { background: var(--ok-soft); }
.motion-decision.warn { background: var(--warn-soft); }
.motion-decision.bad { background: var(--bad-soft); }
.motion-decision p, .motion-decision ul { margin: 4px 0; }
.motion-decision-label { margin: 0; font-size: 20px; font-weight: 800; }
.motion-decision.ok .motion-decision-label { color: var(--ok); }
.motion-decision.warn .motion-decision-label { color: var(--warn); }
.motion-decision.bad .motion-decision-label { color: var(--bad); }
.motion-prediction th small { display: block; text-transform: none; letter-spacing: 0; font-weight: 600; }
.motion-qs { display: flex; flex-direction: column; }
.motion-q { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.motion-q:last-child { border-bottom: 0; }
.motion-q-answer { text-align: center; }
.motion-sep::before { content: ' · '; white-space: pre; }
.motion-table td { vertical-align: top; }
.motion-table td .chip { white-space: nowrap; }
.motion-overlap, .motion-scenario { padding: 7px 0; border-bottom: 1px solid var(--line); }
.motion-overlap:last-child, .motion-scenario:last-child { border-bottom: 0; }
.motion-kv { grid-template-columns: 150px minmax(0, 1fr); margin: 4px 0; }
.motion-block ul.small:not(.plain) { margin: 6px 0; padding-left: 18px; }
.motion-block ul.small:not(.plain) li { padding: 2px 0; }

/* Guide */
.guide-page { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.welcome-guide { margin: -12px 0 24px; font-size: 15px; }
.guide .markdown { max-width: 880px; }
.guide .markdown > p, .guide .markdown > ul, .guide .markdown > ol, .guide .markdown > blockquote { max-width: 80ch; }
.docs-error { color: var(--bad); }
.guide .markdown h2 { margin-top: 36px; }
.guide .markdown img, .guide .markdown svg { max-width: 100%; }
.markdown .mermaid { margin: 16px 0; padding: 16px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; white-space: normal; }
.markdown .mermaid:not([data-processed]) { font: 12px/1.4 var(--mono); color: var(--ink-2); white-space: pre; text-align: left; }
.markdown .mermaid-error { text-align: left; color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
.markdown .doc-table { display: block; overflow-x: auto; margin: 12px 0; font-size: 13px; line-height: 1.45; }
.markdown .doc-table td, .markdown .doc-table th { vertical-align: top; text-align: left; }
.guide-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.guide-pager a { display: flex; flex-direction: column; gap: 2px; max-width: 48%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.guide-pager a:hover { background: var(--hover); }
.guide-pager .guide-next { margin-left: auto; text-align: right; }
.guide-dir { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.guide-link-title { font-weight: 700; color: var(--accent-ink); }
.markdown td:first-child code { white-space: nowrap; overflow-wrap: normal; }
