/* ═══════════ Glass HUD: tokens, base and shared primitives ═══════════
   One surface language (translucent dark glass over the room art), one accent
   for anything live or actionable, one type system. Source of truth:
   design/design_handoff_bridge_glass/README.md. Linked by bridge.html only,
   after the legacy CSS. Rooms use the gl- primitives below and never restyle
   them per room. Sections:
     1  tokens            6  rows             11 tables           16 legacy restyle
     2  density, accent   7  buttons          12 status colours   17 focus
     3  base              8  select, inputs   13 foot, legend     18 small screens
     4  pane              9  hint             14 dots, skeleton   19 reduced motion
     5  pane layouts      10 notice, actions  15 modal, sheet     20 forced colours */

/* ── 1 · Tokens (README "Design Tokens", values verbatim) ───────────────── */
:root {
  /* a dark page: native controls, scrollbars and the canvas follow */
  color-scheme: dark;
  /* ground */
  --bg: #0e120f;  --scrim: linear-gradient(180deg,#0a0e0bb3 0,#0a0e0b40 30%,#0a0e0b80 60%,#0a0e0bf0 100%);
  --glass: rgba(8,12,9,.78);  --glass-blur: 12px;
  --line: #ffffff1f;  --line-soft: #ffffff14;  --hairline-top: inset 0 1px 0 #ffffff14;
  --field: rgba(255,255,255,.04);
  /* ink */
  --ink: #e8e4d6;  --ink-muted: #9ea596;  --ink-title: #fff4dc;  --on-accent: #1a1308;  --on-red: #1a0c08;
  /* accent (chosen: green; amber alt) */
  --accent: #9fd4a6;        /* alt #f0b35a, #e8cd92, #8fb8d8 */
  --accent-60: color-mix(in srgb, var(--accent) 60%, transparent);
  --accent-40: color-mix(in srgb, var(--accent) 40%, transparent);   /* glows */
  --accent-20: color-mix(in srgb, var(--accent) 20%, transparent);   /* ring halo */
  --accent-12: color-mix(in srgb, var(--accent) 12%, transparent);   /* selected tab */
  --accent-08: color-mix(in srgb, var(--accent) 8%, transparent);    /* notice fill */
  /* semantic */
  --good: #9fd4a6;  --bad: #e0604a;  --off: #3a423a;  --ring-track: #ffffff22;
  /* density: Compact (chosen) | Balanced | Roomy */
  --gap: 8px;            /* 12px | 16px */
  --pad: 10px 12px 12px; /* 14px 16px 16px | 16px 18px 18px */
  --row-pad: 5px;        /* 8px | 10px */
  --hero-min: 170px;     /* 240px | 300px */
  /* type: the @font-face families in typography.css */
  --font-head: IPTType3Head, 'Rajdhani', 'Arial Narrow', Arial, sans-serif;  /* 600 */
  --font-ui: IPTType3UI, 'Chakra Petch', Arial, sans-serif;                  /* 400, 500 */
  --font-mono: IPTType3Log, 'JetBrains Mono', ui-monospace, monospace;       /* 400 */

  /* derived (not in the README block, used by the primitives) */
  --accent-10: color-mix(in srgb, var(--accent) 10%, transparent);   /* ghost hover */
  --bad-08: color-mix(in srgb, var(--bad) 8%, transparent);          /* alert notice fill */
  --bad-33: color-mix(in srgb, var(--bad) 33.3%, transparent);       /* alert glow, #e0604a55 */
  --muted-40: #9ea59666;                                             /* disabled dashed border */
  --ease-glass: cubic-bezier(.215,.61,.355,1);
  --t-pane: 160ms;  --t-backdrop: 400ms;  --t-arc: 300ms;

  /* the retired material palette, pointed at glass so content that has not
     migrated yet follows the one accent instead of brass */
  --brass: var(--accent);  --brass-hi: var(--accent);  --brass-dim: var(--accent-60);
  --ink-2: var(--ink-muted);  --ink-3: var(--ink-muted);  --ink-dim: var(--ink-muted);
  --hairline: var(--line);  --hairline-2: var(--line-soft);
  --green: var(--good);  --red: var(--bad);  --blue: var(--accent);
  --plate: transparent;  --plate-2: var(--glass);  --bg-2: var(--field);
}
/* The derived accents recompute wherever --accent is overridden. */
body, [data-accent], [style*="--accent:"] {
  --accent-60: color-mix(in srgb, var(--accent) 60%, transparent);
  --accent-40: color-mix(in srgb, var(--accent) 40%, transparent);
  --accent-20: color-mix(in srgb, var(--accent) 20%, transparent);
  --accent-12: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-10: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-08: color-mix(in srgb, var(--accent) 8%, transparent);
  --brass: var(--accent);  --brass-hi: var(--accent);  --brass-dim: var(--accent-60);  --blue: var(--accent);
}

