/* Nephysis components. Depends on tokens.css + base.css. Vocabulary documented in DESIGN.md.
 * Rules of the house: corners 0-2 px, greys everywhere, accent only for details, few lines:
 * surfaces and space separate things, borders only where they carry meaning. */

/* ==== Buttons ======================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 36px; padding: 0 var(--s-4);
  background: transparent; color: var(--text);
  border: var(--border-strong); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: var(--tracking-label); text-transform: uppercase; text-decoration: none;
  white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { background: var(--surface); border-color: var(--muted); }
.btn:active { background: var(--raised); }
/* Primary: inverted neutral (text colour fill, background-colour text). Never blue. */
.btn--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--primary:hover { background: var(--text); border-color: var(--text); opacity: 0.88; }
.btn--primary:active { opacity: 0.78; background: var(--text); }
.btn--ghost { border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn--danger { color: var(--error); border-color: var(--error); }
.btn--danger:hover { background: var(--error-dim); border-color: var(--error); }
.btn--sm { height: 28px; padding: 0 var(--s-3); }
.btn--lg { height: 44px; padding: 0 var(--s-5); }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"], .btn.is-disabled {
  opacity: 0.4; cursor: not-allowed; pointer-events: none;
}
.btn__arrow { font-family: var(--font-sans); transition: transform var(--dur) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(2px); }

/* ==== Forms ========================================================================= */
/* Bare widgets are styled too, so Django's default form rendering looks right. */
.control,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
select,
textarea {
  display: block; width: 100%;
  height: 36px; padding: 0 var(--s-3);
  background: var(--bg); color: var(--text);
  border: var(--border-strong); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea { height: auto; min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="file"] { font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--muted); }
input[type="file"]::file-selector-button {
  margin-right: var(--s-3); height: 32px; padding: 0 var(--s-3);
  background: transparent; color: var(--text); border: var(--border-strong); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--fs-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; cursor: pointer;
}
/* Select: square chevron drawn with gradients (theme-aware via currentColor-free trick). */
select:not([multiple]):not([size]) {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
/* Multiselect */
select[multiple], select[size] { height: auto; min-height: 120px; padding: var(--s-1); }
select[multiple] option, select[size] option { padding: 4px var(--s-2); border-radius: 0; }
select[multiple] option:checked { background: var(--accent-dim); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
/* Native date/time pickers follow color-scheme from tokens. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }

/* Checkbox + radio: both square. Checkbox = tick on a filled box; radio = inner square. */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0;
  width: 16px; height: 16px; position: relative; display: inline-grid; place-content: center;
  background: var(--bg); border: var(--border-strong); border-radius: 0;
  cursor: pointer; vertical-align: -3px;
  transition: border-color var(--dur) var(--ease);
}
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--muted); }
input[type="checkbox"]::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg);
  transform: rotate(-45deg) scale(0); transition: transform var(--dur) var(--ease);
}
input[type="checkbox"]:checked { background: var(--text); border-color: var(--text); }
input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
input[type="checkbox"]:indeterminate { background: var(--text); border-color: var(--text); }
input[type="checkbox"]:indeterminate::after { width: 8px; height: 0; margin: 0; border-left: 0; border-bottom-width: 2px; transform: none; }
input[type="radio"]::after { content: ""; width: 8px; height: 8px; background: var(--text); transform: scale(0); transition: transform var(--dur) var(--ease); }
input[type="radio"]:checked { border-color: var(--text); }
input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.4; cursor: not-allowed; }

/* Range: hairline track, rectangular thumb, accent on focus. */
input[type="range"] {
  appearance: none; -webkit-appearance: none; width: 100%; height: 20px; margin: 0;
  background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 16px; margin-top: -7px;
  background: var(--text); border: 0; border-radius: 0;
}
input[type="range"]::-moz-range-thumb { width: 10px; height: 16px; background: var(--text); border: 0; border-radius: 0; }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-dim); outline: 1px solid var(--accent); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--accent-dim); outline: 1px solid var(--accent); }

