/* Critical CSS (reviewers' #17): the rules the first paint needs — tokens, base type, shell,
   sidebar/nav, main, footer, skip link, phone breakpoints, and the Ask-page hero. Everything else
   (brand.css/app.css) is preloaded in base.html and swapped in by app.js once the parser is done;
   no-JS users get them via <noscript>. Excerpts are VERBATIM from brand.css/app.css (same commit);
   keep the :root tokens in sync with brand.css when they change. The post-deploy visual check is
   the guard: hero + sidebar + nav on desktop and phone widths, font swap, dark theme, tiles. */
:root {
  --bg: #f2f4f0;
  --surface: #ffffff;
  --surface-2: #ecefe9;
  --line: #dfe5dc;
  --ink: #12211a;
  --muted: #5c6e63;
  --brand: #047857;          /* emerald: primary actions */
  --brand-ink: #ffffff;
  --brand-soft: #e2f5ec;
  --brand-deep: #0f3527;     /* deep green: hero accents */
  --mint: #ddf5ea;           /* soft mint: tinted surfaces */
  --navy: #0a2540;           /* sidebar, headings accents */
  --navy-ink: #e8eef8;
  --navy-muted: #9fb0c8;
  --accent: #b45309;         /* amber: steps, highlights */
  --accent-soft: #fdf3e2;
  --good: #047857;   --good-soft: #e3f5ec;
  --bad: #c2352b;    --bad-soft: #fdecea;
  --warn: #b45309;   --warn-soft: #fdf3e2;
  --info: #1d4ed8;   --info-soft: #e8efff;
  --chart-a: #f59e0b;
  --chart-b: #047857;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 1px 2px rgba(18, 33, 26, .05), 0 8px 28px rgba(18, 33, 26, .07);
  --shadow-soft: 0 1px 2px rgba(18, 33, 26, .04), 0 4px 14px rgba(18, 33, 26, .05);
  --display: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  --sans: "Figtree", Inter, "SF Pro Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1210;
  --surface: #131b16;
  --surface-2: #1a241e;
  --line: #26332b;
  --ink: #e9f0ea;
  --muted: #9db3a4;
  --brand: #34d399;
  --brand-ink: #04241a;
  --brand-soft: #0f2e27;
  --brand-deep: #0f3527;
  --mint: #122b1f;
  --navy: #070d19;
  --navy-ink: #e7edf7;
  --navy-muted: #7f90ad;
  --accent: #fbbf24;
  --accent-soft: #2b2310;
  --good: #34d399;   --good-soft: #0f2e27;
  --bad: #f87171;    --bad-soft: #3a1717;
  --warn: #fbbf24;   --warn-soft: #2b2310;
  --info: #93b4ff;   --info-soft: #17254a;
  --chart-a: #fbbf24;
  --chart-b: #34d399;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 28px rgba(0, 0, 0, .3);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .22);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 800; letter-spacing: -.03em; } h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); } h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-underline-offset: 2px; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
pre { background: var(--surface-2); padding: 14px 16px; border-radius: 10px; overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); }
.num, td, .rp-dl dd, .fw-step, .money input, input[type=number] { font-variant-numeric: tabular-nums; }
/* ---- brand lockup ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img, .brand svg { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--display); font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: 600 .95rem var(--sans);
  cursor: pointer; text-decoration: none; transition: filter .12s, background .12s, transform .12s;
  box-shadow: 0 1px 2px rgba(18, 33, 26, .08);
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--muted); filter: none; }
.btn.quiet { background: transparent; color: var(--muted); border-color: transparent; box-shadow: none; }
.btn.quiet:hover { color: var(--ink); background: var(--surface-2); filter: none; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.small { padding: 7px 14px; font-size: .86rem; border-radius: 999px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow-soft); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 .72rem var(--sans); letter-spacing: .01em; vertical-align: middle; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-soft); }
.pill.bad  { color: var(--bad);  background: var(--bad-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.info { color: var(--info); background: var(--info-soft); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: var(--navy-ink); display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; align-self: start;
  position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand-name { color: #fff; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav .grp { font: 600 .68rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--navy-muted); padding: 14px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; color: var(--navy-muted);
  text-decoration: none; font-weight: 500; font-size: .93rem; }
.side-nav a svg { width: 18px; height: 18px; flex: none; }
/* Icons read thin at small sizes: one notch heavier stroke on nav, tiles and buttons.
   (CSS beats the stroke-width="1.8" presentation attribute on the shared icon macro.) */