/* ── 2 · Density and accent variants ────────────────────────────────────── */
.density-compact  { --gap: 8px;  --pad: 10px 12px 12px; --row-pad: 5px;  --hero-min: 170px; }
.density-balanced { --gap: 12px; --pad: 14px 16px 16px; --row-pad: 8px;  --hero-min: 240px; }
.density-roomy    { --gap: 16px; --pad: 16px 18px 18px; --row-pad: 10px; --hero-min: 300px; }
[data-accent="green"] { --accent: #9fd4a6; }
[data-accent="amber"] { --accent: #f0b35a; }
[data-accent="brass"] { --accent: #e8cd92; }
[data-accent="blue"]  { --accent: #8fb8d8; }

/* ── 3 · Base ───────────────────────────────────────────────────────────── */
html:has(> body.glass-bridge) { background: var(--bg); }
body.glass-bridge {
  height: auto; min-height: 100vh; min-height: 100dvh; overflow: auto;
  background: var(--bg); color: var(--ink);
  font: 400 14px/1.3 var(--font-ui);
  -webkit-font-smoothing: auto;
}
:where(.glass-bridge) a { color: var(--accent); text-underline-offset: 2px; }
:where(.glass-bridge) a:hover { color: var(--ink-title); }
:where(.glass-bridge) ::selection { background: var(--accent-40); color: var(--ink-title); }
:where(.glass-bridge) :where(input[type="checkbox"], input[type="radio"], input[type="range"], progress, meter) { accent-color: var(--accent); }
/* Bare form fields read as glass fields until a room gives them a class. */
:where(.glass-bridge) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="image"]), select, textarea) {
  min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 0;
  background-color: var(--field); color: var(--ink);
  font: 400 14px/1.2 var(--font-ui); letter-spacing: 0; box-shadow: none;
}
/* Bare selects keep their native arrow (room rules may reset backgrounds);
   wrap a select in .gl-select for the glass chevron. */
:where(.glass-bridge) :where(select) { cursor: pointer; }
:where(.glass-bridge) :where(input, textarea)::placeholder { color: var(--ink-muted); opacity: 1; }
:where(.glass-bridge) :where(select option, select optgroup) { background-color: var(--bg); color: var(--ink); }
:where(.glass-bridge) :where(input, select, textarea):disabled { color: var(--ink-muted); border-style: dashed; cursor: default; }
[hidden] { display: none !important; }
.sr-only, .gl-sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important;
}
@keyframes gl-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes gl-fade { from { opacity: 0; } to { opacity: 1; } }
.gl-enter { animation: gl-in var(--t-pane) ease-out both; }

/* ── 4 · Glass pane: the one container style ────────────────────────────── */
.gl-pane {
  min-width: 0; padding: var(--pad);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line); border-radius: 0; box-shadow: var(--hairline-top);
  color: var(--ink);
}
.gl-pane--flush { padding: 0; }
.gl-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  min-width: 0; margin: 0 0 4px;
}
.gl-title {
  margin: 0; padding: 0; border: 0;
  font: 500 11px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent);
}
.gl-meta { margin: 0; font: 400 11px/1 var(--font-mono); letter-spacing: 0; color: var(--ink-muted); }
.gl-mono { font-family: var(--font-mono); font-weight: 400; }
.gl-spacer { flex: 1; }

