/* THE CONSOLE'S DESIGN SYSTEM. One light console, not nine dialects.
 *
 * ── WHAT THIS FILE IS ────────────────────────────────────────────────────────
 * `home.html` is a byte-faithful transcription of the design canvas `Ella Chat
 * Dashboard.dc.html`: every value on that page is an inline `style=` attribute
 * copied across unchanged, so the port can be checked against the design by eye.
 * That is the right shape for ONE page and the wrong shape for fourteen.
 *
 * So this file is the same design, said once, as classes. EVERY NUMBER AND
 * EVERY COLOUR IN IT WAS READ OFF `home.html`. Nothing here was invented: if a
 * value is not in the transcription it is not in this file, and the comment
 * beside each token says which element in the design it came from. A screen
 * that needs a colour this file does not have is a screen asking for a colour
 * the design does not have.
 *
 * ── WHO LOADS IT ─────────────────────────────────────────────────────────────
 * `console.html` — the shared shell — loads `fonts.css` then this file on every
 * page. `home.html` loads `home.css` on top of it, which carries only the hover
 * and focus rules for that page's own inline-styled controls.
 *
 * The retired dark system (tokens/base/shell/components/screens/activity.css,
 * loaded by `base.html`) shares no selector and no custom property with this
 * file, so a screen that has not been ported yet cannot half-inherit this one.
 *
 * ── THE RULES OF THE HOUSE, IN THIS FILE ─────────────────────────────────────
 * 1. EVERY CUSTOM PROPERTY A DECLARATION SPENDS IS DEFINED BELOW. An undefined
 *    `var()` is not an error: the browser drops the WHOLE declaration and paints
 *    on in silence. That has shipped here before — a `margin-bottom` spending a
 *    `--sp-48` against a scale that has `--sp-46` and `--sp-56` and no `--sp-48`,
 *    which left the live strip sitting on top of the Send button through a
 *    restart and a reload — and
 *    `tests/test_ported_console_regressions.py::test_no_stylesheet_spends_a_
 *    custom_property_that_was_never_defined` now greps every sheet for it.
 * 2. NO `@import`, no font from a third party, no CDN. The CSP is
 *    `default-src 'self'`; `fonts.css` self-hosts Manrope and JetBrains Mono
 *    from `/static/fonts/`.
 * 3. Primitives are prefixed `c-` and are all class selectors. The only element
 *    selectors in this file are the canvas's own reset, at the top, which is
 *    transcribed from the design's `<style>` and describes the whole document.
 *    A primitive that styled bare `<button>` or `<input>` would reach into
 *    `home.html`, whose controls are painted entirely by inline attributes, and
 *    the point of that page is that nothing else paints it.
 *
 * ── HOW TO USE IT ────────────────────────────────────────────────────────────
 * Every primitive below is documented with the markup that uses it, because the
 * other screens are written by other hands and this file is what they copy from.
 */

/* ═══ 1. THE CANVAS'S OWN <style>, TRANSCRIBED ═══════════════════════════════
 *
 * Byte for byte from `Ella Chat Dashboard.dc.html`, and identical to the block
 * at the top of `home.css` — the two pages that load both sheets get the same
 * declarations twice, which costs nothing and keeps either sheet readable
 * alone. This is the document, not a component: it is the only place in this
 * file that selects an element.
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: Manrope, system-ui, sans-serif; background: oklch(0.975 0.004 60); color: oklch(0.22 0.008 60); -webkit-font-smoothing: antialiased; }
a { color: oklch(0.55 0.13 15); text-decoration: none; }
a:hover { color: oklch(0.45 0.13 15); }
textarea, input, button, select { font: inherit; color: inherit; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: oklch(0.9 0.005 60); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: oklch(0.62 0.14 15); cursor: pointer; box-shadow: 0 1px 3px oklch(0.2 0.01 60 / 0.3); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(0.88 0.004 60); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ═══ 2. THE SCALE ═══════════════════════════════════════════════════════════
 *
 * Read off `home.html` element by element. The comment on each line names the
 * element it was taken from, so a value can be traced back to the design rather
 * than argued about.
 *
 * There is no dark half. The design declares `<meta name="color-scheme"
 * content="light">` and the console is light; a `prefers-color-scheme: dark`
 * block here would be a second palette nobody drew.
 */

