/* Medical-Research · shared stylesheet (v2, business-medical)
   Layout: navy navigation rail + one reading column on a faint clinical grid; report sections keep a label rail that stacks on narrow containers.
   UI colour: navy brand + medical teal accent. Charts keep their own validated series palette (--s1..--s3, --neg). */
:root {
  --bg: #F3F6F9;
  --surface: #FFFFFF;
  --sunken: #EAF0F5;
  --ink: #0F1D2B;
  --muted: #586A7C;
  --line: #D6E0EA;
  --grid: #E6ECF2;
  --pattern: rgba(15, 43, 70, 0.045);
  --brand: #0F2B46;
  --nav-bg: #0F2B46;
  --nav-ink: #B9C9DA;
  --nav-strong: #FFFFFF;
  --nav-dim: #7F96AE;
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: rgba(53, 182, 190, 0.18);
  --nav-line: rgba(255, 255, 255, 0.09);
  --accent: #0B7F86;
  --accent-strong: #07636A;
  --accent-soft: #E0F1F2;
  --info: #1D5FA6;
  --info-soft: #E5EEF8;
  --good: #2F7D4F;
  --good-soft: #E1F1E7;
  --warn: #9A6A12;
  --warn-soft: #F7EDD6;
  --bad: #B03A32;
  --bad-soft: #F8E3E0;
  --shadow: 0 1px 2px rgba(15, 29, 43, 0.05), 0 6px 18px rgba(15, 29, 43, 0.04);
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --neg: #e34948;
  --neutral-series: #A3ACB8;
  --seq1: #86b6ef;
  --seq2: #3987e5;
  --seq3: #184f95;
  --f-display: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --f-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --nav-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1520; --surface: #102030; --sunken: #0D1A27; --ink: #E4ECF4; --muted: #92A4B6; --line: #21364B; --grid: #182A3B;
    --pattern: rgba(120, 170, 210, 0.05); --brand: #E4ECF4;
    --nav-bg: #07111B; --nav-ink: #9FB2C6; --nav-strong: #F2F7FB; --nav-dim: #61778D; --nav-hover: rgba(255, 255, 255, 0.05); --nav-active: rgba(53, 182, 190, 0.16); --nav-line: rgba(255, 255, 255, 0.07);
    --accent: #35B6BE; --accent-strong: #66CDD3; --accent-soft: #0E3238; --info: #6CA8EA; --info-soft: #132A42;
    --good: #6CC48F; --good-soft: #163325; --warn: #E0B25A; --warn-soft: #34290F; --bad: #EE8B80; --bad-soft: #3A1E1B;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --neg: #e66767; --neutral-series: #5C6673;
    --seq1: #184f95; --seq2: #2a78d6; --seq3: #86b6ef;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1520; --surface: #102030; --sunken: #0D1A27; --ink: #E4ECF4; --muted: #92A4B6; --line: #21364B; --grid: #182A3B;
  --pattern: rgba(120, 170, 210, 0.05); --brand: #E4ECF4;
  --nav-bg: #07111B; --nav-ink: #9FB2C6; --nav-strong: #F2F7FB; --nav-dim: #61778D; --nav-hover: rgba(255, 255, 255, 0.05); --nav-active: rgba(53, 182, 190, 0.16); --nav-line: rgba(255, 255, 255, 0.07);
  --accent: #35B6BE; --accent-strong: #66CDD3; --accent-soft: #0E3238; --info: #6CA8EA; --info-soft: #132A42;
  --good: #6CC48F; --good-soft: #163325; --warn: #E0B25A; --warn-soft: #34290F; --bad: #EE8B80; --bad-soft: #3A1E1B;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --neg: #e66767; --neutral-series: #5C6673;
  --seq1: #184f95; --seq2: #2a78d6; --seq3: #86b6ef;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--pattern) 1px, transparent 1px), linear-gradient(90deg, var(--pattern) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.7;
}
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.005em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--info); }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.muted { color: var(--muted); }

/* ---------- logo ---------- */
.logo { width: 34px; height: 34px; flex: none; }
#mr-logo .bg { fill: var(--accent); }
#mr-logo .cross { fill: #FFFFFF; }
#mr-logo .pulse { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  background: var(--nav-bg); color: var(--nav-ink);
  padding: 20px 14px 18px max(14px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-rows: auto 1fr auto; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; color: var(--nav-strong); }