/* ── 5 · The three summary panes (README "Pane A/B/C") ──────────────────── */
.gl-pane-a, .gl-pane-b { display: flex; flex-direction: column; min-width: 0; }
.gl-pane-c { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gl-pane-b > .gl-head { margin-bottom: 12px; }
.gl-pane-c > .gl-head { align-items: center; flex-wrap: wrap; margin-bottom: 0; }
.gl-pane-a > .gl-actions { justify-content: flex-start; margin-top: 14px; }
/* Without a .gl-spacer the button row still sits at the bottom of the pane. */
.gl-pane-a:not(:has(> .gl-spacer)) > .gl-actions { margin-top: auto; padding-top: 14px; }
.gl-pane-b:not(:has(> .gl-spacer)) > .gl-actions { margin-top: auto; }

/* ── 6 · Rows ───────────────────────────────────────────────────────────── */
.gl-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  min-width: 0; padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft);
  font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted);
}
.gl-k { min-width: 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted); overflow-wrap: break-word; }
.gl-v { min-width: 0; font: 400 13px/1.4 var(--font-mono); color: var(--ink); text-align: right; overflow-wrap: break-word; }

/* ── 7 · Buttons: ghost (default), solid, disabled. Nothing else. ───────── */
.gl-btn {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; margin: 0; padding: 0 14px;
  font: 500 13px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
  text-align: center; text-decoration: none; white-space: nowrap;
  border-radius: 0; box-shadow: none; filter: none; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid var(--accent-60);
}
.gl-btn:hover { background: var(--accent-10); border-color: var(--accent); color: var(--accent); }
.gl-btn--solid,
.gl-btn[aria-pressed="true"], .gl-btn[aria-checked="true"], .gl-btn[aria-selected="true"] {
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
}
.gl-btn--solid:hover,
.gl-btn[aria-pressed="true"]:hover, .gl-btn[aria-checked="true"]:hover, .gl-btn[aria-selected="true"]:hover {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent); filter: brightness(1.08);
}
.gl-btn--red, .gl-btn--red:hover { background: var(--bad); color: var(--on-red); border: 1px solid var(--bad); }
.gl-btn--red:hover { filter: brightness(1.08); }
.gl-btn--ghost, .gl-btn--ghost:hover { filter: none; }
.gl-btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent-60); }
.gl-btn--ghost:hover { background: var(--accent-10); border-color: var(--accent); }
.gl-btn--cta { padding: 0 18px; }
.gl-btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.gl-btn--md { height: 34px; padding: 0 10px; font-size: 12px; }
.gl-btn--block { display: flex; width: 100%; }
.gl-btn:disabled, .gl-btn[aria-disabled="true"],
.gl-btn:disabled:hover, .gl-btn[aria-disabled="true"]:hover {
  background: transparent; color: var(--ink-muted); border: 1px dashed var(--muted-40);
  filter: none; cursor: default;
}
/* Segmented controls: SECTOR | CLUSTER | GALAXY, then a divider, then CENTRE. */
.gl-seg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.gl-seg-divider { flex: none; width: 1px; height: 20px; margin: 0 6px; background: var(--line); }

/* ── 8 · Select and inputs (one field style) ────────────────────────────── */
/* .gl-select wraps a real <select>: <label class="gl-select"><select>…</select></label>
   The wrapper draws the field (38 px inside its 1 px border, as the reference
   renders). The transparent select spans the wrapper's whole border box
   (margin -1px), so the tap target is the full 40 px field (44 px on touch)
   and its focus ring sits 2 px outside the visible field. Its padding is
   1 px wider than the README's 0 12px to keep the text where the reference
   puts it. */
