/* ────────────────────────────────────────────────────────────
   felix — Coral's operator portal, in Coral's own design language.
   Doto (display) · Space Grotesk (body) · Space Mono (labels, numbers)
   ──────────────────────────────────────────────────────────── */

/* ─── Colour ───────────────────────────────────────────────────────────────
   The two palettes are Coral's, value for value: web/src/index.css, light on
   `:root` (so an unthemed document is light), dark under `[data-theme="dark"]`.
   tests/test_felix_theme.py parses both files and fails if one drifts from
   the other — change a colour in the app and this block has to follow. */
:root,
[data-theme="light"] {
  color-scheme: light;
  /* A grey page under white cards: a card stands off it at 1.23:1, where the
     near-white page it replaced was 1.09:1 and every card read as part of
     the page. */
  --surface-page: #E8E8E8;
  --surface: #FFFFFF;
  --surface-raised: #F0F0F0;
  /* A selected row or a filled track, one step past raised. */
  --surface-2: #E2E2E2;
  /* A field or a well set into a card. */
  --surface-sunken: #F4F4F4;

  --text-display: #000000;
  --text-primary: #111111;
  --text-secondary: #2E2E2E;
  /* The caption colour across the app (hundreds of call sites): close to
     primary, so a caption reads at a glance — 9.3:1 on a card, where the AA
     pass's #5E5E5E was 6.5:1 and the shipped #6B6B6B fell to 4.19:1 on a
     selected row. */
  --text-muted: #474747;
  --text-inverse: #FFFFFF;

  /* A hairline you can see, an outline (a card's edge, a pill) a step past
     it, and the edge that says "type here" at 7.0:1. */
  --border: #D2D2D2;
  --border-visible: #A6A6A6;
  --border-strong: #595959;

  /* Hover/active wash that works on any surface: darkens here, lightens in
     dark. For the places that used `rgba(255,255,255,…)`, which is white on
     white in this palette. */
  --tint: rgba(0, 0, 0, 0.05);

  /* The dark palette's hues, deepened until each reads as text on the
     darkest light surface and on its own tint. */
  --accent: #B8141C;
  --accent-strong: #8F0F15;
  --accent-tint: #FBE9EA;
  --success: #16693A;
  --success-tint: #E5F3E9;
  /* The brand gold (CoralMark's `CORAL_GOLD`) as a heads-up colour. On white
     it cannot be the art's #EAA602 (2.1:1), so here it is a deep amber. */
  --warning: #7A5200;
  --warning-tint: #FBF0D9;
  --info: #0A57B8;
  --info-tint: #E6EFFB;

  /* The hues with no status twin, each a type colour with its own wash: the
     dark palette's, deepened until each reads on the darkest light surface. */
  --hue-slate: #475569;
  --hue-slate-tint: #EEF1F5;
  --hue-indigo: #4338CA;
  --hue-indigo-tint: #EEEEFC;
  --hue-violet: #6D28D9;
  --hue-violet-tint: #F2ECFD;
  --hue-teal: #0B6A62;
  --hue-teal-tint: #E3F3F0;
  --hue-flame: #B13A08;
  --hue-flame-tint: #FCEDE5;

  /* What sits under a drawer or a modal, and what floats over the page. A
     card lifts off the page (a tight contact shadow and a soft one under
     it); menus, popovers and modals float higher, lighter on a light page. */
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.14), 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.2);

  /* A chart's first series: the dataviz palette's categorical slot 1 for
     this surface (3:1 against the card, which a line needs; it is never
     text). */
  --chart-1: #2A78D6;
}

