:root {
  /* EI dark theme — ember on near-black. */
  --bg: #0b0c0e;
  --surface: #131519;
  --surface-2: #191b20;
  --surface-3: #1d2025;
  --raised: linear-gradient(180deg, #22252b 0%, #17191e 100%);
  --glass: linear-gradient(160deg, rgba(255,255,255,0.075) 0%, rgba(255,255,255,0.018) 48%, rgba(255,255,255,0.045) 100%);
  --input: #111317;
  --hover: rgba(255,255,255,0.035);
  --text: #f2f3f5;
  --text-secondary: #adb2ba;
  --text-muted: #737983;
  --text-faint: rgba(242, 243, 245, 0.32);
  --border: rgba(242, 243, 245, 0.08);
  --border-strong: rgba(242, 243, 245, 0.14);
  --border-emphasis: rgba(242, 243, 245, 0.24);
  --ember: oklch(0.68 0.18 35);
  --ember-soft: oklch(0.68 0.18 35 / 0.12);
  --ember-text: oklch(0.78 0.16 40);
  --green: oklch(0.78 0.16 150);
  --green-soft: oklch(0.78 0.16 150 / 0.1);
  --amber: oklch(0.78 0.15 70);
  --amber-soft: oklch(0.78 0.15 70 / 0.1);
  --heading: "Titillium Web", -apple-system, "Helvetica Neue", "Inter", Arial, sans-serif;
  --sans: -apple-system, "Helvetica Neue", "Inter", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  --panel-shadow: 0 2px 5px rgba(0,0,0,0.5), 0 18px 40px -20px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.07);
  --button-shadow: 0 1px 2px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  --glass-border: rgba(242,243,245,0.1);
  --glass-inset: rgba(255,255,255,0.055);
  --glass-shadow: rgba(0,0,0,0.22);
  --on-accent: #0b0c0e;

  /* Existing component aliases mapped onto the EI system. */
  --paper: var(--surface);
  --paper-dim: var(--bg);
  --ink: var(--text);
  --ink-soft: var(--text-secondary);
  --ink-faint: var(--text-muted);
  --line: var(--border);
  --line-soft: var(--border-strong);
  --lit: var(--green);
  --lit-bg: var(--green-soft);
  --lit-line: color-mix(in oklch, var(--green) 48%, transparent);
  --lit-deep: var(--green);
  --warn: var(--amber);
  --warn-bg: var(--amber-soft);
  --warn-deep: var(--amber);
  --bad: var(--ember);
  --bad-bg: var(--ember-soft);
}

