/* EYE · design system
 *
 * Tokens, base styles, and the shared UI primitives every module builds with.
 * Module stylesheets (map.css, hud.css, …) add layout for their own regions and
 * must use these tokens rather than raw colours, so the console reads as one system.
 */

/* ─── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Surfaces — docks are near-opaque: dense numbers over moving tiles must stay
     legible, and backdrop blur over an animating map repaints every frame. */
  --bg: #0b0f14;             /* page (Zyno brand) */
  --bg-1: #0b0f14;           /* inset controls */
  --bg-2: #111820;           /* docks / raised (Zyno brand) */
  --bg-3: #18222d;           /* hover */
  --bg-4: #1f2b38;           /* pressed / active */
  --surface: rgba(17, 24, 32, 0.99);    /* docked panels: opaque enough that map labels never ghost through */
  --surface-float: rgba(11, 15, 20, 0.92); /* small floating chips over the map */
  --glass: var(--surface);
  --glass-strong: rgba(11, 15, 20, 0.97);
  --glass-blur: 10px;        /* small chips only */
  --halo: #0b0f14;           /* map label halo */

  /* Lines */
  --line: rgba(160, 190, 220, 0.12);
  --line-2: rgba(160, 190, 220, 0.2);
  --line-strong: rgba(160, 190, 220, 0.32);

  /* Ink */
  --ink: #e6edf3;
  --ink-2: #b4bfca;
  --muted: #8794a4;          /* ≥5.8:1 on --bg-2: safe for 10–11 px mono labels */
  --faint: #6b7a8a;          /* rules, disabled, placeholders — not for body text */

  /* Map symbology: colour = affiliation only. Status lives in rings/bars/badges. */
  --friendly: #58a6ff;
  --friendly-fill: #0e1a2b;
  --hostile: #f85149;
  --wreck: #6e7681;
  --select: #ffffff;

  /* Semantic */
  --blue: #58a6ff;           /* friendly / primary */
  --blue-2: #79b8ff;
  --red: #f85149;            /* hostile / critical / destroyed */
  --amber: #d29922;          /* warning / damaged */
  --amber-2: #e3b341;
  --green: #3fb950;          /* healthy / good */
  --cyan: #39c5cf;           /* sealift */
  --purple: #bc8cff;         /* ISR / ARM */
  --orange: #f0883e;

  --blue-a: rgba(88, 166, 255, 0.14);
  --red-a: rgba(248, 81, 73, 0.14);
  --amber-a: rgba(210, 153, 34, 0.16);
  --green-a: rgba(63, 185, 80, 0.14);
  --cyan-a: rgba(57, 197, 207, 0.14);
  --purple-a: rgba(188, 140, 255, 0.15);

  --good: var(--green);
  --warn: var(--amber-2);
  --bad: var(--red);

  /* Type */
  --sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --serif: 'Fraunces', 'Times New Roman', serif;
  --fs-xs: 10.5px;
  --fs-sm: 11.5px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --track: 0.12em;           /* uppercase mono label tracking */

  /* Shape & depth */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--blue);

  /* Layout (modules read these; main.js toggles body state classes) */
  --topbar-h: 44px;
  --rail-w: 56px;
  --panel-w: 360px;          /* resizable 300–520 (panels.js sets it inline on <body>) */
  --right-w: 340px;
  --inspector-w: var(--right-w);
  --dock-h: 112px;
  --timeline-h: var(--dock-h);
  --dock-left-w: 220px;      /* transport + clock; the debrief's label column matches it */
  --dock-right-w: 280px;     /* instrument block; the debrief's right column matches it */
  --gap: 10px;               /* margin for floating overlays inside the safe frame */

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms;
  --t-med: 200ms;

  /* Stacking */
  --z-map: 0;
  --z-overlay: 400;          /* map HUD readouts, legend */
  --z-dock: 500;             /* rail, panels, inspector, timeline */
  --z-sheet: 600;            /* debrief */
  --z-bar: 700;              /* top bar */
  --z-pop: 900;              /* menus, popovers */
  --z-modal: 2000;
  --z-toast: 2100;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-md)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;           /* the console is a fixed-viewport app */
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: rgba(88, 166, 255, 0.35); }

