/* Cloud Pavilion console — design tokens (docs/THEMES.md §2).
   Loaded after styles.css and flat.css, so these values are the console's. Dark is Pavilion's dark (today's look);
   light is a full second theme. A company theme sets the same custom properties, one validated value each, on
   <html> (themes.js); a member's comfort settings (data-* on <html>) always win over it.
   The safety areas never use these: console/safety.css gives them a fixed palette of their own. */

:root {
  /* the colour tokens: gate/src/themes.ts COLOUR_TOKENS, values from PRESETS.pavilion.dark */
  --ink-0: #07090d; --ink-1: #121821; --ink-2: #18202a; --ink-3: #1f2833; --ink-4: #2a3542;
  --line: #212a35; --line-2: #2c3846; --control: #66727f;
  --text: #e9e6df; --text-2: #a7adb6; --text-3: #8d949e;
  --canopy: #ff5a36; --canopy-2: #ff7a5c; --canopy-fill: #c93a18; --canopy-ink: #2a0f08; --on-fill: #ffffff;
  --sky: #8cc8ff; --ok: #3ddc97; --warn: #ffb020; --bad: #ff4d6a; --bad-2: #ff8a9c; --info: #a59cff; --focus: #ff7a5c;
  --chrome-bg: #07090d; --chrome-fg: #e9e6df; --chrome-fg-2: #8d949e; --chrome-hover: #11161d; --chrome-active: #18202a; --chrome-line: #161d26; --content-bg: #121821; --panel-divider: #212a35; --pop-bg: #1a222d;
  --rail-bg: #0d1117; --rail-edge: #161d26;
  /* lengths and the font */
  --radius: 4px; --radius-s: 3px; --focus-w: 2px; --content-radius: 10px;
  /* the frame's measures (CONSOLE-REDESIGN §3.5): layout, the same in every theme, not theme values */
  --content-inset: 8px; --side-w: 56px; --side-w-open: 232px; --rail-w: 64px; --rail-w-open: 320px; --header-h: 48px;
  /* elevation's knobs for this scheme (the shadows themselves are below, made from the theme's tokens): dark leans on a
     hairline edge and a lit top edge, with a soft lift in the theme's deepest ink, never a heavy black blur */
  --elev-ink: var(--ink-0); --elev-a1: 40%; --elev-a2: 55%; --elev-edge-a: 9%; --elev-lit-a: 5%;
  /* a scrim dims what it covers, in the same ink as the shadows (--scrim, below): darker in dark, where a light wash would lift the page */
  --scrim-a: 55%;
  /* motion (CONSOLE-REDESIGN §3.6): three durations and three curves; reduced motion (below) turns them all off */
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 260ms;
  --ease-out: cubic-bezier(.2, 0, 0, 1); --ease-in: cubic-bezier(.4, 0, 1, 1); --ease-emph: cubic-bezier(.05, .7, .1, 1);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
:root[data-scheme="light"] {
  --ink-0: #efece5; --ink-1: #fcfbf9; --ink-2: #ffffff; --ink-3: #ebe6dc; --ink-4: #dcd6ca;
  --line: #e4e0d7; --line-2: #d4cdc0; --control: #8a8378;
  --text: #1b1a17; --text-2: #4a4741; --text-3: #66625a;
  --canopy: #cf3f16; --canopy-2: #b5310f; --canopy-fill: #c4380f; --canopy-ink: #ffffff; --on-fill: #ffffff;
  --sky: #1d5fb0; --ok: #024e26; --warn: #8a5800; --bad: #eb5258; --bad-2: #b01f37; --info: #4b59b7; --focus: #c4380f;
  --chrome-bg: #e6e3dc; --chrome-fg: #24231f; --chrome-fg-2: #625e56; --chrome-hover: #dcd8d0; --chrome-active: #d1ccc2; --chrome-line: #d3cec4; --content-bg: #fcfbf9; --panel-divider: #e4e0d7; --pop-bg: #ffffff;
  --rail-bg: #efede8; --rail-edge: #d3cec4;
  /* elevation in light: the theme's own ink (its text colour), at low opacity, a tight contact shadow and a soft ambient one */
  --elev-ink: var(--text); --elev-a1: 7%; --elev-a2: 11%; --elev-edge-a: 9%; --elev-lit-a: 0%;
  --scrim-a: 22%;
  color-scheme: light;
}

/* High contrast (a member's comfort setting): the Contrast preset, which wins over the company theme (themes.js does
   not set the company's colours while it is on). */
:root[data-contrast="more"] {
  --ink-0: #000000; --ink-1: #0a0a0a; --ink-2: #141414; --ink-3: #1a1a1a; --ink-4: #333333;
  --line: #5c5c5c; --line-2: #7a7a7a; --control: #b3b3b3;
  --text: #ffffff; --text-2: #e6e6e6; --text-3: #cccccc;
  --canopy: #ffd500; --canopy-2: #ffe14d; --canopy-fill: #ffd500; --canopy-ink: #000000; --on-fill: #000000;
  --sky: #80d4ff; --ok: #65ebc6; --warn: #f9b42f; --bad: #c95347; --bad-2: #ff9eaa; --info: #7c73d2; --focus: #ffe14d;
  --chrome-bg: #000000; --chrome-fg: #ffffff; --chrome-fg-2: #cccccc; --chrome-hover: #141414; --chrome-active: #1a1a1a; --chrome-line: #5c5c5c; --content-bg: #0a0a0a; --panel-divider: #7a7a7a; --pop-bg: #1a1a1a;
  --rail-bg: #050505; --rail-edge: #5c5c5c;
  --focus-w: 3px;
}
:root[data-contrast="more"][data-scheme="light"] {
  --ink-0: #f0f0f0; --ink-1: #ffffff; --ink-2: #f5f5f5; --ink-3: #e6e6e6; --ink-4: #cccccc;
  --line: #8c8c8c; --line-2: #6b6b6b; --control: #4d4d4d;
  --text: #000000; --text-2: #1a1a1a; --text-3: #333333;
  --canopy: #0038a8; --canopy-2: #00297a; --canopy-fill: #00297a; --canopy-ink: #ffffff; --on-fill: #ffffff;
  --sky: #00297a; --ok: #00735a; --warn: #965311; --bad: #8b020b; --bad-2: #8f0018; --info: #1e379f; --focus: #00297a;
  --chrome-bg: #f0f0f0; --chrome-fg: #000000; --chrome-fg-2: #333333; --chrome-hover: #e6e6e6; --chrome-active: #cccccc; --chrome-line: #6b6b6b; --content-bg: #ffffff; --panel-divider: #6b6b6b; --pop-bg: #ffffff;
  --rail-bg: #f6f6f6; --rail-edge: #6b6b6b;
}

/* Derived values: worked out from the tokens wherever the tokens are set, so a theme never has to name them.
   safety.css repeats this block for the safety areas, which set their own tokens. */
:root {
  --line-3: color-mix(in srgb, var(--control) 55%, var(--line-2));
  --canopy-fill-2: color-mix(in srgb, var(--canopy-fill) 88%, var(--text));
  --code-text: color-mix(in srgb, var(--text) 88%, var(--sky));
  --paper: var(--text);
  --idle: var(--text-3);
  --hair: 1px solid var(--line);
  /* Elevation (docs/THEMES.md §2 "Elevation"): one scale for everything that floats, made from the theme's tokens and the
     scheme's knobs above, so every base theme, light and dark, gets it without naming a shadow. Each level is a hairline
     edge (and in dark a lit top edge), a tight contact shadow and a soft ambient one.
     1: small things over the page (a tooltip, a name, a toast). 2: menus, popovers, a glimpse card, a sheet beside a pane.
     3: what covers the page (⌘K, the Create panel, a dialog, the sidebar opened over the content). */
  --elev-edge: color-mix(in srgb, var(--text) var(--elev-edge-a), transparent);
  --elev-lit: color-mix(in srgb, var(--text) var(--elev-lit-a), transparent);
  --elev-1: inset 0 1px 0 var(--elev-lit), 0 0 0 1px var(--elev-edge), 0 1px 2px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent),
    0 3px 8px -2px color-mix(in srgb, var(--elev-ink) var(--elev-a2), transparent);
  --elev-2: inset 0 1px 0 var(--elev-lit), 0 0 0 1px var(--elev-edge), 0 1px 2px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent),
    0 4px 8px -2px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent), 0 14px 28px -8px color-mix(in srgb, var(--elev-ink) var(--elev-a2), transparent);
  --elev-3: inset 0 1px 0 var(--elev-lit), 0 0 0 1px var(--elev-edge), 0 2px 4px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent),
    0 10px 20px -6px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent), 0 28px 56px -14px color-mix(in srgb, var(--elev-ink) var(--elev-a2), transparent);
  /* the sidebar opened over the content: the same level 3, cast to the right only (its other edges are the window's) */
  --elev-side: 1px 0 0 var(--elev-edge), 2px 0 4px -1px color-mix(in srgb, var(--elev-ink) var(--elev-a1), transparent),
    16px 0 32px -12px color-mix(in srgb, var(--elev-ink) var(--elev-a2), transparent);
  --pop-shadow: var(--elev-2); --shadow: var(--elev-3); /* the older names, kept for what still says them */
  /* The scrim behind what covers the page (⌘K, a dialog, a glimpse on a phone): the elevation's ink (the theme's text in
     light, its deepest surface in dark) at the scheme's --scrim-a, so it always dims, never washes the page lighter. */
  --scrim: color-mix(in srgb, var(--elev-ink) var(--scrim-a), transparent);
  /* the redesign's names for what the console already has (CONSOLE-REDESIGN §3.5) */
  --raised: var(--ink-2); --sunk: var(--ink-0);
  --accent: var(--canopy); --accent-ink: var(--canopy-ink); --accent-text: var(--canopy-2);
  /* The composer's chip kinds (CONSOLE-REDESIGN §3.5, §5.2; step 8). Each is a hue made from the theme's own tokens, so
     every base theme (Pavilion, Paper, Graphite, Harbour, Grove, Contrast), light and dark, has them without a value of
     its own, and a company theme moves them with its states. A chip draws its tint (14 %) and edge (40 %) from the kind
     on its ground, its words in --text and its icon in the kind (gate/test/chip-kinds.test.ts checks every base: the
     words ≥ 4.5:1 on the tint, the icon ≥ 3:1 on the content surface and on --pop-bg). Colour is never the only
     signal: every kind has its own icon and its kind in the chip's name. */
  --k-person: var(--sky);
  --k-customer: color-mix(in srgb, var(--bad-2) 60%, var(--canopy-2));
  --k-agent: var(--info);
  --k-machine: var(--text-3);
  --k-project: color-mix(in srgb, var(--ok) 50%, var(--sky));
  --k-tag: var(--text-2);
  --k-date: color-mix(in srgb, var(--info) 70%, var(--bad-2));
  --k-priority: var(--bad-2);
  --k-place: var(--ok);
  --k-amount: var(--warn);
  --k-template: var(--canopy-2);
  --k-call: color-mix(in srgb, var(--sky) 60%, var(--ok));
}
/* The messaging rail as its own surface (CONSOLE-REDESIGN §4.1, tt-r4-rail): its corners are the content card's, so the
   two read as siblings, and follow a theme's contentRadius. Its colours, --rail-bg and --rail-edge, are theme tokens in
   the palette blocks above (gate/src/themes.ts railBg, railEdge). */