.gl-select {
  position: relative; box-sizing: content-box;
  display: flex; align-items: stretch; min-width: 0;
  height: 38px; padding: 0;
  background: var(--field); border: 1px solid var(--line); border-radius: 0;
  font: 400 14px/1 var(--font-ui); color: var(--ink-muted);
}
.gl-select > select {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  flex: 1 1 auto; width: calc(100% + 2px); min-width: 0; height: calc(100% + 2px); min-height: 0; margin: -1px;
  padding: 0 33px 0 13px; border: 0; border-radius: 0; outline-offset: 2px;
  background: transparent; background-image: none; box-shadow: none;
  font: inherit; letter-spacing: 0; color: inherit; text-overflow: ellipsis; cursor: pointer;
}
.gl-select::after {
  /* Decorative: the empty alternative keeps the glyph out of the
     accessibility tree (browsers without the syntax keep the first value). */
  content: "\25BC"; content: "\25BC" / "";
  position: absolute; inset: 0 12px 0 auto;
  display: flex; align-items: center; pointer-events: none;
  /* Same glyph, fallback and line box as the reference prototype. */
  font: 400 11px/1 IPTType3UI, sans-serif; color: inherit;
}
.gl-select > select:disabled { color: inherit; opacity: 1; cursor: default; }
.gl-select:has(> select:disabled) { cursor: default; }
.gl-select > select option, .gl-select > select optgroup { background-color: var(--bg); color: var(--ink); }
.gl-input {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: block; width: 100%; min-width: 0; height: 40px; margin: 0; padding: 0 12px;
  background: var(--field); border: 1px solid var(--line); border-radius: 0; box-shadow: none;
  font: 400 14px/1.2 var(--font-ui); letter-spacing: 0; color: var(--ink);
}
.gl-input[type="number"] { font-family: var(--font-mono); }
.gl-input::placeholder { color: var(--ink-muted); opacity: 1; }
textarea.gl-input { height: auto; min-height: 80px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.gl-input:disabled { color: var(--ink-muted); border-style: dashed; cursor: default; }
.gl-input[aria-invalid="true"], .gl-select:has(> select[aria-invalid="true"]) { border-color: var(--bad); }
.gl-label {
  display: block; margin: 0 0 6px;
  font: 500 11px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-muted);
}
.gl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0 0 12px; }
.gl-field > .gl-label { margin: 0; }

/* ── 9 · Hint ───────────────────────────────────────────────────────────── */
.gl-hint { margin: 10px 0 12px; font: 400 13px/1.45 var(--font-ui); color: var(--ink-muted); }

/* ── 10 · Notice card and button row ────────────────────────────────────── */
.gl-notice {
  --tone: var(--accent); --tone-fill: var(--accent-08); --on-tone: var(--on-accent);
  min-width: 0; margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--tone); background: var(--tone-fill); color: var(--ink);
}
.gl-notice--alert { --tone: var(--bad); --tone-fill: var(--bad-08); --on-tone: var(--on-red); }
.gl-notice-tag {
  margin: 0; font: 400 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tone);
}
.gl-notice-title { margin: 4px 0 0; font: 600 16px/1.2 var(--font-head); color: var(--ink); }
.gl-notice-body { margin: 2px 0 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted); }
/* A notice button is solid in the notice's tone. */
.gl-notice .gl-btn {
  height: auto; min-height: 38px; max-width: 100%; margin-top: 10px; white-space: normal;
  background: var(--tone); color: var(--on-tone); border: 1px solid var(--tone);
}
.gl-notice .gl-btn:hover { background: var(--tone); color: var(--on-tone); border-color: var(--tone); filter: brightness(1.08); }
.gl-notice .gl-btn.gl-btn--ghost { background: transparent; color: var(--tone); border-color: var(--tone); filter: none; }
.gl-notice .gl-btn:is(:disabled, [aria-disabled="true"]) {
  background: transparent; color: var(--ink-muted); border: 1px dashed var(--muted-40); filter: none; cursor: default;
}
.gl-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; min-width: 0; }
.gl-actions--start { justify-content: flex-start; }

/* ── 11 · Three-column table (div grid; add table roles for screen readers) ─ */
.gl-table { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gl-table-head, .gl-table-row {
  display: grid; grid-template-columns: var(--gl-cols, minmax(0,1.4fr) minmax(0,1fr) minmax(0,1fr));
  gap: 12px; min-width: 0;
}
.gl-table-head {
  padding: 0 0 6px; border-bottom: 1px solid var(--accent-60);
  font: 500 11px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted);
}
.gl-table-row {
  align-items: baseline; padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft);
  font: 400 13px/1.4 var(--font-ui); color: var(--ink);
}
.gl-table-head > *, .gl-table-row > * { min-width: 0; overflow-wrap: break-word; }
.gl-table-head > :nth-child(n+2), .gl-table-row > :nth-child(n+2) { text-align: right; }
.gl-table-row > :nth-child(n+2) { font-family: var(--font-mono); font-weight: 400; }
.gl-table-empty { padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft); font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted); }