/* .field: label + control + help/error. */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field__label {
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted);
}
.field__help, .field .helptext { font-size: var(--fs-xs); color: var(--faint); font-family: var(--font-sans); }
.field__error, .field .errorlist { margin: 0; padding: 0; list-style: none; font-size: var(--fs-xs); font-family: var(--font-sans); color: var(--error); }
.field--error input, .field--error select, .field--error textarea, .field input[aria-invalid="true"] { border-color: var(--error); }
.field--inline { flex-direction: row; align-items: center; gap: var(--s-2); }
.field--inline > label { text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--text); font-weight: 400; cursor: pointer; }
.field__row { display: flex; align-items: center; gap: var(--s-3); }
.field__value { font-family: var(--font-mono); font-size: var(--fs-sm); min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }  /* sentences, not captions */
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
/* Checklist: scrollable bordered list of checkboxes (alternative multiselect). */
.checklist { max-height: 200px; overflow: auto; border: var(--border-strong); border-radius: var(--radius); background: var(--bg); }
.checklist label { display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-3); border-bottom: var(--border); font-size: var(--fs-sm); cursor: pointer; }
.checklist label:last-child { border-bottom: 0; }
.checklist label:hover { background: var(--surface); }
.checklist label:has(input:checked) { box-shadow: inset 2px 0 0 var(--accent); }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; padding-top: var(--s-4); border-top: var(--border); }

/* ==== Panels + HUD frame ============================================================ */
.panel { position: relative; background: var(--surface); border-radius: var(--radius); min-width: 0; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 40px; padding: var(--s-4) var(--s-5) 0;
}
.panel__title { display: flex; align-items: center; gap: var(--s-2); font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.panel__title .accent { display: none; }  /* section numbers: dropped for a calmer look */
.panel__meta { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--faint); letter-spacing: 0.04em; }
.panel__body { padding: var(--s-4) var(--s-5) var(--s-5); }
.panel__body--flush { padding: 0; }
.panel__foot { padding: 0 var(--s-5) var(--s-4); font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--faint); }
.panel--raised { background: var(--raised); }
.panel--plain { background: transparent; }

/* .hud / .panel--hud are kept for compatibility but no longer draw corner brackets. */
.hud, .panel--hud { position: relative; }

/* ==== Stat tiles / KPI row ========================================================== */
.stat { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4); min-width: 0; }
.stat__label { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }
.stat__value { font-family: var(--font-mono); font-size: var(--fs-xl); font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.stat__unit { font-size: var(--fs-sm); color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.stat__sub { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--faint); }
.stat--key .stat__value { color: var(--text); }

/* .stats: KPI row of separate tiles; wraps on small screens. */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: var(--s-3);
}
.stats > .stat { background: var(--surface); border-radius: var(--radius); }