[data-theme="dark"] {
  color-scheme: dark;
  --surface-page: #000000;
  --surface: #1B1B1B;
  --surface-raised: #222222;
  --surface-2: #272727;
  --surface-sunken: #0A0A0A;

  --text-display: #FFFFFF;
  --text-primary: #F2F2F2;
  --text-secondary: #DCDCDC;
  --text-muted: #C0C0C0;
  --text-inverse: #000000;

  --border: #383838;
  --border-visible: #5C5C5C;
  --border-strong: #A3A3A3;

  --tint: rgba(255, 255, 255, 0.06);

  /* Coral's red as shipped (#D71921) is a fill colour on black, not a text
     colour: lifted to where it reads on `--surface-2`, and a hair further
     (from #FF4F55) when the card was lifted off the black, so it keeps its
     5.5:1 on a card. */
  --accent: #FF5A60;
  --accent-strong: #FF7A7E;
  /* A step lighter than the shipped #331416, which is 1.03:1 on the lifted
     card — no wash at all. */
  --accent-tint: #421A1D;
  --success: #5DBA72;
  --success-tint: #12291A;
  /* The brand gold itself: on black it reads (7.5:1 on `--surface-2`). */
  --warning: #EAA602;
  --warning-tint: #2E2309;
  --info: #6CA6F8;
  --info-tint: #13233A;

  --hue-slate: #A3B1C6;
  --hue-slate-tint: #1D232B;
  --hue-indigo: #A5A0FA;
  --hue-indigo-tint: #222238;
  --hue-violet: #C0A2F8;
  --hue-violet-tint: #2A2340;
  --hue-teal: #3CCFBA;
  --hue-teal-tint: #0F2A26;
  --hue-flame: #FF8A4C;
  --hue-flame-tint: #36190C;

  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 4px 14px rgba(0, 0, 0, 0.9);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);

  --chart-1: #3987E5;
}

/* The app's older names and what its colours mean, pointing at the jobs
   above — index.css's block, value for value; felix's rules still say
   --black, --danger and friends. */
:root,
[data-theme] {
  --black: var(--surface-page);              /* "the page", in both themes */
  --text-disabled: var(--text-muted);        /* the caption colour, not only disabled */
  --accent-subtle: var(--accent-tint);
  --danger: var(--accent);
  --danger-tint: var(--accent-tint);
  --amber: var(--warning);
  --interactive: var(--info);
  --focus-ring: var(--info);

  /* ─── What colour means ────────────────────────────────────────────────
     The colour-coded half of "do both a and b": one small set of hues, each
     kept to one family of meaning on every screen —

       green   calls and wins       a call task, a callback, CALLS, Closed
       blue    messages             email, the inbox, Contacted
       indigo  sequences            a play, a LinkedIn step, Insights
       violet  meetings, the agent  Meeting, a meeting to log, the Agent area
       teal    lists                LISTS, a list built from a search
       amber   waiting on someone   Proposal, warm, a stalled deal, Home
       red     lost or late         Lost, LATE, an error (the accent)
       flame   hot                  a 90+ lead, PEOPLE, the Prospects area
       slate   not started          Prospecting, cool, a plain task, Settings

     Blue, green, amber and red ARE the status colours, so a Closed column is
     the green of every SAVED and a Lost one the red of every error. The rules
     that draw them name `--tone` / `--tone-tint`, set per element from a
     data attribute (`data-stage`, `data-heat`, `data-kind`…), so a meaning is
     written once and drawn in one colour everywhere. */
  --hue-blue: var(--info);
  --hue-blue-tint: var(--info-tint);
  --hue-green: var(--success);
  --hue-green-tint: var(--success-tint);
  --hue-amber: var(--warning);
  --hue-amber-tint: var(--warning-tint);
  --hue-red: var(--accent);
  --hue-red-tint: var(--accent-tint);

  /* "Prospecting gray, Contacted blue, Meeting violet, Proposal amber,
     Closed green, Lost red" — the owner, 2026-10-02
     (`pages/pipeline.model.ts`, `stageFamily`). */
  --stage-prospecting: var(--hue-slate);
  --stage-prospecting-tint: var(--hue-slate-tint);
  --stage-contacted: var(--hue-blue);
  --stage-contacted-tint: var(--hue-blue-tint);
  --stage-meeting: var(--hue-violet);
  --stage-meeting-tint: var(--hue-violet-tint);
  --stage-proposal: var(--hue-amber);
  --stage-proposal-tint: var(--hue-amber-tint);
  --stage-closed: var(--hue-green);
  --stage-closed-tint: var(--hue-green-tint);
  --stage-lost: var(--hue-red);
  --stage-lost-tint: var(--hue-red-tint);

  /* A lead's heat by its score: 90+ hot, 70–89 warm, under 70 cool
     (`components/score/heat.model.ts`). */
  --heat-hot: var(--hue-flame);
  --heat-hot-tint: var(--hue-flame-tint);
  --heat-warm: var(--hue-amber);
  --heat-warm-tint: var(--hue-amber-tint);
  --heat-cool: var(--hue-slate);
  --heat-cool-tint: var(--hue-slate-tint);
}