:root { --rail-radius: var(--content-radius); }
/* The stacking order (CONSOLE-REDESIGN §3.6 "The stacking order"; tt-r4-polish2): every z-index in console/*.css is one of
   these, so two surfaces of different kinds never meet at one number. Layout, the same in every theme. From the bottom:
   inside a component (a divider over its panes, a sticky head over its own list); floating inside a pane (a pane's
   sheet, the @-picker, a search's suggestions); the messaging rail; the sidebar, which opens over the content and the
   rail; a tooltip; a popover (presence's list); something sticky over the page (the platform banner); a phone's sheet;
   a menu from the frame (Create, ⋯); a dialog (the Create panel, a view's dialog, .modal); ⌘K; a glimpse; toasts; the
   theme preview's bar; the sign-in screen over everything. A surface with a scrim takes its level for the scrim and
   one more for itself. */
:root {
  --z-raise: 2; --z-float: 5; --z-rail: 20; --z-sidebar-overlay: 30; --z-tooltip: 40; --z-popover: 45; --z-sticky: 50; --z-sheet: 60;
  --z-menu: 80; --z-dialog: 100; --z-palette: 140; --z-glimpse: 160; --z-toast: 200; --z-preview: 250; --z-entry: 300;
}
@media (max-width: 780px) { :root { --content-inset: 0px; --header-h: 46px; } }

