:root {
  --bg: #F4F5F7; --panel: #FFFFFF; --ink: #0C0E13; --muted: #565C68; --line: #DDE0E6; --line-strong: #8B919C;
  --accent: #2A36DB; --accent-ink: #FFFFFF; --accent-soft: #E8EAFD;
  --good: #1D7348; --good-soft: #E4F3EA; --weak: #935A00; --weak-soft: #FBEFD9; --bad: #C23A2E; --bad-soft: #FBE9E7; --info: #0E6F83; --info-soft: #E1F2F5;
  /* Aliases the code depends on: warn is weak, preview is info. */
  --warn: var(--weak); --warn-soft: var(--weak-soft); --preview: var(--info); --preview-soft: var(--info-soft);
  --radius: 8px; --radius-ctl: 6px; --radius-sm: 4px; --shadow: none; --shadow-sheet: 0 12px 40px rgba(0,0,0,.18);
  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Bricolage Grotesque", "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1015; --panel: #171A21; --ink: #F3F4F7; --muted: #A0A6B3; --line: #2A2E38; --line-strong: #5C6372;
  --accent: #8391FF; --accent-ink: #0E1015; --accent-soft: #1D2350;
  --good: #7CCB9E; --good-soft: #15301F; --weak: #F0B85C; --weak-soft: #35280F; --bad: #FF8F85; --bad-soft: #3D1C19; --info: #6CC4D9; --info-soft: #10303A;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0E1015; --panel: #171A21; --ink: #F3F4F7; --muted: #A0A6B3; --line: #2A2E38; --line-strong: #5C6372;
  --accent: #8391FF; --accent-ink: #0E1015; --accent-soft: #1D2350;
  --good: #7CCB9E; --good-soft: #15301F; --weak: #F0B85C; --weak-soft: #35280F; --bad: #FF8F85; --bad-soft: #3D1C19; --info: #6CC4D9; --info-soft: #10303A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.005em; }
h1 { font-size: 25px; font-weight: 700; } h2 { font-size: 16px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); font-weight: 600; }
p { margin: 0; }
textarea, input:not([type]), input[type=text], input[type=email], input[type=number], input[type=url], select { width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); padding: 10px 12px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.rail { border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; background: var(--panel); }
.rail .brand { font-family: var(--font-head); font-weight: 700; padding: 6px 10px 14px; font-size: 17px; }
.rail .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.rail a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-ctl); color: var(--ink); position: relative; }
.rail a:hover { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.rail a.active { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.rail a.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--accent); }
.rail .spacer { flex: 1; }
.main { padding: 28px 32px 120px; max-width: 1180px; width: 100%; min-width: 0; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.crumbs { color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); }
.areas { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.areas a { padding: 6px 12px; border-radius: var(--radius-ctl); color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.areas a.active { background: var(--accent-soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.areas a .dot { display: none; }
.bottombar { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 16px 16px 110px; }
  .bottombar { display: flex; position: fixed; bottom: calc(38px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 4px; z-index: 5; }
  .bottombar a { color: var(--muted); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: var(--radius-ctl); min-width: 44px; flex: 1; position: relative; }
  .bottombar a.active { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
  .bottombar a.active::before { content: ""; position: absolute; top: -6px; left: 20%; right: 20%; height: 2px; border-radius: 1px; background: var(--accent); }
  .areas { width: 100%; overflow-x: auto; } .areas a { flex: 1; justify-content: center; padding: 6px 8px; }
}

/* Cards and panels */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel > h2, .panel > h3 { margin-bottom: 10px; }
.panel .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.panel .head a { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.lead { font-size: 16px; color: var(--muted); max-width: 62ch; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.list { display: flex; flex-direction: column; }
.list > * { padding: 10px 0; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; padding-top: 0; }
.item { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.item .body { flex: 1; min-width: 0; }
.item .body p { white-space: pre-wrap; }
.clickable { cursor: pointer; }
.clickable:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-ctl); border: 1px solid var(--line-strong); background: var(--panel); font-size: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 6px 8px; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; white-space: normal; text-align: left; border: 1px solid transparent; }
.chip.open { background: var(--bg); color: var(--muted); border-color: var(--line-strong); }
.chip.attached { background: var(--info-soft); color: var(--info); }
.chip.reviewing { background: var(--info-soft); color: var(--info); }
.chip.accepted { background: var(--good-soft); color: var(--good); }
.chip.weak { background: var(--warn-soft); color: var(--warn); }
.chip.overridden { background: var(--bg); color: var(--muted); border-color: var(--line-strong); }
.chip.draft { background: var(--info-soft); color: var(--info); }

.chip.preview { background: var(--preview-soft); color: var(--preview); }
/* Provenance and context read as a plain muted line, not as chips: text joined by a dot. */
.chip.origin, .chip.area, .chip.who, .chip.ini:not(.restricted) { background: none; border: 0; padding: 0; border-radius: 0; color: var(--muted); font-weight: 400; font-size: 13px; display: inline; }
.chip.ini:not(.restricted) { color: var(--accent); }
:is(.chip.origin, .chip.area, .chip.who, .chip.ini) + :is(.chip.origin, .chip.area, .chip.who, .chip.ini)::before { content: "·"; color: var(--muted); margin: 0 .45em; }
.foot > :is(.chip.origin, .chip.area, .chip.who, .chip.ini) + :is(.chip.origin, .chip.area, .chip.who, .chip.ini)::before, .row > :is(.chip.origin, .chip.area, .chip.who, .chip.ini) + :is(.chip.origin, .chip.area, .chip.who, .chip.ini)::before { margin-left: 0; }
.meta-line { color: var(--muted); font-size: 13px; }
.chip .n { width: 18px; height: 18px; border-radius: 50%; background: currentColor; color: var(--panel); display: inline-grid; place-items: center; font-size: 11px; }

/* Reason line */
.reason { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; }
.reason::before { content: ""; width: 2px; border-radius: 1px; background: var(--line-strong); align-self: stretch; flex: none; }
.reason.good::before { background: var(--good); } .reason.warn::before { background: var(--warn); } .reason.bad::before { background: var(--bad); } .reason.info::before { background: var(--info); }

/* Notices */
.notice { padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.notice.preview { background: var(--preview-soft); border-color: transparent; color: var(--preview); }
.notice.coach { background: var(--bg); }
.notice p { color: inherit; }

/* Sections in record */
.section { padding: 14px 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; padding-top: 0; }
.section .head h3 { display: flex; align-items: center; gap: 8px; }
.section .hint { color: var(--muted); font-size: 13px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-ctl); }
.section .hint.later { border-style: solid; background: var(--bg); }
.entry { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl); color: var(--ink); display: block; }
.entry p { white-space: pre-wrap; }
.entry .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.entry.flagged { border-color: var(--warn); }

/* Home summaries */
.summary .section-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.summary .section-row:first-child { border-top: 0; }
.summary .section-row .n { color: var(--muted); font-size: 13px; }

/* Stage ladder */
.ladder { display: flex; gap: 6px; align-items: stretch; margin-bottom: 14px; flex-wrap: wrap; }
.ladder .step { flex: 1; min-width: 120px; padding: 8px 10px; border-radius: var(--radius-ctl); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.ladder .step.current { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); font-weight: 600; }
.ladder .step.done { color: var(--good); border-color: var(--good); }
.ladder .step small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.criterion { color: var(--ink); display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 12px 8px; border-radius: var(--radius-ctl); }
.criterion .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; color: var(--muted); }
.criterion.accepted .num { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.criterion.overridden .num { background: var(--bg); color: var(--muted); border-color: var(--line-strong); }
.criterion.weak .num { background: var(--weak-soft); color: var(--weak); border-color: var(--weak); }
@media (max-width: 700px) { .criterion { grid-template-columns: 28px 1fr; } .criterion > .chip { grid-column: 2; justify-self: start; } }

/* Quadrants */
.quadrants { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .quadrants { grid-template-columns: 1fr; } }
.quadrant { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.quadrant.over { border-color: var(--accent); background: var(--accent-soft); }
.quadrant .qhead { display: flex; justify-content: space-between; align-items: baseline; }
.quadrant .qhead small { color: var(--muted); font-size: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius-ctl); padding: 10px 12px; background: var(--panel); cursor: grab; display: flex; flex-direction: column; gap: 6px; position: relative; }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .5; }
.card .title { font-weight: 600; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.card .title a { color: var(--ink); flex: 1; }
.card .why { color: var(--muted); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card .move { position: relative; }
.card select.move, .panel select.move { width: auto; padding: 6px 8px; font-size: 13px; border-radius: 6px; color: var(--muted); min-height: 32px; }
.start { border-left: 2px solid var(--accent); }
.start .label { font-size: 13px; font-family: var(--font); color: var(--muted); font-weight: 600; margin: 0; }
.start .task-why { font-size: 15px; }
.start .next { font-family: var(--font-head); font-size: 20px; font-weight: 600; line-height: 1.3; margin: 4px 0 8px; }
.start .next a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.start .next a:hover { text-decoration-color: var(--accent); }
.areacards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .areacards { grid-template-columns: 1fr; } }
.areacard { display: block; color: var(--ink); }
.areacard .big { font-family: var(--font-head); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.qmini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .qmini { grid-template-columns: repeat(2, 1fr); } }
select { max-width: 100%; }
.decide { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.decided { color: var(--good); font-size: 13px; margin-top: 6px; }
.qmini a { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-ctl); color: var(--ink); font-size: 13px; }
.qmini a strong { display: block; font-size: 18px; }
.rail .group { margin: 12px 10px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.filledby { color: var(--muted); font-size: 12px; text-align: right; max-width: 55%; }
.card.done { opacity: .6; }
.card.done .title a { text-decoration: line-through; }

/* Drafts */
.draftbox { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); }
.draftbox textarea, .draftbox input:not([type=radio]) { background: var(--panel); }
.draftbox .label { color: var(--muted); font-weight: 600; font-size: 13px; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }

/* Read view */
.doc { max-width: 72ch; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 40px; }
@media (max-width: 700px) { .doc { padding: 22px 18px; } }
.doc h1 { font-size: 26px; margin-bottom: 4px; }
.doc h2 { font-size: 18px; margin: 28px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.doc p { margin: 0 0 10px; white-space: pre-wrap; }
.doc .annot { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }
.doc .empty { color: var(--muted); font-style: italic; }

/* Onboarding / sign in */
.center { max-width: 560px; margin: 8vh auto 0; padding: 0 16px; }
.center .panel { padding: 28px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); }
.field .req { color: var(--warn); }

/* Sheet (confirmation) */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: end center; z-index: 60; }
@media (min-width: 700px) { .scrim { place-items: center; } }
.sheet { background: var(--panel); box-shadow: var(--shadow-sheet); border-radius: var(--radius) var(--radius) 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 90vh; overflow: auto; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .sheet { border-radius: var(--radius); } }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Demo bar */
#demobar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; padding: 5px 16px; display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; z-index: 30; font-family: var(--font); min-height: 38px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); }
#demobar .say { color: var(--ink); }
#demobar .spacer { flex: 1; }
#demobar label { display: flex; align-items: center; gap: 6px; }
#demobar select { width: auto; padding: 2px 6px; font-size: 13px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
#demobar button { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px 10px; font-size: 13px; }
#demobar button:hover { border-color: var(--line-strong); }
#demobar .toggle { color: var(--accent); border-color: transparent; background: none; padding-inline: 4px; }
#demobar .toggle:hover { text-decoration: underline; border-color: transparent; }
#demobar a { color: var(--accent); }
#demobar .more { display: none; flex-basis: 100%; gap: 8px 16px; align-items: center; flex-wrap: wrap; padding: 6px 0 2px; border-top: 1px solid var(--line); }
#demobar.open .more { display: flex; }
#demobar .code { color: var(--muted); }
#demobar .narrow { display: none; }
@media (max-width: 820px) {
  #demobar { padding-inline: 12px; gap: 6px 10px; }
  #demobar .say-more, #demobar .wide, #demobar .spacer { display: none; }
  #demobar .narrow { display: flex; gap: 12px; align-items: center; }
  #demobar.open .more { flex-direction: column; align-items: flex-start; }
  body.demo-open .bottombar { display: none; }
}
@media (max-width: 480px) { #demobar .scenario .lbl { display: none; } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 60px; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-ctl); font-size: 13px; z-index: 40; max-width: 90vw; display: none; }
#toast.show { display: block; }

/* Facts for vision areas */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.fact { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl); }
.fact .v { font-family: var(--font-head); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fact .l { color: var(--muted); font-size: 13px; }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.evidence { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-ctl); display: flex; flex-direction: column; gap: 6px; }
.evidence .kind { font-size: 13px; color: var(--muted); }
.later-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.later-item:first-child { border-top: 0; }
.later-item .when { color: var(--muted); font-size: 13px; text-align: right; max-width: 50%; }
.history { color: var(--muted); font-size: 12px; }
.history div { padding: 4px 0; border-top: 1px dashed var(--line); }
/* Guided onboarding */
.intake { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.intake-side { padding: 28px 22px; border-right: 1px solid var(--line); background: var(--panel); }
.intake-side .brand { font-family: var(--font-head); font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.intake-main { padding: 28px 32px 120px; max-width: 760px; width: 100%; margin: 0 auto; }
.intake-rail { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.intake-rail li { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; padding: 6px 8px; border-radius: var(--radius-ctl); }
.intake-rail li .n { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; }
.intake-rail li.current { color: var(--ink); background: var(--accent-soft); font-weight: 600; }
.intake-rail li.current .n { border-color: var(--accent); color: var(--accent); }
.intake-rail li.done .n { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.reflect { display: grid; gap: 10px; }
.reflect > div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
.reflect .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.reflect input { background: var(--panel); padding: 8px 10px; font-size: 14px; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.checks .ok { color: var(--good); }
.checks em { color: var(--warn); font-style: normal; }
.statement { margin: 0 0 8px; padding: 10px 12px; border-left: 2px solid var(--accent); background: var(--panel); border-radius: 0 var(--radius-ctl) var(--radius-ctl) 0; font-size: 15px; }
.sorted { display: flex; gap: 10px; align-items: flex-start; }
.option { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-ctl); background: var(--panel); font-size: 14px; cursor: pointer; }
.option input { margin-top: 3px; }
@media (max-width: 820px) { .intake { grid-template-columns: 1fr; } .intake-side { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; } .intake-rail { flex-direction: row; flex-wrap: wrap; gap: 4px; } .intake-rail li span:last-child { display: none; } .intake-rail li.current span:last-child { display: inline; } .intake-main { padding: 16px 16px 120px; } .reflect > div { grid-template-columns: 1fr; gap: 2px; } }

/* Companies and people */
.cswitch { padding: 0 6px 4px; }
.cswitch select { width: 100%; font-size: 13px; padding: 6px 8px; border-radius: var(--radius-ctl); }
.corow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-ctl); background: var(--panel); color: var(--ink); }
.corow:hover { border-color: var(--line-strong); }
.corow.active { border-color: var(--accent); background: var(--accent-soft); }
.corow .name { font-weight: 600; }
.member { display: grid; grid-template-columns: 1.4fr 1fr .9fr 1.4fr 190px; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.member.head-row { border-top: 0; padding: 0 0 6px; }
.member .who { display: flex; flex-direction: column; }
@media (max-width: 820px) { .member { grid-template-columns: 1fr 1fr; } .member.head-row { display: none; } }

/* Live mode (API behind this origin) and uploaded screenshots */
.evidence .thumb { max-height: 72px; max-width: 120px; border-radius: 6px; vertical-align: middle; border: 1px solid var(--line); }
/* API mode has no demo bar, so the mobile tab bar sits on the bottom edge. */
body.no-bar .bottombar { bottom: env(safe-area-inset-bottom, 0px); }
body.no-bar .main { padding-bottom: 60px; }
@media (max-width: 820px) { body.no-bar .main { padding-bottom: 76px; } }

/* Clearance: initiatives, goals, admins */
.chip.restricted, .chip.ini.restricted { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.admin { background: var(--accent-soft); color: var(--accent); }
.avatars { display: inline-flex; }
.avatars .av { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--info-soft); color: var(--info); border: 2px solid var(--panel); margin-left: -6px; }
.avatars .av:first-child { margin-left: 0; }
.ini-list { display: flex; flex-direction: column; }
.ini-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto auto; gap: 12px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--line); color: var(--ink); border-radius: 6px; }
.ini-row:first-child { border-top: 0; }
.ini-row:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.ini-row .name { font-weight: 600; }
@media (max-width: 700px) { .ini-row { grid-template-columns: 1fr auto; } .ini-row > .small { grid-column: 1 / -1; grid-row: 2; } .ini-row > .chip { grid-column: 1 / -1; justify-self: start; } }
.see-list { display: flex; flex-direction: column; }
.see-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.see-row:first-child { border-top: 0; }
.goal .goal-text { font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.goal .goal-text a { color: var(--ink); }
.goal-ini { padding: 8px 0 4px 14px; border-left: 2px solid var(--line-strong); margin: 6px 0 6px 4px; }
.goal-tasks { margin: 6px 0 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.goal-tasks li.done a, .doc li.done { text-decoration: line-through; color: var(--muted); }
.goal-tasks li { min-width: 0; }
.goal-tasks select.move { width: auto; max-width: min(240px, 100%); padding: 3px 6px; font-size: 12px; border-radius: 6px; color: var(--muted); }
.doc h3 { font-size: 15px; margin: 16px 0 6px; }
.doc ul { margin: 0 0 10px; padding-left: 20px; }
.fates { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* Learning: the task panel, the rehearsal chat, the Learning area */
.areacards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .areacards { grid-template-columns: 1fr; } }
.areacard { color: var(--ink); } .areacard:hover { border-color: var(--line-strong); }
.start h1.next { font-size: 24px; }
.learn-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .learn-opts { grid-template-columns: 1fr; } }
.learn-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); background: var(--panel); color: var(--ink); min-width: 0; }
.learn-opt:hover:not([disabled]) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.learn-opt[disabled] { opacity: .55; cursor: not-allowed; }
.learn-opt .k { font-size: 13px; color: var(--accent); font-weight: 600; }
.learn-opt strong { overflow-wrap: anywhere; }
.learn-line { color: var(--info); }
.rh-past { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--line); color: var(--ink); border-radius: 6px; font-size: 14px; }
.rh-past:hover, .rh-row:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.reading p { margin: 0 0 10px; font-size: 15px; line-height: 1.55; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 85%; min-width: 0; }
.msg .who { font-size: 12px; color: var(--muted); font-weight: 600; }
.msg .bubble { padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.them { align-self: flex-start; }
.msg.them .bubble { background: var(--bg); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.you { align-self: flex-end; align-items: flex-end; }
.msg.you .bubble { background: var(--accent-soft); color: var(--ink); border-top-right-radius: 4px; }
@media (max-width: 560px) { .msg { max-width: 92%; } }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 52px; flex: 1; min-width: 0; }
.fixed-line { padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-ctl); color: var(--muted); }
.topic-list { display: flex; flex-direction: column; }
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.topic-row:first-child { border-top: 0; }
.topic-row > span:first-child { overflow-wrap: anywhere; }
.shown { padding: 6px 0; border-top: 1px solid var(--line); }
.shown:first-of-type { border-top: 0; }
.rh-list { display: flex; flex-direction: column; }
.rh-row { display: grid; grid-template-columns: 110px minmax(0, 1.6fr) minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px; border-top: 1px solid var(--line); color: var(--ink); border-radius: 6px; }
.rh-row:first-child { border-top: 0; }
.rh-row .t { font-weight: 600; min-width: 0; }
@media (max-width: 700px) { .rh-row { grid-template-columns: minmax(0, 1fr) auto; } .rh-row .t { grid-column: 1 / -1; grid-row: 1; } }

/* The evidence margin: one criterion per row. A narrow numbered margin with the state as text, then the requirement,
   the evidence and its source, and the coach's read with the next step, joined by a thin rule within the row only. */
.margins { display: flex; flex-direction: column; }
.margin-row { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--ink); }
.margins > .margin-row:first-child { border-top: 0; padding-top: 4px; }
a.margin-row:hover .mr-req { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.mr-margin { display: flex; align-items: flex-start; gap: 10px; padding-top: 1px; }
.mr-margin .n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); font-variant-numeric: tabular-nums; }
.mr-margin .state { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.3; padding-top: 3px; }
.mr-body { border-left: 2px solid var(--line); padding-left: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mr-req { font-weight: 500; max-width: 65ch; }
.mr-part { font-size: 14px; color: var(--ink); max-width: 65ch; overflow-wrap: anywhere; }
.mr-part .k { color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 6px; }
.mr-part .src { color: var(--muted); font-size: 13px; }
.mr-part.read { color: var(--ink); }
.margin-row.accepted .mr-body { border-left-color: var(--good); }
.margin-row.accepted .n { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.margin-row.accepted .state { color: var(--good); }
.margin-row.weak .mr-body { border-left-color: var(--weak); }
.margin-row.weak .n { background: var(--weak-soft); color: var(--weak); border-color: var(--weak); }
.margin-row.weak .state { color: var(--weak); }
.margin-row.attached .state, .margin-row.reviewing .state { color: var(--info); }
.margin-row.overridden .n { background: var(--bg); color: var(--muted); border-color: var(--line-strong); }
.margin-row.head { border-top: 0; padding: 0; }
.margin-row.head .mr-req { font-family: var(--font-head); font-size: 22px; font-weight: 700; line-height: 1.3; }
.margin-row.head .mr-margin .n { width: 30px; height: 30px; font-size: 14px; }
.margin-row.head .mr-margin .state { padding-top: 6px; }
@media (max-width: 700px) {
  .margin-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .mr-margin { align-items: center; }
  .mr-margin .state { padding-top: 0; }
  .margin-row.head .mr-margin .state { padding-top: 0; }
  .margin-row.head .mr-req { font-size: 20px; }
}

/* Work overview: a dominant working column and a narrower context column. */
.work-cols { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .work-cols { grid-template-columns: minmax(0, 1fr); } }
.stage-summary { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.outcome { font-size: 16px; max-width: 65ch; }
.manage { border-style: dashed; }
.task-why { font-size: 16px; color: var(--muted); max-width: 65ch; margin-top: 6px; }
.criterion .crit-state { color: var(--muted); font-weight: 600; white-space: nowrap; }
.criterion.accepted .crit-state { color: var(--good); } .criterion.weak .crit-state { color: var(--weak); } .criterion.attached .crit-state, .criterion.reviewing .crit-state { color: var(--info); }
.work-cols .criterion { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 10px 4px; }
.card .foot { row-gap: 4px; }
.sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 700px) { .work-cols .criterion { grid-template-columns: 28px minmax(0, 1fr); } .work-cols .criterion .crit-state { grid-column: 2; white-space: normal; } }
.why-k { color: var(--muted); font-weight: 600; font-size: 13px; margin-right: 8px; }
.task-why { color: var(--ink); }
.wordmark { font-family: var(--font-head); font-weight: 700; font-size: 26px; color: var(--ink); }
.center .lead { color: var(--ink); font-size: 16px; }