.brand .bt { display: grid; gap: 0; line-height: 1.3; }
.brand b { font-family: var(--f-display); font-size: 17px; letter-spacing: 0.01em; font-weight: 700; }
.brand span { font-size: 11.5px; color: var(--nav-dim); }
#nav-groups { display: grid; gap: 16px; align-content: start; }
.nav-group { display: grid; gap: 1px; }
.nav-group > span { font-size: 11px; letter-spacing: 0.12em; color: var(--nav-dim); padding: 0 10px 6px; }
.nav a.item { position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--nav-ink); font-size: 14px; }
.nav a.item:hover { background: var(--nav-hover); color: var(--nav-strong); }
.nav a.item[aria-current="page"] { background: var(--nav-active); color: var(--nav-strong); font-weight: 700; }
.nav a.item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--accent); }
.nav a.item .count { margin-left: auto; font-family: var(--f-mono); font-size: 11px; color: var(--nav-dim); }
.nav .planned { padding: 4px 10px; font-size: 13px; color: var(--nav-dim); display: flex; gap: 8px; }
.nav .planned i { font-style: normal; font-family: var(--f-mono); font-size: 11px; }
.nav-foot { display: grid; gap: 10px; border-top: 1px solid var(--nav-line); padding: 14px 6px 0; }
.nav-foot p { font-size: 11px; color: var(--nav-dim); line-height: 1.6; }
.whoami { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 10px; color: var(--nav-strong); font-size: 13px; }
.whoami button { border: 0; background: none; color: var(--nav-dim); cursor: pointer; font-size: 12px; padding: 0; }
.whoami button:hover { color: var(--nav-strong); }
.login-card { max-width: 440px; margin: 64px auto; display: grid; gap: 14px; }
.login-form label { font-size: 13px; color: var(--muted); }
.admin-h { font-size: 18px; margin-top: 8px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.admin-link {
  display: grid; gap: 6px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
}
.admin-link:hover { border-color: var(--accent); }
.admin-link .k { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--accent); }
.admin-link strong { font-size: 15px; }
.r13-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.r13-tabs button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer;
}
.r13-tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: transparent; font-weight: 700; }
:root[data-theme="dark"] .r13-tabs button[aria-selected="true"] { color: #06161B; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .r13-tabs button[aria-selected="true"] { color: #06161B; }
}
.r13-frame { width: 100%; min-height: 720px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  border: 1px solid var(--nav-line); background: transparent; color: var(--nav-strong);
  border-radius: 999px; padding: 5px 12px 5px 9px; font-size: 13px; cursor: pointer;
}
.theme-btn:hover { background: var(--nav-hover); }
.theme-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.topbar { display: none; }
main#view {
  min-width: 0; container-type: inline-size;
  padding-left: max(32px, env(safe-area-inset-left, 0px));
  padding-right: max(32px, env(safe-area-inset-right, 0px));
  padding-block: 0 72px;
}
.wrap { max-width: 1080px; margin: 0 auto; }
.loading { padding-block: 80px; color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; overflow-x: clip; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 20;
    background: var(--nav-bg); color: var(--nav-ink);
    padding: max(10px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  }
  .topbar .brand { padding: 0; min-width: 0; flex: 1; }
  .topbar .brand .bt { min-width: 0; }
  .topbar .brand .bt > span { display: none; }
  .topbar .brand b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .actions { display: flex; gap: 8px; flex: none; }
  .menu-btn { border: 1px solid var(--nav-line); background: transparent; color: var(--nav-strong); border-radius: 6px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
  .topbar .theme-btn span { display: none; }
  .topbar .theme-btn { padding: 6px 9px; }
  .nav {
    display: none; position: fixed; z-index: 25; left: 0; right: 0;
    top: calc(max(10px, env(safe-area-inset-top, 0px)) + 48px);
    height: auto; max-height: calc(100dvh - max(10px, env(safe-area-inset-top, 0px)) - 48px); grid-template-rows: none;
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
  }
  .nav > .brand { display: none; }
  body.nav-open .nav { display: grid; }
  main#view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* ---------- page header ---------- */
header.top { position: relative; padding-block: 40px 26px; border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
header.top::after, .hero::after {
  content: ""; position: absolute; right: 0; top: 30px; width: min(360px, 40%); height: 70px;
  background: var(--accent); opacity: 0.16; pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80'%3E%3Cpath d='M0 46H120l10-0 10-30 14 56 12-44 9 18H250l8-10 8 10H400' fill='none' stroke='black' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80'%3E%3Cpath d='M0 46H120l10-0 10-30 14 56 12-44 9 18H250l8-10 8 10H400' fill='none' stroke='black' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right center / contain;
}
header.top > *, .hero > * { position: relative; z-index: 1; }
header.top .lede { max-width: 68ch; font-size: 16px; color: var(--muted); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.thesis { margin-top: 6px; padding: 16px 18px 16px 20px; border-radius: 8px; background: var(--accent-soft); border-left: 4px solid var(--accent); max-width: 86ch; display: grid; gap: 8px; }
.thesis b { color: var(--accent-strong); }
:root[data-theme="dark"] .thesis b { color: var(--accent-strong); }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.fig { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px 16px 14px; display: grid; gap: 4px; align-content: start; min-width: 0; overflow: hidden; }
.fig::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent); }
.fig .num { font-family: var(--f-display); font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand); }
.fig .num small { font-size: 14px; color: var(--muted); font-weight: 500; }
.fig .cap { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ---------- report sections ---------- */
section.block { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 28px; padding-block: 40px; border-bottom: 1px solid var(--line); }
.rail { display: grid; gap: 8px; align-content: start; }
.rail p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; min-width: 0; }
.intro { max-width: 72ch; }
.discuss-btn {
  justify-self: start; margin-top: 4px; font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.discuss-btn:hover, .discuss-btn.has { color: var(--accent); border-color: var(--accent); }

.tag { display: inline-block; font-family: var(--f-mono); font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; vertical-align: 1px; }
.t-off { background: var(--good-soft); color: var(--good); }
.t-rep { background: var(--info-soft); color: var(--info); }
.t-ven { background: var(--warn-soft); color: var(--warn); }
.t-exp { background: var(--bad-soft); color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--muted); align-items: center; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card, .panel, .mkt, .tier, .mcard, .kt, .line-card, .stat, .finding, .lane, .ch, .viz, .scroll, .funnel, .steps, .topics, .form, .layer, .files {
  box-shadow: var(--shadow);
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; min-width: 0; font-size: 14px; }
.card.dead { border-top: 3px solid var(--bad); }
.card.live { border: 1px solid var(--accent); border-top: 3px solid var(--accent); }
.card.warn { border-top: 3px solid var(--warn); }
.card.ok { border-top: 3px solid var(--good); }
.card .why { color: var(--muted); }
.card ul, .card ol, .panel ul, .panel ol { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; font-size: 14px; }
.formula { font-family: var(--f-mono); font-size: 13px; background: var(--sunken); border-radius: 6px; padding: 10px 12px; line-height: 1.8; overflow-x: auto; }

/* markets (R01) */
.mkt { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.mkt header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mkt .code { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.mkt dl { margin: 0; display: grid; gap: 8px; font-size: 14px; }
.mkt dt { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.mkt dd { margin: 0; }
.mkt .take { border-top: 1px dashed var(--line); padding-top: 10px; font-size: 14px; }
.mkt .take b { color: var(--accent); }

/* tables */
.scroll { overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; background: var(--sunken); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.name { font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--sunken); }
tr.core td { background: var(--accent-soft); }
.w720 { min-width: 720px; }
.w880 { min-width: 880px; }
.lvl { display: inline-flex; gap: 3px; vertical-align: middle; }
.lvl i { width: 8px; height: 8px; border-radius: 2px; background: var(--line); }
.lvl.h3 i:nth-child(-n+3), .lvl.h2 i:nth-child(-n+2), .lvl.h1 i:nth-child(-n+1) { background: var(--accent); }
.lvl.r3 i:nth-child(-n+3), .lvl.r2 i:nth-child(-n+2), .lvl.r1 i:nth-child(-n+1) { background: var(--bad); }
.lvlrow { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.v { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 4px; white-space: nowrap; }
.v.go { background: var(--good-soft); color: var(--good); }
.v.care { background: var(--warn-soft); color: var(--warn); }
.v.no { background: var(--bad-soft); color: var(--bad); }
.v.core { background: var(--accent-soft); color: var(--accent); }

/* journey (R01) */
.funnel { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.stage { display: grid; grid-template-columns: 160px repeat(3, minmax(0, 1fr)); gap: 18px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.stage:last-child { border-bottom: 0; }
.stage.loop { background: var(--accent-soft); }
.stage .st { display: grid; gap: 2px; align-content: start; }
.stage .st .n { font-family: var(--f-mono); font-size: 12px; color: var(--accent); }
.stage .st .k { font-family: var(--f-mono); font-size: 12px; color: var(--muted); line-height: 1.5; }
.stage .cell { font-size: 14px; min-width: 0; }
.stage .cell b { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 2px; }
.stage .cell.ai, .stage .cell.ai b { color: var(--info); }

/* AI map (R01) */
.ai-col h3 { padding-bottom: 8px; border-bottom: 2px solid var(--info); margin-bottom: 4px; }
.ai-col.sticky h3 { border-color: var(--accent); }
.mod { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; font-size: 14px; }
.mod:last-child { border-bottom: 0; }
.mod .at { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.rule { border-left: 3px solid var(--bad); padding: 4px 0 4px 14px; display: grid; gap: 4px; font-size: 14px; }
.rule h3 { font-size: 15px; }

/* timeline (R02) */
.tl { list-style: none; margin: 0; padding: 0; display: grid; border-left: 2px solid var(--line); }
.tl li { position: relative; padding: 0 0 18px 20px; display: grid; gap: 2px; font-size: 14px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--info); }
.tl li.hit::before { border-color: var(--accent); background: var(--accent); }
.tl .d { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }

/* channel dossiers (R02) */
.ch { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ch > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ch > header h3 { font-size: 20px; }
.role { font-size: 13px; color: var(--muted); }
.stage-chip { font-family: var(--f-mono); font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--info-soft); color: var(--info); }
.stage-chip.own { background: var(--accent-soft); color: var(--accent); }
.ch .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ch .f { padding: 14px 20px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; font-size: 14px; display: grid; gap: 6px; align-content: start; }
.ch .f:nth-child(3n) { border-right: 0; }
.ch .f:nth-last-child(-n+3) { border-bottom: 0; }
.ch .f > b { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; color: var(--muted); }
.ch .f ul { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.ch .f.red > b { color: var(--bad); }
.ch .f.ai, .ch .f.ai > b { color: var(--info); }
.ch .verdict { padding: 12px 20px; background: var(--sunken); font-size: 14px; border-top: 1px solid var(--line); }
.ch .verdict b { color: var(--accent); }

.arch { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); align-items: stretch; }
.lane { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.lane.own { border: 1px solid var(--accent); border-top: 3px solid var(--accent); }
.lane h3 { font-size: 15px; }
.lane .q { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunken); }
.arrow { display: grid; place-items: center; color: var(--muted); font-family: var(--f-mono); }
.pivot { padding: 16px 18px; border-radius: 8px; border: 1px dashed var(--accent); background: var(--surface); display: grid; gap: 6px; }
.pivot b { color: var(--accent); }
.pivot ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.mcard h3 { font-size: 14px; }
.mcard ul { margin: 0; padding-left: 16px; font-size: 13px; display: grid; gap: 3px; }

/* R03 */
.nots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.nots li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; font-size: 14px; }
.nots li strong { color: var(--bad); }
.nots li span { color: var(--muted); font-size: 13px; }
.tier { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.tier.mid { border: 1px solid var(--accent); border-top: 3px solid var(--accent); }
.tier .price { font-family: var(--f-display); font-size: 26px; font-weight: 600; color: var(--brand); }
.tier .price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.tier ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.tier .who { font-size: 13px; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.steps li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.steps li:last-child { border-bottom: 0; }
.steps .k { font-family: var(--f-mono); font-size: 12px; color: var(--accent); padding-top: 2px; }
.kpi-targets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kt { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.kt .v2 { font-family: var(--f-display); font-weight: 600; font-size: 19px; color: var(--accent); }
.kt .l { font-size: 13px; }
.kt .s { font-size: 12px; color: var(--muted); }
.road { list-style: none; margin: 0; padding: 0; display: grid; }
.road > li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.road > li:last-child { border-bottom: 0; }
.road .when { font-family: var(--f-mono); font-size: 12px; color: var(--accent); padding-top: 3px; }
.road .what { display: grid; gap: 4px; font-size: 14px; }
.road .what ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.road .gate { font-size: 13px; color: var(--info); }
.askbox { display: grid; gap: 8px; padding: 16px 18px; border: 1px dashed var(--accent); border-radius: 8px; background: var(--surface); }
.askbox ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.sources { font-size: 13px; display: grid; gap: 6px; padding-left: 18px; margin: 0; }
.sources li { word-break: break-word; }

/* verdict banner (R08, R09) */
.verdict-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; padding: 18px 20px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.verdict-box .badge { font-family: var(--f-display); font-weight: 700; font-size: 15px; padding: 8px 14px; border-radius: 6px; white-space: nowrap; }
.badge.go { background: var(--good-soft); color: var(--good); }
.badge.cond { background: var(--warn-soft); color: var(--warn); }
.badge.stop { background: var(--bad-soft); color: var(--bad); }
.verdict-box p + p { margin-top: 6px; }
.score { display: grid; gap: 8px; }
.score .row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 60px; gap: 12px; align-items: center; font-size: 14px; }
.score .track { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.score .fill { height: 100%; border-radius: 4px; background: var(--accent); }
.score .fill.mid { background: var(--warn); }
.score .fill.low { background: var(--bad); }
.score .val { font-family: var(--f-mono); font-size: 13px; text-align: right; }
.flow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.flow > div { padding: 14px 14px 16px; border-right: 1px solid var(--line); display: grid; gap: 6px; align-content: start; font-size: 13px; min-width: 0; }
.flow > div:last-child { border-right: 0; }
.flow .n { font-family: var(--f-mono); font-size: 11px; color: var(--accent); }
.flow h3 { font-size: 14px; }
.flow .gate { color: var(--bad); font-size: 12px; }

/* ---------- charts ---------- */
.viz { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 16px 12px; display: grid; gap: 8px; min-width: 0; }
.viz figcaption { display: grid; gap: 2px; }
.viz figcaption strong { font-family: var(--f-display); font-size: 15px; }
.viz figcaption span { font-size: 13px; color: var(--muted); }
.viz-canvas { width: 100%; min-height: 160px; }
.viz-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.viz-foot .src { flex: 1 1 240px; min-width: 0; }
.viz-foot button { border: 1px solid var(--line); background: var(--sunken); border-radius: 4px; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--muted); }
.viz-foot button:hover, .viz-foot button.has { color: var(--accent); border-color: var(--accent); }
.viz-table { overflow-x: auto; }
.viz-table table { font-size: 13px; }
.viz-table td, .viz-table th { padding: 6px 10px; }
.viz-err { font-size: 13px; color: var(--muted); padding: 24px 0; }

/* ---------- home ---------- */
.hero { position: relative; padding-block: 44px 28px; border-bottom: 1px solid var(--line); display: grid; gap: 16px; }
.hero h1 { font-size: clamp(32px, 5vw, 48px); color: var(--brand); }
.hero .hero-mark { display: flex; align-items: center; gap: 14px; }
.hero .hero-mark .logo { width: 52px; height: 52px; }
.lines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.line-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; display: grid; gap: 6px; }
.line-card .k { font-family: var(--f-mono); font-size: 12px; color: var(--accent); }
.line-card h3 { font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface); display: grid; gap: 2px; }
.stat .n { font-family: var(--f-display); font-size: 28px; font-weight: 600; color: var(--brand); }
.stat .l { font-size: 12px; color: var(--muted); }
.topics { display: grid; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.topic { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: start; text-decoration: none; color: var(--ink); }
.topic:last-child { border-bottom: 0; }
a.topic:hover { background: var(--sunken); }
.topic .no { font-family: var(--f-mono); font-size: 13px; color: var(--accent); padding-top: 2px; }
.topic .t { display: grid; gap: 2px; min-width: 0; }
.topic .t strong { font-size: 15px; }
.topic .t span { font-size: 13px; color: var(--muted); }
.status { font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status.done { background: var(--good-soft); color: var(--good); }
.status.next { background: var(--warn-soft); color: var(--warn); }
.status.planned { background: var(--sunken); color: var(--muted); }
.finding { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.finding:hover { border-color: var(--accent); }
.finding .src2 { font-family: var(--f-mono); font-size: 11px; color: var(--accent); }
.finding strong { font-size: 15px; line-height: 1.5; }
.finding span { font-size: 13px; color: var(--muted); }

/* ---------- forms & data center ---------- */
[data-facts], [data-board], [data-ask], [data-tool], [data-comments-list] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.filters label { font-size: 12px; color: var(--muted); }
.filters select, .filters input, .form select, .form input, .form textarea, .ask-input, .drawer textarea, .drawer input {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
.filters input { min-width: min(200px, 100%); flex: 1 1 200px; max-width: 100%; }
.facts td .u { color: var(--muted); font-size: 12px; margin-left: 2px; }
.facts td a { font-size: 13px; }
.count-line { font-size: 13px; color: var(--muted); }

/* ---------- board ---------- */
.board-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--sunken); border-radius: 8px; padding: 10px; display: grid; gap: 8px; min-width: 0; }
.col > header { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px; }
.col > header h3 { font-size: 14px; }
.col > header span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: grid; gap: 6px; font-size: 14px; min-width: 0; }
.note-card .title { font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.note-card .body { font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.st-btn { border: 0; border-radius: 999px; padding: 1px 9px; font-size: 12px; cursor: pointer; }
.st-btn[disabled] { cursor: default; }
.st-open { background: var(--warn-soft); color: var(--warn); }
.st-ok { background: var(--good-soft); color: var(--good); }
.st-no { background: var(--bad-soft); color: var(--bad); }
.st-hold { background: var(--sunken); color: var(--muted); }
.topic-chip { font-family: var(--f-mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--info-soft); color: var(--info); }
.del-btn { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0 2px; }
.del-btn.armed { color: var(--bad); font-weight: 700; }
.form { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.form .row { display: flex; flex-wrap: wrap; gap: 10px; min-width: 0; max-width: 100%; }
.form .row > * { flex: 1 1 160px; min-width: 0; max-width: 100%; }
.form textarea { min-height: 70px; resize: vertical; width: 100%; }
.form input[type="text"], .form select { width: 100%; max-width: 100%; }
.btn { border: 0; border-radius: 6px; padding: 7px 16px; font-size: 14px; cursor: pointer; background: var(--accent); color: #FFFFFF; font-weight: 500; }
:root[data-theme="dark"] .btn { color: #06161B; }
:root[data-theme="dark"] .btn.ghost { color: var(--ink); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.empty { padding: 20px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 14px; background: var(--surface); }
.mini-list { display: grid; gap: 8px; }
.cmt-item { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 14px; }
.cmt-item .where { font-size: 12px; color: var(--accent); text-decoration: none; }
.cmt-item .txt { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- comment drawer ---------- */
.drawer-veil { position: fixed; inset: 0; background: rgba(8, 18, 28, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(0, 0, 0, 0.18);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding-right: env(safe-area-inset-right, 0px);
}
.drawer header { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.drawer header h3 { font-size: 15px; }
.drawer header p { font-size: 12px; color: var(--muted); }
.drawer .close { border: 1px solid var(--line); background: var(--sunken); border-radius: 6px; padding: 2px 10px; cursor: pointer; }
.drawer .thread { overflow-y: auto; padding: 14px 18px; display: grid; gap: 10px; align-content: start; }
.drawer form { display: grid; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.drawer textarea { width: 100%; min-height: 90px; resize: vertical; }
.drawer .who { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.drawer .who input { width: 140px; padding: 4px 8px; font-size: 13px; }

/* ---------- ask ---------- */
.ask-wrap { display: grid; gap: 14px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; text-align: left; }
.suggest button:hover { border-color: var(--accent); color: var(--accent); }
.chat { display: grid; gap: 12px; }
.msg { padding: 12px 16px; border-radius: 8px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.msg.q { background: var(--accent-soft); justify-self: end; max-width: 85%; }
.msg.a { background: var(--surface); border: 1px solid var(--line); }
.msg.a.thinking { color: var(--muted); }
.ask-form { display: grid; gap: 8px; }
.ask-input { width: 100%; min-height: 80px; resize: vertical; }
.ask-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.setup { display: grid; gap: 8px; padding: 16px 18px; border-radius: 8px; border: 1px dashed var(--warn); background: var(--surface); font-size: 14px; }
.setup code { font-family: var(--f-mono); font-size: 13px; background: var(--sunken); padding: 2px 6px; border-radius: 4px; }

/* ---------- cash-flow tool ---------- */
.sim { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 300px minmax(0, 1fr); box-shadow: var(--shadow); }
.sim .controls { padding: 18px; border-right: 1px solid var(--line); display: grid; gap: 12px; align-content: start; }
.scen { display: flex; gap: 6px; flex-wrap: wrap; }
.scen button { font-size: 13px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--sunken); cursor: pointer; }
.scen button[aria-pressed="true"] { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
:root[data-theme="dark"] .scen button[aria-pressed="true"] { color: #06161B; }
.ctl { display: grid; gap: 2px; }
.ctl .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ctl output { font-family: var(--f-mono); font-size: 13px; color: var(--accent); white-space: nowrap; }
.ctl input[type="range"] { width: 100%; accent-color: var(--accent); }
.ctl .hint { font-size: 11px; color: var(--muted); line-height: 1.4; }
.grp { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.sim .results { padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.kpi .v3 { font-family: var(--f-display); font-weight: 600; font-size: 19px; white-space: nowrap; }
.kpi .l { font-size: 12px; color: var(--muted); line-height: 1.4; }
.kpi.ok { background: var(--good-soft); border-color: transparent; }
.kpi.ok .v3 { color: var(--good); }
.kpi.bad { background: var(--bad-soft); border-color: transparent; }
.kpi.bad .v3 { color: var(--bad); }
.sim-chart h4 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.sim-canvas { height: 210px; }
.sens { display: grid; gap: 6px; }
.sens .s { display: grid; grid-template-columns: 170px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.sens .bar { height: 10px; border-radius: 0 3px 3px 0; background: var(--s1); }
.sens .bar.neg { background: var(--neg); }
.sens .val { font-family: var(--f-mono); text-align: right; font-size: 12px; }

/* ---------- channel value tool (R04) ---------- */
.ltv-in td { padding: 6px 10px; vertical-align: middle; }
.ltv-in th small { font-weight: 400; }
.ltv td.name small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); white-space: normal; max-width: 190px; }
.ltv-in input { width: 84px; font: 13px var(--f-mono); text-align: right; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); }
.ltv-in input:focus-visible, .ltv select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ltv-out td { padding: 8px 10px; vertical-align: middle; }
.ltv select { font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); }
.ltv .pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* ---------- aftercare knowledge base (R06) ---------- */
.kb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; font-size: 13px; }
.kb-tabs button { font-size: 14px; }
.kb-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 20px; display: grid; gap: 10px; min-width: 0; }
.kb-panel h4, .kb-general h4 { margin: 10px 0 0; font-size: 13px; letter-spacing: 0.06em; color: var(--accent); }
.kb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.kb-head h3 { margin: 0; font-size: 20px; }
.kb-head p { margin: 2px 0 0; font-size: 13px; }
.kb-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.kb-meta b { color: var(--ink); font-weight: 500; }
.kb-table { min-width: 640px; font-size: 13px; }
.kb-table td { padding: 8px 12px; }
.kb-table td.name { white-space: nowrap; }
.kb-ul { margin: 0; padding-left: 16px; display: grid; gap: 2px; }
.kb-flags { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kb-flag { border: 1px solid var(--line); border-top: 3px solid var(--info); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; background: var(--surface); }
.kb-flag.now { border-top-color: var(--bad); }
.kb-flag.today { border-top-color: var(--warn); }
.kb-flag-h { display: grid; gap: 4px; }
.kb-flag-h .v, .kb-head .v { justify-self: start; }
.kb-flag-h .act { font-size: 12px; color: var(--muted); line-height: 1.5; }
.kb-flag ul { margin: 0; padding-left: 16px; display: grid; gap: 6px; font-size: 13px; }
.kb-flag li strong { display: block; font-weight: 600; }
.kb-flag li span { color: var(--muted); }
.kb-foot { padding-top: 6px; }
.kb-general { display: grid; gap: 8px; }

/* ---------- R07 clickable prototype ---------- */
.proto { display: grid; gap: 14px; }
.proto-bar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; box-shadow: var(--shadow); }
.proto-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.proto-chips button { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink); cursor: pointer; }
.proto-chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.proto-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.proto-phone { border: 1px solid var(--line); border-radius: 28px; padding: 10px; background: var(--sunken); box-shadow: var(--shadow); display: grid; gap: 8px; width: 100%; max-width: 360px; justify-self: center; }
.proto-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 0; font-size: 14px; }
.proto-screen { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; height: 520px; overflow-y: auto; display: grid; gap: 10px; align-content: start; font-size: 14px; }
.proto-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.proto-tabs button { font-size: 12px; padding: 8px 2px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.proto-tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); font-weight: 600; }
.proto-hello { display: grid; gap: 2px; }
.proto-hello b { font-size: 16px; }
.proto-hello span, .proto-meta, .proto-src { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.proto-src { border-top: 1px dashed var(--line); padding-top: 8px; }
.proto-stage { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 600; }
.proto-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.proto-card.warn { border-color: transparent; background: var(--bad-soft); }
.proto-card h5, .proto-desk h5 { margin: 0; font-size: 12px; letter-spacing: 0.06em; color: var(--accent); }
.proto-card.warn h5 { color: var(--bad); }
.proto-card p { margin: 0; }
.proto-card ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.proto-big { font-size: 16px; font-weight: 600; }
.proto-opt { text-align: left; font: inherit; font-size: 13px; line-height: 1.5; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
.proto-opt:hover { border-color: var(--accent); }
.proto-result { border-radius: 10px; padding: 12px; display: grid; gap: 6px; border: 1px solid var(--line); border-top: 3px solid var(--info); }
.proto-result.now { border-top-color: var(--bad); }
.proto-result.today { border-top-color: var(--warn); }
.proto-result .v { justify-self: start; }
.proto-result p { margin: 0; }
.proto-sign { font-weight: 600; }
.proto-wide { width: 100%; }
.proto-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.proto-row .btn { font-size: 13px; padding: 5px 12px; }
.proto-ok { color: var(--good); font-size: 13px; font-weight: 600; margin: 0; }
.proto-album { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.proto-shot { aspect-ratio: 3 / 4; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); display: grid; align-content: end; padding: 6px; font-size: 12px; }
.proto-shot small { color: var(--muted); font-size: 11px; }
.proto-shot.todo { border-style: dashed; background: transparent; color: var(--muted); }
.proto-gift { background: var(--accent-soft); border-color: transparent; }
.proto-desk { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.proto-desk-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; font-size: 15px; }
.proto-desk-h .muted { font-size: 13px; }
.proto-desk h5 { margin-top: 4px; }
.proto-queue, .proto-tasks { display: grid; gap: 8px; }
.proto-msg { border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 8px 12px; display: grid; gap: 4px; font-size: 13px; }
.proto-msg.now { border-left-color: var(--bad); }
.proto-msg.today { border-left-color: var(--warn); }
.proto-msg.visit { border-left-color: var(--info); }
.proto-msg.mine { background: var(--accent-soft); }
.proto-msg p { margin: 0; }
.proto-msg-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; }
.proto-msg-h .mono { margin-left: auto; font-size: 11px; }
.proto-task { text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: grid; gap: 3px; cursor: pointer; }
.proto-task.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.proto-task-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.proto-task-h .muted { font-size: 12px; }
.proto-say { font-size: 13px; color: var(--muted); line-height: 1.5; }
.proto-draft { border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; font-size: 14px; line-height: 1.6; }
.proto-draft p { margin: 0; }

/* ---------- R11/R12 consultation workbench ---------- */
/* The canvas stays dark in both themes, like a viewing screen, so the face reads the same for doctor and client. */
.wb { display: grid; gap: 14px; }
.wb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wb-hl { font-size: 13px; color: var(--muted); }
.wb-stage {
  --st-bg: #121519; --st-ink: #ECE8E2; --st-muted: #A6ADB6; --st-line: rgba(236, 232, 226, 0.18); --st-btn: rgba(236, 232, 226, 0.07);
  position: relative; overflow: hidden; background: var(--st-bg); color: var(--st-ink); border-radius: 10px; padding: 12px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "top top top" "left view right" "legend legend legend"; gap: 10px;
}
.wb-top { grid-area: top; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wb-top .sp { flex: 1; }
.wb-left, .wb-right { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 0; }
.wb-left { grid-area: left; }
.wb-right { grid-area: right; }
.wb-group { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.wb-rlabel { font-size: 11px; color: var(--st-muted); letter-spacing: 0.04em; margin-top: 4px; }
.wb-btn { font: inherit; font-size: 12px; line-height: 1.25; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--st-line); background: var(--st-btn); color: var(--st-ink); cursor: pointer; white-space: nowrap; }
.wb-btn:hover:not(:disabled) { border-color: var(--st-ink); }
.wb-btn[aria-pressed="true"] { background: var(--st-ink); color: var(--st-bg); border-color: var(--st-ink); }
.wb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.wb-btn:focus-visible { outline: 2px solid #46C2C9; outline-offset: 2px; }
.wb-view { grid-area: view; display: flex; gap: 10px; justify-content: center; align-items: flex-start; min-width: 0; }
.wb-pane { flex: 1 1 0; max-width: 340px; min-width: 0; display: grid; gap: 4px; justify-items: center; }
.wb-pane[hidden] { display: none; }
.wb-pane .cap { font-size: 12px; color: var(--st-muted); }
.wb-svg { width: 100%; height: auto; display: block; }
.wb-stage.drawing .wb-pane:last-child .wb-svg { cursor: crosshair; touch-action: none; }
.wb-svg .wx-face { fill: #2E333A; stroke: #DCD5CA; stroke-width: 0.5; stroke-linejoin: round; }
.wb-svg .wx-band { fill: #46C2C9; fill-opacity: 0.3; stroke: none; }
.wb-svg .wx-band-edge { fill: none; stroke: #46C2C9; stroke-width: 0.35; stroke-dasharray: 1 0.8; }
.wb-svg .wx-before { fill: none; stroke: #A6ADB6; stroke-width: 0.45; stroke-dasharray: 1.6 1.2; }
.wb-svg .wx-pt { fill: #46C2C9; }
.wb-svg .wx-m { fill: none; stroke: #5B9BF8; stroke-width: 0.4; }
.wb-svg .wx-m.dash { stroke-dasharray: 1.2 0.9; }
.wb-svg .wx-badge rect { fill: #2563EB; }
.wb-svg .wx-badge text { fill: #FFFFFF; font-size: 3.1px; font-family: var(--f-body); }
.wb-svg .wx-ink { fill: none; stroke: #F5B841; stroke-width: 0.7; stroke-linecap: round; stroke-linejoin: round; }
.wb-legend { grid-area: legend; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--st-muted); }
.wb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wb-legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.wb-legend .lg-plan { background: #2E333A; border: 1px solid #DCD5CA; }
.wb-legend .lg-band { background: rgba(70, 194, 201, 0.35); border: 1px dashed #46C2C9; }
.wb-legend .lg-before { height: 0; border-top: 2px dashed #A6ADB6; border-radius: 0; }
.wb-legend .lg-m { height: 0; border-top: 2px solid #5B9BF8; border-radius: 0; }
.wb-stage.bare .wb-top > :not(.wb-hide), .wb-stage.bare .wb-left, .wb-stage.bare .wb-right, .wb-stage.bare .wb-legend { display: none; }
.wb-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: calc(100% - 32px); background: #ECE8E2; color: #121519; font-size: 13px; line-height: 1.4; padding: 8px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.wb-toast.on { opacity: 1; }
.wb-stage.flash::after { content: ""; position: absolute; inset: 0; background: #FFFFFF; opacity: 0; pointer-events: none; animation: wbflash 0.35s ease-out; }
@keyframes wbflash { from { opacity: 0.6; } to { opacity: 0; } }
.wb-side { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 12px; }
.wb-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; }
.sim11-warn { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 18px; }
.sim11-warn.bad { color: var(--bad); font-weight: 600; }

/* ---------- about ---------- */
.layers { display: grid; gap: 10px; }
.layer { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; }
.layer .k { display: grid; gap: 2px; align-content: start; }
.layer .k b { font-size: 15px; }
.layer .k span { font-family: var(--f-mono); font-size: 11px; color: var(--accent); }
.layer ul { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.files { font-family: var(--f-mono); font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.7; }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.changelog li { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; }
.changelog .d { font-family: var(--f-mono); font-size: 12px; color: var(--muted); padding-top: 2px; }

/* ---------- container-driven responsiveness ---------- */
@container (max-width: 980px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim { grid-template-columns: 1fr; }
  .sim .controls { border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim .controls .scen, .sim .controls .grp, .sim .controls > .note { grid-column: 1 / -1; }
  .flow { grid-auto-flow: row; }
  .flow > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .flow > div:last-child { border-bottom: 0; }
}
@container (max-width: 860px) {
  .proto-grid, .proto-bar { grid-template-columns: 1fr; }
  section.block { grid-template-columns: 1fr; gap: 16px; padding-block: 32px; }
  .grid3, .lines { grid-template-columns: 1fr; }
  .figures, .stats, .kpi-targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch .grid { grid-template-columns: 1fr; }
  .ch .f { border-right: 0; }
  .ch .f:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .ch .f:last-child { border-bottom: 0; }
  .arch { grid-template-columns: 1fr; gap: 6px; }
  .arrow { transform: rotate(90deg); height: 24px; }
  .stage { grid-template-columns: 1fr 1fr; }
  .stage .st { grid-column: 1 / -1; }
  header.top::after, .hero::after { display: none; }
  header.top, .hero { padding-block: 28px 20px; }
  .form .row { display: grid; grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 640px) {
  .grid2, .nots { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; gap: 10px; }
  .road > li, .steps li, .layer, .changelog li { grid-template-columns: 1fr; gap: 4px; }
  .metrics, .board-cols { grid-template-columns: 1fr; }
  .sim .controls { grid-template-columns: 1fr; }
  .sens .s { grid-template-columns: 120px minmax(0, 1fr) 56px; }
  .kb-flags { grid-template-columns: 1fr; }
  .kb-panel { padding: 16px; }
  .proto-desk { padding: 12px; }
  .topic { grid-template-columns: 44px minmax(0, 1fr); }
  .topic .status { grid-column: 2; justify-self: start; }
  .verdict-box { grid-template-columns: 1fr; }
  .score .row { grid-template-columns: 110px minmax(0, 1fr) 48px; }
}
@container (max-width: 600px) {
  .wb-stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "view" "left" "right" "legend"; }
  .wb-left, .wb-right { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .wb-group { display: flex; flex-wrap: wrap; }
  .wb-rlabel { margin-top: 0; }
}
@container (max-width: 440px) {
  .figures, .stats, .kpi-targets { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  main#view > .wrap { animation: fadein 0.3s ease both; }
  .sens .bar, .score .fill { transition: width 0.25s ease; }
}
@keyframes fadein { from { opacity: 0.6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