:root {
  /* ── grounds ───────────────────────────────────────────────────────────── */
  --c-ground:        oklch(0.975 0.004 60);  /* the window, and the chat pane */
  --c-surface:       oklch(0.99 0.003 60);   /* the rail, the header, every card */
  /* A RAISED CONTROL AT REST. The design's own secondary button is the inbox's
   * Flag while it is unflagged (`home.html`, the chat header): this ground, a
   * `--c-line-input` hairline, and 700. It is NOT white — white is a fan's
   * bubble — and a secondary button that came out white read as a different
   * control from the one the design draws two inches away. */
  --c-raised:        oklch(0.97 0.004 60);   /* a secondary button at rest */
  --c-sunk:          oklch(0.965 0.004 60);  /* a text input at rest; the table head */
  --c-sunk-2:        oklch(0.955 0.004 60);  /* a tag, a resting filter chip, a row hover */
  --c-white:         white;                  /* a fan's message bubble, a focused input */

  /* ── ink ───────────────────────────────────────────────────────────────── */
  --c-ink:           oklch(0.22 0.008 60);   /* body text */
  --c-ink-2:         oklch(0.28 0.01 60);    /* the AI card's own text */
  --c-ink-3:         oklch(0.35 0.008 60);   /* an unattributed bubble */
  --c-ink-4:         oklch(0.42 0.008 60);   /* the sentence under a refused control */
  --c-muted:         oklch(0.45 0.008 60);   /* a table cell */
  --c-muted-2:       oklch(0.5 0.008 60);    /* a rail item at rest; a slider's figure */
  --c-muted-3:       oklch(0.52 0.008 60);   /* a chat row's preview line */
  --c-muted-4:       oklch(0.55 0.008 60);   /* the header subtitle; every empty state */
  --c-muted-5:       oklch(0.58 0.008 60);   /* the reason under a refused tile */
  --c-muted-6:       oklch(0.6 0.008 60);    /* a section heading; a tile's label */
  --c-faint:         oklch(0.62 0.008 60);   /* a handle, a uuid, a refused knob */
  --c-faint-2:       oklch(0.65 0.008 60);   /* a message's clock */

  /* ── hairlines and borders ─────────────────────────────────────────────── */
  --c-line:          oklch(0.925 0.004 60);  /* the rail's edge, the header's floor */
  --c-line-2:        oklch(0.93 0.004 60);   /* a card's border, a fan bubble's border */
  --c-line-3:        oklch(0.945 0.004 60);  /* a rule inside a card; a bar's track */
  --c-line-4:        oklch(0.955 0.004 60);  /* a table row's floor */
  --c-line-strong:   oklch(0.9 0.005 60);    /* a range track; the avatar disc's ring */
  --c-line-input:    oklch(0.92 0.004 60);   /* every input, textarea and select */
  --c-line-dash:     oklch(0.87 0.006 60);   /* "+ tag" — a control with nothing behind it */
  --c-line-dash-2:   oklch(0.9 0.004 60);    /* an unattributed bubble's dashed edge */

  /* ── the accent: rose. The mark, Send, the active rail cell, the unread bar ─ */
  --c-accent:        oklch(0.62 0.14 15);
  --c-accent-hover:  oklch(0.54 0.14 15);    /* the composer's Send, style-hover */
  --c-accent-ink:    oklch(0.45 0.12 15);    /* the active rail cell's letters */
  --c-accent-soft:   oklch(0.945 0.012 15);  /* the active rail cell's ground */
  --c-accent-soft-2: oklch(0.955 0.012 15);  /* the selected chat row */
  --c-accent-line:   oklch(0.75 0.06 15);    /* the search box, focused */
  --c-accent-line-2: oklch(0.78 0.06 15);    /* the private note, focused */
  --c-accent-line-3: oklch(0.9 0.04 15);     /* a bubble she typed in the app */
  --c-link:          oklch(0.55 0.13 15);    /* a prose link */
  --c-link-hover:    oklch(0.45 0.13 15);

  /* ── green: the machine is doing something, and it is allowed to ────────── */
  --c-go:            oklch(0.58 0.12 162);   /* a live toggle's track */
  --c-go-dot:        oklch(0.63 0.13 162);   /* the AI dot on an avatar; the card's pip */
  --c-go-ink:        oklch(0.45 0.1 162);    /* the AI card's label and its Send */
  --c-go-ink-2:      oklch(0.4 0.1 162);     /* "AI on for this chat" */
  --c-go-ink-3:      oklch(0.5 0.1 162);     /* the "AI" tag under a bot message */
  --c-go-hover:      oklch(0.38 0.1 162);    /* the AI card's Send, style-hover */
  --c-go-soft:       oklch(0.965 0.03 162);  /* the header toggle when AI is on */
  --c-go-soft-2:     oklch(0.97 0.025 162);  /* the per-chat toggle when AI is on */
  --c-go-soft-3:     oklch(0.975 0.02 162);  /* the AI card's ground */
  --c-go-line:       oklch(0.85 0.06 162);   /* the header toggle's border when on */
  --c-go-line-2:     oklch(0.87 0.055 162);  /* the per-chat toggle's border when on */
  --c-go-line-3:     oklch(0.78 0.07 162);   /* the AI card's dashed edge */

  /* ── amber: money, and a thing somebody is holding up ───────────────────── */
  --c-warn:          oklch(0.93 0.05 75);    /* the VIP tag's ground */
  --c-warn-2:        oklch(0.94 0.045 75);   /* a priced message's chip */
  --c-warn-3:        oklch(0.96 0.03 75);    /* the composer's PPV chip */
  --c-warn-hover:    oklch(0.93 0.045 75);   /* …its style-hover */
  --c-warn-ink:      oklch(0.45 0.09 60);    /* VIP, and a price */
  --c-warn-ink-2:    oklch(0.42 0.09 60);    /* the PPV chip's letters */
  --c-warn-bg:       oklch(0.97 0.04 75);    /* the noscript strip */
  --c-warn-line:     oklch(0.9 0.05 75);     /* …its floor */
  --c-warn-say:      oklch(0.35 0.06 60);    /* …its text */

  /* ── red-orange: flagged, and an alert nobody has acknowledged ──────────── */
  --c-flag:          oklch(0.6 0.15 40);     /* the ◆ on a flagged row */
  --c-flag-bg:       oklch(0.96 0.05 40);    /* the Flag button, pressed */
  --c-flag-line:     oklch(0.85 0.09 40);    /* …its border */
  --c-flag-ink:      oklch(0.48 0.13 35);    /* …its letters */
  --c-needs-you:     oklch(0.55 0.15 30);    /* a tile's delta when it wants a person */

  /* ── neutral furniture ─────────────────────────────────────────────────── */
  --c-track:         oklch(0.86 0.006 60);   /* a toggle at rest */
  --c-disc:          oklch(0.93 0.01 60);    /* the avatar disc at the foot of the rail */
  --c-disc-line:     oklch(0.9 0.005 60);
  --c-knob:          white;
  --c-scroll:        oklch(0.88 0.004 60);

  /* ── type ──────────────────────────────────────────────────────────────── */
  --c-font:          Manrope, system-ui, sans-serif;
  --c-mono:          'JetBrains Mono', ui-monospace, monospace;
  --c-t-micro:       9.5px;   /* the "AI"/"you" tag under a message */
  --c-t-eyebrow:     10px;    /* a section heading, uppercase */
  --c-t-tiny:        10.5px;  /* a clock, a qualifier, a refused tile's reason */
  --c-t-xs:          11px;    /* a rail cell, a badge, a note under a control */
  --c-t-s:           11.5px;  /* a chip, a tag, a caption */
  --c-t-sm:          12px;    /* the header subtitle */
  --c-t-m:           12.5px;  /* a card heading, a table cell, a fact row, a button */
  --c-t-body:        13.5px;  /* a message bubble, the composer */
  --c-t-name:        14px;    /* the open chat's name */
  --c-t-title:       15px;    /* the page title in the header */
  --c-t-figure:      17px;    /* a metric tile's figure */
  --c-t-big:         27px;    /* lifetime spend, on the fan panel */

  --c-ls-title:     -0.015em; /* the page title */
  --c-ls-name:      -0.01em;  /* a name, a card heading */
  --c-ls-figure:    -0.025em; /* a tile's figure */
  --c-ls-big:       -0.03em;  /* the one big figure */
  --c-ls-eyebrow:    0.08em;  /* an uppercase section heading */
  --c-ls-label:      0.07em;  /* an uppercase tile label */
  --c-ls-tag:        0.06em;  /* the tag under a message; VIP */
  --c-ls-rail:       0.03em;  /* a rail cell */

  /* ── radii ─────────────────────────────────────────────────────────────── */
  --c-r-xs:          5px;     /* the VIP tag */
  --c-r-s:           6px;     /* a spend pill */
  --c-r-m:           8px;     /* a tag */
  --c-r-chip:        9px;     /* a filter chip */
  --c-r-btn:         10px;    /* a button */
  --c-r-input:       11px;    /* an input, a textarea, a small button */
  --c-r-cell:        12px;    /* a rail cell */
  --c-r-row:         13px;    /* a chat row */
  --c-r-toggle:      14px;    /* the header's AI switch */
  --c-r-box:         15px;    /* the composer's box */
  --c-r-card:        16px;    /* a card, a bubble */

  /* ── spacing. The design's own steps, and only those. ──────────────────── */
  --c-sp-1:          2px;
  --c-sp-2:          4px;
  --c-sp-3:          5px;
  --c-sp-4:          6px;
  --c-sp-5:          7px;
  --c-sp-6:          8px;
  --c-sp-7:          10px;
  --c-sp-8:          11px;
  --c-sp-9:          12px;
  --c-sp-10:         14px;
  --c-sp-11:         16px;
  --c-sp-12:         18px;
  --c-sp-13:         20px;
  --c-sp-14:         22px;
  --c-sp-15:         24px;
  --c-sp-16:         26px;
  --c-sp-17:         40px;

  /* ── the two shadows in the design, both under a toggle's knob ─────────── */
  --c-shadow-knob:   0 1px 3px oklch(0.2 0.01 60 / 0.25);
  --c-shadow-knob-s: 0 1px 2px oklch(0.2 0.01 60 / 0.25);

  /* ── motion. The canvas's own durations and its one easing. ────────────── */
  --c-ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --c-fast:          160ms;
  --c-slow:          180ms;

  /* ── the frame ─────────────────────────────────────────────────────────── */
  --c-rail-w:        68px;    /* the icon rail */
  --c-min-w:         1240px;  /* the design's own minimum. Below it the page scrolls sideways. */
  /* The fan panel and the live strip. Both are spent in `console-chat.css`, and
   * they are HERE because the chat's composer has to reserve room against the
   * pair of them — a strip 340 wide inset 16 from a window whose last 272 is the
   * fan panel reaches 84px back into the thread column and lands on the
   * composer's note. Two numbers in two files is how it landed there. */
  --c-side-w:        272px;   /* the fan panel beside a chat */
  --c-livestrip-w:   340px;   /* the activity tail over a chat */
}