/* ==== Key-value table =============================================================== */
.kv { width: 100%; font-size: var(--fs-sm); }
.kv th, .kv td { padding: 7px 0; border-bottom: var(--border); text-align: left; vertical-align: top; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.kv th { width: 1%; padding-right: var(--s-5); font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.kv td { font-family: var(--font-sans); font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.kv--wrap th { white-space: normal; }

/* ==== Data table ==================================================================== */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); background: transparent; -webkit-overflow-scrolling: touch; }
.table-wrap--scroll { max-height: 480px; overflow-y: auto; }
.table { width: 100%; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.table th, .table td { height: 32px; padding: 0 var(--s-3); border-bottom: var(--border); text-align: left; white-space: nowrap; }
.table thead th {
  position: sticky; top: 0; z-index: 1; height: 34px;
  background: var(--surface); border-bottom: var(--border-strong);
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted);
}
.table td { font-family: var(--font-sans); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
/* Numbers, codes and identifiers are data: monospaced. */
.table td.num, .table td.mono, .kv td.num, .kv td.mono { font-family: var(--font-mono); font-size: 0.78rem; }
.table .num { text-align: right; }
.table tbody tr { transition: background-color var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-selected { background: var(--accent-dim); box-shadow: inset 2px 0 0 var(--accent); }
.table a { text-decoration-color: var(--line-strong); }
/* Sortable headers: <th aria-sort="ascending|descending|none"><a|button>Label</a></th> */
.table th[aria-sort] { cursor: pointer; user-select: none; }
.table th[aria-sort] > a, .table th[aria-sort] > button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.table th[aria-sort] > a:focus-visible, .table th[aria-sort] > button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.table th[aria-sort] .sort { display: inline-block; width: 7px; color: var(--faint); }
.table th[aria-sort="none"] .sort::before { content: "\2195"; }
.table th[aria-sort="ascending"] .sort::before { content: "\2191"; color: var(--accent); }
.table th[aria-sort="descending"] .sort::before { content: "\2193"; color: var(--accent); }
.table th[aria-sort="ascending"], .table th[aria-sort="descending"] { color: var(--text); }
.table--compact th, .table--compact td { height: 26px; padding: 0 var(--s-2); }

/* ==== Tags ========================================================================== */
.tag {
  display: inline-flex; align-items: center; gap: 0;
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.4;
  color: var(--muted); white-space: nowrap;
}
.tag::before, .tag::after { content: none; }
.tag--ok { color: var(--text); }
.tag--running { color: var(--accent); }
.tag--running::before, .tag--running::after { color: var(--accent); opacity: 0.6; }
.tag--failed { color: var(--error); }
.tag--failed::before, .tag--failed::after { color: var(--error); opacity: 0.6; }
.tag--admin { color: var(--text); }
.tag--admin::before, .tag--admin::after { color: var(--accent); }
.tag--muted { color: var(--faint); }
/* Boxed variant for filters/chips */
.tag--box { padding: 1px 6px; border: var(--border-strong); border-radius: var(--radius); }
.tag--box::before, .tag--box::after { content: none; }

/* ==== Status pips =================================================================== */
.pip { display: inline-block; width: 6px; height: 6px; flex-shrink: 0; background: var(--faint); vertical-align: 1px; }
.pip--ok, .pip--on { background: var(--accent); }
.pip--running { background: var(--accent); animation: pip-pulse 1.2s var(--ease) infinite; }
.pip--idle, .pip--off { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.pip--failed { background: var(--error); }
.pip--neutral { background: var(--text); }
@keyframes pip-pulse { 50% { opacity: 0.25; } }
.status { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-sans); font-size: var(--fs-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); }

/* ==== Messages / alerts ============================================================= */
.messages { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-4); }
.msg {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: transparent; border: var(--border); border-left: 2px solid var(--muted); border-radius: var(--radius);
  font-size: var(--fs-sm);
  transition: opacity 240ms var(--ease);
}
.msg__tag { flex-shrink: 0; font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); line-height: 1.75; }
.msg__body { flex: 1; min-width: 0; }
.msg__close { flex-shrink: 0; margin: -2px -4px 0 0; width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--faint); font-family: var(--font-sans); font-size: var(--fs-sm); line-height: 1; }
.msg__close:hover { color: var(--text); }
.msg--info, .msg--success { border-left-color: var(--accent); }
.msg--success .msg__tag { color: var(--text); }
.msg--warning { border-left-color: var(--text); }
.msg--warning .msg__tag { color: var(--text); }
.msg--error { border-color: var(--error); border-left-color: var(--error); color: var(--error); background: var(--error-dim); }
.msg--error .msg__tag { color: var(--error); }
.msg.is-leaving { opacity: 0; }

/* ==== Tabs ========================================================================== */
.tabs { display: flex; gap: 0; border-bottom: var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2);
  height: 38px; padding: 0 var(--s-4);
  background: transparent; border: 0; color: var(--muted); text-decoration: none; white-space: nowrap;
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase;
  transition: color var(--dur) var(--ease);
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.tabs__tab[aria-selected="true"], .tabs__tab.is-active, .tabs__tab[aria-current="page"] { color: var(--text); }
.tabs__tab[aria-selected="true"]::after, .tabs__tab.is-active::after, .tabs__tab[aria-current="page"]::after { background: var(--accent); }
.tabs__count { color: var(--faint); }
.tabpanel { padding-top: var(--s-4); }

/* ==== Empty state =================================================================== */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-3);
  padding: var(--s-7) var(--s-4); text-align: center;
  border-radius: var(--radius);
  color: var(--muted);
}
.empty__code { font-family: var(--font-sans); font-size: var(--fs-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--faint); }
.empty__title { font-size: var(--fs-md); font-weight: 500; color: var(--text); }
.empty p { font-size: var(--fs-sm); max-width: 48ch; }

/* ==== Console / log ================================================================= */
.console { border-radius: var(--radius); background: var(--surface); min-width: 0; }
.console__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); height: 32px; padding: 0 var(--s-3); background: var(--surface); }
.console__body {
  max-height: 360px; overflow: auto; padding: var(--s-3);
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.65; color: var(--text);
  white-space: pre; tab-size: 2;
}
.console__body--wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.console .ts { color: var(--faint); }
.console .lvl-info { color: var(--muted); }
.console .lvl-ok { color: var(--accent); }
.console .lvl-warn { color: var(--text); font-weight: 600; }
.console .lvl-err { color: var(--error); }
.console__prompt::before { content: "> "; color: var(--accent); }
pre.console__body { margin: 0; }