html[data-theme="light"] {
  /* EI light theme — ember on white paper, neutral greys (no cream). */
  --bg: #ffffff;
  --surface: #f7f7f8;
  --surface-2: #f1f1f3;
  --surface-3: #eaeaed;
  --raised: linear-gradient(180deg, #ffffff 0%, #f1f1f3 100%);
  --glass: rgba(127,127,127,0.1);
  --input: #ffffff;
  --hover: rgba(17,18,20,0.045);
  --text: #131417;
  --text-secondary: #5b6068;
  --text-muted: #878c95;
  --text-faint: rgba(19,20,23,0.35);
  --border: rgba(19,20,23,0.1);
  --border-strong: rgba(19,20,23,0.16);
  --border-emphasis: rgba(19,20,23,0.26);
  --ember: oklch(0.52 0.18 32);
  --ember-soft: oklch(0.52 0.18 32 / 0.1);
  --ember-text: oklch(0.5 0.19 33);
  --green: oklch(0.55 0.14 150);
  --green-soft: oklch(0.55 0.14 150 / 0.08);
  --amber: oklch(0.65 0.15 70);
  --amber-soft: oklch(0.65 0.15 70 / 0.08);
  --warn-bg: rgba(19,20,23,0.04);
  --panel-shadow: 0 1px 2px rgba(15,16,18,0.07), 0 12px 28px -16px rgba(15,16,18,0.24), 0 0 0 1px rgba(15,16,18,0.04), inset 0 1px 0 rgba(255,255,255,0.9);
  --button-shadow: 0 1px 2px rgba(15,16,18,0.08), 0 1px 1px rgba(15,16,18,0.04), inset 0 1px 0 rgba(255,255,255,0.85);
  --glass-border: rgba(19,20,23,0.1);
  --glass-inset: rgba(255,255,255,0.7);
  --glass-shadow: rgba(15,16,18,0.12);
  --on-accent: #ffffff;
}
* { box-sizing: border-box; margin: 0; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
#app { display: flex; min-height: 100vh; }
::selection { background: var(--ember-soft); color: var(--ember-text); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

#topbar {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 220;
  width: calc(100% - 36px);
  max-width: 1200px;
  height: 54px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 7px 12px 7px 18px;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px var(--glass-shadow), inset 0 1px 0 var(--glass-inset);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  transform: translateX(-50%);
}
.topbar-wordmark {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--heading);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  box-shadow: none;
}
.topbar-wordmark:hover:not(:disabled) { border: 0; color: var(--text); }
.topbar-product { justify-self: center; font-family: var(--heading); font-size: 15px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.topbar-edition { justify-self: end; color: var(--text-muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

#sidebar { width: 190px; background: var(--glass); color: var(--text); padding: 86px 14px 22px; display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--glass-border); box-shadow: inset -1px 0 0 var(--glass-inset), 12px 0 34px var(--glass-shadow); backdrop-filter: blur(30px) saturate(115%); }
#sidebar-content { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.primary-nav { display: grid; gap: 5px; }
#sidebar .nav { width: 100%; padding: 9px 11px; border: 1px solid transparent; border-radius: 8px; background: transparent; box-shadow: none; text-align: left; font-family: var(--heading); font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; user-select: none; transition: color .18s, background .18s, border-color .18s; }
#sidebar .nav:hover { color: var(--text); background: var(--hover); }
#sidebar .nav.active { background: var(--ember-soft); border-color: color-mix(in oklch, var(--ember) 34%, transparent); color: var(--ember-text); font-weight: 600; }
#sidebar .foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-strong); }
#appearance-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left; }
.appearance-icon { width: 17px; height: 17px; flex: none; }
.appearance-icon svg { width: 17px; height: 17px; display: block; }
.appearance-copy { min-width: 0; display: flex; flex-direction: column; }
.appearance-copy strong { color: var(--text-secondary); font-family: var(--heading); font-size: 13px; font-weight: 600; line-height: 1.15; }
.appearance-copy small { color: var(--text-muted); font-family: var(--mono); font-size: 9.5px; line-height: 1.35; }
.icon-sun { display: none !important; }
html[data-theme="light"] .icon-moon { display: none !important; }
html[data-theme="light"] .icon-sun { display: block !important; }
#sidebar .mode { font-family: var(--mono); font-size: 9.5px; color: var(--text-muted); margin-top: 12px; }

.manual-index { position: sticky; top: 94px; align-self: start; width: 260px; max-height: calc(100vh - 112px); overflow-y: auto; padding: 7px 18px 30px 0; border-right: 1px solid var(--border-strong); scrollbar-width: thin; }
.manual-nav-label { padding: 0 10px 12px; color: var(--text-muted); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }
.manual-topic { border-bottom: 1px solid var(--border); }
.manual-topic-toggle { width: 100%; min-height: 43px; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 8px 9px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--text-secondary); text-align: left; }
.manual-topic-toggle:hover:not(:disabled) { border: 0; background: var(--hover); color: var(--text); }
.topic-chevron { display: block; color: var(--text-muted); font-size: 19px; line-height: 1; transform-origin: 50% 50%; transition: transform .16s ease; }
.manual-topic.open .topic-chevron { transform: rotate(90deg); }
.topic-name { font-family: var(--heading); font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.topic-count { min-width: 21px; color: var(--text-muted); font-family: var(--mono); font-size: 9px; text-align: right; }
.manual-pages { padding: 1px 0 9px 22px; }
.manual-page { position: relative; width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px 7px 14px; border: 0; border-left: 1px solid var(--border-strong); border-radius: 0; background: transparent; box-shadow: none; color: var(--text-muted); text-align: left; font-size: 12.5px; line-height: 1.35; }
.manual-page::before { position: absolute; top: 50%; left: -1px; width: 1px; height: 0; background: var(--ember); content: ""; transition: height .15s ease, top .15s ease; }
.manual-page:hover:not(:disabled) { border-color: var(--border-strong); background: var(--hover); color: var(--text); }
.manual-page.selected { background: var(--ember-soft); color: var(--ember-text); font-weight: 600; }
.manual-page.selected::before { top: 0; height: 100%; }
.manual-page small { color: var(--text-faint); font-family: var(--mono); font-size: 8.5px; font-weight: 400; text-transform: uppercase; }

#main { flex: 1; padding: 94px 46px 38px; max-width: 940px; }
.meta { display: flex; justify-content: space-between; margin-bottom: 17px; color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; }
h1, h2, h3 { font-family: var(--heading); }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 14px; }

.welcome { max-width: 820px; padding: 46px 0 30px; }
.welcome-kicker { margin-bottom: 19px; color: var(--ember-text); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.13em; text-transform: uppercase; }
.welcome h1 { max-width: 780px; margin-bottom: 22px; font-family: var(--heading); font-size: clamp(42px, 4.8vw, 58px); font-weight: 500; letter-spacing: -0.032em; line-height: 1.05; }
.welcome-lede { max-width: 760px; color: var(--text); font-size: 18px; line-height: 1.62; }
.welcome-note { max-width: 720px; margin-top: 13px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.welcome-prompt { margin-top: 34px; color: var(--text-muted); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }
.welcome-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.entry-card { min-height: 164px; display: flex; flex-direction: column; align-items: flex-start; padding: 17px 18px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--raised); color: var(--text); text-align: left; box-shadow: var(--panel-shadow); transition: border-color .18s, transform .18s; }
.entry-card:hover { border-color: var(--border-emphasis); transform: translateY(-1px); }
.entry-card .entry-index { margin-bottom: auto; color: var(--ember-text); font-family: var(--mono); font-size: 11px; }
.entry-card strong { display: block; margin: 18px 0 7px; font-family: var(--heading); font-size: 16px; font-weight: 600; line-height: 1.25; }
.entry-card > span:last-child { color: var(--text-secondary); font-size: 12.5px; line-height: 1.55; }
.welcome-publisher { margin-top: 18px; color: var(--text-muted); font-family: var(--mono); font-size: 9.5px; }

body.welcome-mode #app { display: block; }
body.welcome-mode #sidebar { display: none; }
body.welcome-mode #main { max-width: none; min-height: 100vh; padding: 0 36px; }
body.welcome-mode .welcome {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 118px 0 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
body.welcome-mode .welcome-actions { width: 100%; }

.mic { border-left: 3px solid var(--ember); padding: 5px 0 5px 16px; margin: 14px 0 20px; }
.mic .who { color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; margin-bottom: 8px; }
.mic p { color: var(--text); font-size: 16px; line-height: 1.7; }

textarea { width: 100%; min-height: 110px; background: var(--input); border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; font-family: var(--sans); font-size: 14px; line-height: 1.6; color: var(--text); resize: vertical; }
textarea::placeholder { color: var(--text-faint); }
textarea:focus { outline: none; border-color: var(--border-emphasis); box-shadow: 0 0 0 2px var(--ember-soft); }
.hint { font-size: 12.5px; color: var(--text-muted); margin: 14px 0 6px; }
.char-count { float: right; color: var(--text-faint); font-family: var(--mono); font-size: 10px; font-weight: 400; }

button { font-family: var(--sans); cursor: pointer; border-radius: 6px; font-size: 14px; padding: 9px 20px; border: 1px solid var(--border-strong); background: var(--raised); color: var(--text-secondary); box-shadow: var(--button-shadow); }
button:hover:not(:disabled) { border-color: var(--border-emphasis); color: var(--text); }
button.primary { background: var(--ember); color: var(--on-accent); border-color: var(--ember); font-weight: 600; }
button.primary:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: none; border: none; color: var(--text-muted); text-decoration: underline; padding: 9px 6px; box-shadow: none; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.row .right { margin-left: auto; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 14px; }
.split .col .label { color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; margin-bottom: 6px; }
.split .col .label.vet { color: var(--green); }
.split .box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.split .box.vet { background: var(--green-soft); border-color: var(--lit-line); color: var(--text); white-space: normal; }

.pattern { background: var(--warn-bg); border: 1px solid color-mix(in oklch, var(--amber) 24%, transparent); border-radius: 8px; padding: 10px 14px; font-size: 14px; color: var(--text); margin: 14px 0; }
.pattern a { color: var(--warn); }
.notebox { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin: 14px 0; }
.notebox > b:first-child { font-family: var(--heading); font-weight: 600; }
.verdicts { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.verdicts .vlabel { color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; }
.vbtn { padding: 8px 18px; }
.vbtn.hit.on { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 600; }
.vbtn.partial.on { background: var(--amber); color: var(--bg); border-color: var(--amber); font-weight: 600; }
.vbtn.miss.on { background: var(--ember); color: var(--bg); border-color: var(--ember); font-weight: 600; }
.ai-note { font-size: 13px; color: var(--text-secondary); margin-top: 10px; }
.ai-note b.HIT { color: var(--lit); } .ai-note b.PARTIAL { color: var(--warn); } .ai-note b.MISS { color: var(--bad); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px; }
.card .k { color: var(--text-muted); font-family: var(--mono); font-size: 11px; }
.card .v { font-family: var(--heading); font-size: 18px; font-weight: 600; }
.card .v.bad { color: var(--bad); }

.docs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 18px; }
.doc { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px; padding: 9px 11px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.doc:hover { border-color: var(--border-emphasis); color: var(--text); }
.doc.open { border: 1px solid var(--ember); background: var(--ember-soft); color: var(--ember-text); font-weight: 600; }
.doc.locked { opacity: 0.4; cursor: default; }

.docview { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 16px 20px; margin: 0 0 18px; font-size: 13.5px; }
.docview pre, pre.md { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.case-markdown { color: var(--text-secondary); font-size: 14px; line-height: 1.72; }
.case-markdown h2 { margin: 2px 0 14px; color: var(--text); font-size: 24px; font-weight: 600; line-height: 1.2; }
.case-markdown h3 { margin: 24px 0 9px; color: var(--text); font-size: 18px; font-weight: 600; line-height: 1.3; }
.case-markdown h4 { margin: 19px 0 7px; color: var(--text); font-size: 15px; font-weight: 600; line-height: 1.35; }
.case-markdown p { margin: 0 0 14px; }
.case-markdown strong { color: var(--text); font-weight: 600; }
.case-markdown em { color: var(--text-muted); }
.case-markdown blockquote { margin: 15px 0 18px; padding: 12px 16px; border-left: 3px solid var(--ember); background: var(--ember-soft); color: var(--text); font-size: 15px; line-height: 1.65; }
.case-markdown ul, .case-markdown ol { display: grid; gap: 6px; margin: 10px 0 18px; padding-left: 22px; }
.case-markdown li { padding-left: 3px; }
.case-markdown hr { margin: 24px 0; border: 0; border-top: 1px solid var(--border-strong); }
.case-markdown code { padding: 1px 4px; border-radius: 4px; background: var(--surface-3); color: var(--text); font-family: var(--mono); font-size: .9em; }
.case-code { overflow-x: auto; padding: 13px 15px; border: 1px solid var(--border); border-radius: 6px; background: var(--input); }
.case-code code { padding: 0; background: transparent; }
.case-table-wrap { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--border-strong); border-radius: 7px; }
.case-markdown table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; }
.case-markdown th { background: var(--surface-2); color: var(--text); font-family: var(--heading); font-weight: 600; text-align: left; }
.case-markdown th, .case-markdown td { min-width: 110px; padding: 8px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: top; }
.case-markdown th:last-child, .case-markdown td:last-child { border-right: 0; }
.case-markdown tbody tr:last-child td { border-bottom: 0; }
.qs { display: grid; gap: 12px; margin-top: 6px; }
.qs .q label { display: block; margin-bottom: 5px; font-family: var(--heading); font-size: 14px; font-weight: 600; }

.chain { margin: 16px 0; }
.chain .link { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.chain .dot { font-size: 15px; text-align: center; }
.chain .identified .dot { color: var(--lit); }
.chain .partial .dot { color: var(--warn); }
.chain .missed .dot { color: var(--bad); }
.chain .ev { color: var(--text-muted); font-size: 12.5px; font-style: italic; }
.biggap { background: var(--ember-soft); border: 1px solid color-mix(in oklch, var(--ember) 24%, transparent); border-radius: 8px; padding: 12px 14px; font-size: 14px; color: var(--ember-text); margin: 16px 0; font-weight: 600; }

.stub-note { color: var(--text-muted); font-style: italic; }
.section-intro { max-width: 620px; margin: -4px 0 20px; color: var(--text-secondary); }

body.manual-mode #main { width: calc(100% - 190px); max-width: none; padding: 78px 0 0; }
.manual-reader { width: 100%; min-height: calc(100vh - 78px); display: grid; grid-template-columns: 260px minmax(520px, 800px) 190px; justify-content: center; gap: clamp(30px, 3vw, 52px); padding: 42px clamp(24px, 3vw, 54px) 90px; }
.manual-article { min-width: 0; }
.manual-loading { padding-top: 40px; }
.document-header { padding-bottom: 30px; border-bottom: 1px solid var(--border-strong); }
.document-header .crumb { margin-bottom: 19px; color: var(--ember-text); font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .04em; }
.document-header .crumb span { padding: 0 7px; color: var(--text-faint); }
.document-header h1 { max-width: 760px; margin-bottom: 14px; font-size: clamp(38px, 4vw, 54px); font-weight: 500; letter-spacing: -.035em; line-height: 1.04; }
.document-deck { max-width: 710px; color: var(--text-secondary); font-size: 17px; line-height: 1.65; }
.document-strip { display: grid; grid-template-columns: .75fr 1fr 1.35fr; margin-top: 26px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.document-strip > div { padding: 10px 14px 10px 0; }
.document-strip > div + div { padding-left: 15px; border-left: 1px solid var(--border); }
.document-strip dt { color: var(--text-muted); font-family: var(--mono); font-size: 8.5px; letter-spacing: .09em; text-transform: uppercase; }
.document-strip dd { margin-top: 3px; color: var(--text-secondary); font-size: 11.5px; }
.status-dot { width: 6px; height: 6px; display: inline-block; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); vertical-align: 1px; }
.document-body { counter-reset: manual-section; }
.article-section { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 19px; padding: 36px 0 38px; border-bottom: 1px solid var(--border-strong); scroll-margin-top: 92px; }
.section-number { padding-top: 4px; color: var(--text-faint); font-family: var(--mono); font-size: 10px; letter-spacing: .04em; }
.section-copy h2 { margin-bottom: 15px; font-size: 24px; font-weight: 600; letter-spacing: -.015em; }
.section-copy p { max-width: 720px; margin-bottom: 15px; color: var(--text-secondary); font-size: 15.5px; line-height: 1.78; }
.section-copy p:last-child { margin-bottom: 0; }
.section-copy ul { display: grid; gap: 9px; padding-left: 20px; color: var(--text-secondary); font-size: 15px; line-height: 1.7; }
.pattern-section .section-copy > p,
.pattern-section .section-copy > ul { padding: 18px 20px; border-left: 2px solid var(--amber); background: var(--warn-bg); color: var(--text); }
.sources-section .section-copy p,
.sources-section .section-copy li { font-family: var(--mono); font-size: 11.5px; line-height: 1.7; }
.manual-toc { position: sticky; top: 106px; align-self: start; display: flex; flex-direction: column; padding-left: 18px; border-left: 1px solid var(--border-strong); }
.toc-label { margin-bottom: 13px; color: var(--text-muted); font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }
.manual-toc a { position: relative; padding: 5px 0; color: var(--text-muted); text-decoration: none; font-size: 12.5px; line-height: 1.35; }
.manual-toc a::before { position: absolute; top: 8px; left: -22px; color: transparent; content: "→"; }
.manual-toc a:hover, .manual-toc a.active { color: var(--ember-text); }
.manual-toc a.active::before { color: var(--ember-text); }
.toc-rule { margin: 17px 0 13px; border-top: 1px solid var(--border); }
.toc-status { color: var(--text-muted); font-family: var(--mono); font-size: 9.5px; }
.toc-status span { color: var(--text-secondary); }
.connections { border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 12px; background: var(--surface-2); }
.conn-row { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.conn-row:last-child { border-bottom: none; }
.conn-link { text-decoration: none; color: var(--text-secondary); }
.conn-link.pos b { color: var(--lit); }
.conn-link.neg b { color: var(--bad); }
.conn-link:hover b { text-decoration: underline; }
.conn-effect { display: block; color: var(--text-muted); font-size: 12.5px; margin-top: 1px; }
.conn-effect i { color: var(--text-faint); }
.spin { color: var(--text-muted); font-family: var(--mono); font-size: 12px; }

.box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.logs { display: flex; flex-direction: column; gap: 8px; }
.log-row { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.log-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; font-size: 13px; }
.log-head:hover { background: var(--surface-2); }
.log-type { text-transform: uppercase; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--text-muted); background: var(--surface-3); border-radius: 4px; padding: 2px 7px; }
.log-title { flex: 1; color: var(--text); font-family: var(--heading); font-size: 14px; font-weight: 600; }
.log-v { font-family: var(--mono); font-size: 10.5px; font-weight: 500; padding: 2px 9px; border-radius: 100px; }
.log-v.hitv { background: var(--lit-bg); color: var(--lit); }
.log-v.partv { background: var(--warn-bg); color: var(--warn); }
.log-v.missv { background: var(--bad-bg); color: var(--bad); }
.log-time { color: var(--text-muted); font-family: var(--mono); font-size: 10.5px; }
.log-body { padding: 4px 14px 16px; border-top: 1px solid var(--border); }
.log-body .mic { margin-top: 14px; }

@media (max-width: 1400px) {
  .manual-reader { grid-template-columns: 230px minmax(0, 760px); }
  .manual-index { width: 230px; }
  .manual-toc { display: none; }
}

@media (max-width: 760px) {
  #topbar { grid-template-columns: 1fr auto; width: calc(100% - 24px); }
  .topbar-product { justify-self: end; font-size: 13px; }
  .topbar-edition, .topbar-author { display: none; }
  #app { display: block; }
  #sidebar { width: 100%; height: auto; position: static; padding: 82px 16px 16px; }
  #sidebar .foot { display: none; }
  #main { padding: 88px 20px 26px; }
  .welcome { padding-top: 20px; }
  body.welcome-mode #main { padding: 0 20px; }
  body.welcome-mode .welcome { padding: 112px 0 48px; }
  .welcome-actions { grid-template-columns: 1fr; }
  .entry-card { min-height: 150px; }
  .split { grid-template-columns: 1fr; }
  .docs { grid-template-columns: repeat(2, 1fr); }
  body.manual-mode #main { width: 100%; padding: 0; }
  .manual-reader { min-height: auto; display: block; padding: 34px 22px 64px; }
  .manual-index { position: static; width: 100%; max-height: 340px; margin-bottom: 34px; padding: 0 4px 14px; border-right: 0; border-bottom: 1px solid var(--border-strong); }
  .manual-toc { display: none; }
  .document-header h1 { font-size: 38px; }
  .document-strip { grid-template-columns: 1fr; }
  .document-strip > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }
  .article-section { grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
  .log-head { align-items: flex-start; flex-wrap: wrap; }
  .log-title { flex-basis: calc(100% - 120px); }
}

/* Manual landing — pick an area, nothing opens by itself */
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 32px; }
.start-pillar { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--rule, rgba(128,128,128,.25)); border-radius: 10px; background: transparent; cursor: pointer; text-align: left; transition: border-color .2s ease, transform .2s ease; }
.start-pillar:hover { border-color: currentColor; transform: translateY(-2px); }
.start-pillar strong { font-size: 16px; font-weight: 600; }
.start-pillar span { font-size: 13px; line-height: 1.45; opacity: .62; }
.start-back { display: inline-flex; align-items: center; margin-bottom: 18px; padding: 8px 14px; border: 1px solid var(--rule, rgba(128,128,128,.25)); border-radius: 999px; background: transparent; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }

.topbar-author { justify-self: end; color: var(--text-muted); font-family: var(--mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; text-decoration: none; transition: color .2s ease; }
.topbar-author:hover { color: var(--ember-text); }
.welcome-publisher a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.welcome-publisher a:hover { color: var(--ember-text); }

.manual-mobile-toggle { display: none; }
.manual-search-label { display: block; font-size: 12px; margin: 12px 0 6px; color: var(--text-secondary); }
#manual-search { width: 100%; min-width: 0; padding: 10px; background: var(--input); color: var(--text); border: 1px solid var(--border-strong); border-radius: 5px; }
#manual-search-results { font-size: 12px; color: var(--text-secondary); margin: 8px 0 12px; }
@media (max-width: 760px) {
  #topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .topbar-product { justify-self: start; font-size: 12px; }
  .topbar-author { display: block; font-size: 9px; letter-spacing: .04em; }
  .manual-index { max-height: none; margin-bottom: 22px; }
  .manual-mobile-toggle { display: flex; justify-content: space-between; width: 100%; padding: 12px 0; background: transparent; border: 0; box-shadow: none; color: var(--text); }
  .manual-index #manual-index-body { display: none; }
  .manual-index.expanded #manual-index-body { display: block; max-height: 55vh; overflow-y: auto; padding-bottom: 12px; }
}

#main { min-width: 0; }
@media (min-width: 761px) and (max-width: 1100px) {
  .manual-reader { display: block; padding: 30px 28px 64px; }
  .manual-index { position: static; width: 100%; max-height: none; margin-bottom: 24px; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--border-strong); }
  .manual-mobile-toggle { display: flex; justify-content: space-between; width: 100%; padding: 12px 0; background: transparent; border: 0; box-shadow: none; color: var(--text); }
  .manual-index #manual-index-body { display: none; }
  .manual-index.expanded #manual-index-body { display: block; max-height: 55vh; overflow-y: auto; }
}