/* ═══ 3. THE DOCUMENT-WIDE BEHAVIOURS ════════════════════════════════════════
 *
 * Three things the canvas has no concept of, and one it expresses as an
 * attribute its own editor rewrites. All four are copied from `home.css`, where
 * each was measured failing before it was written.
 */

/* A LINK OR BUTTON DRAWN AS THE CANVAS'S DIVS. The canvas has no anchors and no
 * buttons — its clickables are `<div onClick>`. A console needs real ones, and
 * those arrive with user-agent styling the design's divs never had. `.blk`
 * takes it back off; the element's own `style=` or class still wins over this. */
a.blk { color: inherit; text-decoration: none; }
a.blk:hover { color: inherit; }
button.blk {
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  text-align: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* FOCUS HAS TO BE VISIBLE. This console is operated with a keyboard as well as
 * a mouse and the canvas — which cannot be tabbed through — says nothing about
 * it. `:focus-visible` paints for keyboard focus only, so a mouse click never
 * draws a ring the design does not have. */
a.blk:focus-visible,
button.blk:focus-visible,
.c-btn:focus-visible,
.c-input:focus-visible,
.c-textarea:focus-visible,
.c-select:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* A CONTROL THAT WRITES IS DRAWN DISABLED UNTIL ITS SCRIPT IS RUNNING. Every
 * write on this console is a JSON call carrying `X-Dash`, a header a plain form
 * cannot set, so with scripting off these genuinely cannot work. `home.js`
 * clears `disabled` on load; until then, and forever in a browser with
 * scripting off, they are visibly not-live rather than looking live and
 * throwing away what was typed into them. That has happened here twice. */
[data-needs-js][disabled] { opacity: 0.5; }

/* A CONTROL THE DESIGN HAS AND THIS ACCOUNT CANNOT BACK. Different from the
 * rule above and it must stay different: `data-needs-js` means "not live yet,
 * and will be in a moment"; `data-unavailable` means "this will never do
 * anything, and the sentence beside it says why". Dimmer, and with a cursor
 * that refuses, so the two never read the same. */
[data-unavailable] { opacity: 0.45; cursor: not-allowed !important; }

/* `el.hidden = true` HAS TO ACTUALLY HIDE IT. The browser's own `[hidden]` rule
 * is `display: none` at attribute specificity, and it LOSES to any class in an
 * author sheet that sets `display` — and to any inline `display:` at all.
 * Measured on the AI card: Dismiss set `hidden`, `getComputedStyle` still said
 * `flex`, the card kept its 459x171 box, and the button was exactly the dead
 * control this console has shipped three times. */
[hidden] { display: none !important; }

/* Chrome paints a disabled range track and thumb at full strength, so the
 * opacity above is the only thing separating a dead slider from a live one. The
 * thumb needs saying twice: its colour is set through a vendor pseudo-element
 * the shorthand cannot reach. */
input[type=range][data-unavailable]::-webkit-slider-thumb { background: oklch(0.72 0.02 60); }

/* The design's header is `white-space: nowrap`, which is right for a row of
 * short labels and wrong for the sentence a refused tile prints instead of a
 * figure. `.wrap` is on those sentences and nowhere else. */
.wrap { white-space: normal; }

/* Reachable by keyboard, and taking no space. The GET search forms need a
 * submit control for browsers that do not do implicit submission, and a few
 * headings exist only for a screen reader. */
.offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ═══ 4. THE SHELL ═══════════════════════════════════════════════════════════
 *
 * The frame every page sits in, drawn by `templates/console.html`. The
 * STRUCTURAL values there are still inline `style=` attributes copied from the
 * canvas, exactly as `home.html` had them, so the shell can still be checked
 * against the design by eye and `/` measures the same after the lift as before.
 * What lives here is the behaviour a static attribute cannot express: hover,
 * focus, and the flyout label.
 */

/* THE RAIL ITEM. 40x40, radius 12, 11px/700 at 0.03em — the canvas's own cell,
 * and the same one `home.html` drew for its four views. Its resting and active
 * colours are inline, from `pages._NAV_ON` / `_NAV_OFF`, so the two states of
 * one control stay one line apart in the source. */
.rail-nav { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.rail-item { position: relative; }

/* A CELL THAT IS NOT THE PAGE YOU ARE ON LIFTS UNDER THE POINTER. The canvas
 * expresses hover as a `style-hover=` attribute its editor applies by rewriting
 * the inline style; a browser needs a real rule, and because the property it
 * overrides is inline, that rule needs `!important` or it is dropped in
 * silence. `:not([aria-current])` so hovering the current page does not repaint
 * it a colour it is not. */
.rail-item:not([aria-current]):hover { background: var(--c-sunk-2) !important; }

/* EVERY ITEM SAYS ITS NAME. Fourteen destinations abbreviated to two and three
 * letters is a rail nobody can read, and "not too confusing to use" is the
 * whole of what was asked for. The flyout is the canvas's own selected-chip:
 * ground oklch(0.24 0.01 60), white, 11.5px/600, radius 9.
 *
 * `pointer-events: none` so it can never swallow a click meant for the cell
 * under it, and `left: 100%` so it opens INTO the page — the shell's flex
 * container is 1240px wide at minimum and the label is at most ~160px, so it
 * has room and is never clipped.
 *
 * The `title` attribute is on the anchor as well. Belt and braces on purpose:
 * the flyout is the fast answer for a mouse, the title is the one a browser
 * reads out and the one that survives if this rule ever fails to load. */
.rail-label {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: var(--c-sp-6);
  padding: var(--c-sp-3) var(--c-sp-7);
  border-radius: var(--c-r-chip);
  background: oklch(0.24 0.01 60);
  color: var(--c-white);
  font-size: var(--c-t-s);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--c-fast);
  z-index: 20;
}
.rail-item:hover .rail-label,
.rail-item:focus-visible .rail-label { opacity: 1; visibility: visible; }

/* THE COUNT ON A CELL, and only when there is one. Nine grey zeroes down a rail
 * are nine facts to read past to find the one that is not zero, so a count of
 * nothing is not drawn at all — the server omits the element. */
.rail-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--c-r-m);
  border: 2px solid var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--c-t-micro);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}