/* ---------- the focus ring: always visible, in the token's colour and width (check 3 looks for it) ---------- */
:focus-visible { outline: var(--focus-w) solid var(--focus) !important; outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
/* The ring on the box, not the bare field (owner, 15 Nov 2026; THEMES §2 "The focus rule"). Where a field is drawn without
   a box of its own inside a box the person reads as the field — the agent's and the Steward's composer, ⌘K, the voice
   reply, the Grounds' search — the box takes the ring while its field has the focus, and the field's own outline goes.
   Only the field moves the ring: a button inside the box (the mic, Send) keeps its own ring. Same width and colour as
   every other ring (--focus-w, ≥ 2 px; --focus, ≥ 3:1 on the grounds, THEMES §4.1), so nothing loses its indicator. */
:is(.composer .box, .vm-box, .gh-search):has(> :is(textarea, input, [contenteditable="true"]):focus-visible,
  > * > :is(textarea, input, [contenteditable="true"]):focus-visible) {
  outline: var(--focus-w) solid var(--focus); outline-offset: -1px; }
:is(.composer .box, .vm-box, .gh-search) > :is(textarea, input, [contenteditable="true"]):focus-visible,
:is(.composer .box, .vm-box, .gh-search) > * > :is(textarea, input, [contenteditable="true"]):focus-visible { outline: none !important; }

/* ---------- colour is never the only signal: each state keeps its shape (gate/src/themes.ts STATE_ICONS) ---------- */
.pill.working i { border-radius: 50%; }                                   /* success: a dot */
.pill.needs i { border-radius: 1px; transform: rotate(45deg) scale(.85); }  /* warning: a diamond */
.pill.waking i { border-radius: 50%; background: transparent !important; box-shadow: inset 0 0 0 2px var(--sky); } /* info: a ring */
.op-row.ask .op-dot, .op-row.stuck .op-dot { border-radius: 1px; transform: rotate(45deg) scale(.85); }
.op-row.cold .op-dot { border-radius: 0; }                                  /* danger: a square */

/* ---------- a member's comfort settings (themes.js sets these on <html>; they follow the member, not the device) ---------- */
/* Text size: the console is drawn in pixels, so the size is a zoom of the rail, the top bar and the page. */
:root[data-text="87.5"] .rail, :root[data-text="87.5"] .view, :root[data-text="87.5"] .topbar { zoom: .875; }
:root[data-text="112.5"] .rail, :root[data-text="112.5"] .view, :root[data-text="112.5"] .topbar { zoom: 1.125; }
:root[data-text="125"] .rail, :root[data-text="125"] .view, :root[data-text="125"] .topbar { zoom: 1.25; }
:root[data-text="150"] .rail, :root[data-text="150"] .view, :root[data-text="150"] .topbar { zoom: 1.5; }
/* Density */
:root[data-density="compact"] .op-row { padding-top: 6px; padding-bottom: 6px; }
:root[data-density="compact"] table.t td { padding-top: 6px; padding-bottom: 6px; }
:root[data-density="compact"] table.t th { padding-top: 6px; padding-bottom: 6px; }
:root[data-density="compact"] .page { padding-top: 16px; }
:root[data-density="compact"] .page-head { margin-bottom: 12px; }
:root[data-density="compact"] .s-item { height: 32px; }
:root[data-density="compact"] .panel .ph { padding: 10px 0; }
/* Reduced motion: the member's own choice, or the system's */
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Light: the few surfaces that were drawn dark on purpose */
/* Scrollbars: thin, in the theme's text at low opacity on no track, so they sit on any ground (the frame, the content,
   a menu) without a box around the thumb. Firefox takes the standard properties. */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 20%, transparent); background-clip: padding-box; border: 3px solid transparent; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 34%, transparent); }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 24%, transparent) transparent; } }
/* Selected text: the accent, light enough that the words stay readable in either scheme */
::selection { background: color-mix(in srgb, var(--canopy) 28%, transparent); color: inherit; }
/* The platform's mark is drawn in paper white by console.js; it follows the text colour so it shows in light too. */
.brand svg > g, .entry .mark svg > g { fill: var(--text); }