/* ── 12 · Status colours ────────────────────────────────────────────────── */
.gl-good { color: var(--good); }
.gl-bad { color: var(--bad); }
.gl-idle { color: var(--ink-muted); }
.gl-accent { color: var(--accent); }

/* ── 13 · Footnote and legend ───────────────────────────────────────────── */
.gl-foot { margin: auto 0 0; font: 400 12px/1.4 var(--font-mono); letter-spacing: 0; color: var(--ink-muted); }
.gl-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px; min-width: 0;
  font: 400 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted);
}
.gl-legend > * { display: flex; align-items: center; gap: 6px; }

/* ── 14 · Status dots and loading bars ──────────────────────────────────── */
.gl-dot {
  --dot: var(--accent);
  display: inline-block; flex: none; box-sizing: content-box; vertical-align: middle;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot); box-shadow: 0 0 8px var(--dot);
}
.gl-dot--green  { --dot: var(--good); }
.gl-dot--accent { --dot: var(--accent); }
.gl-dot--off    { --dot: var(--off); }
.gl-dot--red    { --dot: var(--bad); }
.gl-dot--lg { width: 10px; height: 10px; box-shadow: 0 0 10px var(--dot); }   /* alert chip */
.gl-dot--xl { width: 12px; height: 12px; box-shadow: 0 0 10px var(--dot); }   /* drive */
.gl-dot--uncharted { background: transparent; box-shadow: none; border: 1px dashed var(--ink-muted); border-radius: 2px; }
.gl-legend .gl-dot { box-shadow: 0 0 6px var(--dot); }
.gl-legend .gl-dot--green, .gl-legend .gl-dot--uncharted { box-shadow: none; }
.gl-skel { display: block; width: var(--skel-w, 100%); max-width: 100%; height: 12px; border-radius: 0; background: var(--line-soft); }
.gl-row > .gl-skel { flex: 1 1 auto; margin-block: 3px; }
.gl-table-row > .gl-skel { grid-column: 1 / -1; margin-block: 3px; }

/* ── 15 · Modal and sheet ───────────────────────────────────────────────── */
.gl-modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: auto; overscroll-behavior: contain;
  background: rgba(10,14,11,.72);
}
.modal-scrim.gl-modal-scrim:not(.open) { display: none; }
.gl-modal {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  width: min(460px, 100%); max-height: 100%; margin: auto; overflow: auto;
  padding: 16px 18px 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line); border-radius: 0; box-shadow: var(--hairline-top);
  color: var(--ink); font: 400 14px/1.45 var(--font-ui);
}
.gl-modal--wide { width: min(720px, 100%); }
.gl-modal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; margin: 0 0 14px; }
.gl-modal-head > div { min-width: 0; }
.gl-modal-head .gl-title + .gl-modal-title { margin-top: 8px; }
.gl-modal-title { margin: 0; font: 600 22px/1.1 var(--font-head); letter-spacing: 0; text-transform: none; color: var(--ink); }
.gl-modal-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gl-modal-body > p { margin: 0; }
.gl-modal-foot {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}

/* ── 16 · Legacy generic classes, restyled to glass ─────────────────────────
   Content that has not migrated to the gl- classes yet reads as glass. Every
   selector here is held to one class (or one element) of specificity with
   :where(), so any rule a room writes for its own content still wins: glass
   is the default skin, never an override. */