/* Quiet: a queue with things in it. Warn: somebody is held up waiting for a
 * click. Danger: something went wrong and nobody has acknowledged it. The three
 * tones are the ones the retired rail used, in this design's colours. */
.rail-badge--quiet  { background: var(--c-disc);      color: var(--c-muted); }
.rail-badge--warn   { background: var(--c-warn);      color: var(--c-warn-ink); }
.rail-badge--danger { background: var(--c-accent);    color: var(--c-white); }

/* The hairline between two groups of destinations. 24px so it reads as a break
 * in a 40px column without drawing a line across the whole rail. */
.rail-rule {
  flex: 0 0 auto;
  width: 24px;
  height: 1px;
  background: var(--c-line);
  margin: 7px 0;
}

/* THE ONLY TWO NUMBERS ON THIS RAIL THAT MOVE.
 *
 * Fourteen 40px cells cannot be squeezed and must not be: the cell is the
 * canvas's own, and shrinking it would make this rail a different rail on a
 * different laptop. What CAN give is the air between them, and it gives in one
 * step before anything is allowed to go off the bottom.
 *
 * MEASURED, not guessed. The rail spends 156px on the mark, the disc, its own
 * padding and the two 26px gaps the canvas puts around the group, so the cells
 * have `100vh - 156px`. At the roomy rhythm (5px gaps, 7px rule margins) they
 * need 705px, which fits any window 861px tall or more. At the tight rhythm
 * (2px and 2px) they need 598px, which fits down to 754px. Below that the rail
 * scrolls, because a destination you cannot reach is worse than a tight one —
 * and scrolling is last, not first, because a scroll container clips the flyout
 * labels and there the `title` is the only thing left answering "what is Sys". */
@media (max-height: 860px) {
  .rail-nav { gap: 2px; }
  .rail-rule { margin: 2px 0; }
}
@media (max-height: 753px) {
  .rail-nav { overflow-y: auto; overflow-x: hidden; min-height: 0; }
}

/* ═══ 5. THE PRIMITIVES ══════════════════════════════════════════════════════
 *
 * One section per component, each with the markup that uses it. Copy the markup
 * — do not re-derive the values, and do not add a colour.
 */

/* ── 5.1 THE PAGE WELL ───────────────────────────────────────────────────────
 * The scrolling region under the shared header. `home.html`'s own views use
 * exactly this padding (22px 26px 40px) and this gap (18px).
 *
 *   <div class="c-page">
 *     <section class="c-card">…</section>
 *     <section class="c-card">…</section>
 *   </div>
 */
.c-page {
  flex: 1;
  overflow-y: auto;
  padding: var(--c-sp-14) var(--c-sp-16) var(--c-sp-17);
  display: flex;
  flex-direction: column;
  gap: var(--c-sp-12);
}
/* NOTHING IN A FLEX COLUMN MAY BE SQUASHED TO FIT.
 *
 * MEASURED, and it is the kind of fault this console keeps shipping: a table
 * card whose content was 216px tall rendered TWO PIXELS high in a well that was
 * already scrolling. The well is `display: flex; flex-direction: column`, which
 * is what the design draws, and a flex item's default `flex-shrink: 1` means
 * every card gives up height to the ones above it before the container is
 * allowed to overflow — and `.c-card--flush` has `overflow: hidden`, so the
 * card did not even spill: it simply disappeared.
 *
 * `flex-shrink: 0` rather than `flex: 0 0 auto` so a child that genuinely wants
 * to grow still can. On `.c-card` too, for the same reason one layer down. */
.c-page > *, .c-card > * { flex-shrink: 0; }

/* A screen whose content is prose or a single column of controls. The AI view
 * uses 760px and nothing on this console is wider. */
.c-page--narrow > * { max-width: 760px; }

/* ── 5.2 SECTION HEADING ─────────────────────────────────────────────────────
 * The uppercase eyebrow over a block, from the fan panel ("LIFETIME SPEND",
 * "FACTS", "TAGS").
 *
 *   <h2 class="c-h">Facts</h2>
 */
.c-h {
  margin: 0;
  font-size: var(--c-t-eyebrow);
  font-weight: 700;
  letter-spacing: var(--c-ls-eyebrow);
  text-transform: uppercase;
  color: var(--c-muted-6);
}

/* The heading INSIDE a card — "Where it comes from", "Voice", "Behaviour". Not
 * uppercase, and it is the card's own first line. */
.c-card-title {
  margin: 0;
  font-size: var(--c-t-m);
  font-weight: 700;
  letter-spacing: var(--c-ls-name);
}
/* The qualifier under a card title: the sentence that says this figure is
 * lifetime, or gross, or looked up for eleven fans of thirteen. */
.c-card-note {
  margin: 0;
  font-size: var(--c-t-xs);
  line-height: 1.45;
  color: var(--c-muted-5);
  white-space: normal;
}

/* ── 5.3 CARD / PANEL ────────────────────────────────────────────────────────
 * The design's one container: surface, 1px border, radius 16, 20px 22px.
 *
 *   <section class="c-card">
 *     <h2 class="c-card-title">Where it comes from</h2>
 *     <p class="c-card-note">lifetime · gross</p>
 *     …
 *   </section>
 *
 * `c-card--flush` for a card whose content is a table and must reach the edge;
 * put the padding on the rows instead.
 */
.c-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line-2);
  border-radius: var(--c-r-card);
  padding: var(--c-sp-13) var(--c-sp-14);
  display: flex;
  flex-direction: column;
  gap: var(--c-sp-10);
}
.c-card--flush { padding: 0; gap: 0; overflow: hidden; }

/* A rule between two blocks inside one card, as the AI view draws between its
 * switches. */
.c-rule { height: 1px; background: var(--c-line-3); border: 0; margin: 0; }

/* ── 5.4 METRIC TILE ─────────────────────────────────────────────────────────
 * The eight-across strip in the header, and the same tile anywhere else.
 *
 *   <div class="c-tiles">
 *     <div class="c-tile">
 *       <div class="c-tile-label">Total revenue</div>
 *       <div class="c-tile-figure">
 *         <span class="c-tile-value">$528.57</span>
 *         <span class="c-tile-delta">all fans</span>
 *       </div>
 *     </div>
 *     <div class="c-tile">
 *       <div class="c-tile-label">Revenue today</div>
 *       <p class="c-refused-why">no dated payment has ever been recorded…</p>
 *     </div>
 *   </div>
 *
 * A REFUSED TILE KEEPS ITS LABEL AND ITS CELL and prints the reason where the
 * figure would be. A grid that silently lost two of eight cells reads as a
 * broken screen; one that filled them with $0 reads as an account that earned
 * nothing, which is a lie this console has already told.
 */
.c-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--c-line-3);
}
.c-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--c-sp-8) var(--c-sp-10) 13px;
  border-right: 1px solid var(--c-line-4);
}
.c-tile:last-child { border-right: 0; }
.c-tile-label {
  font-size: var(--c-t-micro);
  font-weight: 700;
  letter-spacing: var(--c-ls-label);
  text-transform: uppercase;
  color: var(--c-muted-6);
  overflow: hidden;
  text-overflow: ellipsis;
}
.c-tile-figure { display: flex; align-items: baseline; gap: var(--c-sp-3); }
.c-tile-value {
  font-family: var(--c-mono);
  font-size: var(--c-t-figure);
  font-weight: 500;
  letter-spacing: var(--c-ls-figure);
}
.c-tile-delta { font-size: var(--c-t-tiny); font-weight: 600; color: var(--c-muted-6); }
.c-tile-delta--good      { color: var(--c-go-ink-3); }
.c-tile-delta--needs-you { color: var(--c-needs-you); }

