/* Cerebrate's site: ONE stylesheet for every page (DragonDesk's rule, desk.css). Pages add no
   <style> of their own; a new look is a new class here.

   The look is EODE's, because Cerebrate watches EODE and the same people use both: every value
   below is copied from maestro frontend/src/styles/tokens.css (origin/monorepo, 2026-10-30) unless
   it is marked "Cerebrate". Dark is the default, as in EODE. Every colour carries one meaning:
   --accent is the only interactive colour, --success / --warning / --error are status only, and
   each kind of chat event has its own hue (the "thread" below, after DragonDesk's thread colours).
   Text pairs are >= 4.5:1 and control borders >= 3:1 in both themes (measured; the site gets a
   contrast test, as DragonDesk's tests/test_contrast.py and EODE's tokens.contrast.test.ts do).

   The site and the mockups (docs/mockups) both use this file. No fonts are loaded yet: the stacks
   name EODE's faces first and fall back to the system's. The site will self-host them (no
   third-party request), licences checked first. */

/* --- tokens: dark (default) ------------------------------------------------------------------ */
:root {
  color-scheme: dark;
  --bg: #0e1218; --panel: #141a22; --panel-2: #1c2430; --divider: #222b36;
  --chip: #171e27; --chip-line: #2d3846; --header: #0b0f15;
  --ink-primary: #e7edf3; --ink-secondary: #b3c0cc; --ink-tertiary: #7f8fa1;
  --accent: #5b9bdb; --accent-hover: #76afe6; --accent-text: #76afe6; --accent-subtle: #16202e;
  /* Cerebrate: a control's own border. EODE's --accent-border is a card ring (1.67:1 on
     --panel-2), too faint to find an input by; this clears 3:1 on every surface. */
  --control-border: #66768a;
  --success: #4cc47a; --warning: #e1a33a; --error: #f06a61;
  --chart-1: #4a8bd8; --chart-2: #bd6a3f; --chart-3: #a2921f;
  --chart-4: #2fa08a; --chart-5: #9673c9; --chart-6: #c26582;
  --panel-glow: 0 1px 2px rgba(0, 0, 0, 0.28);
  /* The thread (Cerebrate): one hue per kind of event, a tinted card, a 3px bar and a label in
     the same hue. Person = teal (chart-4), Claude = violet (accent-2; DragonDesk's "anything
     Claude wrote"), model call = steel (brand-teal), tool = ochre (chart-2). */
  --k-user-bg: #14231f; --k-user-line: #2fa08a; --k-user-ink: #5cc9ad;
  --k-ai-bg: #1b1928; --k-ai-line: #9673c9; --k-ai-ink: #b9a0e6;
  --k-model-bg: #151c25; --k-model-line: #8eb6d8; --k-model-ink: #8eb6d8;
  --k-tool-bg: #211a17; --k-tool-line: #bd6a3f; --k-tool-ink: #e09a72;
  /* The environment pill (Cerebrate): production must never be mistaken for a test system. */
  --env-prod-bg: #3a1714; --env-prod-ink: #ff9d94; --env-test-bg: #16202e; --env-test-ink: #76afe6;
  --radius-sm: 1px; --radius: 2px; --radius-lg: 4px;
  --sans: "General Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Cabinet Grotesk", var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* THE width (DragonDesk's --sheet-w): edge to edge on a small screen, 1100px on a laptop, then
     82% of the window up to 1800px. Header and page line up on it. */
  --page-w: max(min(1100px, 100% - 24px), min(82vw, 1800px));
}

/* --- tokens: light (EODE html.light) --------------------------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f4; --panel: #ffffff; --panel-2: #f5f7fa; --divider: #dde3e8;
  --chip: #eef2f5; --chip-line: #ccd5dd; --header: #ffffff;
  --ink-primary: #18232d; --ink-secondary: #4d5d68; --ink-tertiary: #636f79;
  --accent: #2563a9; --accent-hover: #1f5591; --accent-text: #1f5591; --accent-subtle: #e7f0fa;
  --control-border: #7d8994;
  --success: #2d794c; --warning: #8f5b12; --error: #b2443d;
  --chart-1: #2f6db3; --chart-2: #ad5535; --chart-3: #96851f;
  --chart-4: #0e8a70; --chart-5: #7a5aa8; --chart-6: #a5506e;
  --panel-glow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --k-user-bg: #ebf6f2; --k-user-line: #0e8a70; --k-user-ink: #0a6553;
  --k-ai-bg: #f3effa; --k-ai-line: #7a5aa8; --k-ai-ink: #5d4387;
  --k-model-bg: #eef3f7; --k-model-line: #4b6f8a; --k-model-ink: #3c5a71;
  --k-tool-bg: #fbf0ea; --k-tool-line: #ad5535; --k-tool-ink: #8a4027;
  --env-prod-bg: #fbe7e5; --env-prod-ink: #9a2f29; --env-test-bg: #e7f0fa; --env-test-ink: #1f5591;
}

/* --- the page -------------------------------------------------------------------------------- */
/* EODE's base is 14px; DragonDesk's type grows with the window. Both: 14px up to ~1400px wide,
   at most 16px. Every size below is in rem, so it all moves together. */
html { font-size: clamp(14px, 9.5px + 0.34vw, 16px); scrollbar-gutter: stable; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink-primary);
  font: 1rem/1.5 var(--sans);
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-family: var(--display); font-size: 1.6rem; font-weight: 700; margin: 0 0 0.25rem; }
h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 700; margin: 1.6rem 0 0.6rem; }
.muted { color: var(--ink-secondary); }
.faint { color: var(--ink-tertiary); }
.mono, .num { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.when { font: 0.88rem var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--ink-secondary); }
/* EODE's "zone meta label": small mono capitals. */
.meta { font: 500 0.72rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-tertiary); }