.side-nav a svg, .tile-ic svg, .side-btn svg, .iconbtn svg { stroke-width: 2; }
.side-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side-nav a[aria-current="page"] { color: #fff; background: rgba(52, 211, 153, .14); box-shadow: inset 3px 0 0 #34d399; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #34d399; color: #04241a; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .who-name { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.3; }
.side-foot .who-name strong { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who-name span { color: var(--navy-muted); font-size: .78rem; }
.side-foot form { margin: 0; }
.side-btn { border: 1px solid rgba(255, 255, 255, .12); background: transparent; color: var(--navy-muted); border-radius: 9px; width: 34px; height: 34px;
  cursor: pointer; display: grid; place-items: center; }
.side-btn:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.side-btn svg { width: 16px; height: 16px; }
.content { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; }
  .side-nav { order: 3; flex: 1 0 100%; min-width: 0; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 32px), transparent 100%); }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .grp { display: none; }
  .side-nav a { flex: none; padding: 8px 14px; font-size: .88rem; min-height: 44px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1); }
  .side-nav a[aria-current="page"] { box-shadow: none; background: rgba(52, 211, 153, .16); border-color: rgba(52, 211, 153, .35); }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .avatar, .side-foot .who-name > span { display: none; }
}
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 32px 72px; }
.page-head { margin-bottom: 28px; }
.page-head h1 { margin-bottom: .2em; }
.page-head p { color: var(--muted); max-width: 64ch; margin: 0; }
footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; padding: 28px 32px 32px; }
footer a { color: inherit; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 6px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.warn-text { color: var(--warn); }
footer p { margin: 0; }
@media (max-width: 640px) { main { padding: 26px 16px 56px; } .flash { padding: 0 16px; } footer { padding: 22px 16px; } .card { padding: 20px 18px; } h1 { font-size: 1.6rem; }
  .dash-hero { padding: 26px 20px; } .hero-actions .btn { width: 100%; } .tiles { grid-template-columns: 1fr; } }
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: stretch; padding: 44px 44px 40px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0a2540 0%, #0d3a34 58%, #0f5c46 100%); color: #e8eef8; margin-bottom: 28px; box-shadow: var(--shadow); }
.dash-hero h1 { font-family: var(--display); color: #fff; font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; margin: 6px 0 14px; }
.dash-hero p { color: #c3d2e4; margin: 0; max-width: 58ch; font-size: 1.06rem; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.hero-actions .btn { background: #34d399; border-color: #34d399; color: #04241a; }
.hero-actions .btn:hover { filter: brightness(1.06); }
.hero-actions .hero-link { color: #a7f3d0; font-weight: 600; text-decoration: none; }
.hero-actions .hero-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.eyebrow { font: 700 .74rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: #6ee7b7; }
/* The model panel hugs its content and sits centred against the hero text, instead of
   stretching the full hero height with the "Change" link pinned to the bottom and a void
   in the middle. The label is a <strong> (not <code>), so the old code rule was dead. */
.dash-model { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; padding: 20px 22px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; justify-content: center; align-self: center; }
.dash-model strong { color: #fff; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.dash-model a { color: #6ee7b7; }
.dash-model .warn-text { color: #fcd34d; }
@media (max-width: 800px) { .dash-hero { grid-template-columns: 1fr; padding: 30px 24px; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 32px; }
.tile { display: flex; flex-direction: column; gap: 3px; padding: 20px 20px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-soft); transition: border-color .15s, transform .15s, box-shadow .15s; }
.tile:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-ic { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 10px; }
.tile-ic svg { width: 22px; height: 22px; }
.tile-k { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.tile-v { font-family: var(--display); font-size: 1.18rem; font-weight: 700; letter-spacing: -.01em; }
.tile-s { font-size: .86rem; color: var(--brand); }