/* The one big figure, as the fan panel draws lifetime spend. */
.c-figure {
  font-family: var(--c-mono);
  font-size: var(--c-t-big);
  font-weight: 500;
  letter-spacing: var(--c-ls-big);
}

/* ── 5.5 THE REFUSED SLOT ────────────────────────────────────────────────────
 * THE MOST IMPORTANT PRIMITIVE IN THIS FILE. `queries.console_view` answers
 * every optional block with either a figure or `{"available": false, "why":
 * "<a sentence>"}`, and a slot it refuses prints the sentence. Never a dash,
 * never a zero, never a plausible figure: this console has lied to this
 * operator about money and he has said so.
 *
 *   {% if m.available %}
 *     <div class="c-tile-value">{{ m.value }}</div>
 *   {% else %}
 *     <p class="c-refused-why">{{ m.why }}</p>
 *   {% endif %}
 *
 * And where a whole card is refused:
 *
 *   <section class="c-card">
 *     <h2 class="c-card-title">{{ block.label }}</h2>
 *     <p class="c-refused">{{ block.why }}</p>
 *   </section>
 */
.c-refused-why {
  margin: 0;
  font-size: var(--c-t-tiny);
  line-height: 1.35;
  color: var(--c-muted-5);
  white-space: normal;
}
.c-refused {
  margin: 0;
  font-size: var(--c-t-m);
  line-height: 1.6;
  color: var(--c-muted-2);
  max-width: 70ch;
  white-space: normal;
}

/* A REFUSED SWITCH IS NOT AN OFF SWITCH. The design's track is kept so the row
 * does not look broken, and the knob is replaced by a dash: a knob resting at
 * the left says "this is off", which is an answer, and the true answer is that
 * there is no such setting to be on or off.
 *
 *   <span class="c-toggle c-toggle--none" role="img"
 *         aria-label="Reply delay: no such setting on this account"
 *         title="no such setting on this account — {{ why }}">—</span>
 */
.c-toggle--none {
  background: var(--c-sunk-2);
  border: 1px dashed var(--c-line-dash);
  align-items: center;
  justify-content: center;
  font-size: var(--c-t-xs);
  color: var(--c-faint);
  padding: 0;
}
.c-toggle--none .c-toggle-knob { display: none; }

/* ── 5.6 TOGGLE ──────────────────────────────────────────────────────────────
 * The canvas draws three sizes of the same switch. This is the 40x23 one from
 * the AI view; `--sm` is the 34x19 from a fans-table row and the per-chat
 * control; `--lg` is the 46x26 in the header.
 *
 *   <button type="button" class="c-toggle-row blk" data-needs-js disabled
 *           aria-disabled="true" data-enabled="{{ 1 if on else 0 }}">
 *     <span class="c-toggle-say">
 *       <span class="c-toggle-label">AI replies to fans</span>
 *       <span class="c-toggle-hint wrap">{{ hint }}</span>
 *     </span>
 *     <span class="c-toggle {{ 'is-on' if on }}">
 *       <span class="c-toggle-knob"></span>
 *     </span>
 *   </button>
 */
.c-toggle {
  flex: 0 0 auto;
  width: 40px;
  height: 23px;
  border-radius: var(--c-r-cell);
  background: var(--c-track);
  padding: 3px;
  display: flex;
  transition: background var(--c-slow);
}
.c-toggle-knob {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--c-knob);
  box-shadow: var(--c-shadow-knob-s);
  transition: transform var(--c-slow) var(--c-ease);
}
.c-toggle.is-on { background: var(--c-go); }
.c-toggle.is-on .c-toggle-knob { transform: translateX(17px); }

.c-toggle--sm { width: 34px; height: 19px; border-radius: var(--c-r-btn); padding: 2.5px; }
.c-toggle--sm .c-toggle-knob { width: 14px; height: 14px; }
.c-toggle--sm.is-on .c-toggle-knob { transform: translateX(15px); }

.c-toggle--lg { width: 46px; height: 26px; border-radius: 13px; }
.c-toggle--lg .c-toggle-knob { width: 20px; height: 20px; box-shadow: var(--c-shadow-knob); }
.c-toggle--lg.is-on .c-toggle-knob { transform: translateX(20px); }

/* A toggle the page REPORTS rather than offers — send authority, takeover
 * minutes. Dimmed so it cannot be mistaken for a control. */
.c-toggle--readonly { opacity: 0.55; }

/* The whole row: words on the left, switch on the right, a hairline above. */
.c-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--c-sp-10);
  width: 100%;
  padding: var(--c-sp-7) 0;
  border-top: 1px solid var(--c-line-3);
  user-select: none;
  cursor: pointer;
  text-align: left;
}
.c-toggle-row[disabled] { cursor: default; }
.c-toggle-say { flex: 1; min-width: 0; }
.c-toggle-label { display: block; font-size: var(--c-t-m); font-weight: 600; }
.c-toggle-hint {
  display: block;
  margin-top: var(--c-sp-1);
  font-size: var(--c-t-s);
  line-height: 1.45;
  color: var(--c-muted-4);
  white-space: normal;
}

/* ── 5.7 BUTTONS ─────────────────────────────────────────────────────────────
 * Three, and no fourth. Primary is the composer's Send; secondary is the AI
 * card's Edit; ghost is its Dismiss.
 *
 *   <button type="button" class="c-btn c-btn--primary">Send</button>
 *   <button type="button" class="c-btn c-btn--secondary">Edit</button>
 *   <button type="button" class="c-btn c-btn--ghost">Dismiss</button>
 *
 * A button that WRITES is served `disabled aria-disabled="true" data-needs-js`
 * and `home.js` enables it on load. A button with nothing behind it is served
 * `disabled aria-disabled="true" data-unavailable title="<the reason>"` and the
 * reason goes on the screen as well, not only in the tooltip.
 */
.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--c-sp-4);
  padding: var(--c-sp-6) var(--c-sp-11);
  border: 1px solid transparent;
  border-radius: var(--c-r-btn);
  /* 12.5px, MEASURED off the design's own Send (`home.html`, the composer:
   * 8px 16px, radius 10, 12.5px, 700). This said `--c-t-sm` (12px), which put
   * the composer's Send at 32.39px tall on every ported screen against 33px on
   * the inbox — a difference on the one button that sends a message to a
   * paying subscriber. */
  font-size: var(--c-t-m);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background var(--c-fast), border-color var(--c-fast);
}
.c-btn--primary { background: var(--c-accent); color: var(--c-white); }
.c-btn--primary:hover:not([disabled]) { background: var(--c-accent-hover); }
.c-btn--go { background: var(--c-go-ink); color: var(--c-white); }
.c-btn--go:hover:not([disabled]) { background: var(--c-go-hover); }
/* THE DESIGN'S SECONDARY IS THE INBOX'S FLAG BUTTON, UNFLAGGED — `--c-raised`,
 * a `--c-line-input` hairline, 700. It was white at 600, which came out 29.8px
 * tall beside the design's own 31px and read as a different control; the two
 * sit in the same chat header on `/` and `/c/<uuid>`. */