/* --- header ---------------------------------------------------------------------------------- */
.top { background: var(--header); border-bottom: 1px solid var(--divider); }
.top-in { width: var(--page-w); margin: 0 auto; height: 3.2rem; display: flex; align-items: center;
  gap: 1.4rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-primary);
  font: 700 1.05rem var(--display); }
.brand:hover { text-decoration: none; color: var(--ink-primary); }
/* The mark, inlined (assets/make_mark.py): its burrows take the header's own colours, so it
   digs into whichever theme is showing. The tendrils keep the brand cyan. */
.brand .cb-mark { width: 2.3rem; height: 2.3rem; overflow: visible;
  --cb-surface: var(--header); --cb-hole: #000000; --cb-lip: #2c3949;
  --cb-ridge-hi: #2a3646; --cb-ridge-lo: #000000;
  --cb-tendril: #44c6e9; --cb-tendril-deep: #2a86b0; --cb-core-edge: #44c6e9; }
:root[data-theme="light"] .brand .cb-mark {
  --cb-hole: #5d6b68; --cb-lip: #ffffff; --cb-ridge-hi: #ffffff; --cb-ridge-lo: #b7c0c8;
  --cb-tendril: #1d84b5; --cb-tendril-deep: #1b5f99; --cb-core-edge: #1d84b5; }
.cb-pit { fill: var(--cb-hole); opacity: .35; filter: url(#cb-soft); }
.cb-hole { fill: var(--cb-hole); }
.cb-lip { fill: none; stroke: var(--cb-lip); stroke-linecap: round; }
.cb-ridge-hi { fill: none; stroke: var(--cb-ridge-hi); stroke-linecap: round; }
.cb-ridge-lo { fill: none; stroke: var(--cb-ridge-lo); stroke-linecap: round; opacity: .55; }
.cb-tendril { fill: url(#cb-flesh); }
.cb-near { stop-color: var(--cb-tendril); }
.cb-far { stop-color: var(--cb-tendril-deep); }
.cb-membrane { fill: url(#cb-flesh); }
.cb-core { fill: url(#cb-core); }
.cb-fold { fill: none; stroke: var(--cb-core-edge); stroke-width: 1.6; stroke-linecap: round; opacity: .42; }
.nav { display: flex; gap: 0.2rem; }
.nav a { color: var(--ink-secondary); padding: 0.4rem 0.7rem; border-radius: var(--radius); }
.nav a:hover { color: var(--ink-primary); background: var(--panel-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink-primary); background: var(--accent-subtle);
  box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 0.8rem; }
.env { font: 600 0.78rem/1 var(--mono); padding: 0.35rem 0.55rem; border-radius: var(--radius); }
.env-prod { background: var(--env-prod-bg); color: var(--env-prod-ink); }
.env-test { background: var(--env-test-bg); color: var(--env-test-ink); }
.who { color: var(--ink-secondary); font-size: 0.9rem; }
.btn { font: inherit; font-size: 0.9rem; color: var(--ink-primary); background: var(--panel-2);
  border: 1px solid var(--control-border); border-radius: var(--radius); padding: 0.35rem 0.7rem;
  cursor: pointer; }
.btn:hover { border-color: var(--accent); }
a.btn { display: inline-block; text-decoration: none; }
/* The one call to action on a page (sign-in). Page-colour text on the accent: 6.4:1 dark,
   5.6:1 light. */
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover);
  color: var(--bg); }
.signout { display: inline; margin: 0; }

/* --- layout ---------------------------------------------------------------------------------- */
main { width: var(--page-w); margin: 1.4rem auto 3rem; }
.crumbs { font-size: 0.9rem; color: var(--ink-tertiary); margin-bottom: 0.6rem; }
.head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head .sub { color: var(--ink-secondary); }
.panel { background: var(--panel); border: 1px solid var(--divider); border-radius: var(--radius);
  box-shadow: var(--panel-glow); }
/* The notice that a read is recorded (security: every conversation opened is audited). */
.notice { display: flex; gap: 0.6rem; align-items: center; padding: 0.55rem 0.8rem;
  background: var(--panel-2); border: 1px solid var(--divider); border-left: 3px solid var(--accent);
  border-radius: var(--radius); color: var(--ink-secondary); font-size: 0.9rem; margin-bottom: 1rem; }

/* --- filters --------------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: end; padding: 0.8rem;
  margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field input, .field select { font: inherit; font-size: 0.9rem; color: var(--ink-primary);
  background: var(--chip); border: 1px solid var(--control-border); border-radius: var(--radius);
  padding: 0.35rem 0.5rem; min-width: 9rem; }
.check { display: flex; gap: 0.4rem; align-items: center; color: var(--ink-secondary);
  font-size: 0.9rem; padding-bottom: 0.4rem; }

/* --- KPI row --------------------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.6rem;
  margin-bottom: 1rem; }
.kpi { padding: 0.7rem 0.85rem; }
.kpi .v { font: 700 1.45rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.kpi .v small { font: 500 0.8rem var(--mono); color: var(--ink-tertiary); margin-left: 0.2rem; }

/* --- tables ---------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { font: 500 0.72rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-tertiary); text-align: left; padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--divider); position: sticky; top: 0; background: var(--panel); }
th.num { text-align: right; }
td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--divider); vertical-align: top; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
.id { font: 0.85rem var(--mono); color: var(--ink-secondary); white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0.7rem;
  border-top: 1px solid var(--divider); color: var(--ink-tertiary); font-size: 0.88rem; }

/* --- chips ----------------------------------------------------------------------------------- */
.chip { display: inline-block; font: 500 0.75rem/1.3 var(--mono); padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm); background: var(--chip); border: 1px solid var(--chip-line);
  color: var(--ink-secondary); white-space: nowrap; }
.chip-fail { color: var(--error); border-color: var(--error); }
.chip-ok { color: var(--success); border-color: var(--success); }
.chip-off { color: var(--ink-tertiary); border-style: dashed; }

/* --- the thread: one conversation, turn by turn ---------------------------------------------- */
.turn { margin-bottom: 1.4rem; }
.turn-head { display: flex; gap: 0.8rem; align-items: baseline; margin-bottom: 0.5rem; }
.turn-head .meta { color: var(--ink-tertiary); }
.ev { border-left: 3px solid; border-radius: var(--radius); padding: 0.6rem 0.85rem;
  margin: 0 0 0.45rem; }
.ev-label { font: 600 0.72rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  display: flex; gap: 0.8rem; align-items: baseline; flex-wrap: wrap; }
.ev-label .facts { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-secondary); }
/* A tool's name is an identifier: shown exactly as the CLI reported it, never re-cased. */
.ev-label .name { letter-spacing: 0; text-transform: none; }
.ev-body { margin-top: 0.35rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-user { background: var(--k-user-bg); border-color: var(--k-user-line); }
.ev-user .ev-label { color: var(--k-user-ink); }
.ev-ai { background: var(--k-ai-bg); border-color: var(--k-ai-line); }
.ev-ai .ev-label { color: var(--k-ai-ink); }
.ev-model { background: var(--k-model-bg); border-color: var(--k-model-line); padding: 0.4rem 0.85rem; }
.ev-model .ev-label { color: var(--k-model-ink); }
.ev-tool { background: var(--k-tool-bg); border-color: var(--k-tool-line); }
.ev-tool .ev-label { color: var(--k-tool-ink); }
.ev-tool.failed { border-color: var(--error); }
/* A tool's input and output: closed by default, bounded when open. */
details { margin-top: 0.35rem; }
summary { cursor: pointer; color: var(--ink-secondary); font-size: 0.88rem; }
summary:hover { color: var(--ink-primary); }
pre { font: 0.82rem/1.5 var(--mono); background: var(--chip); border: 1px solid var(--chip-line);
  border-radius: var(--radius); padding: 0.55rem 0.7rem; margin: 0.35rem 0 0; max-height: 22rem;
  overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-primary); }
/* Content the CLI exported with its content switch off: the count survives, the words do not. */
.not-captured { color: var(--ink-tertiary); font-style: italic; }

/* --- small screens --------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .top-in { height: auto; flex-wrap: wrap; padding: 0.5rem 0; gap: 0.6rem; }
  .top-right { margin-left: 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}

/* --- the mark at full size (logo.html) ------------------------------------------------------- */
.mark-stage { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.cb-mark-big { width: min(30rem, 90vw); height: auto; overflow: visible;
  --cb-surface: var(--bg); --cb-hole: #000000; --cb-lip: #2c3949;
  --cb-ridge-hi: #2a3646; --cb-ridge-lo: #000000;
  --cb-tendril: #44c6e9; --cb-tendril-deep: #2a86b0; --cb-core-edge: #44c6e9; }
:root[data-theme="light"] .cb-mark-big {
  --cb-hole: #5d6b68; --cb-lip: #ffffff; --cb-ridge-hi: #ffffff; --cb-ridge-lo: #b7c0c8;
  --cb-tendril: #1d84b5; --cb-tendril-deep: #1b5f99; --cb-core-edge: #1d84b5; }