.btn {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 4px 18px;
  font: 500 13px/1.15 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
  text-align: center; text-decoration: none;
  border-radius: 0; box-shadow: none; filter: none; transition: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
}
.btn:where(:hover) { background: var(--accent); color: var(--on-accent); border-color: var(--accent); box-shadow: none; filter: brightness(1.08); }
.btn:where(.ghost) { padding: 4px 14px; background: transparent; color: var(--accent); border: 1px solid var(--accent-60); filter: none; }
.btn:where(.ghost):where(:hover) { background: var(--accent-10); color: var(--accent); border-color: var(--accent); }
.btn:where(:disabled, [aria-disabled="true"]) {
  background: transparent; color: var(--ink-muted); border: 1px dashed var(--muted-40);
  opacity: 1; filter: none; box-shadow: none; cursor: default;
}
.mini {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 28px; padding: 2px 10px;
  font: 500 12px/1.15 var(--font-ui); letter-spacing: .08em; text-transform: uppercase;
  border-radius: 0; transition: none; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid var(--accent-60);
}
.mini:where(:hover) { background: var(--accent-10); color: var(--accent); border-color: var(--accent); }
.mini:where(:disabled) { background: transparent; color: var(--ink-muted); border: 1px dashed var(--muted-40); cursor: default; }

.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0; border: 0; }
.tab {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 28px; margin: 0; padding: 2px 10px;
  font: 500 12px/1.15 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  border-radius: 0; transition: none; cursor: pointer;
  background: transparent; color: var(--accent); border: 1px solid var(--accent-60);
}
.tab:where(:hover) { background: var(--accent-10); color: var(--accent); border-color: var(--accent); }
.tab:where(.active, [aria-selected="true"], [aria-pressed="true"]) { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.card, .annot {
  min-width: 0; padding: var(--pad);
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line); border-radius: 0; box-shadow: var(--hairline-top); color: var(--ink);
}
:where(.annot) h3 {
  margin: 0 0 4px; padding: 0; border: 0;
  font: 500 11px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
}
.line {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  min-width: 0; padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft);
  font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted);
}
:where(.line) .k { min-width: 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted); }
:where(.line) .v { min-width: 0; font: 400 13px/1.4 var(--font-mono); color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
:where(.line .v).up { color: var(--good); }
:where(.line .v).down { color: var(--bad); }
:where(.line .v).gold { color: var(--accent); }

.hint { margin-top: 10px; font: 400 13px/1.45 var(--font-ui); letter-spacing: 0; color: var(--ink-muted); }
:where(.hint) :where(b, strong) { font-weight: 500; color: var(--ink); }
.hint:where(.good) { color: var(--good); }
.hint:where(.err), .err { color: var(--bad); }

/* status pills become mono status text with a dot */
.pill {
  --pill: var(--ink-muted);
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none;
  font: 400 11px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; color: var(--ink-muted);
}
.pill::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pill); box-shadow: 0 0 8px var(--pill); }
.pill:where(.ok)     { --pill: var(--good); }
.pill:where(.warm)   { --pill: var(--accent); }
.pill:where(.idle)   { --pill: var(--off); }
.pill:where(.danger) { --pill: var(--bad); color: var(--bad); }
.pill:where(.info)   { --pill: var(--accent); }

.lrow {
  display: flex; align-items: baseline; gap: 12px; min-width: 0;
  padding: var(--row-pad) 0; border-bottom: 1px solid var(--line-soft);
  font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted);
}
:where(.lrow) .nm { font: 400 13px/1.4 var(--font-ui); color: var(--ink); }
:where(.lrow) .sub2 { font: 400 11px/1.4 var(--font-mono); letter-spacing: 0; color: var(--ink-muted); }
:where(.lrow) .right { margin-left: auto; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
:where(.lrow) .val2 { font: 400 12px/1.4 var(--font-mono); color: var(--ink-muted); }

table { width: 100%; border-collapse: collapse; border-spacing: 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink); }
:where(thead) th {
  padding: 0 12px 6px 0; text-align: left; vertical-align: bottom; background: none;
  border-bottom: 1px solid var(--accent-60);
  font: 500 11px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-muted);
}
:where(tbody) td { padding: var(--row-pad) 12px var(--row-pad) 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink); }
:where(thead th, tbody td):last-child { padding-right: 0; }
:where(tbody tr:hover) td { background: var(--field); }
:where(th, td).num { text-align: right; }
.num { font-family: var(--font-mono); font-weight: 400; font-variant-numeric: tabular-nums; }
.res { font: 400 13px/1.4 var(--font-ui); letter-spacing: 0; color: var(--ink); }
.price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.age { font: 400 12px/1.4 var(--font-mono); color: var(--ink-muted); }
.table-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 0 0;
  font: 400 12px/1.4 var(--font-mono); letter-spacing: 0; color: var(--ink-muted);
}