.c-btn--secondary {
  background: var(--c-raised);
  border-color: var(--c-line-input);
  /* MEASURED off the same reference button, unflagged (`home.html`, the inbox
   * chat header: `color:oklch(0.5 0.008 60)`) — `--c-muted-2`. This said
   * `--c-ink` (0.22), so "Flag" on `/` and "Flagged: off" on `/c/<uuid>` — the
   * same control, one click apart — were two different inks; the darker one
   * read as the primary action on a header where nothing there is primary. */
  color: var(--c-muted-2);
}
.c-btn--secondary:hover:not([disabled]) { background: var(--c-sunk); }
.c-btn--ghost {
  background: none;
  color: var(--c-muted-4);
  font-weight: 600;
}
.c-btn--ghost:hover:not([disabled]) { background: var(--c-white); }
/* The one destructive shape on this console: Flag, and anything that stops the
 * machine. Rose-orange, never solid red — nothing here deletes anything. */
.c-btn--flag {
  background: var(--c-flag-bg);
  border-color: var(--c-flag-line);
  color: var(--c-flag-ink);
}
/* The design's own small button is the inbox's Flag: 7px 11px, 11.5px, radius
 * 11, and a line box of 15px — 11.5px Manrope at `normal`, because the canvas
 * sets no line-height on it. `.c-btn`'s 1.2 gives 13.8 and the button lands
 * 29.8px tall against the design's 31; it is written here in pixels because 15
 * is what was measured, not a ratio anybody chose. */
.c-btn--sm {
  padding: var(--c-sp-5) var(--c-sp-8);
  font-size: var(--c-t-s);
  line-height: 15px;
  border-radius: var(--c-r-input);
}

/* ── 5.8 CHIP, TAG, PILL ─────────────────────────────────────────────────────
 * Three small things and they are NOT interchangeable.
 *
 * CHIP is a control — a filter, a segment. It is an <a> so it survives
 * JavaScript being off, and the selected one is the canvas's dark chip.
 *   <a class="c-chip blk" href="?filter=unanswered">Unanswered</a>
 *   <a class="c-chip blk is-on" href="?filter=all" aria-current="true">All</a>
 *
 * TAG is a fact about a row. Not clickable, ever.
 *   <span class="c-tag">subscriber</span>
 *   <span class="c-tag c-tag--vip">VIP</span>
 *   <span class="c-tag c-tag--dashed">+ tag</span>
 *
 * PILL is a figure — money, a count — set in the mono face.
 *   <span class="c-pill">$12.20</span>
 *   <span class="c-pill c-pill--paid">$8.00</span>
 */
.c-chip {
  display: inline-block;
  padding: var(--c-sp-3) var(--c-sp-7);
  border-radius: var(--c-r-chip);
  background: var(--c-sunk-2);
  color: var(--c-muted);
  font-size: var(--c-t-s);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.c-chip:hover { background: var(--c-disc); color: var(--c-muted); }
.c-chip.is-on { background: oklch(0.24 0.01 60); color: var(--c-white); }
.c-chip.is-on:hover { background: oklch(0.24 0.01 60); color: var(--c-white); }

.c-tag {
  display: inline-block;
  padding: var(--c-sp-2) var(--c-sp-6);
  border-radius: var(--c-r-m);
  background: var(--c-sunk-2);
  border: 1px solid var(--c-line-2);
  font-size: var(--c-t-s);
  font-weight: 600;
  white-space: nowrap;
}
.c-tag--vip {
  background: var(--c-warn);
  border-color: transparent;
  color: var(--c-warn-ink);
  font-size: var(--c-t-micro);
  letter-spacing: var(--c-ls-tag);
  font-weight: 700;
  border-radius: var(--c-r-xs);
  padding: var(--c-sp-1) var(--c-sp-3);
}
.c-tag--dashed { background: none; border: 1px dashed var(--c-line-dash); color: var(--c-muted-4); }

.c-pill {
  display: inline-block;
  font-family: var(--c-mono);
  font-size: var(--c-t-s);
  font-weight: 500;
  padding: var(--c-sp-1) var(--c-sp-4);
  border-radius: var(--c-r-s);
  background: var(--c-sunk-2);
  color: var(--c-muted);
  white-space: nowrap;
}
.c-pill--paid { background: var(--c-warn-2); color: var(--c-warn-ink); }
.c-pill--plain { background: none; padding: 0; }

/* ── 5.9 BADGE ───────────────────────────────────────────────────────────────
 * A count beside a heading, not on the rail (that one is `.rail-badge`).
 *
 *   <h2 class="c-card-title">Alerts <span class="c-badge c-badge--danger">3</span></h2>
 */
.c-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  padding: 0 var(--c-sp-3);
  height: 18px;
  border-radius: var(--c-r-chip);
  background: var(--c-disc);
  color: var(--c-muted);
  font-size: var(--c-t-tiny);
  font-weight: 700;
  line-height: 1;
}
.c-badge--warn   { background: var(--c-warn);   color: var(--c-warn-ink); }
.c-badge--danger { background: var(--c-accent); color: var(--c-white); }
.c-badge--go     { background: var(--c-go-soft); color: var(--c-go-ink-2); }

/* ── 5.10 INLINE STATUS ──────────────────────────────────────────────────────
 * A dot and a sentence: is the daemon beating, did that send leave, is this
 * chat claimed. The dot is `aria-hidden`; the words carry the meaning, because
 * a colour on its own is not something everybody can read.
 *
 *   <span class="c-status c-status--go">
 *     <span class="c-status-dot" aria-hidden="true"></span>Running
 *   </span>
 *
 * `--live` pulses, and ONLY on something that is genuinely happening right now.
 * A pulse over a stopped daemon is the console lying with an animation.
 */
.c-status {
  display: inline-flex;
  align-items: center;
  gap: var(--c-sp-5);
  font-size: var(--c-t-s);
  font-weight: 600;
  color: var(--c-muted-4);
}
.c-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-faint); flex: 0 0 auto; }
.c-status--go     { color: var(--c-go-ink-2); }
.c-status--go     .c-status-dot { background: var(--c-go-dot); }
.c-status--warn   { color: var(--c-warn-ink); }
.c-status--warn   .c-status-dot { background: var(--c-warn-ink); }
.c-status--danger { color: var(--c-flag-ink); }
.c-status--danger .c-status-dot { background: var(--c-flag); }
.c-status--live .c-status-dot { animation: pulse 1.8s ease-in-out infinite; }