/* ─── felix's own layout tokens ─────────────────────────────────────────── */
:root {
  --font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-display: 'Doto', 'Space Mono', ui-monospace, monospace;
  --nav-w: 232px;
  --top-h: 56px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --fast: 150ms;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--black);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}
a { color: var(--interactive); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--interactive); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ─── Type ─────────────────────────────────────────────────────────────── */
/* The app's look (web/src/index.css, "do both a and b" — the owner,
   2026-10-02): a section's label a size up and bold, cards that lift off the
   page, the page you are on solid, status as a tinted chip. */
.label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.caption {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}
.mono, .num { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-disabled); }
.h1 { font-size: 26px; font-weight: 500; letter-spacing: -0.01em; color: var(--text-display); line-height: 1.2; }
.h2 { font-size: 18px; font-weight: 500; color: var(--text-display); line-height: 1.3; }
.h3 { font-size: 15px; font-weight: 500; color: var(--text-display); }
.ok { color: var(--success); }
.warn { color: var(--warning); }
.bad { color: var(--danger); }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }

.fx-skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); color: var(--text-display); padding: 8px 12px;
  border: 1px solid var(--border-visible); border-radius: 4px;
}
.fx-skip:focus { left: 8px; }

/* ─── Shell ────────────────────────────────────────────────────────────── */
.fx-app { display: flex; min-height: 100vh; }
.fx-nav {
  position: sticky; top: 0; height: 100vh; width: var(--nav-w); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 20px;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px calc(16px + var(--safe-bottom));
  overflow-y: auto;
}
.fx-brand { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; }
.fx-wordmark {
  font-family: var(--font-display); font-weight: 900; font-size: 30px;
  letter-spacing: 0.04em; color: var(--text-display); line-height: 1;
}
.fx-navlist { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.fx-navlink {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.fx-navlink:hover { background: var(--tint); color: var(--text-display); text-decoration: none; }
.fx-navlink[aria-current="page"],
.fx-navlink[aria-current="page"]:hover {
  color: var(--text-inverse); background: var(--text-display); font-weight: 700;
  border-left: 3px solid var(--text-display); border-radius: 0 4px 4px 0;
}
.fx-navlink svg { flex-shrink: 0; }
.fx-navcount {
  margin-left: auto; font-size: 11.5px; font-weight: 700; min-width: 18px; text-align: center;
  padding: 1px 6px; border-radius: 999px; border: 1px solid var(--warning); color: var(--warning);
}
.fx-navcount.bad { border-color: var(--danger); color: var(--danger); }
.fx-nav-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); }
.fx-operator { font-family: var(--font-mono); font-size: 13px; color: var(--text-display); margin-top: 4px; word-break: break-all; }
.fx-operator.unknown { color: var(--warning); }
.fx-signout { display: inline-block; margin-top: 8px; }

/* The sign-in page (felix/sso.py). */
.fx-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--black); }
.fx-login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px;
  padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.fx-login-copy { color: var(--text-secondary); margin: 8px 0 4px; }
.fx-login-note { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); margin: 0; }
.fx-login-note.bad { color: var(--danger); }
.fx-login-go { text-align: center; text-decoration: none; }

.fx-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fx-top {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.fx-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.fx-crumbs a, .fx-crumbs span {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fx-crumbs a { color: var(--text-secondary); }
.fx-crumbs a:hover { color: var(--text-display); }
.fx-crumbs span[aria-current] { color: var(--text-display); }
.fx-crumbs .sep { color: var(--text-disabled); flex-shrink: 0; }
.fx-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 4px;
  border: 1px solid var(--border-visible); color: var(--text-secondary);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.fx-iconbtn:hover { color: var(--text-display); border-color: var(--text-primary); }
.fx-menu { display: none; }
.fx-searchbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text-secondary);
  font-family: var(--font-mono); font-size: 12px; min-width: 220px;
}
.fx-searchbtn:hover { border-color: var(--text-primary); color: var(--text-display); }
.fx-searchbtn kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--border-visible); border-radius: 3px; color: var(--text-secondary);
}
.fx-main { padding: 28px 32px 64px; width: 100%; max-width: 1280px; outline: none; }
.fx-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 29; }