.field { display: flex; align-items: stretch; gap: 10px; min-width: 0; margin: 4px 0 8px; }
:where(.field) :where(input, select) {
  flex: 1; min-width: 0; height: 40px; padding-top: 0; padding-bottom: 0;
  font-size: 14px; border-radius: 0; box-shadow: none;
}
:where(.field) .btn { min-height: 40px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 4px 0 0; padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 0; background: none;
  font: 400 11px/1.2 var(--font-mono); letter-spacing: .04em; color: var(--ink-muted);
}

.bar { position: relative; height: 8px; overflow: hidden; border-radius: 0; background: var(--ring-track); }
:where(.bar) i { position: absolute; inset: 0 auto 0 0; border-radius: 0; background: var(--accent); }
.bar:where(.thin) { height: 5px; }
.barrow {
  display: grid; grid-template-columns: 128px minmax(0,1fr) 46px; gap: 12px; align-items: center;
  padding: var(--row-pad) 0; font: 400 13px/1.4 var(--font-ui); color: var(--ink-muted);
}
:where(.barrow) .pct { font: 400 12px/1 var(--font-mono); text-align: right; color: var(--ink); }

.maplegend {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 18px; margin-top: 10px;
  font: 400 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted);
}
:where(.maplegend) span { display: flex; align-items: center; gap: 6px; }
:where(.maplegend) .sw { flex: none; box-sizing: content-box; width: 8px; height: 8px; border-radius: 50%; opacity: 1; }
:where(.maplegend .sw).cur { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
:where(.maplegend .sw).vis { background: var(--good); box-shadow: none; }
:where(.maplegend .sw).unk { background: none; border: 1px dashed var(--ink-muted); border-radius: 2px; box-shadow: none; }

.ph-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 200px; padding: 24px; text-align: center;
  font: 400 13px/1.45 var(--font-ui); color: var(--ink-muted);
}
:where(.ph-body) .t { font: 600 22px/1.1 var(--font-head); color: var(--ink); }

/* legacy dialogs: .modal-scrim shows with .open */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: auto; overscroll-behavior: contain;
  background: rgba(10,14,11,.72); -webkit-backdrop-filter: none; backdrop-filter: none;
}
.modal-scrim:where(.open) { display: flex; }
.modal {
  width: min(460px, 100%); max-width: 100%; max-height: 100%; margin: auto; overflow: auto;
  padding: 16px 18px 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--line); border-radius: 0; box-shadow: var(--hairline-top);
  color: var(--ink); font: 400 14px/1.45 var(--font-ui);
}
:where(.modal) h2 { margin: 0 0 2px; font: 600 22px/1.1 var(--font-head); letter-spacing: 0; color: var(--ink); }
:where(.modal) .sub { margin: 4px 0 14px; font: 400 11px/1.4 var(--font-mono); letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
:where(.modal) label { display: block; margin: 12px 0 6px; font: 500 11px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-muted); }
:where(.modal) .row { display: flex; gap: 12px; }
:where(.modal .row) > div { flex: 1; min-width: 0; }
:where(.modal) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"]), select) { width: 100%; height: 40px; padding-top: 0; padding-bottom: 0; }
:where(.modal) :where(textarea) { width: 100%; }
:where(.modal) .foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
:where(.modal) .err { margin-top: 10px; min-height: 16px; font: 400 13px/1.4 var(--font-ui); }

/* ── 17 · Focus: every control, the accent outline ──────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The select covers its wrapper's border box, so this ring is 2 px outside the field. */
.gl-select > select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 18 · Small screens and touch: 44 px hit targets ────────────────────── */
@media (max-width: 640px), (pointer: coarse) {
  .gl-btn, .gl-btn--sm, .gl-btn--md, .gl-notice .gl-btn, .btn, .mini, .tab { min-height: 44px; }
  .gl-btn--sm, .gl-btn--md { height: 44px; }
  .gl-select { height: 42px; }   /* 44 px with its border; the select spans all of it */
  .gl-input { height: 44px; }
  .field :where(input, select), .modal :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"]), select) { height: 44px; }
}
/* Phones, upright or on their side (the query phone.css and typography.css
   use): 16 px stops the browser zooming into a focused field. The select in
   a .gl-select inherits it. */
