:root {
  --bg: #ffffff;
  --surface: #f6f9fc;
  --ink: #0a2540;
  --body: #425466;
  --muted: #687385;
  --border: #e3e8ee;
  --border-strong: #c9d3e0;
  --accent: #635bff;
  --accent-hover: #4f46cf;
  --code-bg: #f2f5f9;
  --callout-bg: #f2f6ff;
  --callout-border: #d4dff5;
  --edge: #8b98ac;
  --thead: #687385;
  --dia-accent-fill: #635bff;
  --ok-bg: #e7f6ec;
  --ok-ink: #17803f;
  --bad-bg: #fdecec;
  --bad-ink: #c03038;
  --band-bg: #fdf1df;
  --band-ink: #8a5a13;
  --av-bg: #edecff;
  --av-ink: #4f46cf;
  --bp-bg: #dff4f4;
  --bp-ink: #0c6e73;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1219;
    --surface: #151b28;
    --ink: #eef2f9;
    --body: #b6c0d2;
    --muted: #8291a9;
    --border: #263048;
    --border-strong: #3a4763;
    --accent: #8e88ff;
    --accent-hover: #aca7ff;
    --code-bg: #1a2233;
    --callout-bg: #17203a;
    --callout-border: #2b3a61;
    --edge: #5c6a85;
    --thead: #8291a9;
    --dia-accent-fill: #574fd6;
    --ok-bg: #16311f;
    --ok-ink: #7fd6a0;
    --bad-bg: #3a1d20;
    --bad-ink: #f2969b;
    --band-bg: #33270f;
    --band-ink: #e8b567;
    --av-bg: #262051;
    --av-ink: #b4afff;
    --bp-bg: #10333a;
    --bp-ink: #74d4dc;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1219;
  --surface: #151b28;
  --ink: #eef2f9;
  --body: #b6c0d2;
  --muted: #8291a9;
  --border: #263048;
  --border-strong: #3a4763;
  --accent: #8e88ff;
  --accent-hover: #aca7ff;
  --code-bg: #1a2233;
  --callout-bg: #17203a;
  --callout-border: #2b3a61;
  --edge: #5c6a85;
  --thead: #8291a9;
  --dia-accent-fill: #574fd6;
  --ok-bg: #16311f;
  --ok-ink: #7fd6a0;
  --bad-bg: #3a1d20;
  --bad-ink: #f2969b;
  --band-bg: #33270f;
  --band-ink: #e8b567;
  --av-bg: #262051;
  --av-ink: #b4afff;
  --bp-bg: #10333a;
  --bp-ink: #74d4dc;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
code, .mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; }

/* ---------- top bar + top navigation ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: 56px; display: flex; align-items: center; gap: 28px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { color: var(--ink); font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; flex: none; }
.brand .slash { color: var(--border-strong); font-weight: 400; margin: 0 8px; }
.brand .area { color: var(--muted); font-weight: 500; }
.topnav {
  display: flex; align-items: stretch; gap: 4px;
  align-self: stretch; flex: 1 1 auto; min-width: 0;
  overflow: visible;
}
.topnav .dd { position: relative; display: flex; align-items: stretch; }
.dd-toggle {
  display: flex; align-items: center; gap: 5px; padding: 0 14px;
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 500; color: var(--body);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.dd-toggle:hover { color: var(--ink); }
.dd-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dd-toggle.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dd-toggle .caret { font-size: 10px; opacity: 0.7; }
.dd-menu {
  display: none; position: absolute; top: calc(100% + 1px); left: 0;
  min-width: 220px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; box-shadow: 0 10px 28px rgba(10, 37, 64, 0.12);
  z-index: 40;
}
.dd:hover .dd-menu, .dd:focus-within .dd-menu, .dd.open .dd-menu { display: block; }
.dd-menu a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--body); text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.dd-menu a:hover { background: var(--surface); color: var(--ink); }
.dd-menu a.on { color: var(--accent); font-weight: 600; background: var(--surface); }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  display: flex; align-items: center; padding: 0 14px;
  color: var(--body); text-decoration: none; font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap; flex: none;
}
.topnav a:hover { color: var(--ink); }
.topnav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.topnav a:focus-visible, .side a:focus-visible, .toc a:focus-visible, .content a:focus-visible, .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 800px) 210px;
  gap: 56px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 88px 32px 96px;
}

.shell-wide { grid-template-columns: 250px minmax(0, 900px); }
figure.dia .frame::-webkit-scrollbar { height: 8px; }
figure.dia .frame::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
figure.dia .frame::-webkit-scrollbar-track { background: transparent; }

/* ---------- left nav ---------- */
.side { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 112px); overflow-y: auto; font-size: 13.5px; }
.side .group { margin-bottom: 26px; }
.side .group-title {
  font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px; padding-left: 12px;
}
.side a {
  display: block; padding: 5px 12px; border-radius: 6px;
  color: var(--body); text-decoration: none; line-height: 1.45;
}
.side a:hover { color: var(--ink); background: var(--surface); }
.side a.active { color: var(--accent); background: var(--surface); font-weight: 600; }