/* ==== Charts ======================================================================== */
.chart { position: relative; width: 100%; min-height: 280px; min-width: 0; }
.chart--sm { min-height: 200px; }
.chart--lg { min-height: 400px; }
.chart:empty::before {
  content: "NO DATA"; position: absolute; inset: 0; display: grid; place-content: center;
  font-family: var(--font-sans); font-size: var(--fs-xs); letter-spacing: var(--tracking-wide); color: var(--faint);
  background-image: linear-gradient(var(--grid-faint) 1px, transparent 1px), linear-gradient(90deg, var(--grid-faint) 1px, transparent 1px);
  background-size: 24px 24px;
}
.chart-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-2); }
/* Plotly chrome overrides */
.chart .modebar { display: none !important; }
.chart .hoverlayer .hovertext path { stroke-width: 1px !important; }

/* ==== Map (Leaflet) ================================================================= */
.map { position: relative; width: 100%; height: 420px; background: var(--surface); border-radius: var(--radius); z-index: 0; }
.map--sm { height: 280px; }
.map--lg { height: 560px; }
.map .leaflet-tile-pane { filter: var(--map-filter); }
.map.leaflet-container { background: var(--surface); font-family: var(--font-sans); font-size: var(--fs-xs); }
.map .leaflet-bar { border: var(--border-strong) !important; border-radius: var(--radius) !important; box-shadow: none !important; }
.map .leaflet-bar a {
  width: 28px; height: 28px; line-height: 28px;
  background: var(--raised); color: var(--text); border-bottom: var(--border) !important; border-radius: 0 !important;
  font-family: var(--font-sans); font-weight: 400;
}
.map .leaflet-bar a:hover { background: var(--surface); color: var(--text); }
.map .leaflet-bar a.leaflet-disabled { background: var(--surface); color: var(--faint); }
.map .leaflet-control-attribution { background: var(--overlay) !important; color: var(--muted); font-size: 10px; padding: 0 6px; }
.map .leaflet-control-attribution a { color: var(--muted); }
.map .leaflet-popup-content-wrapper, .map .leaflet-tooltip {
  background: var(--raised); color: var(--text); border: var(--border-strong); border-radius: var(--radius); box-shadow: none;
  font-family: var(--font-sans); font-size: var(--fs-xs);
}
.map .leaflet-popup-tip { background: var(--raised); box-shadow: none; border: var(--border-strong); }
.map .leaflet-tooltip::before { display: none; }
.map .leaflet-popup-content { margin: var(--s-2) var(--s-3); line-height: 1.5; }
.map .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
/* Station marker: L.divIcon({className: "station-pip", iconSize: [10, 10]}); add "is-selected". */
.station-pip { background: var(--muted); border: 1px solid var(--bg); box-shadow: 0 0 0 1px var(--muted); transition: background-color var(--dur) var(--ease); }
.station-pip:hover { background: var(--text); box-shadow: 0 0 0 1px var(--text); }
.station-pip.is-selected { background: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-dim), 0 0 10px var(--accent-glow); z-index: 1000 !important; }
.station-pip.is-muted { background: var(--faint); box-shadow: 0 0 0 1px var(--faint); opacity: 0.6; }

/* ==== Disclosure (details) ========================================================== */
.disclosure { border-radius: var(--radius); }
.disclosure > summary {
  display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-3);
  list-style: none; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; width: 1ch; color: var(--faint); }
.disclosure[open] > summary::before { content: "\2212"; color: var(--accent); }
.disclosure > summary:hover { color: var(--text); }
.disclosure__body { padding: var(--s-3); border-top: var(--border); }