@media (max-width: 760px), (max-width: 1279px) and (max-height: 500px) and (pointer: coarse) {
  .gl-select, .gl-input { font-size: 16px; }
}
@media (max-width: 640px) {
  .gl-modal-scrim { align-items: flex-end; padding: 0; }
  .gl-modal { width: 100%; max-height: 92dvh; margin: 0; border-bottom: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}

/* ── 19 · Reduced motion: nothing animates ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ── 20 · Forced colours: system colours, borders stay visible ─────────── */
@media (forced-colors: active) {
  .gl-pane, .gl-modal, .card, .annot, .modal, .gl-notice, .chip {
    background: Canvas; color: CanvasText; border-color: CanvasText; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .gl-title, .annot h3, .gl-notice-tag, .gl-meta, .gl-k, .gl-hint, .hint, .gl-legend, .maplegend, .gl-foot, .table-foot { color: CanvasText; }
  .gl-row, .gl-table-row, .line, .lrow, tbody td, .gl-modal-foot, .modal .foot { border-color: GrayText; }
  .gl-table-head, thead th { border-color: CanvasText; }
  .gl-btn, .btn, .btn.ghost, .tab, .mini {
    forced-color-adjust: none; background: ButtonFace; color: ButtonText; border: 1px solid ButtonText; filter: none;
  }
  .gl-btn--solid, .gl-btn--red, .gl-notice .gl-btn, .btn:not(.ghost), .tab.active, .tab[aria-selected="true"], .tab[aria-pressed="true"],
  .gl-btn[aria-pressed="true"], .gl-btn[aria-checked="true"], .gl-btn[aria-selected="true"] {
    background: ButtonText; color: ButtonFace; border: 1px solid ButtonText;
  }
  /* A ghost button inside a notice (normally outlined in the notice tone). */
  .gl-notice .gl-btn.gl-btn--ghost { background: ButtonFace; color: ButtonText; border: 1px solid ButtonText; }
  /* Hover, at the weight of every hover rule above (a notice button and a
     pressed button outrank a bare .gl-btn:hover). */
  .gl-btn:hover, .btn:hover, .tab:hover, .mini:hover,
  .gl-notice .gl-btn:hover, .gl-notice .gl-btn.gl-btn--ghost:hover,
  .gl-btn[aria-pressed="true"]:hover, .gl-btn[aria-checked="true"]:hover, .gl-btn[aria-selected="true"]:hover { background: Highlight; color: HighlightText; border-color: Highlight; }
  .gl-btn:disabled, .gl-btn[aria-disabled="true"], .gl-notice .gl-btn:is(:disabled, [aria-disabled="true"]),
  .gl-notice .gl-btn.gl-btn--ghost:is(:disabled, [aria-disabled="true"]),
  .gl-btn:is(:disabled, [aria-disabled="true"]):is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]),
  .btn:disabled, .btn[aria-disabled="true"], .mini:disabled {
    background: Canvas; color: GrayText; border: 1px dashed GrayText;
  }
  .gl-select, .gl-input, :where(.glass-bridge) :where(input, select, textarea) { background: Field; color: FieldText; border-color: ButtonText; }
  .gl-select::after { color: FieldText; }
  .gl-dot, .pill::before, .maplegend .sw { forced-color-adjust: none; background: CanvasText; box-shadow: none; }
  .gl-dot--off, .pill.idle::before { background: Canvas; outline: 1px solid CanvasText; outline-offset: -1px; }
  .gl-dot--uncharted, .maplegend .sw.unk { background: Canvas; border: 1px dashed CanvasText; }
  .gl-skel, .bar { forced-color-adjust: none; background: GrayText; }
  .bar i { forced-color-adjust: none; background: CanvasText; }
  .gl-modal-scrim, .modal-scrim { background: Canvas; }
  .gl-seg-divider { background: CanvasText; }
  :focus-visible, .gl-select > select:focus-visible { outline: 2px solid Highlight; }
}