/* ── 5.11 TABLE ──────────────────────────────────────────────────────────────
 * A grid, not a <table>, because every row on this console is a link or holds
 * one. The column widths belong to the screen: set them on BOTH the head and
 * the row with an inline `style="grid-template-columns:…"` — the CSP carries
 * `style-src 'self' 'unsafe-inline'` for exactly this.
 *
 *   <div class="c-card c-card--flush">
 *     <div class="c-thead" style="grid-template-columns:1.6fr 0.8fr 0.7fr">
 *       <div>Fan</div><div>Spend</div><div class="c-right">AI</div>
 *     </div>
 *     <div class="c-tr" style="grid-template-columns:1.6fr 0.8fr 0.7fr">
 *       <a class="blk c-cell-name" href="…">…</a>
 *       <div class="c-pill c-pill--plain">$12.20</div>
 *       <div class="c-right">…</div>
 *     </div>
 *   </div>
 *
 * AN EMPTY TABLE PRINTS A SENTENCE, never an empty box: see `.c-empty`.
 */
.c-thead {
  display: grid;
  gap: var(--c-sp-9);
  padding: var(--c-sp-9) var(--c-sp-12);
  background: var(--c-sunk);
  border-bottom: 1px solid var(--c-line-2);
  font-size: var(--c-t-eyebrow);
  font-weight: 700;
  letter-spacing: var(--c-ls-label);
  text-transform: uppercase;
  color: var(--c-muted-4);
}
.c-tr {
  display: grid;
  gap: var(--c-sp-9);
  padding: 13px var(--c-sp-12);
  border-bottom: 1px solid var(--c-line-4);
  align-items: center;
  font-size: var(--c-t-m);
}
.c-tr:last-child { border-bottom: 0; }
.c-tr--link { cursor: pointer; }
.c-tr--link:hover { background: oklch(0.972 0.004 60); }
.c-right { text-align: right; justify-self: end; }
.c-cell-name { display: flex; align-items: center; gap: var(--c-sp-7); min-width: 0; }
.c-cell-name b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-cell-name small {
  display: block;
  font-size: var(--c-t-xs);
  color: var(--c-muted-5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.c-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A KEY AND ITS VALUE, one per line, as the fan panel's Facts block draws them.
 *
 *   <div class="c-kv"><span class="c-kv-key">Fan since</span>
 *                     <span class="c-kv-val">Jul 2023</span></div>
 *   <div class="c-kv"><span class="c-kv-key">Avg tip</span>
 *                     <p class="c-refused-why c-kv-val">{{ why }}</p></div>
 */
.c-kv {
  display: flex;
  justify-content: space-between;
  gap: var(--c-sp-7);
  font-size: var(--c-t-m);
  padding: var(--c-sp-3) 0;
  border-bottom: 1px solid var(--c-line-3);
}
.c-kv-key { color: var(--c-muted-4); }
.c-kv-val { text-align: right; font-weight: 600; margin: 0; max-width: 200px; }

/* ── 5.12 AVATAR ─────────────────────────────────────────────────────────────
 * The initials disc. Its two colours are assigned per fan by
 * `queries.AVATAR_PAIRS` and arrive as inline `background`/`color`, exactly as
 * they do on `home.html` — there is no palette for them here on purpose.
 *
 *   <span class="c-av" style="background:{{ c.av_bg }};color:{{ c.av_fg }}">{{ c.initials }}</span>
 */
.c-av {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--c-t-xs);
  font-weight: 700;
}
.c-av--lg { width: 38px; height: 38px; font-size: 13px; }
.c-av--sm { width: 28px; height: 28px; }

/* ── 5.13 FORM CONTROLS ──────────────────────────────────────────────────────
 *   <label class="c-field">
 *     <span class="c-field-label">App id</span>
 *     <input class="c-input" name="FANVUE_CLIENT_ID" value="…">
 *     <span class="c-field-help">From the app you registered.</span>
 *   </label>
 *
 * A field whose value cannot be written prints why in `.c-field-help` and the
 * control carries `disabled aria-disabled="true" data-unavailable`.
 */
.c-field { display: flex; flex-direction: column; gap: var(--c-sp-6); }
.c-field-label { font-size: var(--c-t-s); color: var(--c-muted-2); }
.c-field-help {
  font-size: var(--c-t-s);
  line-height: 1.55;
  color: var(--c-muted-2);
  white-space: normal;
}
.c-input, .c-textarea, .c-select {
  width: 100%;
  padding: var(--c-sp-6) 13px;
  border-radius: var(--c-r-input);
  border: 1px solid var(--c-line-input);
  background: var(--c-sunk);
  font-size: var(--c-t-m);
  line-height: 1.5;
  outline: none;
}
.c-input:focus, .c-textarea:focus, .c-select:focus {
  border-color: var(--c-accent-line);
  background: var(--c-white);
}
/* A SINGLE-LINE FIELD IS THE DESIGN'S SEARCH BOX: 9px 12px at 13px, which is
 * 38px tall. The rule above is the TEXTAREA's (the design's own note box, 10px
 * at 12.5px) and a single-line input inheriting it came out 36.75px — so a
 * text box was one height on the inbox and another on every screen built from
 * this file. There is no 9px step on the design's spacing scale and inventing
 * one would be worse than the literal.
 *
 * `line-height: normal` is the design's too, and it is the last 1.5px: the
 * search box on the inbox sets no line-height at all, so it inherits `normal`
 * and stands 38px. Left at the textarea's 1.5 it came to 39.5. */
.c-input, .c-select { padding: 9px var(--c-sp-9); font-size: 13px; line-height: normal; }
/* AND THE HEIGHT IS STATED, not left to the padding. On /settings and /vault a
 * text field and a dropdown stand side by side in one form; with identical
 * padding, font-size and line-height the <select> still came out 36 against
 * the <input>'s 38, because a browser does not derive the two content boxes
 * the same way: an <input> gets the font's `normal` line box (line gap and
 * all), while a <select> is sized from its option row, which drops that gap —
 * and how much it drops depends on the font that is actually rendering, so the
 * gap opens and closes on whether Manrope has finished loading. Padding cannot
 * close a difference it never caused. 38px is the design's own single-line
 * field (`home.html`, the inbox search box) written as the literal it was
 * measured as, with `box-sizing: border-box` from the reset so the 9px padding
 * and the hairline live inside it. DO NOT "simplify" this back to padding
 * alone: it looks equal in whichever browser and font state you happen to
 * open, and diverges in the next one. */
.c-input, .c-select { height: 38px; }
.c-textarea { min-height: 74px; resize: vertical; }
.c-select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: var(--c-sp-16); }
/* Kept because `inbox.html` names it. It is now exactly `.c-input`: the search
 * box's numbers ARE the input's numbers, which is the point of the rule above.
 * A screen that says what a field is loses nothing by saying it. */
.c-input--search { padding: 9px var(--c-sp-9); font-size: 13px; }

/* ── 5.14 EMPTY STATE ────────────────────────────────────────────────────────
 * A SENTENCE, always, and never an empty box or a shrug. It says what would
 * have to happen for something to be here.
 *
 *   <p class="c-empty">No chats yet. They appear the moment the daemon reads
 *      one — the roster poll writes a row per fan.</p>
 *   <p class="c-empty c-empty--centred">Nothing is mirrored in this chat yet.</p>
 */
.c-empty {
  margin: 0;
  padding: var(--c-sp-15) var(--c-sp-12);
  font-size: var(--c-t-m);
  line-height: 1.55;
  color: var(--c-muted-4);
  white-space: normal;
}
.c-empty--centred { align-self: center; max-width: 70%; text-align: center; }