/* ---------- right toc ---------- */
.toc { position: sticky; top: 88px; align-self: start; font-size: 13px; }
.toc .toc-title { font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.toc a {
  display: block; color: var(--muted); text-decoration: none;
  padding: 3px 0 3px 14px; border-left: 2px solid var(--border); line-height: 1.4;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---------- content ---------- */
.content { min-width: 0; }
.doc-sec { display: block; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h1 { color: var(--ink); font-size: 30px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 14px; text-wrap: balance; }
.lede { font-size: 16.5px; color: var(--body); margin: 0 0 8px; max-width: 68ch; }
h2 {
  color: var(--ink); font-size: 21px; font-weight: 650; letter-spacing: -0.015em;
  margin: 56px 0 14px; padding-top: 26px; border-top: 1px solid var(--border);
  text-wrap: balance; position: relative;
}
.doc-sec:first-of-type h2 { margin-top: 24px; }
h2 .anchor, h3 .anchor { color: var(--border-strong); text-decoration: none; margin-left: 8px; font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
h2 .anchor:hover, h3 .anchor:hover { color: var(--accent); }
h3 { color: var(--ink); font-size: 16.5px; font-weight: 650; margin: 34px 0 10px; }
p { margin: 0 0 14px; max-width: 72ch; }
ul, ol { margin: 0 0 16px; padding-left: 24px; }
li { margin-bottom: 7px; max-width: 68ch; }
li::marker { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
.content a:hover { color: var(--accent-hover); text-decoration: underline; }
strong, b { color: var(--ink); font-weight: 600; }
em { color: var(--body); }
code {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-size: 12.5px; color: var(--ink);
}

/* callouts */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--callout-bg); border: 1px solid var(--callout-border);
  border-radius: 10px; padding: 14px 18px; margin: 18px 0 22px; font-size: 14px;
}
.callout .ico { flex: none; margin-top: 2px; color: var(--accent); }
.callout p { margin: 0 0 6px; } .callout p:last-child { margin: 0; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 18px 0 26px; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--thead); padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--body); }
tr:last-child td { border-bottom: none; }
td b, td strong { color: var(--ink); font-weight: 600; }
td ol, td ul { margin: 6px 0 8px; padding-left: 18px; }
td li { margin-bottom: 4px; }
.num { font-variant-numeric: tabular-nums; }

/* figures / diagrams */
figure.dia { margin: 24px 0 30px; }
figure.dia .frame {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
  padding: 20px 12px; overflow-x: auto;
}
figure.dia svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; max-width: 72ch; }
figcaption b { color: var(--body); }

