/* AnswerHog app. Tokens and rules: docs/DESIGN.md. Shares its look with the website (site/DESIGN.md):
   Instrument Sans, blueberry, ink pill buttons, mist panels and hairlines. */
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/vendor/instrument-sans-latin.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("/vendor/instrument-sans-latin-italic.woff2") format("woff2"); }
:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --surface-3: #ececf0;
  --ink: #111114;
  --ink-2: #55555f;
  --ink-3: #666670;
  --line: #e6e6eb;
  --line-2: #d4d4dc;
  --neutral-bar: #cfcfd7;
  --ring: rgba(17, 17, 20, 0.10);
  --accent: #1f5bff;
  --accent-ink: #ffffff;
  --accent-soft: #e8eeff;
  --raised: #ffffff;
  --btn: #111114;
  --btn-ink: #ffffff;
  --good: #0ca30c; --good-ink: #006300; --good-soft: #e3f4e3;
  --warn: #fab219; --warn-ink: #8a5a00; --warn-soft: #fdf2d8;
  --serious: #ec835a; --serious-soft: #fbe7de;
  --crit: #d03b3b; --crit-ink: #b02a2a; --crit-soft: #fae3e3;
  --s1: #1f5bff; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #e6e6eb; --axis: #c9c9d1;
  --shadow: none;
  --shadow-lift: 0 1px 2px rgba(17, 17, 20, .06);
  --shadow-pop: 0 1px 2px rgba(17, 17, 20, .05), 0 16px 40px -12px rgba(17, 17, 20, .22);
  --radius: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f0f12; --surface: #0f0f12; --surface-2: #18181d; --surface-3: #222229; --neutral-bar: #4a4a55;
    --ink: #f3f3f6; --ink-2: #b6b6c2; --ink-3: #8f8f9b; --line: #2a2a32; --line-2: #3a3a44; --ring: rgba(255,255,255,0.10);
    --accent: #7c9cff; --accent-ink: #0f0f12; --accent-soft: #1b2347; --raised: #26262d; --btn: #f3f3f6; --btn-ink: #0f0f12;
    --good-ink: #0ca30c; --good-soft: #13261a; --warn-ink: #fab219; --warn-soft: #2e2510; --serious-soft: #2f1d15; --crit-ink: #e66767; --crit-soft: #301818;
    --s1: #7c9cff; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #b07cf0; --s8: #e66767;
    --grid: #2a2a32; --axis: #3a3a44; --shadow: none; --shadow-lift: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f12; --surface: #0f0f12; --surface-2: #18181d; --surface-3: #222229; --neutral-bar: #4a4a55;
  --ink: #f3f3f6; --ink-2: #b6b6c2; --ink-3: #8f8f9b; --line: #2a2a32; --line-2: #3a3a44; --ring: rgba(255,255,255,0.10);
  --accent: #7c9cff; --accent-ink: #0f0f12; --accent-soft: #1b2347; --raised: #26262d; --btn: #f3f3f6; --btn-ink: #0f0f12;
  --good-ink: #0ca30c; --good-soft: #13261a; --warn-ink: #fab219; --warn-soft: #2e2510; --serious-soft: #2f1d15; --crit-ink: #e66767; --crit-soft: #301818;
  --s1: #7c9cff; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #b07cf0; --s8: #e66767;
  --grid: #2a2a32; --axis: #3a3a44; --shadow: none; --shadow-lift: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; caret-color: var(--accent); }
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 13px; color: var(--ink-2); letter-spacing: 0; }
p { margin: 0 0 8px; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 0; border-radius: 10px; padding: 12px; margin: 0; max-height: 520px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface-2); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 30px; height: 30px; display: block; flex: none; border-radius: 9px; overflow: hidden; background: var(--accent-soft); }
.nav-label { font-size: 13px; font-weight: 550; color: var(--ink-3); padding: 18px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 9px; color: var(--ink-2); cursor: pointer; font-size: 14px; text-decoration: none !important; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-lift); }
.nav-item.muted-item { color: var(--ink-3); }
.nav-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nav-item .pill { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); padding: 16px 36px 0; }
.topbar-row { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.topbar .sub { color: var(--ink-3); font-size: 13px; }
.tabs { display: flex; gap: 2px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--ink-2); cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.content { padding: 28px 36px 72px; max-width: 1200px; }
.subnav { display: flex; gap: 4px; margin: -6px 0 18px; flex-wrap: wrap; }
.subnav a { padding: 5px 12px; border-radius: 99px; font-size: 13px; color: var(--ink-2); text-decoration: none !important; border: 1px solid transparent; }
.subnav a:hover { background: var(--surface-2); color: var(--ink); }
.subnav a.on { background: var(--surface-3); border-color: transparent; color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }

/* ---------- primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.card.flush { padding: 0; }
.card-foot { margin-top: 16px; }
.card + .card { margin-top: 0; }
.card-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.card-h h3 { font-size: 16px; font-weight: 600; }
.card-h .hint { color: var(--ink-3); font-size: 13px; }
.grid { display: grid; gap: 24px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 650; }
.right { text-align: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mt { margin-top: 14px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 14px; }

button, .btn { font: inherit; font-size: 14px; font-weight: 550; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 6px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.35; white-space: nowrap; text-decoration: none !important; transition: background-color .15s, border-color .15s, opacity .15s, transform .15s var(--ease); }
button:hover, .btn:hover { background: var(--surface-3); border-color: var(--line-2); }
button:active:not(:disabled), .btn:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--btn); border-color: var(--btn); opacity: .86; }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
button.danger { color: var(--crit-ink); }
button.sm, .btn.sm { padding: 3px 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.link:active { transform: none; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 11px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field .flabel { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.field .help { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid transparent; white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); border-color: transparent; }
.badge.serious { background: var(--serious-soft); color: var(--crit-ink); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.solid { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 550; color: var(--ink-3); font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- KPI tiles ---------- */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpi .label { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; margin-top: 4px; line-height: 1.1; }
.kpi .value .unit { font-size: 16px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.kpi .foot { font-size: 12px; color: var(--ink-3); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--good-ink); } .delta.down { color: var(--crit-ink); } .delta.flat { color: var(--ink-3); }

/* ---------- bars ---------- */
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 54px; gap: 10px; align-items: center; font-size: 13px; position: relative; }
.barrow .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.barrow .track { height: 10px; border-radius: 0 4px 4px 0; position: relative; }
.barrow .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.barrow .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.barrow:hover .lbl { text-decoration: underline; }
.stackbar { display: flex; height: 16px; gap: 2px; border-radius: 4px; overflow: hidden; }
.stackbar > div { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-pop); white-space: nowrap; z-index: 5; }
.chart .tip .k { color: var(--ink-3); }
.axis-text { fill: var(--ink-3); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }
.callout { border: 1px solid transparent; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); }
.callout.info { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.callout.crit { background: var(--crit-soft); border-color: transparent; color: var(--ink); }
.callout.good { background: var(--good-soft); border-color: transparent; color: var(--ink); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--btn); color: var(--btn-ink); padding: 10px 16px; border-radius: 12px; font-weight: 550; font-size: 13px; box-shadow: var(--shadow-pop); max-width: 420px; }
.toast.err { background: var(--crit); color: #fff; }
.drawer-bg { position: fixed; inset: 0; background: rgba(17,17,20,.28); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(820px, 96vw); height: 100%; background: var(--page); overflow-y: auto; padding: 20px 24px 40px; box-shadow: var(--shadow-pop); border-left: 1px solid var(--line); }
/* The panel itself takes focus when it opens so Escape and Tab work; it needs no ring of its own. */
.drawer:focus, .modal:focus { outline: none; }
.modal-bg { position: fixed; inset: 0; background: rgba(17,17,20,.32); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--page); border: 1px solid var(--line); border-radius: 16px; width: min(720px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px 24px; box-shadow: var(--shadow-pop); }
.answer { white-space: pre-wrap; line-height: 1.6; font-size: 14px; background: var(--surface-2); border: 0; border-radius: 12px; padding: 16px 18px; max-height: 560px; overflow: auto; }
mark.b { background: color-mix(in srgb, var(--s1) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; font-weight: 650; }
mark.c { background: color-mix(in srgb, var(--s2) 20%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kcol h4 { padding: 2px 4px 10px; display: flex; gap: 6px; }
.kcard { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.kcard:hover { border-color: var(--line-2); }
.kcard .t { font-weight: 600; font-size: 14px; line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid transparent; border-radius: 99px; padding: 2px 4px 2px 9px; font-size: 13px; }
.chip button { border: 0; background: none; padding: 0 4px; color: var(--ink-3); font-size: 14px; border-radius: 99px; }
.chip button:hover { background: var(--surface-3); color: var(--ink); }
.scorebig { font-size: 44px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; width: fit-content; max-width: 100%; overflow-x: auto; flex: none; scrollbar-width: none; }
.seg button { border: 0; padding: 4px 12px; font-size: 13px; font-weight: 500; background: transparent; color: var(--ink-2); }
.seg button:hover { background: var(--surface-3); color: var(--ink); }
.seg button.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-lift); }
.seg button:active { transform: none; }
.dropdown { position: relative; display: inline-block; }
.dropdown > button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dropdown > button .icon { color: var(--ink-3); margin-right: -4px; }
.dropdown .menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 14px; min-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.dropdown .menu.right { left: auto; right: 0; }
.dropdown .menu .mlabel { font-size: 12px; color: var(--ink-3); margin-bottom: 5px; }
details.more > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; padding: 6px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 6px; height: 6px; margin: 0 3px 0 1px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); }
details.more[open] > summary::before { transform: rotate(45deg); margin-top: -3px; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.step::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.step.done::before { content: ""; background: var(--good-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 8.5l2.6 2.6L12 5.5' fill='none' stroke='%230ca30c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 14px no-repeat; }
.prose { max-width: 820px; line-height: 1.65; }
.prose h2 { margin: 26px 0 8px; } .prose h3 { margin: 18px 0 6px; }
.prose ul { padding-left: 20px; margin: 6px 0 10px; } .prose li { margin: 3px 0; }
.bookmarklet { display: inline-block; padding: 8px 16px; border-radius: 999px; background: var(--btn); color: var(--btn-ink) !important; font-weight: 600; cursor: grab; text-decoration: none !important; }

/* ---------- design system pieces (docs/DESIGN.md) ---------- */
.icon { flex: none; vertical-align: -3px; }
.icon-btn { padding: 6px; border-radius: 999px; }
.delta { display: inline-flex; align-items: center; gap: 1px; }
.delta .icon { vertical-align: 0; }
.section { min-width: 0; }
.section-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-h h2 { font-size: 16px; font-weight: 600; }
.section-h .hint { color: var(--ink-3); font-size: 13px; }
.panel-h { display: flex; align-items: flex-start; gap: 12px; }
.panel-h h2 { flex: 1; }

/* sidebar: brand switcher on top, then the current brand's areas */
.switcher { position: relative; margin: 2px 0 10px; }
.switcher > button { width: 100%; justify-content: space-between; background: var(--raised); border-color: var(--line); border-radius: 12px; padding: 6px 10px 6px 6px; font-weight: 600; box-shadow: var(--shadow-lift); }
.switcher > button:hover { background: var(--raised); border-color: var(--line-2); }
.switcher > button:active { transform: none; }
.switcher > button .icon { color: var(--ink-3); }
.switcher > button .sw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 9px; min-width: 0; }
.switcher .menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; gap: 1px; max-height: 60vh; overflow-y: auto; }
.switcher .menu a { display: flex; align-items: center; gap: 9px; padding: 5px 8px; min-height: 34px; border-radius: 9px; color: var(--ink); font-size: 14px; text-decoration: none !important; }
.switcher .menu a > .icon { margin: 0 4px; color: var(--ink-2); }
.switcher .sw-all { width: 26px; height: 26px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.switcher .menu a:hover, .switcher .menu a.on { background: var(--surface-2); }
.switcher .menu a.on { font-weight: 600; }
.switcher .menu .sep { height: 1px; background: var(--line); margin: 4px 2px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
/* A brand's Hugs: a small face on a tile tinted with its colour (--hug). Still, unless it's busy. */
.hug-av { display: block; flex: none; overflow: hidden; border-radius: 30%; background: color-mix(in srgb, var(--hug, var(--accent)) 16%, var(--raised)); }
.hug-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.hug-pick button { padding: 4px; border-radius: 14px; background: transparent; border: 2px solid transparent; }
.hug-pick button:hover { background: var(--surface-2); border-color: transparent; }
.hug-pick button[aria-pressed="true"] { border-color: var(--ink); background: transparent; }
.brand-settings { display: flex; align-items: center; gap: 6px; }


/* ---------- glance: status, actions, home, hero ---------- */
.link-sm { font-size: 13px; color: var(--ink-2); }
.link-sm:hover { color: var(--accent); }
.checked { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.controls { gap: 10px; }
.ok-ink { color: var(--good-ink); } .warn-ink { color: var(--warn-ink); } .crit-ink { color: var(--crit-ink); }
.sub-label { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
ul.tight { margin: 6px 0 0; padding-left: 18px; } ul.tight li { margin: 3px 0; }
.chip.plain { padding: 3px 10px; }

/* status: a dot plus a word, never colour alone */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 3px 10px 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status.s-good { background: var(--good-soft); color: var(--good-ink); } .status.s-good i { background: var(--good); }
.status.s-warn { background: var(--warn-soft); color: var(--warn-ink); } .status.s-warn i { background: var(--warn); }
.status.s-crit { background: var(--crit-soft); color: var(--crit-ink); } .status.s-crit i { background: var(--crit); }

/* "Do next": one line of what, one of why, one button */
.actions { list-style: none; margin: 0; padding: 0; }
.actions li { display: flex; align-items: center; gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.actions li:first-child { border-top: 0; padding-top: 0; }
.actions li:last-child { padding-bottom: 0; }
.card.flush .actions li, .card.flush .actions li:first-child, .card.flush .actions li:last-child { padding: 18px 24px; }
.a-body { flex: 1; min-width: 0; }
.a-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.a-why { color: var(--ink-2); font-size: 13px; margin-top: 3px; line-height: 1.45; }
.a-brand { color: var(--ink); font-weight: 550; }
.a-cta { flex: none; }
.actions-empty { color: var(--ink-3); }
.card.flush .actions-empty { padding: 22px 24px; }

/* Home */
.home { display: flex; flex-direction: column; gap: 36px; max-width: 1040px; }
.home-head h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.home-head p { margin: 8px 0 0; }
.home-head .checked { font-size: 14px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.sec-h h2 { font-size: 16px; font-weight: 600; letter-spacing: 0; }
.sec-h .hint { color: var(--ink-3); font-size: 13px; }
.note { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); font-size: 14px; }
.brows { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: minmax(0, 1fr) 132px 116px 124px 72px 64px; align-items: center; gap: 16px; padding: 18px 24px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.brow:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.brow:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.brow:only-child { border-radius: var(--radius); }
a.brow:hover { background: var(--surface-2); }
a.brow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.brow.static { grid-template-columns: minmax(0, 1fr) auto; }
.b-name { display: flex; align-items: center; gap: 14px; min-width: 0; }
.b-text { min-width: 0; }
.b-name .nm { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-name .b-next { color: var(--ink-2); font-weight: 550; }
.b-name .why { color: var(--ink-3); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-num { white-space: nowrap; }
.b-num .v { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.b-trend svg { display: block; }
.b-meta { font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }

/* Brand overview hero: one big number, three quiet figures */
.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 36px; padding: 28px 32px; }
.hero.start { display: block; }
.hero-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.hero-label { margin-top: 24px; font-size: 14px; color: var(--ink-2); }
.hero-num { display: flex; align-items: baseline; gap: 14px; margin-top: 4px; }
.hero-num > span { font-size: 56px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.hero-num small { font-size: 24px; color: var(--ink-3); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.hero-num .delta { font-size: 14px; }
.hero-line { margin: 12px 0 0; font-size: 16px; color: var(--ink-2); }
.hero-line.big { font-size: 20px; line-height: 1.35; color: var(--ink); font-weight: 600; margin-top: 16px; }
.hero-trend { margin-top: 20px; }
.hero-trend svg { width: 100%; max-width: 440px; height: auto; display: block; }
.hero-side { margin: 0; display: flex; flex-direction: column; justify-content: center; gap: 22px; border-left: 1px solid var(--line); padding-left: 32px; }
.fig dt { font-size: 13px; color: var(--ink-2); }
.fig dd { margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.fig dd small { font-size: 14px; color: var(--ink-3); font-weight: 500; margin-left: 1px; }
.fig dd .delta { font-size: 13px; letter-spacing: 0; }
.fig-empty { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* questions you're missing */
.qlist { display: flex; flex-direction: column; }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; align-items: start; }
.qrow:first-child { border-top: 0; padding-top: 0; }
.qrow:last-child { padding-bottom: 0; }
.qrow:hover .q { text-decoration: underline; }
.qrow .q { line-height: 1.45; }
.qrow .who { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.qrow .qv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* trust: sources, review, fact checks */
.hero-source { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.hero-source .checked { font-size: 13px; }
.hero-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; background: var(--surface-2); max-width: 560px; }
.hero-note.warn { background: var(--warn-soft); color: var(--ink); }
.hero-num small { font-size: 24px; }
.b-num small { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.b-den { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.fact-check { margin-top: 10px; line-height: 1.45; }
.fact-check .badge { margin-right: 4px; }
.review-item { padding: 20px 24px; }
.ri-q { font-weight: 600; font-size: 16px; line-height: 1.4; }
.ri-meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.ri-why { margin: 12px 0 0; font-size: 14px; }
.ri-hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.ri-excerpt { margin-top: 12px; padding: 12px 14px; border-left: 2px solid var(--line-2); background: var(--surface-2); border-radius: 0 10px 10px 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; }

/* work: one status ladder, question → brief → published → re-checked */
.stage { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.stage.t-info { background: var(--accent-soft); color: var(--accent); }
.stage.t-good { background: var(--good-soft); color: var(--good-ink); }
.stage.t-warn { background: var(--warn-soft); color: var(--warn-ink); }
.stage.t-crit { background: var(--crit-soft); color: var(--crit-ink); }
.stage .stage-d { font-weight: 500; }
a.stage-link { text-decoration: none !important; }
a.stage-link:hover .stage { filter: brightness(0.96); }
.qrow .qa { margin-top: 8px; }
.journey { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.journey li { position: relative; padding: 0 0 18px 28px; }
.journey li::before { content: ''; position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); }
.journey li::after { content: ''; position: absolute; left: 7px; top: 19px; bottom: 2px; width: 2px; background: var(--line); }
.journey li:last-child::after { display: none; }
.journey li.done::before { border-color: var(--good); background: var(--good); }
.journey .j-h { font-weight: 600; font-size: 14px; margin-bottom: 4px; }

/* ideas library */
.ideas { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ideas li { display: flex; gap: 24px; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid var(--line); }
.i-body { flex: 1; min-width: 0; }
.i-title { font-weight: 600; font-size: 14px; }
.i-meta { font-size: 13px; color: var(--ink-3); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.i-detail { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); max-width: 760px; cursor: pointer; line-height: 1.5; }
.i-cta { flex: none; padding-top: 2px; }
.tabs-spacer { height: 12px; }

/* phase 4: where you stand, the recommended step, the question panel, the plan list */
.standing { display: flex; flex-direction: column; gap: 10px; }
.st-line { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.25; margin: 4px 0 0; }
.st-pct { color: var(--ink-2); font-weight: 500; }
.st-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
.st-meta .checked { font-size: 13px; color: var(--ink-2); }
.st-note { margin: 0; font-size: 13px; color: var(--ink-2); }
.st-figs { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 12px 40px; padding-top: 14px; border-top: 1px solid var(--line); }
.st-figs .fig dd { font-size: 20px; }
.st-figs .fig dd .muted { font-size: 14px; font-weight: 500; }
.decision { border-color: transparent; background: var(--accent-soft); }
.decision .ds-more { border-top-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.ds-label { font-size: 13px; font-weight: 600; color: var(--accent); }
.ds-title { font-size: 20px; line-height: 1.3; margin: 6px 0 0; }
.ds-why { margin: 6px 0 16px; color: var(--ink-2); max-width: 720px; }
.ds-more { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
a.qlink { color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.qpanel section { display: flex; flex-direction: column; gap: 8px; }
.qp-meta { font-size: 13px; color: var(--ink-3); margin-top: -12px; }
.qp-h { font-size: 14px; font-weight: 600; margin: 0; }
.qp-tiers { display: flex; flex-wrap: wrap; gap: 12px; }
.qp-tier { background: var(--surface-2); border: 0; border-radius: 12px; padding: 12px 16px; min-width: 150px; }
.qp-t { font-size: 13px; color: var(--ink-2); }
.qp-v { font-size: 20px; font-weight: 650; margin-top: 2px; }
.chip.you { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.qp-answers { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.qp-answers li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.qp-answers li.left-out { opacity: .7; }
.qp-answers .row { gap: 10px; }
.qp-excerpt { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* action plan list: rows on the page, not cards */
.plan { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plan li { display: flex; gap: 24px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.p-body { flex: 1; min-width: 0; }
a.p-title { font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; line-height: 1.4; }
a.p-title:hover { color: var(--accent); text-decoration: none; }
.p-why { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); max-width: 760px; line-height: 1.5; }
.p-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.p-side { flex: none; display: flex; align-items: center; gap: 10px; padding-top: 1px; }
@media (max-width: 560px) { .plan li, .ideas li { flex-direction: column; gap: 10px; } }

/* phase 5: tables on the page, views, grouped rows */
table.t.on-page th { background: var(--page); }
table.t.on-page { border-top: 1px solid var(--line); }
table.t tr.paused td { opacity: .55; }
table.t .group-row td { background: var(--surface-2); font-weight: 600; font-size: 13px; padding-top: 7px; padding-bottom: 7px; }
.q-cell { max-width: 520px; }
.brands-cell { max-width: 240px; }
.nowrap { white-space: nowrap; }
.seg-n { color: var(--ink-3); font-weight: 500; margin-left: 2px; font-variant-numeric: tabular-nums; }
.seg button.on .seg-n { color: inherit; opacity: .8; }

.run-facts { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }

/* add answers from apps: a guided flow */
.app-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.app-pick button { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; min-width: 150px; background: var(--surface); border-radius: 12px; }
.app-pick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.app-pick .ap-name { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.app-pick .ap-n { font-size: 12px; color: var(--ink-3); }
.app-pick button.on .ap-n { color: var(--accent); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.meter > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.capture-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.capture-list li { border-bottom: 1px solid var(--line); padding: 12px 0; }
.cl-row { display: flex; gap: 16px; align-items: center; }
.cl-q { flex: 1; min-width: 0; font-size: 14px; line-height: 1.45; }
.cl-actions { flex: none; display: flex; gap: 8px; align-items: center; }
.paste-form { margin-top: 12px; padding: 16px; background: var(--surface-2); border: 0; border-radius: 12px; }
@media (max-width: 560px) { .cl-row { flex-direction: column; align-items: flex-start; } .cl-actions { flex-wrap: wrap; } }

@media (max-width: 1180px) {
  .brow { grid-template-columns: minmax(0, 1fr) 132px 116px 72px 64px; }
  .b-trend { display: none; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; flex-direction: row; flex-wrap: wrap; gap: 20px 36px; justify-content: flex-start; }
  .brow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .b-trend, .b-meta { display: none; }
}
@media (max-width: 560px) {
  .home { gap: 28px; }
  .home-head h1 { font-size: 24px; }
  .brow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; padding: 16px; }
  .b-status { grid-column: 1; grid-row: 2; }
  .b-num { grid-column: 2; grid-row: 1 / span 2; }
  .actions li { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card.flush .actions li, .card.flush .actions li:first-child, .card.flush .actions li:last-child { padding: 16px; }
  .hero { padding: 22px 20px; }
  .hero-num > span { font-size: 48px; }
  .note { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 1100px) { .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; } .stat:nth-child(3) { padding-left: 0; border-left: 0; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .nav-label, .side-foot { display: none; } .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .g2, .g3, .g4, .g6, .kanban { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .side { align-items: center; gap: 8px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 0 4px 0 0; }
  .side .switcher { flex: 1; min-width: 0; margin: 0; }
  .side .nav-group { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; gap: 4px; }
  .side .nav-group .nav-item { white-space: nowrap; }
  .topbar-row { flex-wrap: wrap; row-gap: 2px; }
}

/* Getting started (public/ui/start.js): Hugs at the top, then four numbered steps on a line. The step
   you're on is open with its work right there; finished steps fold to one line. */
.onb { max-width: 860px; }
.onb-head { display: flex; gap: 24px; align-items: center; margin-bottom: 32px; }
.onb-hug { width: 112px; height: 112px; flex: none; }
.onb-head h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 0; }
.onb-head p { margin: 8px 0 0; max-width: 58ch; }
.onb-steps { list-style: none; margin: 0; padding: 0; }
.onb-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; position: relative; padding-bottom: 24px; }
.onb-step::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; border-radius: 2px; background: var(--line); }
.onb-step:last-child::before { display: none; }
.onb-step.done::before { background: var(--good-soft); }
.onb-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 14px; background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); transition: background-color .2s, box-shadow .2s; }
.onb-step.open .onb-dot { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 0 0 5px var(--accent-soft); }
.onb-step.done .onb-dot { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.onb-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-height: 36px; padding-top: 6px; }
.onb-title h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.onb-step:not(.open):not(.done) .onb-title h2 { color: var(--ink-3); }
.onb-sum { font-size: 13px; color: var(--ink-3); }
.onb-sum a { margin-left: 6px; }
.onb-why { margin: 0 0 12px; max-width: 64ch; }
.onb-work { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.onb-work > .stack > .card { border: 0; padding: 0; background: none; }
@media (max-width: 640px) {
  .onb-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .onb-hug { width: 84px; height: 84px; }
  .onb-head h1 { font-size: 24px; }
  .onb-step { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
  .onb-dot { width: 30px; height: 30px; font-size: 13px; }
  .onb-step::before { left: 14px; top: 34px; }
  .onb-work { padding: 14px; }
}
