:root {
  color-scheme: dark;


  /* T376 (doc 57): console glow — additive; consumed by the shell background. */
  --ui-glow-1: rgb(0 212 255 / 0.055);
  --ui-glow-2: rgb(0 212 255 / 0.03);
  /* T374 (doc 57): type system tokens — consumed by the shell row (S2). */
  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 30px;
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* Token audit (18 Aug, doc 65): --mono was referenced (dock transparency
     panel, terminal-capture log) with no fallback, so those elements
     silently rendered in the UI sans font instead of the machine-layer
     mono — alias to the real token rather than duplicate it. */
  --mono: var(--font-mono);
  --speed: 140ms;
  --ui-bg: #08111d;
  --ui-panel: #0d1928;
  --ui-raised: #132238;
  --ui-hover: #182a42;
  --ui-line: #263a52;
  --ui-line-soft: #182a3d;
  /* T485 (doc 57/65): the prototype's literal --ui-panel/--ui-line — a truly
     translucent glass tint meant to sit under backdrop-filter:blur(), not an
     opaque card color. Our own --ui-panel/--ui-line were long ago repurposed
     as opaque, solid surface colors consumed by hundreds of cards app-wide,
     so they cannot be redefined to this value without a much bigger fidelity
     project. Any surface that wants the prototype's actual glass-drawer look
     (currently: the launch panel) should reference --ui-glass/--ui-glass-line
     instead, e.g. by locally overriding --ui-panel:var(--ui-glass) within its
     own scope so its descendants (which already read --ui-panel) pick it up. */
  --ui-glass: rgba(255, 255, 255, 0.028);
  --ui-glass-line: rgba(255, 255, 255, 0.075);
  --ui-glass-line-soft: rgba(255, 255, 255, 0.05);
  --ui-line-strong: color-mix(in srgb, var(--ui-line) 78%, var(--ui-text));
  --ui-text: #f8fbff;
  --ui-text-soft: #a7b5c8;
  --ui-muted: #718198;
  --ui-text-muted: var(--ui-muted); /* fidelity fix: some shell rules reference --ui-text-muted, which was never defined, so it inherited full text color instead of muted grey */
  --ui-accent: #00d4ff;
  --ui-accent-soft: rgb(0 212 255 / 0.1);
  --ui-primary: #00d4ff;
  --ui-primary-text: #06111b;
  --ui-success: #39ff6e;
  --ui-success-text: #06140c;
  --ui-success-soft: rgb(57 255 110 / 0.1);
  --ui-warning: #ffb000;
  --ui-warning-soft: rgb(255 176 0 / 0.11);
  --ui-danger: #ff7a86;
  --ui-shadow: 0 2rem 6rem rgb(0 0 0 / 0.25);
  --ui-shadow-sm: 0 0.5rem 1.5rem rgb(0 0 0 / 0.16);
  --ui-panel-soft: color-mix(in srgb, var(--ui-panel) 84%, var(--ui-bg));
  --ui-input: color-mix(in srgb, var(--ui-bg) 82%, #000);
  --ui-inset: color-mix(in srgb, var(--ui-bg) 90%, transparent);
  --ui-muted-surface: color-mix(in srgb, var(--ui-bg) 72%, transparent);
  --ui-muted-surface-strong: color-mix(in srgb, var(--ui-bg) 84%, transparent);
  --ui-text-prose: color-mix(in srgb, var(--ui-text) 86%, var(--ui-text-soft));
  --ui-accent-faint: color-mix(in srgb, var(--ui-accent) 4.5%, transparent);
  --ui-accent-medium: color-mix(in srgb, var(--ui-accent) 18%, transparent);
  /* Token audit (18 Aug, doc 65): --ui-accent-line was referenced (approvals
     capability-grant border) with no fallback but was never defined — every
     other state color in this family (success/warning/danger) already has
     a -line variant; this closes the gap at the same 40% the warning
     sibling uses. */
  --ui-accent-line: color-mix(in srgb, var(--ui-accent) 40%, transparent);
  --ui-success-line: color-mix(in srgb, var(--ui-success) 45%, transparent);
  --ui-warning-line: color-mix(in srgb, var(--ui-warning) 40%, transparent);
  --ui-danger-soft: color-mix(in srgb, var(--ui-danger) 12%, transparent);
  --ui-danger-line: color-mix(in srgb, var(--ui-danger) 45%, transparent);
  --ui-neutral-soft: color-mix(in srgb, var(--ui-muted) 14%, transparent);
  --ui-neutral-line: color-mix(in srgb, var(--ui-muted) 30%, transparent);
  /* T486 (doc 57/65 round 4): --ui-chip-bg was referenced by agent-tag chips
     with fallbacks guessed per call site
     instead of a real token — the token-audit commit (4dcabe0a) deferred
     this one because workforce/multi-dock.css were being actively landed;
     same concept as --ui-neutral-soft above, alias rather than duplicate. */
  --ui-chip-bg: var(--ui-neutral-soft);
  /* Token audit (18 Aug, doc 65): --ui-surface-soft was referenced (workforce
     idle chip, session-ended note, ended-dock-column header) with no
     fallback at all — a fully transparent background, not just off-brand.
     Deferred at the token-audit round (4dcabe0a) pending the workforce lane
     clearing; that lane has been quiet since T444, so closing it here.
     Same "quiet neutral wash" concept as --ui-neutral-soft, alias not
     duplicate. */
  --ui-surface-soft: var(--ui-neutral-soft);
  --ui-shadow-color: rgb(0 0 0 / 0.22);
  /* Token audit: --ui-ok/--ui-warn were referenced (agent state dots, file-
     reference freshness chips, files-index health) with a hardcoded
     non-theme-aware hex fallback (#2f7d4a / #a15c12, matching neither
     theme's real success/warning color) because they were never defined —
     alias to the real tokens so these states go theme-correct. */
  --ui-ok: var(--ui-success);
  --ui-warn: var(--ui-warning);
  /* --ui-border was referenced (files pinned/search dividers) with no
     fallback in some call sites and a guessed rgba in others; it's used
     identically to --ui-line everywhere it appears — alias it. */
  --ui-border: var(--ui-line);
  /* files-new's tree card radius already falls back to 18px, the
     prototype's literal --ui-radius (mf.css) — defining it here just
     removes the undefined-property gap; it does not change any rendering
     (the fallback and this value are identical). --ui-radius-sm/-md/-lg
     are NOT added here: their only consumer is workforce/multi-dock.css
     (a concurrently-owned surface this round deliberately avoids), and the
     prototype only defines a base --ui-radius + --ui-radius-sm (12px) —
     -md/-lg have no prototype source value at all. See doc-65 audit log. */
  --ui-radius: 18px;
  /* T486 (doc 57/65 round 4): the other half of the audit commit's deferred
     radius trio, now that this lane's own round has landed. --ui-radius-sm
     is the prototype's literal (mf.css) — used for medium cards/popovers,
     never for tiny ~30px controls (those get a concrete small literal at
     their call site instead; see multi-dock.css). --ui-radius-md/-lg are
     deliberately still not defined: the audit found no prototype source
     value for either, and inventing one here would just relocate the same
     guess from a CSS fallback into tokens.css. Their remaining call sites
     were replaced with concrete per-rule values instead (multi-dock.css);
     no dangling var() refs are left in this lane. */
  --ui-radius-sm: 12px;
  /* Operator-ratified shell delta: production needs a roomier expanded rail. */
  --ui-sidebar-expanded: 12.75rem;
  --ui-sidebar-collapsed: 4.2rem;
  --ui-topbar-height: 4rem;
  --cc-visual-viewport-height: 100dvh;
  --cc-visual-viewport-top: 0px;
  --cc-visual-viewport-bottom: 0px;

  /* T320 global layer law: content < bar < drawer < modal/sheet < popover/status. */
  --cc-z-content: 0;
  --cc-z-bar: 40;
  --cc-z-drawer-scrim: 50;
  --cc-z-drawer: 60;
  --cc-z-modal-scrim: 80;
  --cc-z-modal: 90;
  --cc-z-popover: 110;
  --cc-z-status: 120;
  --cc-z-system: 130;

  /* Legacy feature aliases. New shell/components use only --ui-* tokens. */
  --bg: var(--ui-bg);
  --navy: #1d283a;
  --card: color-mix(in srgb, var(--ui-panel) 92%, transparent);
  --card-child: color-mix(in srgb, var(--ui-raised) 72%, transparent);
  --card-2: var(--ui-raised);
  --system-card: color-mix(in srgb, var(--ui-panel) 84%, var(--ui-bg));
  --line: var(--ui-line);
  --line-faint: var(--ui-line-soft);
  --txt: var(--ui-text);
  --txt-soft: var(--ui-text-soft);
  --txt-prose: color-mix(in srgb, var(--ui-text) 86%, var(--ui-text-soft));
  --dim: var(--ui-muted);
  --slate: var(--ui-muted);
  --idle-txt: var(--ui-text-soft);
  --green: var(--ui-success);
  --amber: var(--ui-warning);
  --red: var(--ui-danger);
  --cyan: var(--ui-accent);
  --blue: var(--ui-accent);
  /* Token audit (18 Aug, doc 65): five more legacy-alias names in the same
     family, referenced around the codebase (engine picker checkmark,
     settings default-engine outline, gateway-status danger/warning panels,
     settings muted meta text) but never defined — each fell back to a
     hardcoded, non-theme-aware hex guess (or nothing at all) instead of
     tracking the real theme token like their --green/--amber/--red/--cyan
     siblings already do. */
  --accent: var(--ui-accent);
  --danger: var(--ui-danger);
  --warning: var(--ui-warning);
  --warn: var(--ui-warning);
  --good: var(--ui-success);
  --muted: var(--ui-muted);
  --text-secondary: var(--ui-text-soft);
  --text-tertiary: var(--ui-muted);
  --purple: #9ba9bd;
  --claude: #c4b5fd;
  --preview-surface: color-mix(in srgb, var(--ui-bg) 88%, #000);
  --topbar-bg: var(--ui-panel);
  --tabbar-bg: var(--ui-panel);
  --panel-bg: var(--ui-panel);
  --drawer-bg: var(--ui-panel);
  --overlay-bg: rgb(5 8 14 / 0.8);
  --button-bg: color-mix(in srgb, var(--ui-text) 4%, transparent);
  --primary-ink: var(--ui-primary-text);
  --primary-hover: color-mix(in srgb, var(--ui-primary) 78%, white);
  --muted-bg: color-mix(in srgb, var(--ui-bg) 72%, transparent);
  --muted-bg-strong: color-mix(in srgb, var(--ui-bg) 84%, transparent);
  --inset-bg: color-mix(in srgb, var(--ui-bg) 90%, transparent);
  --inset-soft: color-mix(in srgb, var(--ui-bg) 78%, transparent);
  --drop-bg: color-mix(in srgb, var(--ui-panel) 90%, transparent);
  --conversation-shell: color-mix(in srgb, var(--ui-panel) 84%, var(--ui-bg));
  --conversation-bg: color-mix(in srgb, var(--ui-raised) 72%, var(--ui-bg));
  --composer-bg: color-mix(in srgb, var(--ui-panel) 82%, var(--ui-bg));
  --status-bg: color-mix(in srgb, var(--ui-panel) 72%, var(--ui-bg));
  --transcript-agent-bg: color-mix(in srgb, var(--ui-text) 4%, transparent);
  --operator-txt: color-mix(in srgb, var(--ui-accent) 24%, var(--ui-text));
  --tool-bg: color-mix(in srgb, var(--ui-bg) 68%, transparent);
  --tool-txt: var(--ui-text-soft);
  --tool-hover-txt: var(--ui-text);
  --tool-pre-bg: color-mix(in srgb, var(--ui-bg) 82%, transparent);
  --tool-pre-txt: var(--ui-text-soft);
  --input-bg: var(--ui-input);
  --code-bg: var(--ui-raised);
  --code-deep: color-mix(in srgb, var(--ui-bg) 90%, #000);
  --paper: #fff;
  --accent-faint: color-mix(in srgb, var(--ui-accent) 4.5%, transparent);
  --accent-soft: var(--ui-accent-soft);
  --accent-medium: color-mix(in srgb, var(--ui-accent) 18%, transparent);
  --accent-border: color-mix(in srgb, var(--ui-accent) 40%, transparent);
  --accent-strong: color-mix(in srgb, var(--ui-accent) 65%, transparent);
  --positive-soft: var(--ui-success-soft);
  /* Token audit: --green-soft (harness chip background, .hn-deepagents) had
     no fallback at all and is the same concept as --positive-soft above —
     alias rather than duplicate. */
  --green-soft: var(--ui-success-soft);
  --positive-border: color-mix(in srgb, var(--ui-success) 45%, transparent);
  --positive-glow: color-mix(in srgb, var(--ui-success) 55%, transparent);
  --warning-soft: var(--ui-warning-soft);
  --warning-border: color-mix(in srgb, var(--ui-warning) 40%, transparent);
  --warning-glow: color-mix(in srgb, var(--ui-warning) 42%, transparent);
  --danger-soft: color-mix(in srgb, var(--ui-danger) 12%, transparent);
  --danger-medium: color-mix(in srgb, var(--ui-danger) 20%, transparent);
  --danger-border: color-mix(in srgb, var(--ui-danger) 45%, transparent);
  --danger-glow: color-mix(in srgb, var(--ui-danger) 42%, transparent);
  --neutral-soft: color-mix(in srgb, var(--ui-muted) 14%, transparent);
  --neutral-border: color-mix(in srgb, var(--ui-muted) 30%, transparent);
  --purple-soft: rgb(167 139 250 / 0.12);
  --state-working-wash: color-mix(in srgb, var(--ui-accent) 6%, transparent);
  --state-needs-input-wash: color-mix(in srgb, var(--ui-warning) 8%, transparent);
  --engine-codex-line: rgb(0 212 255 / 0.46);
  --engine-codex-mark: #52def8;
  --engine-claude-line: rgb(218 145 99 / 0.46);
  --engine-claude-mark: #e0a77f;
  --engine-cursor-line: rgb(155 169 189 / 0.42);
  --engine-cursor-mark: #aeb9c9;
  --engine-opencode-line: rgb(45 212 167 / 0.42);
  --engine-opencode-mark: #63dfbd;
  --engine-deepagents-line: rgb(155 169 189 / 0.42);
  --engine-deepagents-mark: #aeb9c9;
  --project-saturation: 58%;
  --project-bar-lightness: 66%;
  --project-name-lightness: 78%;
  --grid-line: color-mix(in srgb, var(--ui-accent) 3.2%, transparent);
  --shadow-color: rgb(0 0 0 / 0.22);
  --shadow: var(--ui-shadow);
  --agent-dock-width: 20rem;
  --agent-dock-top: calc(77px + env(safe-area-inset-top, 0px));
  /* Audit contract: one shared gutter; routed views fill the remaining workspace. */
  --ui-page-gutter: clamp(0.85rem, 1.6vw, 1.35rem);

  /* Spacing scale — prefer these over ad-hoc rem in layout CSS (T289). */
  --ui-space-1: 0.25rem;
  --ui-space-2: 0.35rem;
  --ui-space-3: 0.5rem;
  --ui-space-4: 0.75rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ui-bg: #f7f5f0;
  --ui-panel: #ffffff;
  --ui-raised: #ffffff;
  --ui-input: #ffffff;
  --ui-hover: #efece4;
  --ui-line: #d8d3c8;
  --ui-line-soft: #eae7df;
  /* T485: prototype's literal light --ui-panel/--ui-line (see dark-theme
     note above) — light theme's prototype panel is already opaque solid
     (doc57's PDF-surface exception), so this is a plain color, not a tint. */
  --ui-glass: #fcfbf7;
  --ui-glass-line: rgba(20, 32, 51, 0.1);
  --ui-glass-line-soft: rgba(20, 32, 51, 0.07);
  --ui-text: #142033;
  --ui-text-soft: #475669;
  --ui-muted: #6f7b8e;
  --ui-text-muted: var(--ui-muted); /* fidelity fix: see dark-theme note above */
  --ui-accent: #007b91;
  --ui-accent-soft: rgb(0 123 145 / 0.09);
  --ui-primary: #10263d;
  --ui-primary-text: #ffffff;
  --ui-success: #087a3e;
  --ui-success-text: #ffffff;
  --ui-success-soft: rgb(8 122 62 / 0.09);
  --ui-warning: #9a6b00;
  --ui-warning-soft: rgb(154 107 0 / 0.09);
  --ui-danger: #c93a56;

  /* T376 (doc 57): light-mode glow — deep-cyan washes on warm paper. */
  --ui-glow-1: rgb(0 123 145 / 0.05);
  --ui-glow-2: rgb(0 123 145 / 0.03);
  --ui-shadow: 0 2rem 6rem rgb(20 32 51 / 0.12);
  --navy: #10263d;
  --overlay-bg: rgb(29 40 58 / 0.38);
  --primary-hover: #193b5d;
  --purple: #6651a8;
  --claude: #6651a8;
  --paper: #fff;
  --purple-soft: rgb(102 81 168 / 0.1);
  --engine-codex-line: rgb(0 123 145 / 0.44);
  --engine-codex-mark: #007285;
  --engine-claude-line: rgb(154 82 42 / 0.4);
  --engine-claude-mark: #98532f;
  --engine-cursor-line: rgb(72 88 108 / 0.38);
  --engine-cursor-mark: #4d5d71;
  --engine-opencode-line: rgb(8 124 100 / 0.4);
  --engine-opencode-mark: #087c64;
  --engine-deepagents-line: rgb(72 88 108 / 0.38);
  --engine-deepagents-mark: #4d5d71;
  --project-saturation: 62%;
  --project-bar-lightness: 40%;
  --project-name-lightness: 32%;
}

[hidden] {
  display: none !important;
}