/* svg diagram vocabulary */
.nd { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.nd-plain { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1.2; }
.nd-accent { fill: var(--bg); stroke: var(--accent); stroke-width: 1.6; }
.nd-future { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.nd-group { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.t-eyebrow { font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; fill: var(--muted); }
.t-title { font-size: 13.5px; font-weight: 600; fill: var(--ink); }
.t-sub { font-size: 11px; fill: var(--body); }
.t-lbl { font-size: 11px; fill: var(--body); }
.t-lbl-a { font-size: 11px; font-weight: 600; fill: var(--accent); }
.t-lbl-m { font-size: 11px; fill: var(--muted); }
.t-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; fill: var(--body); }
.e { stroke: var(--edge); stroke-width: 1.4; fill: none; }
.e-a { stroke: var(--accent); stroke-width: 2.4; fill: none; }
.e-d { stroke: var(--edge); stroke-width: 1.4; fill: none; stroke-dasharray: 5 5; }
.plate { fill: var(--bg); }
.m-e { fill: var(--edge); } .m-a { fill: var(--accent); }

/* v2 diagram vocabulary — reference style: quiet filled nodes, one accent node, floating labels, legend */
.n2 { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; }
.n2-dash { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 6 5; }
.n2-accent { fill: var(--dia-accent-fill); stroke: none; }
.n2-group { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.n2-t { font-size: 15px; font-weight: 650; fill: var(--ink); }
.n2-s { font-size: 12px; fill: var(--muted); }
.n2-tw { font-size: 15px; font-weight: 650; fill: #ffffff; }
.n2-sw { font-size: 12px; fill: rgba(255,255,255,0.85); }
.lg-t { font-size: 12.5px; fill: var(--body); }

@media (max-width: 1180px) { .shell { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-top: 76px; }
  .side { display: none; }
  .brand .area, .brand .slash { display: none; }
}

/* v3 diagram — ink-on-paper flow map */
.d3-frame { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.d3 { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.d3-focus { fill: var(--bg); stroke: var(--ink); stroke-width: 2.6; }
.d3-dash { fill: var(--bg); stroke: var(--edge); stroke-width: 1.5; stroke-dasharray: 6 5; }
.d3-group { fill: none; stroke: var(--border-strong); stroke-width: 1.4; }
.d3-eyebrow { font: 600 9.5px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.18em; fill: var(--muted); }
.d3-title { font-size: 17px; font-weight: 700; fill: var(--ink); }
.d3-title-s { font-size: 15px; font-weight: 700; fill: var(--ink); }
.d3-sub { font-size: 12.5px; fill: var(--muted); }
.d3-lbl { font: 11px ui-monospace, Menlo, Consolas, monospace; fill: var(--body); }
.d3-lbl-b { font: 700 11px ui-monospace, Menlo, Consolas, monospace; fill: var(--ink); }
.d3-badge { fill: var(--ink); }
.d3-badge-t { font: 700 8.5px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.14em; fill: var(--bg); }
.d3-foot { font: 600 10px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.16em; fill: var(--muted); }
.e3-new { stroke: var(--ink); stroke-width: 2.4; fill: none; }
.e3-live { stroke: var(--edge); stroke-width: 1.5; fill: none; }
.e3-dash { stroke: var(--edge); stroke-width: 1.5; fill: none; stroke-dasharray: 5 5; }
.m-ink { fill: var(--ink); }
.d3-chip { fill: var(--surface); stroke: var(--ink); stroke-width: 1.3; }
.d3-chip-t { font: 700 10px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.12em; fill: var(--ink); }
.fl { transition: opacity 0.15s ease; }
.fl.dim { opacity: 0.16; }
.n3 { cursor: default; }

/* ---------- wireframe vocabulary (.wf-*) — redrawn screen mockups ---------- */
.wf {
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg);
  font-size: 12.5px; line-height: 1.45; color: var(--body); overflow: hidden;
}
.wf-body { padding: 14px 16px 16px; }
.wf-min { min-width: 620px; }
.wf-wide { min-width: 780px; }
.wf-title { font-size: 15px; font-weight: 650; color: var(--ink); margin: 0 0 12px; }
.wf-sub { font-size: 12px; font-weight: 650; color: var(--ink); margin: 14px 0 8px; }

/* filter/toolbar rows and form fields */
.wf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; }
.wf-row:last-child { margin-bottom: 0; }
.wf-field { display: flex; flex-direction: column; gap: 3px; }
.wf-label { font-size: 9.5px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.wf-input, .wf-select {
  display: inline-block; border: 1px solid var(--border-strong); background: var(--bg);
  border-radius: 6px; padding: 4px 10px; color: var(--ink); font-size: 12px; min-width: 96px; white-space: nowrap;
}
.wf-select .c { color: var(--muted); font-size: 10px; margin-left: 8px; }
.wf-input.ro { background: var(--surface); color: var(--muted); }
.wf-input.ph { color: var(--muted); font-style: italic; }
.wf-area {
  border: 1px solid var(--border-strong); background: var(--bg); border-radius: 6px;
  padding: 6px 10px; color: var(--muted); font-style: italic; min-height: 44px; margin: 4px 0 12px;
}
.wf-btn {
  display: inline-block; border-radius: 7px; padding: 5px 12px; font-weight: 600; font-size: 12px;
  border: 1px solid var(--border-strong); color: var(--ink); background: var(--surface); white-space: nowrap;
}
.wf-btn-p { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wf-btn-s { padding: 3px 9px; font-size: 11px; font-weight: 500; background: var(--bg); }
.wf-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.wf-ck {
  display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--edge);
  border-radius: 3px; vertical-align: -1px; margin-right: 9px; background: var(--bg);
}

/* tabs */
.wf-tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin: 0 0 14px; }
.wf-tab {
  padding: 5px 14px; border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; background: var(--surface); color: var(--body); font-weight: 500; font-size: 12px;
}
.wf-tab.on { background: var(--bg); color: var(--accent); font-weight: 650; box-shadow: inset 0 -2px 0 var(--accent); }

/* tables */
.wf table { font-size: 12px; }
.wf th {
  font-size: 10px; padding: 7px 10px; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-strong);
}
.wf td { padding: 6px 10px; font-size: 12px; vertical-align: middle; }
.wf tr:last-child td { border-bottom: none; }
.wf .r { text-align: right; font-variant-numeric: tabular-nums; }
.wf .c2 { text-align: center; font-variant-numeric: tabular-nums; }
.wf td.grp {
  background: var(--surface); color: var(--ink); font-weight: 650; font-size: 11.5px;
}
.wf td.band { background: var(--band-bg); color: var(--band-ink); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; }
.wf tr.sum td { background: var(--surface); font-weight: 650; color: var(--ink); }
.wf td .cell {
  display: inline-block; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--bg); padding: 2px 8px; min-width: 42px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.wf td .cell.wide { min-width: 150px; }
.wf-ellip td { color: var(--muted); font-style: italic; }
.wf td.ind { padding-left: 38px; }
.wf-btn.dis { opacity: 0.45; }
.wf-tabs { flex-wrap: wrap; }

/* badges + state text */
.wf-badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 600; }
.wf-ok { background: var(--ok-bg); color: var(--ok-ink); }
.wf-bad { background: var(--bad-bg); color: var(--bad-ink); }
.wf-red { color: var(--bad-ink); font-weight: 650; }
.wf-dim { color: var(--muted); }

/* KPI stat cards */
.wf-kpis { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.wf-kpi { border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; min-width: 150px; }
.wf-kpi .k { font-size: 9.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wf-kpi .v { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.wf-kpi .s { font-size: 11px; color: var(--muted); }

/* notice strip, modal, pager, footer actions */
.wf-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; margin: 0 0 14px; color: var(--body);
}
.wf-modal { max-width: 480px; margin: 0 auto; }
.wf-pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }
.wf-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.wf-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-top: 12px; }
.wf-panel .pt { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 6px; }
.wf-total { text-align: right; font-weight: 700; color: var(--ink); margin-top: 10px; }

/* ---------- topbar search ---------- */
.search { position: relative; flex: none; margin-left: auto; }
.search input {
  width: 180px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); padding: 6px 12px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; width: 260px; }
.search input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 380px; max-width: 84vw;
  max-height: 60vh; overflow-y: auto; z-index: 30;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(10, 37, 64, 0.16); padding: 6px;
}
.search-results a {
  display: block; padding: 8px 10px; border-radius: 7px; text-decoration: none;
}
.search-results a .sr-t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.search-results a .sr-a { font-size: 11px; color: var(--accent); font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.search-results a .sr-x { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results a:hover, .search-results a.sel { background: var(--surface); }
.search-results .sr-none { padding: 10px 12px; font-size: 13px; color: var(--muted); }

/* ---------- screens index cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin: 22px 0 30px; }
a.card {
  display: block; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  text-decoration: none; color: var(--body); background: var(--bg);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
a.card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(10, 37, 64, 0.07); text-decoration: none; }
.card .card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card .card-num { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; }
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card p { margin: 0 0 10px; font-size: 12.5px; max-width: none; }
.card .card-meta { font-size: 11.5px; color: var(--muted); }
.card .card-meta b { color: var(--body); font-weight: 600; }
.chip {
  display: inline-block; border-radius: 999px; padding: 1px 9px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.03em;
  background: var(--callout-bg); color: var(--accent); border: 1px solid var(--callout-border);
}
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
.chip.warn { background: var(--band-bg); color: var(--band-ink); border-color: transparent; }
.card .thumb {
  height: 74px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px;
  background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 12px 12px;
  display: flex; align-items: center; justify-content: center; gap: 5px; padding: 10px 14px; overflow: hidden;
}
.thumb i { display: block; border-radius: 3px; background: var(--border-strong); flex: none; }
.thumb .t-col { display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; min-width: 0; }
.thumb .t-bar { height: 7px; background: var(--border); border-radius: 3px; }
.thumb .t-bar.a { background: var(--accent); opacity: 0.55; }
.thumb .t-bar.w60 { width: 60%; } .thumb .t-bar.w80 { width: 80%; } .thumb .t-bar.w40 { width: 40%; }

/* ---------- screen-page panels ---------- */
.panel { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 18px 0 26px; }
.panel .panel-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.panel p:last-child, .panel ul:last-child { margin-bottom: 0; }
.panel.replaces { background: var(--surface); }
.coverage { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
.coverage li { margin: 0; font-size: 13px; max-width: none; padding-left: 22px; position: relative; }
.coverage li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.coverage li.y::before { content: "✓"; color: var(--ok-ink); }
.coverage li.n::before { content: "○"; color: var(--bad-ink); }
.coverage li.n { color: var(--bad-ink); }
.coverage li.p::before { content: "◐"; color: var(--band-ink); }

/* decision log */
.status { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 650; }
.status.open { background: var(--band-bg); color: var(--band-ink); }
.status.resolved { background: var(--ok-bg); color: var(--ok-ink); }
.status.superseded { background: var(--surface); color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
ul.dlist { list-style: none; margin: 0; padding: 0; }
ul.dlist > li { margin: 0 0 14px; padding: 0; max-width: none; font-size: 13px; }
ul.dlist > li:last-child { margin-bottom: 0; }
ul.dlist .status { margin-right: 6px; vertical-align: 1px; }
ul.dlist .hint { margin: 6px 0 8px; }
ul.dlist .rec { margin-top: 6px; }
.rec {
  background: var(--callout-bg); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 8px 12px; margin: 0;
  font-size: 12.5px;
}
.rec .rec-k {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}

/* ---------- prev/next page navigation ---------- */
.pagenav { display: flex; gap: 12px; justify-content: space-between; margin-top: 48px; }
.pagenav .pn {
  flex: 1 1 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px;
}
.pagenav .pn span { display: block; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.pagenav .pn:hover { border-color: var(--accent); text-decoration: none; }
.pagenav .pn.next { text-align: right; }

/* ---------- live interactive wireframe (reconciliation flow) ---------- */
.live { margin: 22px 0 30px; }
.live .scenarios { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; align-items: center; }
.live .scenarios .sc-label { font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.live .sc {
  appearance: none; font: inherit; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 3px 12px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--body);
}
.live .sc:hover { color: var(--ink); }
.live .sc.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.live .lockbar {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  justify-content: flex-end; flex-wrap: wrap;
}
.live .locknote { font-size: 12px; color: var(--muted); margin-right: auto; }
.live .locked-banner {
  background: var(--ok-bg); color: var(--ok-ink); border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 600; margin-top: 12px;
}
.live .rmodal {
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg);
  box-shadow: 0 12px 32px rgba(10, 37, 64, 0.14); padding: 14px 16px; margin: 10px 0;
  max-width: 460px;
}
.live .rmodal .rm-t { font-weight: 700; color: var(--ink); margin: 0 0 8px; font-size: 14px; }
.live .rmodal label { display: block; font-size: 12.5px; margin: 4px 0; cursor: pointer; }
.live .rmodal .rm-x { font-size: 11.5px; color: var(--muted); margin: 8px 0 10px; }

/* ---------- print ---------- */
@media print {
  .topbar, .side, .toc, .search, .pagenav, .art-view, .live .scenarios { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  body { font-size: 12px; }
  figure.cmp .frame.artboard { overflow: visible; background-image: none; }
  a { color: inherit; }
  h2 { page-break-after: avoid; }
  figure.dia { page-break-inside: avoid; }
}

/* artboard figures — wireframe with a segmented view switcher (wireframe / low-fi original) */
figure.cmp .art-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0 0 8px;
}
figure.cmp .art-title { font-size: 13.5px; font-weight: 650; color: var(--ink); }
figure.cmp .art-view {
  display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong);
  border-radius: 8px; overflow: hidden; background: var(--surface);
}
figure.cmp .av {
  appearance: none; font: inherit; cursor: pointer; border: none;
  padding: 4px 12px; font-size: 11.5px; font-weight: 600;
  background: transparent; color: var(--muted);
}
figure.cmp .av + .av { border-left: 1px solid var(--border-strong); }
figure.cmp .av:hover { color: var(--ink); }
figure.cmp .av:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
figure.cmp .av.on { background: var(--accent); color: #fff; }
figure.cmp .frame.artboard {
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 16px 16px;
  padding: 20px; overflow-x: auto; scrollbar-width: thin;
}
figure.cmp .cmp-pane { display: none; }
figure.cmp .cmp-pane.on { display: block; }
figure.cmp .cmp-pane img {
  display: block; max-width: 100%; height: auto; margin: 0 auto;
  border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
}

/* annotation pins — inline markers inside wireframes, linked to the note list below */
.pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  /* negative vertical margins collapse the margin box so the badge never
     inflates the line box of the (often smaller) text it annotates */
  vertical-align: middle; margin: -8px 2px; cursor: default; user-select: none;
}
.pin.hl, .pin:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
ol.pin-list { margin: 12px 0 26px; padding: 0; list-style: none; }
ol.pin-list li {
  position: relative; padding: 5px 10px 5px 34px; margin: 0; max-width: none;
  font-size: 13px; border-radius: 7px;
}
ol.pin-list li::before {
  content: attr(data-pin); position: absolute; left: 8px; top: 7px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
ol.pin-list li.hl, ol.pin-list li:hover { background: var(--surface); }
ol.pin-list li b { color: var(--ink); }
.pin { cursor: help; }
.pin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pin-pop {
  position: fixed; z-index: 40; max-width: 320px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(10, 37, 64, 0.18);
  padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: var(--body);
  pointer-events: none;
}
.pin-pop b { color: var(--ink); }
.pin-pop .pp-n {
  display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700;
  line-height: 15px; text-align: center; margin-right: 6px; vertical-align: 1px;
}
@media print { .pin-pop { display: none !important; } }

/* ---------- auth pages (login / denied) ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface); padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(10, 37, 64, 0.08);
  padding: 40px 44px; text-align: center;
}
.auth-card .brand { display: block; margin-bottom: 26px; }
.auth-card h1 { color: var(--ink); font-size: 20px; letter-spacing: -0.01em; margin: 0 0 8px; }
.auth-lede { font-size: 14px; color: var(--body); margin: 0 0 24px; }
.auth-lede b { color: var(--ink); font-weight: 600; }
.auth-error { background: var(--bad-bg); color: var(--bad-ink); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 16px; }
.auth-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 16px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.auth-google:hover { background: var(--surface); }
.auth-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px;
}
.auth-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form button {
  width: 100%; padding: 10px 16px; margin-top: 2px;
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 14px;
}
.auth-form button:hover { filter: brightness(1.08); }
.auth-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- topbar user chip ---------- */
.user-menu { display: flex; align-items: center; gap: 8px; flex: none; margin-left: 12px; }
.user-menu img { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); display: block; }
.user-menu button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.user-menu button:hover { color: var(--ink); background: var(--surface); }

/* ---------- checklists ---------- */
.checklist { list-style: none; padding: 0; margin: 14px 0 26px; }
.checklist li { position: relative; padding: 5px 0 5px 32px; max-width: 780px; }
.checklist li::before {
  content: ""; position: absolute; left: 4px; top: 10px; width: 14px; height: 14px;
  border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--bg);
}
.checklist li.done::before { background: var(--ok-bg); border-color: var(--ok-ink); }
.checklist li.done::after {
  content: ""; position: absolute; left: 8px; top: 13.5px; width: 7px; height: 4px;
  border-left: 2px solid var(--ok-ink); border-bottom: 2px solid var(--ok-ink);
  transform: rotate(-45deg);
}
.checklist li.done { color: var(--muted); }
.checklist li.done b { color: inherit; }
.who {
  display: inline-block; border-radius: 999px; padding: 1px 8px; margin-right: 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; vertical-align: 1.5px;
}
.who.av { background: var(--av-bg); color: var(--av-ink); }
.who.bp { background: var(--bp-bg); color: var(--bp-ink); }
.who.os { background: var(--band-bg); color: var(--band-ink); }
.who.crit { background: var(--bad-bg); color: var(--bad-ink); }
.checklist li.done .who { opacity: 0.65; }
.who-legend { font-size: 12.5px; color: var(--muted); margin: 4px 0 20px; }
.who-legend .who { margin-right: 4px; vertical-align: 1px; }

/* ---------- live tasks ---------- */
.tasks { margin: 6px 0 30px; }
.tasks-progress { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; font-size: 13px; color: var(--muted); }
.tasks-progress .tp-overdue { color: var(--bad-ink); font-weight: 700; }
.tp-bar { flex: 1 1 auto; max-width: 260px; height: 6px; border-radius: 3px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.tp-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.25s ease; }
h3.tasks-group { margin-top: 30px; }
ul.tasklist { list-style: none; padding: 0; margin: 12px 0 20px; }
ul.tasklist li.task {
  position: relative; display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 0 5px 32px; max-width: 820px; border-radius: 8px;
}
ul.tasklist li.task:hover { background: var(--surface); }
ul.tasklist li.task.dragging { opacity: 0.45; }
.task .tick {
  position: absolute; left: 4px; top: 9px; width: 15px; height: 15px;
  border: 1.5px solid var(--border-strong); border-radius: 4px; background: var(--bg);
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.task.done .tick { background: var(--ok-bg); border-color: var(--ok-ink); }
.task.done .tick::after {
  content: ""; flex: none; width: 8px; height: 4.5px; margin-top: -2px;
  border-left: 2px solid var(--ok-ink); border-bottom: 2px solid var(--ok-ink);
  transform: rotate(-45deg);
}
.task .task-body { flex: 1 1 auto; min-width: 0; }
.task .task-title { white-space: pre-line; } /* keep Shift+Enter line breaks visible */
.task.done .task-body { color: var(--muted); }
.task.done .task-title { text-decoration: line-through; text-decoration-color: #797979; }
.task.done .who { opacity: 0.65; }
.task .due {
  display: inline-block; border: 1px dashed var(--border-strong); border-radius: 999px;
  background: none; cursor: pointer; padding: 0 8px; margin-left: 7px;
  font-size: 10.5px; font-weight: 650; color: var(--muted); vertical-align: 1.5px; white-space: nowrap;
}
.task .due.soon { background: var(--band-bg); color: var(--band-ink); border-color: transparent; border-style: solid; }
.task .due.overdue { background: var(--bad-bg); color: var(--bad-ink); border-color: transparent; border-style: solid; }
ul.tasklist li.task .due:empty { visibility: hidden; }
.task .task-created {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 650; color: var(--muted);
  margin-left: 7px; white-space: nowrap; vertical-align: 1.5px;
}
.task .task-created svg { width: 10px; height: 10px; flex: none; }
ul.tasklist li.task:not(:hover) .due:not(.soon):not(.overdue) { opacity: 0; }
ul.tasklist li.task[data-deadline]:not([data-deadline=""]):not(:hover) .due { opacity: 1; }
.task .task-actions {
  flex: none; display: flex; align-items: center; gap: 2px;
  opacity: 0; padding-top: 2px;
}
ul.tasklist li.task:hover .task-actions { opacity: 1; }
.task .tact {
  border: none; background: none; cursor: pointer; color: var(--muted);
  font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 5px;
}
.task .tact:hover { color: var(--ink); background: var(--border); }
.task .drag { cursor: grab; color: var(--border-strong); font-size: 12px; letter-spacing: -3px; padding: 3px 6px 3px 2px; user-select: none; }
.task .drag:hover { color: var(--muted); }
li.task-add { padding: 4px 0 4px 32px; max-width: 820px; }
li.task-add textarea {
  display: block; width: 100%; min-height: 66px; border: 1px dashed var(--border-strong); border-radius: 8px;
  background: none; color: var(--body); font: inherit; font-size: 13.5px; line-height: 1.5;
  padding: 8px 10px; resize: none; overflow: hidden;
}
li.task-add textarea:focus { outline: none; border-style: solid; border-color: var(--accent); }
li.task-add textarea::placeholder { color: var(--muted); opacity: 0.7; }
textarea.task-edit {
  display: block; width: 100%; max-width: 700px; min-height: 66px; border: 1px solid var(--accent); border-radius: 6px;
  background: var(--bg); color: var(--body); font: inherit; font-size: 14px; line-height: 1.5;
  padding: 8px; resize: none; overflow: hidden;
}
.task-pop {
  position: absolute; z-index: 60; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; box-shadow: 0 10px 28px rgba(10, 37, 64, 0.16);
  display: flex; align-items: center; gap: 8px;
}
.task-pop input[type="date"] { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--body); font: inherit; font-size: 13px; padding: 4px 8px; }
.task-pop .pop-clear { border: none; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.task-pop .pop-clear:hover { color: var(--bad-ink); }
.owners-pop { max-width: 320px; flex-wrap: wrap; }
.owners-pop .who { border: 1.5px solid transparent; cursor: pointer; opacity: 0.45; }
.owners-pop .who.on { opacity: 1; border-color: currentColor; }
.tasks[data-static="1"] .drag, .tasks[data-static="1"] .del-btn { display: none; }

/* ---------- project meta strip (responsible team + status) ---------- */
.proj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 28px; }
.proj-meta .meta-lbl {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin-left: 6px;
}
.proj-meta .meta-lbl:first-child { margin-left: 0; }
.team { display: inline-block; border-radius: 999px; padding: 2px 11px; font-size: 12px; font-weight: 650; }
.team.av { background: var(--av-bg); color: var(--av-ink); }
.team.bp { background: var(--bp-bg); color: var(--bp-ink); }
.pstatus {
  display: inline-block; border-radius: 999px; padding: 2px 11px; font-size: 12px; font-weight: 650;
  background: var(--surface); border: 1px solid var(--border); color: var(--body);
}

/* ---------- inline comments (comments.js) ---------- */
/* translucent tints hold on both light and dark grounds */
::highlight(dc-open) { background-color: rgba(255, 205, 60, 0.34); }
::highlight(dc-active) {
  background-color: rgba(255, 183, 20, 0.55);
  text-decoration: underline;
  text-decoration-color: rgba(200, 145, 0, 0.9);
  text-decoration-thickness: 2px;
}
::highlight(dc-resolved) { background-color: rgba(139, 152, 172, 0.26); }

@keyframes dc-in { from { opacity: 0; transform: translateY(5px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dc-chip-in { from { opacity: 0; transform: translateY(3px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes dc-slide-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

.dc-ic { display: inline-flex; align-items: center; }
.dc-ic svg { display: block; }

/* selection chip */
.dc-chip {
  position: absolute; z-index: 60; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 5px 13px 5px 11px; font: inherit; font-size: 12.5px; font-weight: 650;
  box-shadow: 0 1px 2px rgba(10, 37, 64, 0.18), 0 5px 16px rgba(10, 37, 64, 0.22);
  animation: dc-chip-in 0.14s ease-out;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.dc-chip:hover {
  background: var(--accent-hover); transform: translateY(-1px);
  box-shadow: 0 2px 3px rgba(10, 37, 64, 0.18), 0 8px 22px rgba(10, 37, 64, 0.26);
}
.dc-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* popover card (thread + composer) */
.dc-pop {
  position: absolute; z-index: 61; width: 380px; max-width: calc(100vw - 24px);
  background: var(--bg); color: var(--body);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px 14px; font-size: 13.5px; line-height: 1.55;
  box-shadow: 0 0 0 1px rgba(10, 37, 64, 0.03), 0 3px 8px rgba(10, 37, 64, 0.08), 0 18px 48px rgba(10, 37, 64, 0.18);
  animation: dc-in 0.16s ease-out;
}
.dc-pop-fixed { position: fixed; right: 348px; top: 76px; }

.dc-head { display: flex; align-items: center; gap: 4px; margin: 0 -4px 8px 0; }
.dc-head-title { font-size: 13px; font-weight: 650; color: var(--ink); margin-right: auto; }

.dc-iconbtn {
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: none; color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.dc-iconbtn:hover { background: var(--surface); color: var(--ink); }
.dc-iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dc-resolve:hover { background: var(--ok-bg); color: var(--ok-ink); }

.dc-band {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 10px; padding: 6px 11px; border-radius: 9px;
  background: var(--ok-bg); color: var(--ok-ink); font-size: 12px; font-weight: 600;
}
.dc-band .dc-mini { margin-left: auto; color: var(--ok-ink); padding: 0; }

.dc-detached {
  margin: 0 0 10px; padding: 6px 11px; border-radius: 9px;
  background: var(--band-bg); color: var(--band-ink); font-size: 12px; font-weight: 600;
}

.dc-quote {
  margin: 0 0 12px; padding: 5px 12px;
  border-left: 3px solid rgba(255, 196, 40, 0.95);
  background: var(--surface); border-radius: 0 8px 8px 0;
  color: var(--muted); font-size: 12.5px; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* messages */
.dc-msgs { max-height: 320px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.dc-msg { display: flex; gap: 10px; padding: 7px 0; }
.dc-ava { flex: none; width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.dc-ava-txt {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--av-bg); color: var(--av-ink); font-size: 10.5px; font-weight: 700;
}
.dc-ava-s { width: 16px; height: 16px; }
.dc-ava-s.dc-ava-txt { font-size: 7.5px; }
.dc-msg-col { min-width: 0; flex: 1; }
.dc-who { margin: 1px 0 2px; font-size: 11.5px; color: var(--muted); }
.dc-who b { color: var(--ink); font-weight: 650; font-size: 12.5px; }
.dc-body { margin: 0; white-space: pre-wrap; overflow-wrap: break-word; color: var(--body); }
.dc-body a { color: var(--accent); }

/* own-message tools: revealed on hover / focus; always visible on touch */
.dc-tools { margin: 3px 0 0; display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.dc-msg:hover .dc-tools, .dc-msg:focus-within .dc-tools, .dc-tools-confirm { opacity: 1; }
@media (hover: none) { .dc-tools { opacity: 1; } }
.dc-confirm-txt { font-size: 11.5px; color: var(--bad-ink); font-weight: 600; margin-right: 6px; }
.dc-mini {
  cursor: pointer; background: none; border: none; padding: 0 8px 0 0;
  color: var(--muted); font-size: 11.5px; font-weight: 550;
}
.dc-mini:hover { color: var(--accent); text-decoration: underline; }
.dc-mini-danger { color: var(--bad-ink); }
.dc-mini-danger:hover { color: var(--bad-ink); }

/* reply / composer input */
.dc-reply { display: flex; gap: 9px; align-items: flex-start; margin-top: 10px; }
.dc-reply-box {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 3px 3px 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dc-reply-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.13); }
.dc-ta {
  flex: 1; width: 100%; box-sizing: border-box; min-height: 30px; max-height: 320px; resize: none;
  background: transparent; color: var(--body); border: none; outline: none;
  padding: 5px 6px; font: inherit; font-size: 13px; line-height: 1.5;
}
.dc-send { width: 30px; height: 30px; border-radius: 10px; flex: none; background: var(--accent); color: #fff; }
.dc-send:hover { background: var(--accent-hover); color: #fff; }
.dc-send[disabled] { background: transparent; color: var(--border-strong); cursor: default; }

/* edit-in-place */
.dc-ta-edit {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  margin-top: 2px; min-height: 40px;
}
.dc-ta-edit:focus-visible { border-color: var(--accent); }
.dc-row { display: flex; gap: 8px; margin-top: 8px; }
.dc-btn {
  cursor: pointer; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); color: var(--body); padding: 5px 13px; font-size: 12.5px; font-weight: 650;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dc-btn:hover { background: var(--surface); }
.dc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dc-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dc-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.dc-btn[disabled] { opacity: 0.55; cursor: default; }

.dc-hint { margin: 8px 2px 0; font-size: 11px; color: var(--muted); }
.dc-err { color: var(--bad-ink); font-size: 12px; margin: 8px 0 0; }
.dc-composer { width: 520px; }
.dc-ta-lg { min-height: 160px; }

.dc-toast {
  position: fixed; z-index: 70; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(10, 37, 64, 0.25);
  animation: dc-in 0.16s ease-out;
}

/* topbar chip */
.dc-topchip {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; flex: none;
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; color: var(--body); margin-left: 10px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.dc-topchip:hover { border-color: var(--border-strong); background: var(--surface); color: var(--ink); }
.dc-topchip.on { border-color: var(--accent); background: var(--av-bg); color: var(--av-ink); }
.dc-topchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dc-topchip-n {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; padding: 0 6px; line-height: 16px; min-width: 16px; text-align: center;
}

/* drawer */
.dc-drawer {
  position: fixed; z-index: 59; top: 68px; right: 14px; bottom: 14px; width: 312px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(10, 37, 64, 0.03), 0 4px 10px rgba(10, 37, 64, 0.06), 0 18px 48px rgba(10, 37, 64, 0.16);
  display: flex; flex-direction: column; overflow: hidden;
}
.dc-drawer[hidden] { display: none; }
.dc-drawer:not([hidden]) { animation: dc-slide-in 0.18s ease-out; }
.dc-drawer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border);
  color: var(--ink); font-size: 13.5px;
}
.dc-drawer-head b { font-weight: 650; }
.dc-pill-n {
  background: var(--av-bg); color: var(--av-ink); border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 8px;
}
.dc-drawer-x { margin-left: auto; }
.dc-drawer-bar { padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dc-drawer-toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.dc-drawer-toggle input { accent-color: var(--accent); margin: 0; }
.dc-list { overflow-y: auto; padding: 12px 14px; flex: 1; }
.dc-group {
  margin: 14px 2px 7px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.dc-group:first-child { margin-top: 0; }
.dc-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin: 0 0 8px; font: inherit; color: var(--body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.dc-item:hover { border-color: var(--accent); box-shadow: 0 3px 10px rgba(10, 37, 64, 0.08); transform: translateY(-1px); }
.dc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dc-item-done { opacity: 0.6; }
.dc-item-quote {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 12.5px; font-style: italic; color: var(--body);
  border-left: 2px solid rgba(255, 196, 40, 0.9); padding-left: 8px;
}
.dc-item-done .dc-item-quote { border-left-color: var(--border-strong); }
.dc-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11px; color: var(--muted); }
.dc-empty { text-align: center; color: var(--muted); padding: 36px 14px; }
.dc-empty > .dc-ic {
  width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface); color: var(--muted); margin-bottom: 8px;
}
.dc-empty-title { margin: 0 0 3px; font-size: 13px; font-weight: 650; color: var(--ink); }
.dc-empty-sub { margin: 0; font-size: 12px; }

@media (max-width: 900px) {
  .dc-drawer { width: calc(100vw - 28px); }
  .dc-pop-fixed { right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-chip, .dc-pop, .dc-drawer:not([hidden]) { animation: none; }
  .dc-chip:hover, .dc-item:hover { transform: none; }
  .dc-chip, .dc-pop *, .dc-drawer *, .dc-topchip, .dc-iconbtn, .dc-item { transition: none; }
}

/* ---------- For me (personal inbox) ---------- */
.fm-nav {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 13px; margin-left: 10px;
  color: var(--body); text-decoration: none; font-size: 13px; font-weight: 500;
  white-space: nowrap;
}
.fm-nav:hover { color: var(--ink); background: var(--surface); }
.fm-nav.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.fm-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fm-pill {
  min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.fm-nav.on .fm-pill { background: var(--accent); }

.fm-shell { max-width: 860px; margin: 0 auto; padding: 96px 24px 120px; }
.fm-summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 26px; font-size: 13px; color: var(--muted);
}
.fm-summary b { color: var(--ink); }
.fm-summary .tp-overdue { color: var(--bad-ink); font-weight: 700; }
.fm-as { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-left: 4px; }

.fm-block { margin: 0 0 42px; }
.fm-block-title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 2px; font-size: 17px; letter-spacing: -0.01em;
}
.fm-block-n {
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; font-weight: 700;
}
.fm-block-blurb { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }

.fm-bucket {
  margin: 22px 0 8px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.fm-bucket-overdue { color: var(--bad-ink); }
.fm-bucket-this-week { color: var(--band-ink); }

.fm-proj { margin: 12px 0 2px; font-size: 12px; }
.fm-proj a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border); }
.fm-proj a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.fm-tasks .tasklist { margin-bottom: 4px; }
.fm-empty {
  text-align: center; color: var(--muted);
  padding: 40px 18px; border: 1px dashed var(--border-strong); border-radius: 12px;
}
.fm-empty-title { margin: 0 0 5px; font-size: 14px; font-weight: 650; color: var(--ink); }
.fm-empty-sub { margin: 0; font-size: 12.5px; line-height: 1.6; }
.fm-empty-sub code { font-size: 12px; }

/* Rows leave the inbox when ticked, rather than striking through in place. */
.fm-tasks li.task.fm-going {
  opacity: 0; transform: translateX(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.fm-undo {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 9px 10px 9px 18px; font-size: 13px;
  box-shadow: 0 10px 28px rgba(10, 37, 64, 0.22);
}
.fm-undo button {
  border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 650;
  background: var(--bg); color: var(--ink); padding: 5px 13px;
}
.fm-undo button:hover { background: var(--surface); }

@media (max-width: 700px) {
  .fm-shell { padding: 84px 16px 90px; }
  .fm-nav { padding: 5px 10px; margin-left: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-tasks li.task.fm-going { transition: none; }
}

.fm-block-head { display: block; }


/* ---------- @mentions ---------- */
.dc-mention {
  display: inline; padding: 0 3px; border-radius: 4px; font-weight: 600;
  background: var(--surface); color: var(--ink);
}
.dc-mention.av { background: var(--av-bg); color: var(--av-ink); }
.dc-mention.bp { background: var(--bp-bg); color: var(--bp-ink); }
.dc-mention.os { background: var(--band-bg); color: var(--band-ink); }
.dc-mention-me { outline: 1px solid currentColor; }

.dc-mention-menu {
  position: absolute; z-index: 80; min-width: 190px; max-width: 240px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 5px; box-shadow: 0 10px 28px rgba(10, 37, 64, 0.16);
  max-height: 240px; overflow-y: auto;
}
.dc-mention-opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 0; background: none; padding: 4px 6px; border-radius: 6px; font: inherit;
}
.dc-mention-opt.on, .dc-mention-opt:hover { background: var(--surface); }

/* ---------- For me: mentions block ---------- */
.fm-mentions { margin-top: 34px; }
.fm-cleared { color: var(--muted); }
.fm-mention {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.fm-mention:hover { border-color: var(--border-strong); }
.fm-mention-main { flex: 1 1 auto; min-width: 0; }
.fm-mention-quote {
  margin: 0 0 6px; font-size: 12.5px; font-style: italic; color: var(--body);
  border-left: 2px solid rgba(255, 196, 40, 0.9); padding-left: 8px;
}
.fm-mention-body { margin: 0 0 6px; font-size: 13.5px; color: var(--ink); line-height: 1.55; }
.fm-mention-meta { margin: 0; font-size: 11.5px; color: var(--muted); }
.fm-mention-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.fm-clear, .fm-open {
  border: 1px solid var(--border); background: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 7px; color: var(--muted);
  font-size: 13px; line-height: 1; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.fm-clear:hover { color: var(--ok-ink); border-color: var(--ok-ink); }
.fm-open:hover { color: var(--accent); border-color: var(--accent); }
.fm-clear:focus-visible, .fm-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fm-mention.fm-going { opacity: 0; transform: translateX(10px); transition: opacity 0.22s ease, transform 0.22s ease; }
.fm-mention-none { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.fm-jump { color: var(--accent); text-decoration: none; }
.fm-jump:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .fm-mention.fm-going { transition: none; }
}

/* The count pill flashes when it changes under you. */
@keyframes fm-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}
.fm-pill.fm-pulse { animation: fm-pulse 0.42s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .fm-pill.fm-pulse { animation: none; }
}