/* ==== Progress / loader ============================================================= */
.progress { position: relative; height: 2px; background: var(--line); overflow: hidden; }
.progress__bar { position: absolute; inset: 0 auto 0 0; width: var(--value, 0%); background: var(--accent); transition: width 300ms var(--ease); }
.progress--indeterminate .progress__bar { width: 30%; animation: progress-slide 1.4s var(--ease) infinite; }
@keyframes progress-slide { from { left: -30%; } to { left: 100%; } }
.loader { display: inline-flex; gap: 3px; }
.loader i { width: 4px; height: 4px; background: var(--muted); animation: pip-pulse 1s steps(2) infinite; }
.loader i:nth-child(2) { animation-delay: 0.2s; }
.loader i:nth-child(3) { animation-delay: 0.4s; }
.htmx-indicator { opacity: 0; transition: opacity var(--dur) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ==== Copyable id =================================================================== */
.copy { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.copy__btn { height: 22px; padding: 0 6px; background: transparent; border: var(--border); border-radius: var(--radius); color: var(--faint); font-family: var(--font-sans); font-size: 10px; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.copy__btn:hover { color: var(--text); border-color: var(--line-strong); }
.copy__btn.is-done { color: var(--accent); border-color: var(--accent); }

/* ==== Section header (inside pages) ================================================= */
.section-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }

.section-head__index { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--accent); letter-spacing: var(--tracking-label); }

/* ==== HUD backdrop: faint square grid + readouts ==================================== */
.hud-grid { background: none; }  /* the grid backdrop was dropped */
.readout { font-family: var(--font-sans); font-size: var(--fs-xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--faint); font-variant-numeric: tabular-nums; }
.readout b { font-weight: 500; color: var(--muted); }
.readout .accent { color: var(--accent); }

/* ==== Home (public landing) ========================================================= */
.hero { position: relative; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: var(--s-7) var(--gutter); overflow: hidden; }
.hero__frame { position: relative; width: 100%; max-width: 880px; min-height: min(68vh, 620px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-5); padding: var(--s-8) var(--s-5); text-align: center; }
.hero__symbol { width: clamp(96px, 18vw, 148px); height: auto; }
.hero__lockup { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.hero__wordmark { font-family: var(--font-display); font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 500; letter-spacing: 0.42em; margin-right: -0.42em; line-height: 1; }
.hero__statement { max-width: 36ch; font-size: var(--fs-lg); color: var(--muted); }
.hero__rule { width: 48px; height: 1px; background: var(--accent); border: 0; margin: 0; }
.hero__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin-top: var(--s-2); }
.hero__corner { position: absolute; display: flex; flex-direction: column; gap: 4px; padding: var(--s-3); text-align: left; }
.hero__corner--tl { top: 0; left: 0; }
.hero__corner--tr { top: 0; right: 0; text-align: right; align-items: flex-end; }
.hero__corner--bl { bottom: 0; left: 0; }
.hero__corner--br { bottom: 0; right: 0; text-align: right; align-items: flex-end; }
.hero__crosshair { position: absolute; width: 11px; height: 11px; opacity: 0.6; }
.hero__crosshair::before, .hero__crosshair::after { content: ""; position: absolute; background: var(--muted); }
.hero__crosshair::before { left: 5px; top: 0; width: 1px; height: 11px; }
.hero__crosshair::after { top: 5px; left: 0; height: 1px; width: 11px; }
.hero__ticks { position: absolute; left: 50%; bottom: var(--s-3); transform: translateX(-50%); width: 160px; height: 6px;
  background-image: linear-gradient(90deg, var(--line-strong) 1px, transparent 1px); background-size: 10px 6px; }
.hero__ticks::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 10px; background: var(--accent); }
@media (max-width: 599px) {
  .hero { padding: var(--s-5) var(--gutter); }
  .hero__frame { padding: var(--s-8) var(--s-3); min-height: 72vh; }
  .hero__corner { padding: var(--s-2); }
  .hero__corner .readout-optional { display: none; }
}

/* ==== Auth (login) ================================================================== */
.auth { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: var(--s-7) var(--gutter); }
.auth__box { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: var(--s-5); }
.auth__symbol { width: 56px; height: auto; }
.auth__panel { width: 100%; }
.auth__panel form { display: flex; flex-direction: column; gap: var(--s-4); }
.auth__note { font-family: var(--font-sans); font-size: var(--fs-xs); color: var(--faint); text-align: center; letter-spacing: 0.04em; }

/* Whole-panel links (overview shortcuts): no underline, hover lifts the border. */
a.panel { display: block; color: inherit; text-decoration: none; }
a.panel:hover { border-color: var(--line-strong); }
a.panel:hover .panel__title { color: var(--text); }
/* Inline filter bars: the actions sit on the field row, without the separator. */
.form-grid > .form-actions { padding-top: 0; border-top: 0; align-self: end; }