.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ink { color: var(--ink); }
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 6px; left: 6px; z-index: calc(var(--z-modal) + 10);
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--blue); color: #06101c; font: 600 var(--fs-sm)/1 var(--mono);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
.label {
  font: 500 var(--fs-xs)/1.3 var(--mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--muted);
}

.tone-good { --tone: var(--good); }
.tone-warn { --tone: var(--warn); }
.tone-bad { --tone: var(--bad); }
.tone-blue { --tone: var(--blue); }
.tone-red { --tone: var(--red); }
.tone-amber { --tone: var(--amber-2); }
.tone-green { --tone: var(--green); }
.tone-cyan { --tone: var(--cyan); }
.tone-purple { --tone: var(--purple); }
.tone-muted { --tone: var(--muted); }

/* Scrollbars */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ─── Surfaces ────────────────────────────────────────────────────────────── */
/* Docked surface (panels, right column, dock, debrief): opaque, ruled edges. */
.dock-surface {
  background: var(--surface);
  border-color: var(--line);
  border-style: solid;
  border-width: 0;
}
/* Floating chip/card over the map (map controls, banners, scale): small, may blur. */
.float {
  background: var(--surface-float);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
/* Back-compat alias: an opaque rounded card. */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.panel { display: flex; flex-direction: column; min-height: 0; }
.panel__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.panel__title {
  font: 500 var(--fs-sm)/1.2 var(--mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel__body { padding: 12px 14px; flex: 1; min-height: 0; }
.panel__foot { padding: 10px 14px; border-top: 1px solid var(--line); flex: none; }

/* A titled group inside a panel */
.section { padding: 10px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section__head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.section__head .label { flex: 1; }

.divider { height: 1px; background: var(--line); border: 0; margin: 10px 0; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--ink);
  font: 500 var(--fs-sm)/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), opacity var(--t-fast);
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--bg-4); border-color: var(--line-strong); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex: none; }

.btn--primary { background: var(--blue); border-color: var(--blue); color: #06101c; }
.btn--primary:hover:not(:disabled) { background: var(--blue-2); border-color: var(--blue-2); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover:not(:disabled) { background: var(--bg-3); border-color: var(--line); color: var(--ink); }
.btn--outline { background: transparent; }
.btn--danger { background: transparent; border-color: rgba(248, 81, 73, 0.45); color: var(--red); }
.btn--danger:hover:not(:disabled) { background: var(--red-a); border-color: var(--red); }
.btn--sm { height: 24px; padding: 0 8px; font-size: var(--fs-xs); }
.btn--lg { height: 36px; padding: 0 16px; }
.btn--block { width: 100%; }
.btn--icon { width: 30px; padding: 0; }
.btn--icon.btn--sm { width: 24px; }
.btn[aria-pressed='true'], .btn.is-on { background: var(--blue-a); border-color: rgba(88, 166, 255, 0.5); color: var(--blue-2); }

/* Bare icon button (rows, headers) */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--bg-3); color: var(--ink); }
.icon-btn--danger:hover { color: var(--red); background: var(--red-a); }
.icon-btn svg { width: 14px; height: 14px; }

/* ─── Form controls ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field__label {
  font: 500 var(--fs-xs)/1.3 var(--mono);
  letter-spacing: var(--track); text-transform: uppercase; color: var(--muted);
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
}
.field__hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.field__error { font-size: var(--fs-xs); color: var(--red); line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.input, .select, .textarea {
  width: 100%; min-width: 0;
  height: 30px; padding: 0 9px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: 400 var(--fs-md)/1 var(--sans);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input.num, .input[type='number'] { font-family: var(--mono); font-size: var(--fs-sm); }
.textarea { height: auto; min-height: 76px; padding: 8px 9px; line-height: 1.45; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237d8b99' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.input[aria-invalid='true'] { border-color: var(--red); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }

/* Number input with −/+ steppers */
.stepper { display: flex; align-items: stretch; height: 26px; }
.stepper .input { height: 26px; border-radius: 0; text-align: right; padding: 0 6px; width: 88px; }
.stepper button {
  width: 24px; flex: none;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--ink-2);
  font: 500 13px/1 var(--mono);
}
.stepper button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; }
.stepper button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.stepper button:hover { background: var(--bg-4); color: var(--ink); }