/* ── 5.15 MEDIA THUMB AND GRID ───────────────────────────────────────────────
 * The vault. A thumb that cannot be produced keeps its box and says why in it,
 * for the same reason a refused tile does.
 *
 *   <ul class="c-grid">
 *     <li class="c-thumb"><img src="/api/vault/thumb/x.jpg" alt=""></li>
 *     <li class="c-thumb c-thumb--none"><span>no thumbnail on disk</span></li>
 *   </ul>
 */
.c-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--c-sp-9);
}
.c-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--c-r-cell);
  border: 1px solid var(--c-line-2);
  background: var(--c-sunk-2);
  overflow: hidden;
}
.c-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-thumb--none {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--c-sp-7);
  text-align: center;
  font-size: var(--c-t-xs);
  line-height: 1.4;
  color: var(--c-muted-5);
}
/* The caption strip under a thumb. */
.c-thumb-say {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--c-sp-4) var(--c-sp-6);
  background: oklch(0.24 0.01 60 / 0.72);
  color: var(--c-white);
  font-size: var(--c-t-xs);
  font-weight: 600;
}

/* ── 5.16 BAR ────────────────────────────────────────────────────────────────
 * The proportion bar from "Where it comes from". Its width is a fact, so it is
 * an inline `width:` from the payload's own percentage — never a class.
 *
 *   <div class="c-bar"><span class="c-bar-fill" style="width:38%"></span></div>
 */
.c-bar { height: 7px; border-radius: 4px; background: var(--c-line-3); overflow: hidden; }
.c-bar-fill { display: block; height: 100%; border-radius: 4px; background: oklch(0.62 0.14 15 / 0.85); }
.c-bar--thin { height: 6px; border-radius: 3px; }
.c-bar--thin .c-bar-fill { border-radius: 3px; }

/* ── 5.17 THE NOSCRIPT STRIP ─────────────────────────────────────────────────
 * Drawn by `console.html` on every page. Amber, above the content, saying which
 * controls are dead and why.
 */
.c-noscript {
  padding: var(--c-sp-7) var(--c-sp-15);
  background: var(--c-warn-bg);
  border-bottom: 1px solid var(--c-warn-line);
  font-size: var(--c-t-s);
  line-height: 1.5;
  color: var(--c-warn-say);
  white-space: normal;
}

/* ── 5.18 THE AI SWITCH'S CONFIRMATION ───────────────────────────────────────
 * Drawn by `console.html` on every page, hidden until the operator reaches for
 * the switch with chats that would change hands. It is not decoration: the
 * switch releases the per-fan flags a typed reply used to set, and on the live
 * account that handed four conversations — two of them men the same screen had
 * just called "held for a person — left for you" — to a bot that answers
 * unattended, with nothing named anywhere.
 *
 * ONLY WHAT AN ATTRIBUTE CANNOT SAY IS HERE. The panel's colours and rhythm are
 * inline in the template, like every other structural value in this port; a
 * fixed overlay, a scroll container and a hover state are not things a `style="`
 * can express once, so they are here.
 *
 * `[hidden]` is stated explicitly. The panel is a flex container, and `display:
 * flex` in this rule would otherwise beat the browser's own `display: none` for
 * `[hidden]` — the failure that puts a modal scrim over every page of the
 * console permanently, with the switch behind it unclickable.
 */
.ai-confirm {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--c-sp-15);
  background: oklch(0.24 0.01 60 / 0.34);
}
.ai-confirm[hidden] { display: none; }
.ai-confirm-panel {
  width: min(560px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--c-sp-9);
  padding: var(--c-sp-13) var(--c-sp-14);
  border: 1px solid var(--c-line-2);
  border-radius: 16px;
  background: var(--c-white);
  /* The header this sheet covers sets `white-space: nowrap` on everything
   * inside it. A confirmation is sentences, and a sentence that cannot wrap is
   * a sentence the operator reads the first eight words of. */
  white-space: normal;
  box-shadow: 0 18px 48px oklch(0.2 0.01 60 / 0.22);
}
/* One chat that would change hands: the tick box, his name, his own words. */
.ai-confirm-row {
  display: flex;
  align-items: flex-start;
  gap: var(--c-sp-7);
  padding: var(--c-sp-7) var(--c-sp-8);
  border: 1px solid var(--c-line-2);
  border-radius: 11px;
  background: var(--c-sunk);
  cursor: pointer;
}
.ai-confirm-row:hover { background: var(--c-sunk-2); }
/* THE TICKED ROW IS DRAWN AS KEPT, and not by hue alone: an operator scanning
 * four rows for the one he ticked needs the row to look different, not just the
 * 15px box in it. `:has` is unsupported in nothing this console runs on
 * (Chromium app window), and where it is unsupported the checkbox still shows
 * the state — the styling is the second cue, never the only one. */
.ai-confirm-row:has(.ai-keep:checked) {
  background: var(--c-white);
  border-color: oklch(0.85 0.09 40);
}

/* ── IS THE MACHINE RUNNING, ON EVERY SCREEN, BESIDE THE SWITCH ──────────────
 *
 * "i still cant see what chats have AI enabled and are actively scanning for
 * chats, maybe add a little symbol in the chat list on each person who has AI
 * enabled and a little green dot to show its actively working"
 *
 * The per-row chip answers the first half. This answers the second, and it is
 * the half the Inbox could not answer at all: `_banner.html` is included only
 * by the retired dark shell, so with the daemon stopped the header read
 * "AI chatting · all chats / replying in all 13 chats" over thirteen green
 * chips while `/activity`, on the same heartbeat, read "The daemon is stopped".
 *
 * FOUR STATES, `service.machine_state`'s OWN, and never a fifth composed here:
 * the label and the sentence are the same strings the Live log prints at the
 * top of its feed. `data-working` is the one thing this sheet branches on for
 * the dot, because `working` is not `live` — the daemon goes on checking for
 * messages with AI replies off, and a dot that went out then would be the next
 * lie in the other direction.
 */
.c-machine {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--c-sp-4);
  padding: var(--c-sp-3) var(--c-sp-7);
  border-radius: var(--c-r-chip);
  border: 1px solid var(--c-line-2);
  background: var(--c-sunk);
  font-size: var(--c-t-xs);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The dot. Solid and pulsing only while something is genuinely reading the
 * inbox; a flat grey disc otherwise, so a stopped daemon can never show green. */
.c-machine-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-line-strong);
}
.c-machine[data-working="1"] .c-machine-dot {
  background: var(--c-go-dot);
  animation: pulse 1.8s ease-in-out infinite;
}
/* The tones are the log header's, so one machine has one colour everywhere. */
.c-machine[data-tone="good"]  { background: var(--c-go-soft);  border-color: var(--c-go-line);   color: var(--c-go-ink-2); }
.c-machine[data-tone="quiet"] { background: var(--c-sunk);     border-color: var(--c-line-2);    color: var(--c-muted-2); }
.c-machine[data-tone="warn"]  { background: var(--c-warn-2);   border-color: var(--c-warn-line); color: var(--c-warn-ink-2); }
.c-machine[data-tone="bad"]   { background: var(--c-flag-bg);  border-color: var(--c-flag-line); color: var(--c-flag-ink); }