/* ─── Page furniture ───────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .h1 { margin-top: 6px; }
.page-head .caption { margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
/* Side by side, each card as tall as its own content. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--border-visible); border-radius: 12px; padding: 16px;
  box-shadow: var(--shadow-card);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 14px 16px 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border-visible); border-radius: 12px; padding: 14px 16px; min-width: 0; box-shadow: var(--shadow-card); }
.tile .value {
  font-family: var(--font-mono); font-size: 24px; line-height: 1.15; margin-top: 8px;
  color: var(--text-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .value.ok { color: var(--success); }
.tile .value.bad { color: var(--danger); }
.tile .value.warn { color: var(--warning); }
.tile .sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); margin-top: 6px; overflow-wrap: anywhere; }
a.tile { display: block; color: inherit; }
a.tile:hover { text-decoration: none; border-color: var(--border-strong); }

/* ─── Controls ─────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 8px 16px; min-height: 34px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-primary { background: var(--text-display); color: var(--black); }
.btn-primary:hover:not(:disabled) { background: var(--text-primary); }
.btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border-visible); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text-primary); color: var(--text-display); }
.btn-destructive { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-destructive:hover:not(:disabled) { background: var(--accent-subtle); }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 11px; border-radius: 4px; }
.btn-link { font-family: var(--font-mono); font-size: 12px; color: var(--interactive); text-transform: uppercase; letter-spacing: 0.04em; }

.input, .select, textarea.input {
  background: var(--surface); border: 1px solid var(--border-visible); border-radius: 4px;
  color: var(--text-primary); font-family: var(--font-body); font-size: 14px;
  padding: 7px 10px; min-height: 36px; outline: none; width: 100%;
  transition: border-color var(--fast) var(--ease);
}
.input:focus, .select:focus { border-color: var(--text-primary); }
.input::placeholder { color: var(--text-disabled); }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%), linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%); background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.select-sm, .input-sm { min-height: 30px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.select-sm { background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px; }
.input.mono { font-family: var(--font-mono); font-size: 13px; }
/* A short number (a month count). A class, because felix's CSP refuses a
   style attribute — the page that set one logged a console error. */
.input.input-short { width: 6em; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label { color: var(--text-secondary); }
.help { font-size: 12px; color: var(--text-secondary); line-height: 1.45; max-width: 72ch; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--text-display); }

/* Status */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-visible); background: var(--surface-2); font-family: var(--font-mono); font-size: 11.5px;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap;
}
.pill.ok { color: var(--success); border-color: var(--success); background: var(--success-tint); }
.pill.warn { color: var(--warning); border-color: var(--warning); background: var(--warning-tint); }
.pill.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-tint); }
.pill.info { color: var(--interactive); border-color: var(--interactive); background: var(--info-tint); }
.pill.on { color: var(--text-display); border-color: var(--text-display); background: transparent; }
.bracket { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; }
.bracket.ok, .bracket.warn, .bracket.bad { display: inline-block; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.bracket.ok { color: var(--success); background: var(--success-tint); }
.bracket.warn { color: var(--warning); background: var(--warning-tint); }
.bracket.bad { color: var(--danger); background: var(--danger-tint); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-disabled); flex-shrink: 0; }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--warning); }
.dot.bad { background: var(--danger); }

.notice {
  border: 1px solid var(--border); border-left: 3px solid var(--interactive); border-radius: 4px;
  padding: 10px 12px; background: var(--surface); font-size: 13px; line-height: 1.45;
}
/* The tone is the rule and the caption; the sentence stays in body ink —
   a paragraph in amber or red is harder to read, not more urgent. */