/* Segmented control: <div class="seg"><button aria-pressed="true">…</button>…</div> */
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-sm);
}
.seg > button {
  height: 24px; padding: 0 9px; border-radius: 3px;
  font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed='true'] { background: var(--bg-4); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg--block { display: flex; }
.seg--block > button { flex: 1; }

/* Checkbox / switch row */
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { accent-color: var(--blue); width: 14px; height: 14px; }

/* File drop / pick */
.filepick {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  color: var(--ink-2); font-size: var(--fs-sm); cursor: pointer;
}
.filepick:hover { border-color: var(--blue); color: var(--ink); background: var(--blue-a); }
.filepick input { display: none; }

/* Progressive-disclosure "add" form */
.disclosure { border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(255, 255, 255, 0.015); }
.disclosure > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--blue);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: '+'; font-size: 14px; line-height: 1; width: 12px; text-align: center; }
.disclosure[open] > summary::before { content: '−'; }
.disclosure > summary:hover { color: var(--blue-2); }
.disclosure__body { padding: 4px 10px 10px; }

/* ─── Data display ────────────────────────────────────────────────────────── */
.chip {
  --tone: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
  background: color-mix(in srgb, var(--tone) 13%, transparent);
  color: var(--tone);
  font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.chip--solid { background: var(--tone); color: #06101c; border-color: var(--tone); }

.tag {
  --tone: var(--muted);
  display: inline-block;
  padding: 2px 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  color: var(--tone);
  font: 600 9.5px/1.1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  vertical-align: middle; white-space: nowrap;
}

.badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  border-radius: 999px;
  background: var(--blue-a); color: var(--blue-2);
  font: 600 9.5px/1 var(--mono);
}
.badge--red { background: var(--red-a); color: var(--red); }

.dot { --tone: var(--muted); width: 7px; height: 7px; border-radius: 50%; background: var(--tone); flex: none; display: inline-block; }
.dot--ring { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tone); }

.kbd {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  font: 500 10px/1 var(--mono); color: var(--ink-2); background: var(--bg-2);
}

/* KPI tile */
.kpi { --tone: var(--ink); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi__label { font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: var(--track); text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.kpi__value { font: 500 20px/1.1 var(--mono); font-variant-numeric: tabular-nums; color: var(--tone); white-space: nowrap; }
.kpi__sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi--sm .kpi__value { font-size: 15px; }
.kpi--lg .kpi__value { font-size: 28px; }

/* Horizontal meter: <div class="meter tone-good" style="--v:62%"><span></span></div> */
.meter { --tone: var(--blue); --v: 0%; position: relative; height: 5px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; width: var(--v); background: var(--tone); border-radius: 3px; transition: width var(--t-med) var(--ease); }
.meter--thin { height: 3px; }
.meter--tall { height: 8px; }

/* Dense list rows */
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 5px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: default;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.row--link { cursor: pointer; }
.row--link:hover { background: var(--bg-3); }
.row.is-selected { background: var(--blue-a); border-color: rgba(88, 166, 255, 0.35); }
.row__icon { width: 20px; height: 20px; flex: none; color: var(--ink-2); display: grid; place-items: center; }
.row__icon svg { width: 18px; height: 18px; }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row__title { font-size: var(--fs-md); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub { font: 400 var(--fs-xs)/1.35 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__aside { flex: none; display: flex; align-items: center; gap: 4px; color: var(--muted); font: 400 var(--fs-xs)/1 var(--mono); }
.row .icon-btn { opacity: 0; }
.row:hover .icon-btn, .row:focus-within .icon-btn, .row .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .row .icon-btn { opacity: 1; } }

/* Group header inside lists */
.group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px 4px;
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--muted);
}
.group-head .grow { flex: 1; }

/* Key/value stat lines */
.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: var(--fs-sm); }
.stats dt { color: var(--muted); font-family: var(--mono); font-size: var(--fs-xs); letter-spacing: 0.04em; padding-top: 1px; }
.stats dd { color: var(--ink); text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }

/* Data table */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-2);
  text-align: left; padding: 7px 10px;
  font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: var(--track); text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.table td.num, .table th.num { text-align: right; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.table tr.is-link { cursor: pointer; }
.table tr:last-child td { border-bottom: 0; }

/* Tabs: <div class="tabs" role="tablist"><button class="tab" role="tab" aria-selected="true"> */
.tabs { display: flex; gap: 2px; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: var(--track); text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
  transition: color var(--t-fast);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { color: var(--ink); }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--blue); }

/* Empty / loading / error states */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 22px 14px; text-align: center;
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.5;
}
.empty__title { font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: var(--track); text-transform: uppercase; color: var(--ink-2); }
.callout {
  --tone: var(--blue);
  padding: 9px 11px; border-radius: var(--r-sm);
  border-left: 3px solid var(--tone);
  background: color-mix(in srgb, var(--tone) 9%, transparent);
  color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5;
}
.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid var(--line-2); border-top-color: var(--blue);
  border-radius: 50%;
  animation: eye-spin 0.8s linear infinite;
}
@keyframes eye-spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress { height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--v, 0%); background: var(--tone, var(--blue)); transition: width 0.4s var(--ease); }
.progress--indeterminate > span { width: 35%; animation: eye-indet 1.2s var(--ease) infinite; }
@keyframes eye-indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* ─── Popovers & menus ────────────────────────────────────────────────────── */
.popover {
  position: absolute; z-index: var(--z-pop);
  min-width: 220px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
  text-align: left; color: var(--ink-2); font-size: var(--fs-md);
}
.menu__item:hover, .menu__item:focus-visible { background: var(--bg-3); color: var(--ink); box-shadow: none; }
.menu__item.is-current { color: var(--blue-2); }
.menu__item small { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 1px; }
.menu__item svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.menu__sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu__label { padding: 6px 10px 4px; }

/* ─── Toasts ──────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; z-index: var(--z-toast);
  top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  --tone: var(--blue);
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 12px 10px 12px;
  background: var(--glass-strong);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--tone);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md); color: var(--ink);
  animation: eye-toast-in var(--t-med) var(--ease);
}
.toast--success { --tone: var(--green); }
.toast--error { --tone: var(--red); }
.toast--warning { --tone: var(--amber-2); }
.toast__close { color: var(--muted); margin-left: 4px; font-size: 14px; line-height: 1; }
.toast__close:hover { color: var(--ink); }
.toast__action {
  flex: none; margin-left: 6px;
  font: 600 var(--fs-xs)/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--blue-2); padding: 4px 6px; border-radius: var(--r-sm);
}
.toast__action:hover { background: var(--blue-a); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity var(--t-med), transform var(--t-med); }
@keyframes eye-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ─── Modal shell ─────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(2, 5, 9, 0.66);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
  animation: eye-fade var(--t-med) var(--ease);
}
.modal {
  width: min(640px, 100%); max-height: min(86vh, 760px);
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@keyframes eye-fade { from { opacity: 0; } to { opacity: 1; } }

/* ─── Boot / fatal states ─────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #0d1620 0%, var(--bg) 70%);
  transition: opacity 400ms var(--ease);
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot__mark { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }
.boot__eye { width: 54px; height: 54px; color: var(--blue); animation: eye-pulse 1.6s var(--ease) infinite; }
.boot__word { font: 400 28px/1 var(--serif); letter-spacing: 0.32em; color: var(--ink); padding-left: 0.32em; }
.boot__msg { font: 500 var(--fs-xs)/1.4 var(--mono); letter-spacing: var(--track); text-transform: uppercase; }
.boot__err { max-width: 420px; text-align: center; color: var(--ink-2); font-size: var(--fs-md); }
@keyframes eye-pulse { 0%, 100% { opacity: 0.55; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* Number inputs: no native spinners (steppers and unit suffixes replace them). */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