.notice, .notice.ok, .notice.warn, .notice.bad { color: var(--text-primary); }
.notice.warn { border-left-color: var(--warning); }
.notice.bad { border-left-color: var(--danger); }
.notice.ok { border-left-color: var(--success); }
.notice .label { display: block; margin-bottom: 3px; }
.notice.warn .label { color: var(--warning); }
.notice.bad .label { color: var(--danger); }
.notice.ok .label { color: var(--success); }
.attn-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.attn-line strong { color: var(--text-display); font-weight: 500; }
.attn-line .spacer { min-width: 8px; }
.attn-detail { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

/* ─── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary); text-align: left; font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: var(--tint); }
.tbl tr.clickable { cursor: pointer; }
.tbl .sub { font-size: 12px; color: var(--text-secondary); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions > * + * { margin-left: 6px; }
.cell-title { color: var(--text-display); font-weight: 500; }
/* A name that is a link says so without shouting: a quiet underline that
   darkens on hover. */
a.cell-title { text-decoration: underline; text-decoration-color: var(--border-visible); text-underline-offset: 3px; }
a.cell-title:hover { text-decoration-color: var(--text-display); }
.tbl .select { min-width: 116px; }

/* ─── States ───────────────────────────────────────────────────────────── */
.loading { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--text-secondary); padding: 24px 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-secondary); }
.empty .h3 { margin-bottom: 6px; }
.empty .help { margin: 0 auto 14px; }
.error-state { border: 1px solid var(--danger); border-radius: 12px; padding: 16px; background: var(--surface); }
.error-state .h3 { color: var(--danger); margin-bottom: 4px; }
.is-refetching { opacity: 0.55; transition: opacity var(--fast) var(--ease); }

/* Shown-once secret: a claim link or a temporary password. */
.once { border: 1px solid var(--warning); border-radius: 8px; padding: 12px; background: var(--surface-sunken); }
.once .label { color: var(--warning); }
.once-value { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.once-value code {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13px; color: var(--text-display);
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 7px 10px;
  overflow-wrap: anywhere; user-select: all;
}

/* ─── Overlays ─────────────────────────────────────────────────────────── */
.fx-toasts {
  position: fixed; right: 20px; bottom: calc(20px + var(--safe-bottom)); z-index: 60;
  display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); color: var(--text-primary); border: 1px solid var(--border-visible);
  border-left: 3px solid var(--success); border-radius: 6px; padding: 10px 12px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.toast.bad { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast .toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-close { color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; }

dialog.fx-dialog {
  margin: auto; border: 1px solid var(--border-visible); border-radius: 12px; padding: 0;
  background: var(--surface); color: var(--text-primary); width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}
dialog.fx-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.fx-dialog > form, .fx-dialog > .dialog-inner { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.confirm-target {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-display); background: var(--surface-sunken);
  border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; align-self: flex-start; user-select: all;
}
.fx-dialog .dialog-body { font-size: 14px; line-height: 1.5; color: var(--text-primary); }
.fx-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.fx-palette {
  position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(0, 0, 0, 0.45);
}
.fx-palette-panel {
  width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border-visible);
  border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; max-height: 70vh;
}
.fx-palette-input {
  border: none; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 16px;
  padding: 14px 16px; min-height: 52px; background: var(--surface);
}
.fx-palette-input:focus { border-color: var(--border); }
.fx-palette-list { list-style: none; overflow-y: auto; padding: 6px; }
.fx-palette-group { padding: 10px 10px 4px; }
.fx-palette-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.fx-palette-item .sub { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }
.fx-palette-item[aria-selected="true"] { background: var(--surface-raised); }
.fx-palette-empty { padding: 18px 16px; color: var(--text-secondary); font-size: 13px; }
.fx-palette-hint { border-top: 1px solid var(--border); padding: 8px 14px; display: flex; gap: 14px; }

.bulkbar {
  position: sticky; top: calc(var(--top-h) + 8px); z-index: 10;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border-visible); border-radius: 12px; padding: 10px 12px;
}
.bulkbar .caption { margin-right: auto; }
.orglist { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.orglist > div { white-space: nowrap; }
.orglist .role { color: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; }
.fx-navclose { display: none; margin-left: auto; }

/* ─── Org tree ─────────────────────────────────────────────────────────── */
.tree { list-style: none; }
.tree .tree { margin-left: 22px; border-left: 1px solid var(--border); padding-left: 8px; }
.tree-row {
  /* Fixed number columns: a nested row is narrower (it is indented), so
     fractional columns would drift right at every level. Fixed widths line
     the numbers up down the whole tree; the name column takes the indent. */
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 84px 84px 84px 116px;
  align-items: center; gap: 8px; padding: 8px 8px; border-radius: 6px; cursor: pointer;
}
.tree-row:hover { background: var(--tint); }
.tree-row.selected { background: var(--surface-raised); }
.tree-toggle { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); border-radius: 4px; }
.tree-toggle:hover { background: var(--tint); }
.tree-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tree-name .cell-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-stat { font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tree-when { font-family: var(--font-mono); font-size: 11px; text-align: right; color: var(--text-secondary); }
.tree-headrow { cursor: default; padding-top: 4px; padding-bottom: 4px; }
.tree-headrow .num { text-align: right; }
.tree-headrow:hover { background: none; }

/* ─── Charts ───────────────────────────────────────────────────────────── */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-text { fill: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; }
.chart .bar { fill: var(--chart-1); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar.hover { fill-opacity: 0.75; }
.chart .zero { fill: var(--border-visible); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 140px; max-width: 240px;
  background: var(--surface); border: 1px solid var(--border-visible); border-radius: 6px; padding: 8px 10px;
  font-size: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.chart-tip .tip-value { font-family: var(--font-mono); font-size: 14px; color: var(--text-display); }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-secondary); font-family: var(--font-mono); font-size: 11px; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }
.meter > span.warn { background: var(--warning); }
.meter > span.bad { background: var(--danger); }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }

/* ─── Keys ─────────────────────────────────────────────────────────────── */
.vendor { display: grid; grid-template-columns: minmax(180px, 0.9fr) minmax(0, 2.1fr); gap: 16px; }
.vendor + .vendor { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.keyrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.keyrow + .keyrow { margin-top: 14px; }
.keyline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.keyline .input { flex: 1; min-width: 180px; }
/* Caps & prices: the kind of ceiling sits beside its dollar figure. */
.keyline .select { width: auto; flex: 0 0 auto; }
.test-result { margin-top: 8px; }

/* ─── Audit ────────────────────────────────────────────────────────────── */
.detail-json {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); white-space: pre-wrap;
  overflow-wrap: anywhere; max-width: 520px; margin-top: 4px;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 160px; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* ─── Roadmap ──────────────────────────────────────────────────────────── */
/* The tabs (Board · Ideas · Bugs · Rewards), the board's cards, a report's
   words as they were typed, and its screenshot — no inline styles (the CSP). */
.section-tabs { margin-bottom: 16px; }
.rm-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.rm-item + .rm-item { margin-top: 8px; }
.rm-item .help { margin-top: 4px; }
.rm-item .rm-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 8px; }
.rm-quote { white-space: pre-wrap; overflow-wrap: anywhere; }
.rm-list { margin: 4px 0 10px; padding-left: 18px; display: grid; gap: 4px; }
.rm-list li { overflow-wrap: anywhere; }
.rm-shot { display: block; max-width: min(100%, 480px); height: auto; margin: 8px 0; border: 1px solid var(--border-visible); border-radius: 8px; }

/* ─── Laptop → phone ───────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .vendor { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 900px) {
  .fx-nav {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; height: 100%;
    transform: translateX(-100%); transition: transform 200ms var(--ease);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
  }
  .fx-nav.open { transform: translateX(0); }
  .fx-menu { display: inline-flex; }
  /* The drawer carries its own close, so a phone never has to find the scrim. */
  .fx-brand { display: grid; grid-template-columns: 1fr auto; align-items: start; }
  .fx-brand .label { grid-column: 1; }
  .fx-navclose { display: inline-flex; grid-column: 2; grid-row: 1 / span 2; }
  .fx-top { padding: 0 16px; }
  .fx-main { padding: 20px 20px 56px; }
  .fx-searchbtn { min-width: 0; }
}
@media (max-width: 640px) {
  .fx-main { padding: 16px 14px 56px; }
  .fx-searchtext, .fx-searchbtn kbd { display: none; }
  .fx-searchbtn { width: 32px; padding: 0; justify-content: center; }
  .h1 { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .value { font-size: 20px; }
  .tbl.tbl-wide { min-width: 640px; }
  .tree-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .tree-row .tree-stat, .tree-row .tree-when { display: none; }
  .tree-row .tree-stat.primary { display: block; }
  .tree-headrow { display: none; }
  .tree .tree { margin-left: 12px; }
  .fx-toasts { left: 16px; right: 16px; max-width: none; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
  .fx-iconbtn { width: 40px; height: 40px; }
  .fx-searchbtn { width: 40px; height: 40px; }
  .fx-palette { padding-top: 8vh; }
}
