@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;600;700&display=swap');
/* ═══ SIGDX ODS — styles v20260324-phE10 ═══ */
:root {
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  /* Cool palette */
  --bg: #f4f6fa;
  --bg-top: #fafbfd;
  --bg-bot: #edf0f7;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #edf0f7;
  --surface-overlay: rgba(250,251,253,.97);
  --surface-raised: var(--surface-3);
  --panel: var(--surface);
  --panel-shadow: var(--shadow-md);
  --text: #0f1520;
  --text-strong: #080d17;
  --text-soft: #3a4560;
  --text-muted: #7a8ba0;
  --text-secondary: var(--text-soft);
  --muted: var(--text-muted);
  --border: #dde3ee;
  --border-strong: #bcc6da;
  --bg-strong: #edf0f7;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-teal: #0891b2;
  --accent-soft: #eef3ff;
  --ok: #16a34a;
  --warn: #d97706;
  --crit: #dc2626;
  --info: #2563eb;
  --metric-left: #0891b2;
  --metric-right: #dc2626;
  --shadow-sm: 0 1px 3px rgba(30,50,100,.08), 0 0 0 1px rgba(30,50,100,.04);
  --shadow-md: 0 4px 16px rgba(30,50,100,.10), 0 1px 4px rgba(30,50,100,.06);
  --shadow-lg: 0 12px 40px rgba(30,50,100,.12), 0 2px 8px rgba(30,50,100,.06);
  /* Rail sidebar — intentionally dark */
  --rail-bg: linear-gradient(180deg,#1e2d4a 0%,#111827 100%);
  --rail-text: #e8edf5;
  --rail-text-soft: #8a9ab5;
  --rail-text-secondary: var(--rail-text-soft);
  --rail-muted: #4a5870;
  --rail-border: rgba(232,237,245,.1);
  --rail-border-strong: rgba(232,237,245,.16);
  --rail-surface: rgba(255,255,255,.06);
  --rail-surface-hover: rgba(255,255,255,.12);
  /* Plot */
  --plot-bg-top: #f7faff;
  --plot-bg-bot: #edf0f7;
  --plot-grid: rgba(15,21,32,.12);
  --plot-lane-bg: rgba(37,99,235,.04);
  --plot-tick-color: rgba(15,21,32,.6);
  --plot-marker-stroke: rgba(255,255,255,.9);
  /* ── Spacing scale — 4px grid ── */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-7: 32px;  --sp-8: 48px;
  /* ── Control heights ── */
  --ctrl-xs: 24px; --ctrl-sm: 28px; --ctrl-md: 34px; --ctrl-lg: 48px;
  /* ── Width tokens ── */
  --w-1: 100px; --w-2: 128px; --w-3: 280px; --w-4: 360px;
  /* ── Border radius ── */
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-full: 9999px;
  /* ── Type scale ── */
  --t-2xs: 10px; --t-xs: 11px; --t-sm: 12px; --t-base: 13px;
  --t-md:  14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 26px;
  /* ── Elevation ── */
  --el-raised:  0 1px 4px rgba(8,20,60,.08);
  --el-float:   0 4px 16px rgba(8,20,60,.12);
  --el-overlay: 0 8px 32px rgba(8,20,60,.18);
  --el-modal:   0 20px 60px rgba(8,20,60,.28);
  /* ── Brand ── */
  --brand-grad: linear-gradient(135deg, var(--accent) 0%, var(--accent-teal) 100%);
  --accent-halo: rgba(37,99,235,.12);
  /* ── Severity ── */
  --sev-low: #0891b2; --sev-med: #d97706; --sev-high: #ea580c; --sev-critical: #dc2626;
  /* Unified control tokens */
  --ctrl-font: var(--t-xs);
  --ribbon-h: 36px;
  --section-table-fr: 50fr;
  --section-spatial-fr: 50fr;
}
* { box-sizing: border-box; margin: 0; padding: 0; scrollbar-width: thin; scrollbar-color: rgba(58,69,96,.28) transparent; }
html, body, #app { width: 100%; height: 100%; }
body, button, input, select, textarea { font-family: var(--font-ui); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
body {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: linear-gradient(160deg,var(--bg-top) 0%,var(--bg-bot) 100%);
  -webkit-font-smoothing: antialiased;
}
/* Hide browser-native password reveal (Edge/Chromium) — we have our own toggle */
input[type="password"]::-ms-reveal { display: none; }
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-thumb { background: rgba(58,69,96,.26); border: 4px solid transparent; border-radius: 999px; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.brand-title,.ctrl-mode-title,.dash-section-title,.settings-title,.login-title,.admin-title,.anomaly-title { font-family: var(--font-display); }
/* ─── Top bar ─── */
.top-bar {
  height: 58px; min-height: 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: relative; z-index: 20; color: var(--text); background: rgba(255,255,255,.94); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.top-bar::before { content:''; position:absolute; inset:0 0 auto; height:2px; background: linear-gradient(90deg,var(--accent) 0%,var(--accent-teal) 60%,transparent 100%); }
.brand-block,.top-metrics,.top-metric,.rail-actions,.anomaly-ribbon-actions,.settings-head-left,.admin-head-left,.settings-profile,.settings-profile-edit-row,.ctrl-field-row,.settings-inline,.admin-form-row,.admin-form-actions,.totp-setup-actions,.totp-verify-row,.tfa-recommend-content { display:flex; align-items:center; gap:12px; }
.brand-block { gap: 11px; }
.brand-mark { width: 36px; height: 36px; }
.brand-copy { display:flex; flex-direction:column; min-width:0; }
.brand-kicker,.top-metric-label,.panel-title,.rail-field-label,.ctrl-kicker,.ctrl-section-label,.ctrl-field-label,.settings-section-label,.login-eyebrow,.section-hd { font-size: 10px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; }
.brand-kicker,.top-metric-label,.panel-title,.ctrl-kicker,.ctrl-section-label,.ctrl-field-label,.settings-section-label,.login-field-label { color: var(--text-soft); }
.brand-title { font-size: 16px; letter-spacing: -.04em; color: var(--text-strong); }
.brand-line-wrap { display:inline-flex; align-items:center; gap:7px; padding:4px 9px 4px 10px; border-radius:999px; background: var(--accent-soft); border:1px solid rgba(37,99,235,.1); }
.brand-line-label { font-size:10px; font-weight:700; color: var(--text-soft); }
.m-badge { width: 26px; height: 26px; border-radius: 8px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800; font-size:11px; box-shadow: 0 2px 6px rgba(0,0,0,.14); }
.m1b{background:#ea4335}.m2b{background:#00a86b}.m3b{background:#fbbc04;color:#162744}.customb{background:linear-gradient(135deg,var(--accent) 0%,var(--accent-teal) 100%)}
.top-metrics { flex: 0 0 auto; align-items: center; gap: 0; }
.top-metric { display:flex; flex-direction:column; gap:2px; padding: 0 13px; }
.top-metric-value { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-strong); }
.top-metric-divider { width:1px; height:20px; background: var(--border); }
/* ─── Layout ─── */
.main { flex:1; min-height:0; height:calc(100vh - 58px); display:flex; gap:12px; padding:12px; align-items:stretch; }
.workspace-shell { flex:1; min-width:0; min-height:0; display:flex; flex-direction:column; gap:12px; }
.console-panel,.anomaly-ribbon-card,.mode-table-panel,.dash-plot-card,.section-stations,.section-table-panel,.upload-hint-panel,#legend {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--el-raised); border-radius: var(--r-lg);
}
.settings-card,.admin-panel,.totp-setup-card {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--el-modal); border-radius: var(--r-lg);
}
.console-panel { min-height:0; height:100%; display:flex; flex-direction:column; gap:12px; padding:12px; overflow:hidden; }
.container-1 { width: 238px; min-width: 238px; }
.container-2 { width: 265px; min-width: 265px; }
.console-panel.collapsed { width:48px; min-width:48px; max-width:48px; padding:12px 7px; flex:0 0 48px; }
.console-panel.collapsed .panel-title, .console-panel.collapsed .panel-body { display:none; }
.panel-titlebar { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:2px 2px 8px; }
.panel-body { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; gap:12px; }
.panel-body-scroll { overflow:auto; }
.container-1-footer { margin-top:auto; display:flex; flex-direction:column; gap:8px; }
/* ─── Ctrl panel ─── */
.ctrl-mode-head { display:flex; flex-direction:column; gap:6px; }
.ctrl-mode-title,.dash-section-title,.settings-title { font-size:17px; line-height:1.08; letter-spacing:-.03em; color: var(--text-strong); }
/* dash-section-title removed */
.settings-head-icon,.admin-head-icon,.upload-icon,.hint-icon { color: var(--accent); }
/* ─── Rail dark sidebar ─── */
.rail-dark { background: var(--rail-bg); border-color: var(--rail-border); color: var(--rail-text); box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.rail-dark .panel-titlebar { border-bottom:1px solid var(--rail-border); }
.rail-context,.ctrl-filters,.mode-control-group { display:flex; flex-direction:column; gap:10px; }
.rail-field,.ctrl-field,.toolbar-field,.login-field,.settings-section,.admin-form-row label { display:flex; flex-direction:column; gap:6px; }
.rail-input,.ctrl-input,.tb-select,.profile-edit-input,.login-input,.admin-form-row input,.admin-form-row select,.admin-audit-range input[type=date],.totp-digit,.totp-verify-input {
  width:100%; min-height:var(--ctrl-md); padding:8px 12px; border-radius:var(--r-sm); border:1px solid var(--border-strong); background: var(--surface); color: var(--text); font:inherit; outline:none; appearance:none;
}
.rail-input option,.ctrl-input option,.admin-form-row select option { background: var(--surface-2); color: var(--text); }
.rail-dark .rail-input { background: rgba(255,255,255,.07); border-color: var(--rail-border-strong); color: var(--rail-text); }
.rail-input:focus,.ctrl-input:focus,.tb-select:focus,.profile-edit-input:focus,.login-input:focus,.admin-form-row input:focus,.admin-form-row select:focus,.admin-audit-range input[type=date]:focus,.totp-digit:focus,.totp-verify-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.11); }
.rail-input::placeholder,.ctrl-input::placeholder,.profile-edit-input::placeholder,.login-input::placeholder,.admin-form-row input::placeholder { color: var(--text-muted); }
/* ─── Buttons ─── */
.shell-icon-btn,.rail-action-btn,.ribbon-scroll-btn,.util-icon-btn,.icon-btn,.settings-close-btn,.settings-logout-btn,.settings-admin-btn,.settings-2fa-btn,.settings-collapse-btn,.upload-info-btn,.act-btn,.admin-close-btn,.admin-add-btn,.admin-btn-save,.admin-btn-cancel,.admin-tab,.map-mode-btn,.map-nav-btn,.v-btn,.totp-copy-btn,.totp-verify-btn,.tfa-recommend-btn,.tfa-recommend-close,.login-submit {
  border-radius:var(--r-sm); transition: background .14s ease,color .14s ease,border-color .14s ease,transform .13s ease; }
.shell-icon-btn,.rail-action-btn,.ribbon-scroll-btn,.util-icon-btn,.icon-btn,.settings-close-btn,.upload-info-btn,.act-btn,.admin-close-btn { width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; padding:0; border:1px solid var(--border); background: var(--surface-3); color: var(--text-soft); }
.shell-icon-btn:hover,.rail-action-btn:hover,.ribbon-scroll-btn:hover:not([disabled]),.util-icon-btn:hover,.icon-btn:hover,.settings-close-btn:hover,.upload-info-btn:hover,.act-btn:hover,.admin-close-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.2); color: var(--accent); }
.rail-dark .shell-icon-btn,.rail-dark .rail-action-btn,.rail-dark .ribbon-scroll-btn { background: var(--rail-surface); border-color: var(--rail-border); color: var(--rail-text-soft); }
.rail-dark .shell-icon-btn:hover,.rail-dark .rail-action-btn:hover,.rail-dark .ribbon-scroll-btn:hover:not([disabled]) { background: var(--rail-surface-hover); color: var(--accent); }
.shell-icon-btn svg,.ribbon-scroll-btn svg,.utility-icon,.nav-icon,.settings-head-icon,.hint-icon,.upload-icon,.admin-head-icon,.settings-close-btn svg,.settings-logout-btn svg,.settings-admin-btn svg,.settings-2fa-btn svg,.settings-collapse-chevron,.upload-info-btn svg,.act-btn svg,.admin-close-btn svg { width:16px; height:16px; stroke:currentColor; stroke-width:1.8; fill:none; stroke-linecap:round; stroke-linejoin:round; }
/* ─── Rail nav ─── */
.rail-nav .container-mode-stack,.view-toggle,.map-mode-toggle,.inline-mode-toggle { display:grid; gap:6px; }
.map-mode-toggle { grid-template-columns: repeat(2,minmax(0,1fr)); }
.map-nav-row { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }
.rail-nav .v-btn,.map-mode-btn,.map-nav-btn,.chip,.toolbar-chip,.mini-chip,.admin-tab {
  min-height:38px; padding:8px 12px; border:1px solid var(--border); background: rgba(255,255,255,.76); color: var(--text-soft); font-weight:600; font-size:12px;
}
.rail-nav .v-btn { border-color: var(--rail-border); background: rgba(255,255,255,.05); color: var(--rail-text-soft); }
.rail-nav .v-btn { display:flex; align-items:center; justify-content:flex-start; gap:9px; }
.rail-nav .v-btn:hover:not(.active) { background: var(--rail-surface-hover); color: var(--rail-text); }
.map-mode-btn:hover:not(.active),.map-nav-btn:hover:not(:disabled),.admin-tab:hover:not(.active) { background: var(--accent-soft); border-color: rgba(37,99,235,.15); color: var(--accent); }
.map-nav-btn:disabled { opacity:.52; cursor:not-allowed; }
.rail-nav .v-btn.active,.map-mode-btn.active,.chip.active,.toolbar-chip.active,.mini-chip.active,.admin-tab.active { color:#fff; border-color:transparent; background: linear-gradient(135deg,var(--accent) 0%,var(--accent-teal) 100%); box-shadow: 0 6px 18px rgba(37,99,235,.22); }
.rail-separator,.ctrl-separator,.settings-divider,.hint-divider { height:1px; background: var(--border); }
.rail-separator { background: var(--rail-border); }
/* ─── Status banner ─── */
.rail-status,.settings-pw-status,.admin-status,.upload-status,.totp-setup-status,.login-error {
  padding:10px 12px; border-radius:var(--r-sm); border:1px solid var(--border);
}
.rail-status { display:flex; align-items:flex-start; gap:10px; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08); }
.rail-status-dot { width:7px; height:7px; margin-top:4px; border-radius:50%; background: var(--info); flex: 0 0 7px; }
.rail-status[data-kind=error] .rail-status-dot { background: var(--crit); }
.rail-status[data-kind=loading] .rail-status-dot { background: var(--warn); }
.rail-status[data-kind=empty] .rail-status-dot { background: rgba(255,255,255,.32); }
.rail-status-text { color: var(--rail-text-soft); font-size:12px; }

/* ─── Anomaly ribbon ─── */
/* ─── Anomaly Ribbon — Phase 4 ─── */
.anomaly-ribbon-card { padding: 0; overflow: hidden; isolation: isolate; }
/* Bar — always-visible 32px strip */
.ar-bar {
  height: 32px; min-height: 32px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 10px;
}
.ar-toggle {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; padding: 0;
  color: var(--text-muted); transition: color .13s; cursor: pointer;
}
.ar-toggle:hover { color: var(--accent); }
.ar-chevron {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease;
}
.anomaly-ribbon-card.ar-expanded .ar-chevron { transform: rotate(180deg); }
.ar-dot {
  width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
  background: var(--accel-color, var(--border-strong));
  transition: background .2s;
}
.ar-summary {
  flex: 1; min-width: 0;
  font-size: 11px; font-weight: 600; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .01em;
}
.ar-bar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* Animated track using grid-template-rows collapse trick */
.ar-track-wrap {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .18s ease;
  overflow: clip;
}
.anomaly-ribbon-card.ar-expanded .ar-track-wrap { grid-template-rows: 1fr; }
.anomaly-ribbon-track {
  min-height: 0;
  display: flex; gap: 7px;
  overflow-x: auto; overflow-y: hidden;
  padding: 4px 12px 8px;
  scroll-snap-type: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.anomaly-ribbon-track::-webkit-scrollbar { height: 4px; }
.anomaly-ribbon-track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.anomaly-ribbon-track::-webkit-scrollbar-track { background: transparent; }
/* ─── Defect cards — Phase 4 ─── */
.d-card {
  min-width: 160px; max-width: 160px; height: 64px;
  padding: 7px 10px 7px 12px;
  position: relative; flex-shrink: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-sm);
  cursor: pointer; overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
.d-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--accel-color, var(--accent));
}
.d-card:hover { box-shadow: var(--shadow-md); }
.d-card.sel { border-color: rgba(37,99,235,.4); box-shadow: 0 0 0 2px rgba(37,99,235,.2), var(--shadow-md); }
/* Line 1: dot + position + rail badge */
.dc-l1 { display: flex; align-items: center; gap: 5px; overflow: hidden; }
.dc-sev-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--accel-color, var(--border-strong)); }
.dc-pos { font-family: var(--font-mono); font-size: 10px; color: var(--text-soft); flex-shrink: 0; white-space: nowrap; }
.dc-rail-badge { font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-3); border-radius: 3px; padding: 0 3px; flex-shrink: 0; }
/* Line 2: section name */
.dc-l2 { overflow: hidden; }
.dc-sec { font-size: 11px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
/* Line 3: acceleration value + counter */
.dc-l3 { display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.dc-val { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accel-color, var(--accent)); }
.dc-counter { font-size: 10px; color: var(--text-muted); }
.empty-state { padding:12px 14px; border:1px dashed var(--border-strong); border-radius:var(--r-sm); background: var(--surface-3); color: var(--text-soft); }
/* ─── View / map area ─── */
.view-area,#map,#map-3d,.leaflet-container,.maplibregl-map { border-radius:18px; }
.view-area { position:relative; flex:1; min-height:0; overflow:hidden; }
#map,#map-3d,#dashboard,#total-mode,#section-mode,.mode-surface,.section-mode-shell,.section-main { height:100%; min-height:0; }
.mode-surface.total-surface,.mode-surface.dash-surface,.section-mode-shell { padding:14px; }
.mode-table-panel,.section-table-panel { padding:14px; min-height:0; overflow-y:auto; display:flex; flex-direction:column; gap:10px; height:100%; }
.section-stations,.dash-plot-card { padding:14px; min-height:0; }
.plot-embed{flex:1;min-height:0;border:none;border-radius:0;box-shadow:none}
.pos-rel{position:relative}
.mode-context-strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(148px,1fr)); gap:8px; }
.mode-context-chip { display:flex; flex-direction:column; gap:5px; padding:9px 11px; border:1px solid var(--border); border-radius:var(--r-sm); background:linear-gradient(180deg, rgba(255,255,255,.72), rgba(238,242,247,.92)); }
.mode-context-chip-label { font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color: var(--text-muted); }
.mode-context-chip-value { font-size:13px; font-weight:700; color: var(--text-strong); line-height:1.25; }
.mode-context-chip-value.mono { font-family: var(--font-mono); }
.mode-context-chip-sub { font-size:11px; color: var(--text-soft); line-height:1.3; }
/* ─── Tables ─── */
.dash-table-wrap,.total-table-wrap,.section-table-wrap,.admin-table-wrap { flex:1; min-height:0; overflow:auto; max-width:100%; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface); }
.dash-table,.total-table,.admin-table,.pop-table { width:100%; border-collapse:separate; border-spacing:0; }
.dash-table th,.dash-table td,.total-table th,.total-table td,.admin-table th,.admin-table td { padding:10px 12px; text-align:left; white-space:nowrap; }
.dash-table th,.total-table th,.admin-table th { position:sticky; top:0; z-index:2; font-size:10px; letter-spacing:.08em; text-transform:uppercase; color: var(--text-soft); background: var(--surface-2); border-bottom:1px solid var(--border); }
.dash-table td,.total-table td,.admin-table td,.pop-table td { color: var(--text); border-bottom:1px solid var(--border); }
.dash-row:hover,.total-row:hover,.admin-table tbody tr:hover { background: var(--accent-soft); }
.dash-row.sel,.total-row.sel { background: rgba(37,99,235,.07); }
.dash-label-cell { font-weight:400; color: var(--text-strong); }
td.accel-cell { color: var(--accel-color,var(--accent)); font-weight:800; }
td.counter-cell { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.rail-split { font-weight:700; }
.rail-split-left { color: var(--metric-left); }
.rail-split-right { color: var(--metric-right); }
.dash-bar-wrap,.password-strength-bar { width:100%; height:7px; border-radius:999px; background: var(--border); overflow:hidden; }
.dash-bar { width: var(--bar-width,0%); height:100%; border-radius:inherit; background: var(--bar-color,var(--accent)); }
.mode-inline-stats,#total-summary { display:flex; flex-wrap:wrap; gap:6px; }
.total-summary-chip { min-width:98px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 10px; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); }
.total-summary-chip span { font-size:10px; letter-spacing:.08em; text-transform:uppercase; color: var(--text-soft); }
/* ─── Section mode ─── */
.section-layout { display:grid; grid-template-columns:230px minmax(0,1fr); gap:12px; height:100%; transition: grid-template-columns .2s ease; }
.section-layout.sections-collapsed { grid-template-columns:28px minmax(0,1fr); }
.section-layout.sections-collapsed .section-stations { overflow:visible; padding:0; border:none; }
.section-layout.sections-collapsed .section-stations > :not(.section-header) { display:none; }
.section-layout.sections-collapsed .section-header .dash-section-title { display:none; }
.section-header { display:flex; align-items:center; justify-content:space-between; gap:6px; }
.section-collapse-btn { width:28px; height:28px; flex:0 0 28px; display:flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:var(--r-sm); background:var(--surface-3); color:var(--text-soft); cursor:pointer; transition:background .13s, color .13s, transform .2s; }
.section-collapse-btn:hover { background:var(--accent-soft); border-color:rgba(37,99,235,.2); color:var(--accent); }
.section-collapse-btn svg { width:14px; height:14px; }
.section-layout.sections-collapsed .section-collapse-btn { transform:rotate(180deg); }
.section-sep { border:none; border-top:1px solid var(--border); margin:8px 0 6px; }
.section-stations { position:relative; display:flex; flex-direction:column; overflow:hidden; }
.section-station-list { display:flex; flex-direction:column; gap:6px; overflow:auto; padding-right:4px; }
.section-station-btn { width:100%; padding:9px 11px; text-align:left; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); color: var(--text-soft); font-size:var(--t-sm); font-weight:400; }
.section-station-btn span { font-weight:400; }
.section-station-btn.active { color:#fff; border-color:transparent; background: linear-gradient(135deg,var(--accent) 0%,var(--accent-teal) 100%); box-shadow: 0 6px 18px rgba(37,99,235,.2); }
.section-main { display:grid; grid-template-rows:auto var(--section-table-fr,60fr) var(--section-spatial-fr,40fr); gap:10px; min-height:0; overflow:hidden; }
.section-plot-shell,.dash-plot-shell { position:relative; height:100%; min-height:0; }
/* ─── Signal workspace ─── */
.sig-workspace { display:flex; flex-direction:column; min-height:0; overflow:hidden; border:1px solid var(--border); border-radius:var(--r-lg); background: var(--surface); box-shadow: var(--el-raised); }
/* ─── Spatial toolbar ─── */
.sp-toolbar { display:flex; align-items:center; gap:4px; padding:4px 8px; border-bottom:1px solid var(--border); background:var(--surface-2); flex:0 0 auto; }
.sp-tool-btn { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; padding:0; border:1px solid var(--border); border-radius:var(--r-sm); background:var(--surface); color:var(--text-soft); cursor:pointer; transition:background .13s, color .13s, border-color .13s; }
.sp-tool-btn svg { width:16px; height:16px; pointer-events:none; }
.sp-tool-btn:hover { background:var(--accent-soft); color:var(--accent); border-color:rgba(37,99,235,.15); }
.sp-tool-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }
/* Signal empty state */
.sig-empty-state { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color: var(--text-muted); }
.sig-empty-state svg { width:32px; height:32px; stroke:currentColor; fill:none; stroke-width:1.5; opacity:.5; }
.sig-empty-label { font-size:13px; font-weight:700; color: var(--text-soft); }
.sig-empty-sub { font-size:11px; color: var(--text-muted); }
.section-plot-container,.section-plot-container svg { width:100%; height:100%; }
.section-datatip { position:absolute; z-index:4; min-width:176px; max-width:220px; padding:10px 12px; border-radius:var(--r-md); border:1px solid var(--border); background: var(--surface-overlay); box-shadow: var(--shadow-md); }
.section-datatip strong { display:block; margin-bottom:4px; font-family: var(--font-display); color: var(--text-strong); }
.section-datatip span { display:block; color: var(--text-soft); }
/* ─── Map legend — scientific colorbar ─── */
#legend { position:absolute; top:16px; left:16px; z-index:800; width:68px; padding:13px 10px; display:flex; gap:9px; border-radius:14px; }
.leg-bar {
  flex:0 0 13px; min-height:196px; border-radius:2px;
  background: linear-gradient(180deg,
    #eb5757 0%,
    #ffb347 25%,
    #86d17a 50%,
    #2ab7ca 75%,
    #0b4f8c 100%
  );
}
.leg-scale { min-height:196px; display:flex; flex-direction:column; justify-content:space-between; }
.leg-scale span { font-family: var(--font-mono); font-size:10px; font-weight:600; color: var(--text-strong); text-align:right; }
/* ── Detail panel (slide-in) ── */
.detail-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 55%);
  z-index: 800;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--el-float);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel[data-state="open"] {
  transform: translateX(0);
}
.detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-panel-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-panel-kicker {
  font-size: var(--t-2xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.detail-panel-title {
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--text-strong);
}
.detail-panel-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.detail-panel-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.pop-title { padding-right:32px; margin-bottom:10px; font-family: var(--font-display); font-size:13px; color: var(--text-strong); }
.pop-subtitle,.history-sub,.pop-lbl { color: var(--text-soft); font-size:11px; }
.pop-grid { flex:1; min-height:0; overflow-y:auto; }
.pop-dir-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; }
.pop-dir-col { min-width:0; }
.pop-dir-col-title { margin:0 0 6px; font-size:11px; font-weight:700; color: var(--text-strong); text-transform:lowercase; }
.history-empty { border:1px dashed var(--border); border-radius:var(--r-sm); padding:9px 10px; font-size:11px; color: var(--text-soft); background: var(--surface-2); }
.pop-table td { padding:6px 10px; }
.pop-table td:first-child { width:44%; color: var(--text-soft); font-size:11px; }
.pop-table td:last-child { text-align:right; }
.pop-defect-table { margin-top:8px; font-size:11px; }
.pop-defect-table td:first-child { width:auto; color:var(--text); }
.pop-defect-table td:last-child { text-align:left; }
.pop-defect-table th { padding:5px 8px; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-soft); border-bottom:1px solid var(--border); text-align:left; white-space:nowrap; }
.pop-defect-table td { padding:5px 8px; font-size:11px; white-space:nowrap; }
.pop-defect-row { cursor:pointer; transition:background .1s; }
.pop-defect-row:hover { background:var(--surface-2); }
.pop-section-summary { font-size:12px; color:var(--text-soft); margin-bottom:4px; }
.history-item { width:100%; display:flex; flex-direction:column; gap:3px; margin-bottom:6px; padding:9px 10px; text-align:left; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); color: var(--text); }
.history-item.active { border-color: rgba(37,99,235,.22); box-shadow: 0 0 0 1px rgba(37,99,235,.1); }
.inline-accent { color: var(--accel-color,var(--accent)); }
/* ─── Map tools stack (left, below colorbar) ─── */
.map-tools-stack {
  position: absolute; top: 260px; left: 16px; z-index: 800;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.map-stack-btn {
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-overlay); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: background .12s, color .12s;
}
.map-stack-btn:hover { background: var(--surface-3); color: var(--text); }
.map-stack-btn svg { width: 15px; height: 15px; }
.map-stack-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* ─── Pulse ring ─── */
.map-pulse-ring {
  position: absolute; top: 50%; left: 50%;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 3px solid var(--pulse-color, #2563eb);
  opacity: 1;
  animation: pulse-expand 1.1s ease-out forwards;
  pointer-events: none;
}
@keyframes pulse-expand {
  0%   { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(3);   opacity: 0; }
}
/* ─── Map options drawer ─── */
.map-options-drawer {
  position: absolute; left: 36px; top: 0;
  display: flex; gap: 4px; padding: 2px 0;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  transform: translateX(-6px);
}
.map-options-drawer.open {
  opacity: 1; pointer-events: auto; transform: translateX(0);
}
.drop-marker-icon { background: none !important; border: none !important; }
/* ─── Map controls ─── */
/* Hide all native map zoom controls — mouse/touch handles zoom */
.leaflet-control-zoom,.maplibregl-ctrl-group { display: none !important; }
/* ─── Settings drawer ─── */
.settings-drawer,.admin-overlay,.totp-setup-overlay { position:fixed; inset:0; background: rgba(8,13,23,.18); backdrop-filter: blur(8px); }
.settings-drawer,.admin-overlay { z-index:1500; }
.totp-setup-overlay { z-index:2100; background: rgba(8,13,23,.55); } /* above login-overlay (2000) and map compositing layers */
.settings-drawer { display:flex; justify-content:flex-end; gap:14px; padding:14px; }
.settings-card,.settings-detail-card { height: calc(100vh - 28px); max-height: calc(100vh - 28px); }
.settings-detail-panel { width:min(490px,calc(100vw - 28px)); }
.settings-detail-card { display:flex; flex-direction:column; padding:16px; overflow:auto; background: var(--surface); border:1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--el-modal); }
.settings-detail-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.settings-detail-title-wrap { display:flex; flex-direction:column; gap:4px; }
.settings-detail-kicker { font-size:10px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color: var(--text-soft); }
.settings-detail-title { font-family: var(--font-display); font-size:13px; color: var(--text-strong); }
.settings-detail-body { flex:1; min-height:0; overflow-y:auto; display:flex; flex-direction:column; gap:12px; padding-top:14px; }
.settings-panel-hint { display:flex; flex-direction:column; gap:10px; padding:12px; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface-3); }
.settings-card { width:min(430px,calc(100vw - 28px)); display:flex; flex-direction:column; padding:16px; overflow:hidden; }
.settings-menu { flex:1; min-height:0; overflow-y:auto; gap:8px; }
.settings-tool-btn { width:100%; display:flex; align-items:flex-start; gap:10px; padding:11px; text-align:left; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface-3); color: var(--text); }
.settings-tool-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.14); }
.settings-tool-btn.active { border-color: transparent; color:#fff; background: linear-gradient(135deg,var(--accent) 0%,var(--accent-teal) 100%); box-shadow: 0 6px 18px rgba(37,99,235,.2); }
.settings-tool-btn svg { width:16px; height:16px; flex:0 0 16px; stroke: currentColor; stroke-width:1.8; fill:none; stroke-linecap:round; stroke-linejoin:round; margin-top:2px; }
.settings-tool-copy { display:flex; flex-direction:column; gap:3px; }
.settings-tool-copy strong { font-size:11px; }
.settings-tool-copy span { color: inherit; opacity:.82; }
.settings-head,.admin-head,.hint-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.settings-head-actions { display: flex; align-items: center; gap: 6px; }
.settings-title,.admin-title { font-size:var(--t-base); color: var(--text-strong); }
.settings-section { padding:13px 0; }
.settings-profile { padding:11px; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface-3); }
.settings-profile-avatar { width:44px; height:44px; flex:0 0 44px; display:flex; align-items:center; justify-content:center; border-radius:13px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-size:19px; font-weight:700; }
.settings-profile-name { color: var(--text-strong); font-family: var(--font-display); font-size:12px; }
.settings-profile-role,.hint-intro,.hint-file,.hint-note,.hint-option p,.upload-hint,.password-strength-text { color: var(--text-soft); }
.profile-edit-field { margin:0; flex:1; }
.profile-edit-save { margin-top:18px; }
.settings-collapse-btn,.settings-logout-btn,.settings-admin-btn,.settings-2fa-btn,.admin-add-btn,.admin-btn-save,.admin-btn-cancel,.totp-copy-btn,.totp-verify-btn,.tfa-recommend-btn,.login-submit {
  min-height:var(--ctrl-md); padding:9px 13px; border:1px solid var(--border); background: var(--surface-3); color: var(--text); font-weight:600;
}
.settings-collapse-btn,.settings-logout-btn,.settings-admin-btn,.settings-2fa-btn,.admin-add-btn,.totp-copy-btn,.totp-verify-btn,.tfa-recommend-btn { display:inline-flex; align-items:center; gap:8px; }
.settings-collapse-btn,.settings-logout-btn,.settings-admin-btn,.settings-2fa-btn { width:100%; justify-content:flex-start; }
.settings-collapse-btn:hover,.settings-logout-btn:hover,.settings-admin-btn:hover,.settings-2fa-btn:hover,.admin-add-btn:hover,.admin-btn-cancel:hover,.totp-copy-btn:hover,.station-list-dl-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.14); }
.login-submit,.admin-btn-save,.totp-verify-btn,.tfa-recommend-btn { border-color:transparent; color:#fff; background: linear-gradient(135deg,var(--accent) 0%,var(--accent-teal) 100%); box-shadow: 0 6px 18px rgba(37,99,235,.16); }
.login-submit:hover,.admin-btn-save:hover,.totp-verify-btn:hover,.tfa-recommend-btn:hover { transform: translateY(-1px); }
.settings-submit { margin-top:6px; }
.settings-collapse-body.collapsed,.admin-form.hidden,.admin-tab-content,.settings-pw-form.hidden,.admin-audit-range.hidden { display:none; }
.settings-grid,.upload-file-list,.station-list-downloads,.hint-body,.hint-tree,.hint-options,.section-stations,.admin-tab-content.active { display:flex; flex-direction:column; gap:10px; }
.upload-file-list { overflow:auto; max-height:200px; }
.upload-file-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); }
.file-cat { font-size:10px; color: var(--text-soft); text-transform:uppercase; letter-spacing:.08em; }
.settings-inline { align-items:center; }
.color-input { width:44px; height:38px; padding:0; border:1px solid var(--border); border-radius:var(--r-sm); background:transparent; }
.password-strength { display:flex; flex-direction:column; gap:8px; }
.password-strength-fill { height:100%; border-radius:inherit; background: linear-gradient(90deg,var(--crit) 0%,var(--warn) 55%,var(--ok) 100%); }
.station-list-intro { margin:0 0 8px; font-size:12px; }
.station-list-dl-btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:36px; padding:7px 11px; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); color: var(--text); }
.hint-folder { font-weight:700; color: var(--text-strong); }
.hint-file strong { color: var(--text-strong); }
.hint-option { display:flex; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface-3); }
.hint-option-num { width:24px; height:24px; flex:0 0 24px; display:flex; align-items:center; justify-content:center; border-radius:999px; background: var(--accent-soft); color: var(--accent); font-weight:700; }
.upload-client-select { margin-bottom:10px; }
.upload-client-select label { font-size:.82rem; font-weight:600; color:var(--text-strong); }
.upload-client-select select { margin-left:6px; padding:4px 8px; border-radius:var(--r-sm); border:1px solid var(--border); background:var(--surface); color:var(--text-strong); font-size:.82rem; }
.upload-zone { padding:18px 14px; text-align:center; border:1.5px dashed rgba(37,99,235,.18); border-radius:var(--r-md); background: linear-gradient(180deg,rgba(37,99,235,.025) 0%,rgba(8,145,178,.035) 100%); cursor:pointer; }
.upload-zone.drag-over,.upload-zone:hover { border-color: rgba(37,99,235,.3); }
.upload-icon { width:24px; height:24px; margin-bottom:8px; color: var(--accent); }
.upload-text { color: var(--text-strong); font-weight:700; }
.settings-section-header { position:relative; display:flex; align-items:center; justify-content:flex-end; margin-bottom:10px; }
.settings-info-btn { width:24px; height:24px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:var(--r-sm); background:transparent; color:var(--text-soft); cursor:pointer; }
.settings-info-btn:hover { background: var(--surface-3); }
.settings-info-popover { position:absolute; top:100%; right:0; z-index:10; width:min(360px,90vw); max-height:400px; overflow-y:auto; padding:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--el-float); display:flex; flex-direction:column; gap:10px; }
.settings-pw-form .login-field-label { font-family:var(--font-ui); font-size:var(--t-xs); }
.settings-pw-form .login-input { height:var(--ctrl-md); font-size:var(--t-sm); font-family:var(--font-ui); border-radius:var(--r-sm); padding:0 10px; min-height:unset; }
.settings-pw-form .login-submit { height:var(--ctrl-md); font-size:var(--t-sm); font-family:var(--font-ui); border-radius:var(--r-sm); }
/* ─── Admin ─── */
.admin-overlay,.totp-setup-overlay { display:flex; align-items:center; justify-content:center; padding:14px; }
.admin-panel { width:min(1140px,calc(100vw - 28px)); height:min(790px,calc(100vh - 28px)); display:flex; flex-direction:column; padding:16px; overflow:hidden; }
.admin-tabs,.admin-audit-controls { display:flex; gap:8px; flex-wrap:wrap; }
.admin-tabs { padding:11px 0 7px; }
.admin-tab { min-height:var(--ctrl-md); }
.admin-tab-content.active { min-height:0; flex:1; overflow-y:auto; }
.admin-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.admin-count { font-family:var(--font-mono); font-size:13px; font-weight:700; color:var(--text-strong); }
.admin-count .admin-count-label { font-family:var(--font-ui); font-weight:400; font-size:var(--t-xs); color:var(--text-soft); margin-left:4px; }
.admin-add-btn { white-space:nowrap; min-width:120px; height:var(--ctrl-md); display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:0 14px; border:1px solid var(--border); background:var(--surface-3); color:var(--text-soft); }
.admin-add-btn svg { width:14px; height:14px; stroke:currentColor; stroke-width:2; fill:none; flex-shrink:0; }
.admin-add-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.2); color: var(--accent); }
.admin-audit-controls { align-items:stretch; }
.admin-audit-controls .act-btn { width:auto !important; height:auto !important; min-height:var(--ctrl-md) !important; padding:0 10px !important; }
.admin-form { padding:18px; border:1px solid var(--border); border-radius:var(--r-md); background: var(--surface-3); display:flex; flex-direction:column; gap:14px; }
.admin-form-row { gap:16px !important; }
.admin-form-title + .admin-form-row,
.admin-form-title + .admin-form-warn + .admin-form-row { margin-top:4px; }
.admin-status:empty { display:none; }
.admin-tab-content:has(.admin-form:not(.hidden)) .admin-table-wrap,
.admin-tab-content:has(.admin-form:not(.hidden)) .admin-toolbar { display:none; }
.admin-form-title { font-family: var(--font-display); font-size:var(--t-md); color: var(--text-strong); }
.admin-form-row label { flex:1; min-width:0; color: var(--text-soft); }
.admin-form-actions { padding-top:10px; justify-content:flex-end; }
.admin-form-warn { margin-bottom:9px; padding:8px 10px; border:1px solid rgba(217,119,6,.16); border-radius:var(--r-sm); background: rgba(217,119,6,.07); color:#92400e; }
.cell-token { display:flex; align-items:center; gap:4px; }
.token-text { font-size:11px; color:var(--text-soft); background:var(--surface-2); padding:2px 6px; border-radius:var(--r-sm); max-width:120px; overflow:hidden; text-overflow:ellipsis; }
.token-copy,.token-regen { width:24px!important; height:24px!important; }
.token-copy svg,.token-regen svg { width:12px!important; height:12px!important; }
.cell-actions { display:flex; align-items:center; justify-content:flex-end; gap:6px; }
.act-btn.warn:hover { background: rgba(217,119,6,.07); border-color: rgba(217,119,6,.14); color:#92400e; }
.act-btn.danger:hover,.admin-add-btn.warn:hover { background: rgba(220,38,38,.07); border-color: rgba(220,38,38,.12); color: var(--crit); }
.table-message-row,.table-error-row,.table-meta-cell { font-size:11px; }
.table-message-row { text-align:center; color: var(--text-muted); }
.table-error-row { color: var(--crit); }
.role-badge,.status-chip,.active-badge,.data-badge,.metro-line-chip { display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.role-badge { padding:4px 8px; border-radius:999px; font-size:10px; font-weight:700; }
.role-badge.admin { background: rgba(37,99,235,.09); color: var(--accent); }
.role-badge.operator { background: rgba(22,163,74,.09); color: var(--ok); }
.role-badge.guest { background: rgba(122,139,160,.1); color: var(--text-soft); }
.status-chip { padding:3px 7px; margin-left:6px; border-radius:999px; font-size:10px; font-weight:700; text-transform:uppercase; }
.status-chip.locked { background: rgba(220,38,38,.09); color: var(--crit); }
.status-chip.totp { background: rgba(37,99,235,.09); color: var(--accent); }
.active-badge,.data-badge { width:9px; height:9px; border-radius:50%; }
.active-badge.yes,.data-badge.has-data { background: var(--ok); }
.active-badge.no,.data-badge.no-data { background: var(--text-muted); }
.metro-line-list { display:flex; flex-wrap:wrap; gap:6px; }
.metro-line-chip { padding:5px 9px; border-radius:999px; color:#fff; font-weight:700; background: var(--chip-color,var(--accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.metro-line-chip-action { cursor:pointer; }
.admin-audit-range { display:flex; align-items:flex-end; gap:12px; padding:12px 0; color: var(--text-soft); }
.audit-range-label { display:flex; flex-direction:column; gap:4px; font-size:var(--t-xs); font-weight:600; color:var(--text-soft); flex:1; min-width:0; }
.audit-range-label input[type=date] { width:100%; }
.audit-range-actions { display:flex; gap:8px; align-items:flex-end; flex-shrink:0; }
.audit-range-actions .admin-btn-save,
.audit-range-actions .admin-btn-cancel { min-height:var(--ctrl-md); }
.admin-status.success,.settings-pw-status.success,.totp-setup-status.success { background: rgba(22,163,74,.07); border-color: rgba(22,163,74,.14); color: var(--ok); }
.admin-status.error,.settings-pw-status.error,.totp-setup-status.error,.login-error { background: rgba(220,38,38,.06); border-color: rgba(220,38,38,.12); color: var(--crit); }
.admin-status.info,.upload-status,.totp-setup-status { background: rgba(37,99,235,.05); border-color: rgba(37,99,235,.11); color: var(--accent); }
/* ─── Login — see login-refine.css ─── */
.totp-step,.tfa-recommend-text { display:flex; flex-direction:column; gap:12px; }
/* ─── TOTP ─── */
.totp-setup-card { width:min(680px,calc(100vw - 28px)); max-height:calc(100vh - 28px); padding:18px; overflow:auto; }
.totp-setup-title { margin-bottom:13px; font-family: var(--font-display); font-size:18px; color: var(--text-strong); }
.totp-step { padding:13px 0; border-top:1px solid var(--border); }
.totp-step:first-of-type { border-top:0; }
.totp-step-num { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; margin-right:6px; border-radius:999px; background: var(--accent-soft); color: var(--accent); font-weight:700; }
.totp-step-label { color: var(--text-strong); font-weight:700; }
.totp-step-desc { color: var(--text-soft); }
.totp-secret-display { display:flex; align-items:center; gap:8px; padding:9px 11px; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); }
.totp-secret-code,.totp-recovery-code { font-family: var(--font-mono); }
.totp-recovery-codes { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:7px; margin-top:10px; }
.totp-recovery-code { padding:7px 9px; border:1px solid var(--border); border-radius:var(--r-sm); background: var(--surface-3); }
.totp-mandatory-notice { display:flex; align-items:center; gap:8px; margin-top:12px; padding:9px 11px; border:1px solid rgba(217,119,6,.14); border-radius:var(--r-sm); background: rgba(217,119,6,.07); color:#92400e; }
.tfa-recommend-banner { position:fixed; inset:0; z-index:10000; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); display:flex; align-items:center; justify-content:center; }
.tfa-recommend-content { width:min(450px,calc(100vw - 28px)); padding:16px 18px; border:1px solid var(--border); border-radius:var(--r-lg); background: var(--surface); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.tfa-recommend-text { flex:1; min-width:0; gap:3px; }
.tfa-recommend-text strong { color: var(--text-strong); }
.tfa-recommend-text span { color: var(--text-soft); }
.tfa-recommend-close { width:32px; height:32px; min-height:32px; padding:0; }
/* ─── Station label / dot zoom visibility ─── */
#map .station-label-tip,
#map-3d .station-label-tip {
  display: none !important;
}
#map.show-station-labels .station-label-tip,
#map-3d.show-station-labels .station-label-tip {
  display: block !important;
}
#map .station-ring,
#map-3d .station-ring {
  display: none !important;
}
#map.show-station-dots .station-ring,
#map-3d.show-station-dots .station-ring {
  display: block !important;
}
/* 3D station tower markers */
#map-3d .station-tower-wrap {
  --line-color:#2563eb;
  --tower-dx:0px;
  --tower-dy:-76px;
  --tower-len:76px;
  --tower-angle:0deg;
  position:relative;
  width:0;
  height:0;
  pointer-events:auto;
}
#map-3d .station-tower-beam {
  position:absolute;
  left:-1px;
  bottom:0;
  width:2px;
  height:var(--tower-len);
  transform-origin:50% 100%;
  transform:rotate(var(--tower-angle));
  background:linear-gradient(180deg,#9fc0ff 0%,var(--line-color) 100%);
  opacity:.82;
  border-radius:999px;
  box-shadow:0 0 0 1px rgba(255,255,255,.15);
}
#map-3d .station-pin-3d {
  position:absolute;
  left:0;
  bottom:var(--tower-len);
  transform:translate(-50%,-50%);
}
#map-3d .station-pin-3d .station-pin-dot {
  display:block;
  width:10px;
  height:10px;
  border-radius:999px;
  background:#fff;
  border:2px solid var(--line-color);
  box-shadow:0 0 0 2px rgba(255,255,255,.2);
}
#map-3d .station-pin-label-3d {
  position:absolute;
  left:0;
  bottom:0;
  transform:translate(10px,calc(-1 * var(--tower-len) - 6px));
  padding:4px 8px;
  border:1px solid var(--border-strong);
  border-radius:999px;
  background:var(--surface-overlay);
  color:var(--text-strong);
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
  box-shadow:var(--shadow-sm);
}
#map-3d .station-pin-label-3d,
#map-3d .station-pin-3d {
  display:none;
}
#map-3d.show-station-dots .station-pin-3d {
  display:block;
}
#map-3d.show-station-labels .station-pin-label-3d {
  display:block;
}
/* ─── Responsive ─── */
@media (max-width: 1200px) { .container-2{width:240px;min-width:240px}.section-layout{grid-template-columns:200px minmax(0,1fr)}.top-metric{padding:0 9px} }
@media (max-width: 980px) { /* login responsive rules moved to login-refine.css */ }
@media (max-width: 900px) { .main{gap:8px;padding:8px}.container-1,.container-2{width:206px;min-width:206px}.section-layout{grid-template-columns:1fr;grid-template-rows:196px minmax(0,1fr)}.section-main{grid-template-rows:auto var(--section-table-fr,60fr) var(--section-spatial-fr,40fr)} }
@media (max-width: 760px) { .top-bar{height:auto;min-height:0;padding:11px;flex-wrap:wrap;align-items:flex-start}.brand-line-wrap{display:none}.top-metrics{width:100%;justify-content:flex-start;flex-wrap:wrap;border-top:1px solid var(--border);padding-top:8px;margin-top:4px}.main{height:auto;flex-direction:column;overflow:auto}.container-1,.container-2,.workspace-shell{width:100%;min-width:0}.settings-drawer{flex-direction:column;justify-content:flex-start}.settings-card,.settings-detail-card,.admin-panel{width:100%;height:auto;max-height:none}#legend{top:11px;right:11px;width:62px;padding:10px 8px}.leg-bar,.leg-scale{min-height:156px}.totp-recovery-codes{grid-template-columns:1fr}.tfa-recommend-content{width:calc(100vw - 28px);flex-wrap:wrap} }

/* ─── Shell: Sidebar, Header, Ribbon ─── */

/* ─── Root layout ─── */
#app { display:flex; flex-direction:row; height:100vh; overflow:hidden; }
/* body transition removed — amplifies any browser-internal style change as visible flicker */

/* ─── Nav Sidebar ─── */
.nav-sidebar {
  width: var(--nav-sidebar-w, 210px);
  min-width: var(--nav-sidebar-w, 210px);
  flex: 0 0 var(--nav-sidebar-w, 210px);
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width .2s ease, min-width .2s ease, flex-basis .2s ease;
  z-index: 30;
}
.nav-sidebar.collapsed {
  width: 72px; min-width: 72px; flex-basis: 72px;
}
.nav-sidebar-top { display:flex; flex-direction:column; gap:0; flex:1; min-height:0; overflow:hidden; }

/* ─── Sidebar Header (logo + collapse) ─── */
.nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border);
  min-height: 54px;
}
.nav-logo { display:flex; align-items:center; gap:9px; min-width:0; overflow:hidden; }
.nav-logo-mark { width:30px; height:30px; flex:0 0 30px; }
.nav-logo-icon { color: hsl(199,89%,42%); flex:0 0 24px; width:24px; height:24px; }
.nav-logo-accent { color: hsl(199,89%,42%); }
.nav-logo-name {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity .15s ease, width .2s ease;
}
.nav-sidebar.collapsed .nav-logo-name { opacity: 0; width: 0; }
.nav-collapse-btn {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-soft);
  transition: background .13s, color .13s, transform .2s;
}
.nav-collapse-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.2); color: var(--accent); }
.nav-sidebar.collapsed .nav-header { justify-content: center; }
.nav-sidebar.collapsed .nav-collapse-btn { transform: rotate(180deg); display: none; }
.nav-sidebar.collapsed .nav-header:hover .nav-logo { display: none; }
.nav-sidebar.collapsed .nav-header:hover .nav-collapse-btn { display: flex; }
.nav-chevron { width:14px; height:14px; stroke:currentColor; stroke-width:2; fill:none; stroke-linecap:round; stroke-linejoin:round; }

/* ─── Data source (city / line) ─── */
.nav-data-source { display:flex; flex-direction:column; gap:7px; padding:10px 12px; border-bottom:1px solid var(--border); overflow:hidden; }
.nav-ds-field { display:flex; flex-direction:column; gap:4px; }
.nav-ds-label { font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--text-soft); white-space:nowrap; }
.nav-ds-input {
  width:100%; min-height:32px; padding:5px 9px;
  border-radius:var(--r-sm); border:1px solid var(--border-strong);
  background:var(--surface); color:var(--text); font:inherit; font-size:12px;
  outline:none; appearance:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.nav-ds-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.nav-sidebar.collapsed .nav-data-source { display:none; }

/* ─── Nav separator ─── */
.nav-sep { height:1px; background:var(--border); margin:0; }

/* ─── Section label ─── */
.nav-section-label {
  padding: 10px 14px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
  transition: opacity .15s;
}
.nav-sidebar.collapsed .nav-section-label { opacity: 0; }

/* ─── Nav items ─── */
.nav-items { display:flex; flex-direction:column; gap:2px; padding:4px 8px; flex:1; overflow:hidden; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 38px; padding: 8px 10px 8px 7px;
  border-radius: var(--r-sm); border: none;
  border-left: 3px solid transparent;
  background: transparent; color: var(--text-soft);
  font-size: 13px; font-weight: 500;
  text-align: left; white-space: nowrap; overflow: hidden;
  transition: background .13s, color .13s, border-color .13s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item-icon {
  width: 16px; height: 16px; flex: 0 0 16px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity .15s; }
.nav-sidebar.collapsed .nav-item-label { opacity: 0; width: 0; overflow: hidden; }
.nav-sidebar.collapsed .nav-item { justify-content: center; padding: 8px; border-left-width: 0; }
.nav-sidebar.collapsed .nav-item.active { background: var(--accent-soft); color: var(--accent); }

/* ─── Sidebar footer ─── */
.nav-sidebar-footer {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.nav-footer-actions { display: flex; flex-direction: column; gap: 2px; }
.nav-action-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 34px; padding: 6px 10px 6px 7px;
  border-radius: var(--r-sm); border: none; border-left: 3px solid transparent;
  background: transparent; color: var(--text-soft);
  font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; overflow: hidden;
  transition: background .13s, color .13s, border-color .13s;
}
.nav-action-btn:hover { background: var(--surface-3); color: var(--text); }
.nav-action-btn.nav-action-danger:hover { background: rgba(220,38,38,.08); border-left-color: var(--crit); color: var(--crit); }
.nav-action-btn svg { width:16px; height:16px; flex:0 0 16px; stroke:currentColor; stroke-width:1.8; fill:none; stroke-linecap:round; stroke-linejoin:round; }
.nav-action-label { flex:1; overflow:hidden; text-overflow:ellipsis; transition:opacity .15s, width .2s; }
.nav-sidebar.collapsed .nav-action-label { opacity:0; width:0; overflow:hidden; }
.nav-sidebar.collapsed .nav-action-btn { justify-content:center; padding:6px; }
.nav-sidebar.collapsed .nav-footer-actions { align-items:center; }

/* ─── Status in sidebar ─── */
.nav-status {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-3);
  min-height: 38px;
}
.nav-status[data-kind=error] { border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.06); }
.nav-status[data-kind=loading] { border-color: rgba(217,119,6,.25); background: rgba(217,119,6,.06); }
.nav-status-dot {
  width: 7px; height: 7px; margin-top: 4px;
  border-radius: 50%; flex: 0 0 7px;
  background: var(--info);
}
.nav-status[data-kind=error] .nav-status-dot { background: var(--crit); }
.nav-status[data-kind=loading] .nav-status-dot { background: var(--warn); animation: pulse-dot .8s ease infinite; }
.nav-status[data-kind=empty] .nav-status-dot { background: var(--border-strong); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }
.nav-status-text {
  font-size: 11px; color: var(--text-soft); line-height: 1.5;
  overflow-wrap: break-word; word-break: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
}
.nav-copyright {
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
  transition: opacity .15s;
}
.nav-sidebar.collapsed .nav-copyright { display: none; }
.nav-sidebar.collapsed .nav-status-text { display: none; }
.nav-sidebar.collapsed .nav-status { display: none; }

/* ─── App Body ─── */
.app-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

/* ─── Top Bar ─── */
.top-bar {
  height: 56px; min-height: 56px;
  display: grid; grid-template-columns: 164px 1fr auto; align-items: center;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
  position: relative; z-index: 20;
}
.top-bar::before {
  content: ''; position: absolute; inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-teal) 60%, transparent 100%);
}
.top-bar-start { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.top-page-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text-strong);
}
/* ─── Global filter strip (inside top bar) ─── */
/* top-bar-filters removed — filter button now in top-bar-end */
.tbf-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; flex-shrink: 0; }
/* ─── KPIs ─── */
.top-bar-kpis { display: flex; align-items: center; gap: 0; }
.top-kpi { display: flex; flex-direction: column; gap: 1px; padding: 0 14px; }
.top-kpi-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.top-kpi-value { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-strong); }
.top-kpi-value.kpi-accent { color: var(--accel-color, var(--accent-teal)); }
.top-kpi-sep { width: 1px; height: 22px; background: var(--border); }
.top-bar-end { display: flex; align-items: center; gap: 8px; justify-self: end; padding-left: 12px; }
.top-icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-soft);
  transition: background .13s, color .13s;
}
.top-icon-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.2); color: var(--accent); }
.top-icon-btn.active { background: var(--accent-soft); border-color: rgba(37,99,235,.3); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(37,99,235,.15); }
.top-icon-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.top-avatar-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: none;
  background: var(--accent);
  color: #fff; font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: transform .13s, box-shadow .13s;
}
.top-avatar-btn:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.top-avatar-btn.active { box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(37,99,235,.3); transform: scale(1.0); }

/* ─── Filter toggle button (in top bar) ─── */
.filter-popover-btn {
  display: flex; align-items: center; gap: 6px;
  height: var(--ctrl-sm); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-soft);
  font: 600 var(--ctrl-font)/1 var(--font-ui);
  cursor: pointer; transition: background .13s, border-color .13s, color .13s;
}
.filter-popover-btn:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.3); color: var(--accent); }
.filter-popover-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.filter-popover-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
}

/* ─── Filter panel (slide-in from right) ─── */
.filter-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 45%);
  z-index: 800;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--el-float);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.filter-panel[data-state="open"] { transform: translateX(0); }
.filter-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-panel-title {
  font-family: var(--font-display);
  font-size: var(--t-md); font-weight: 600;
  color: var(--text-strong);
}
.filter-panel-body {
  flex: 1; overflow-y: auto; padding: 8px 14px 14px;
}

/* ── Accordion sections inside filter panel ── */
.fp-section {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  margin-bottom: 8px; background: var(--surface-2);
}
.fp-section[hidden] { display: none; }
.fp-section-title {
  display: flex; align-items: center; width: 100%;
  padding: 8px 12px; cursor: pointer;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-soft); list-style: none;
}
.fp-section-title::-webkit-details-marker { display: none; }
.fp-section-title::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg); margin-right: 8px; transition: transform .15s;
  flex-shrink: 0;
}
.fp-section[open] > .fp-section-title::before { transform: rotate(45deg); }
.fp-section-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  padding: 0 12px 10px;
}
.fp-field-v { display: flex; flex-direction: column; gap: 3px; }
.fp-field-span { grid-column: 1 / -1; }
.fp-range-pair { display:flex; align-items:center; gap:6px; }
.fp-range-input { flex:1; min-width:0; }
.fp-range-sep { color:var(--text-muted); font-size:12px; flex:0 0 auto; }

/* ── Filter panel form elements ── */
.fp-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
.fp-count { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.fp-select {
  height: var(--ctrl-sm); padding: 0 24px 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a8ba0'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--text); font: var(--ctrl-font)/1 var(--font-ui); appearance: none; outline: none;
  text-align: center; text-align-last: center; transition: border-color .13s;
  width: 100%;
}
.fp-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.fp-input {
  height: var(--ctrl-sm); padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: var(--ctrl-font)/1 var(--font-ui);
  text-align: center; outline: none; transition: border-color .13s;
  width: 100%;
}
.fp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.fp-date { width: 100%; }

/* ── Alert actions inside filter panel ── */
.fp-alerts-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: rgba(255,255,255,.62);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
body.dark .fp-alerts-body { background: rgba(30,42,64,.72); }
.fp-alert-row { display: flex; gap: 6px; }
.fp-alert-row .alerts-ctx-btn { flex: 1; }
.fp-alert-sel { font-size: var(--t-xs); font-weight: 600; color: var(--text-soft); }

/* ── Alerts total count in sidebar (matches .alerts-source style) ── */
.alerts-total-count {
  padding: 8px 10px; margin-bottom: 8px;
  font-size: 13px; font-weight: 700; color: var(--text-strong);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: rgba(255,255,255,.62); text-align: center;
}
body.dark .alerts-total-count { background: rgba(30,42,64,.72); }

/* ── Search tool (inside map-tools-stack) ── */
.map-float-search { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.map-float-search-box {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 6px;
  background: var(--surface-overlay); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--shadow-sm);
}
.map-float-input {
  width: 160px; height: 24px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--r-xs, 4px);
  background: var(--surface); color: var(--text);
  font: 11px/1 var(--font-ui); outline: none;
}
.map-float-input:focus { border-color: var(--accent); }
.map-float-go {
  width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-xs, 4px);
  background: var(--surface); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px;
}
.map-float-go:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Alerts contextual toolbar ── */
.alerts-ctx-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin: 0 14px 8px;
}
.alerts-ctx-count { font-size: var(--t-xs); font-weight: 600; color: var(--text-soft); margin-right: 4px; }
.alerts-ctx-btn {
  height: var(--ctrl-sm); padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-soft);
  font: 600 var(--ctrl-font)/1 var(--font-ui);
  cursor: pointer; transition: background .12s, color .12s;
}
.alerts-ctx-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.alerts-ctx-btn:disabled { opacity: .45; cursor: default; }
.alerts-ctx-sep { width: 1px; height: 20px; background: var(--border); }
.alerts-ctx-danger { color: var(--crit); }
.alerts-ctx-danger:hover:not(:disabled) { background: rgba(220,38,38,.06); color: var(--crit); }

/* ─── Ribbon controls (used by map-opts-bar) ─── */
.ribbon-group { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.ribbon-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.ribbon-input {
  height: var(--ctrl-sm); width: 64px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: var(--ctrl-font)/1 var(--font-ui);
  text-align: center; outline: none; transition: border-color .13s;
}
.ribbon-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.ribbon-btn {
  height: var(--ctrl-sm); padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-soft);
  font: 700 var(--ctrl-font)/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.ribbon-btn:hover:not(.active) { background: var(--accent-soft); color: var(--accent); }
.ribbon-theme-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-soft);
  flex-shrink: 0;
  transition: background .13s, color .13s;
}
.ribbon-theme-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: rgba(37,99,235,.2); }
.theme-sun,.theme-moon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Workspace ─── */
.workspace {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  gap: 0; overflow: hidden;
  padding: var(--sp-4);
  background: linear-gradient(160deg, var(--bg-top) 0%, var(--bg-bot) 100%);
}
.workspace .anomaly-ribbon-card { flex-shrink: 0; }
.workspace .view-area { flex: 1; min-height: 0; }

/* ─── Map Options Bar ─── */
.map-opts-bar {
  display: flex; align-items: center; gap: 0;
  padding: 0 12px; height: 40px; min-height: 40px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  margin-bottom: 8px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
}
.map-opts-bar::-webkit-scrollbar { display: none; }
.map-opts-sep { width: 1px; height: 18px; background: var(--border); margin: 0 10px; flex-shrink: 0; }
.map-opts-field { display: flex; align-items: center; gap: 6px; margin-right: 10px; }
.map-opts-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; text-align: center; }
.map-opts-input {
  height: var(--ctrl-xs); padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: 12px/1 var(--font-ui);
  text-align: center; outline: none; width: auto; min-width: 56px; max-width: 88px;
  appearance: none; transition: border-color .13s;
}
.map-opts-input:focus { border-color: var(--accent); }
select.map-opts-input { width: 110px; max-width: 110px; padding-right: 20px; }
/* ─── 2D/3D map overlay toggle (inside map-tools-stack) ─── */
.map-overlay-toggle {
  display: flex; flex-direction: column; gap: 0;
}
.map-overlay-toggle .map-mode-btn {
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--border); border-top-width: 0;
  background: var(--surface-overlay); color: var(--text-soft);
  font: 700 9px/1 var(--font-ui); letter-spacing: .05em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: background .12s, color .12s;
}
.map-overlay-toggle .map-mode-btn:first-child { border-top-width: 1px; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.map-overlay-toggle .map-mode-btn:last-child { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.map-overlay-toggle .map-mode-btn:hover:not(.active) { background: var(--surface-3); color: var(--text); }
.map-overlay-toggle .map-mode-btn.active { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-teal) 100%); color: #fff; border-color: transparent; }

/* ─── Workspace spacing overrides ─── */
.workspace .anomaly-ribbon-card { margin-bottom: var(--sp-2); }

/* Inspector — elevated card selection */
.d-card.sel { border-color: rgba(37,99,235,.4); box-shadow: 0 0 0 2px rgba(37,99,235,.18), var(--shadow-md); }


/* ─── Utility: width tokens ─── */
.w-1 { width: var(--w-1); } .w-2 { width: var(--w-2); }
.w-3 { width: var(--w-3); } .w-4 { width: var(--w-4); }

/* ─── Utility: ctrl-label ─── */
.ctrl-label {
  display: block;
  font-size: var(--t-2xs); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-soft);
}

/* ─── Utility: button hierarchy ─── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctrl-md); padding: 0 var(--sp-3);
  border: none; border-radius: var(--r-sm);
  background: var(--brand-grad); color: #fff;
  font: 600 var(--t-sm)/1 var(--font-ui);
  box-shadow: var(--el-raised);
  transition: opacity .13s, transform .13s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; transform: none; cursor: default; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctrl-md); padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font: 500 var(--t-sm)/1 var(--font-ui);
  transition: background .13s, border-color .13s;
}
.btn-secondary:hover { background: var(--accent-soft); border-color: rgba(37,99,235,.2); color: var(--accent); }
.btn-secondary:disabled { opacity: .5; cursor: default; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctrl-md); padding: 0 var(--sp-3);
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--text-soft);
  font: 500 var(--t-sm)/1 var(--font-ui);
  transition: background .13s, border-color .13s, color .13s;
}
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }

/* ─── Dark Theme ─── */
body.dark {
  --bg: #0f1520;
  --bg-top: #0d1321;
  --bg-bot: #111827;
  --surface: #1a2336;
  --surface-2: #1e2a40;
  --surface-3: #1e293b;
  --surface-overlay: rgba(26,35,54,.97);
  --text: #c8d3e8;
  --text-strong: #e8edf5;
  --text-soft: #8a9ab5;
  --text-muted: #6b7c9a;
  --border: #2a3a55;
  --border-strong: #3a4a65;
  --bg-strong: #1a2336;
  --accent-soft: rgba(37,99,235,.14);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 0 0 1px rgba(0,0,0,.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.3);
  --plot-bg-top: #1a2336;
  --plot-bg-bot: #111827;
  --plot-grid: rgba(200,211,232,.1);
}
/* Dark mode — form controls */
body.dark .fp-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7c9a'/%3E%3C/svg%3E");
  background-color: var(--surface-2); color: var(--text); border-color: var(--border);
}
body.dark .fp-input { background: var(--surface-2); color: var(--text); border-color: var(--border); }
body.dark .filter-popover { background: var(--surface); border-color: var(--border); }
body.dark .filter-popover-btn { background: var(--surface-2); }
body.dark .alerts-ctx-bar { background: var(--surface-2); }
body.dark .ribbon-input {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
body.dark .map-opts-input {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
body.dark .nav-ds-input {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
}
body.dark .nav-ds-input option,
body.dark .fp-select option,
body.dark .map-opts-input option { background: var(--surface-2); color: var(--text); }
body.dark .mode-context-chip,
body.dark .alerts-source { background: rgba(30,42,64,.72); }
body.dark .mode-context-chip { border-color: var(--border-strong); }
/* Dark mode — data table labels */
body.dark .d-metric-k { color: var(--text-muted); }
body.dark .d-metric { background: rgba(30,40,60,.7); }
/* Dark mode — Leaflet station labels */
body.dark .leaflet-tooltip.station-label-tip {
  background: rgba(26,35,54,.95);
  border: 1px solid var(--border-strong);
  color: var(--text-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
body.dark .leaflet-tooltip.station-label-tip::before {
  border-right-color: var(--border-strong);
}
/* Dark mode — theme icons */
body.dark .theme-sun { display: none; }
body.dark .theme-moon { display: block !important; }
body.light .theme-moon { display: none; }
body.light .theme-sun { display: block; }

/* ═══ Anomaly Levels Settings Table (P7b) ═══ */
.al-hint {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 8px 10px; margin-bottom: 10px;
  background: var(--accent-soft); border: 1px solid rgba(37,99,235,.12);
  border-radius: var(--r-sm); font-size: 11px; color: var(--text-soft); line-height: 1.4;
}
.al-hint svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; stroke: var(--accent); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.al-table-wrap { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 10px; }
.al-table { width: 100%; border-collapse: collapse; }
.al-table th { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.al-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.al-table tbody tr:last-child td { border-bottom: none; }
.al-lvl-num { font-family: var(--font-mono); font-size: 11px; font-weight: 700; width: 28px; text-align: center; padding: 0; background: none; border: none; color: var(--text-strong); }
.al-op-sel { font-size: 11px; padding: 3px 5px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-3); color: var(--text); width: 48px; }
.al-limit-inp { font-family: var(--font-mono); font-size: 12px; font-weight: 600; width: 72px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-strong); text-align: center; }
.al-color-wrap { display: flex; align-items: center; gap: 5px; }
.al-color-inp { width: 32px; height: 24px; border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px; cursor: pointer; background: none; flex: 0 0 32px; }
.al-color-hex { font-family: var(--font-mono); font-size: 11px; width: 68px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-strong); letter-spacing: .04em; }
.al-label-inp { font-size: 11px; font-weight: 600; width: 60px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-strong); text-align: center; }
.al-rm-btn { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface-3); color: var(--text-muted); font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.al-rm-btn:hover { background: rgba(220,38,38,.08); border-color: var(--crit); color: var(--crit); }
.al-actions { display: flex; gap: 8px; }
.al-mode-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.al-mode-btn { flex: 1; padding: 6px 0; border: 1.5px solid var(--border); border-radius: var(--r-sm); background: transparent; color: var(--text); font-size: var(--t-xs); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.al-mode-btn.active { background: var(--brand-gradient, linear-gradient(135deg, #2563eb, #7c3aed)); color: #fff; border-color: transparent; }
.al-lock-notice { display: flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--text-muted); font-size: var(--t-xs); }
.al-lock-notice svg { flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.al-locked { opacity: 0.45; pointer-events: none; }
.btn-sm { height: var(--ctrl-sm); padding: 0 12px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; letter-spacing: .04em; border: 1px solid var(--border); background: var(--surface-3); color: var(--text-soft); }
.btn-sm:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }


/* ═══ Alerts Mode (P7) ═══ */
#alerts-mode { height: 100%; min-height: 0; padding:14px; }
.alerts-shell { display: flex; height: 100%; min-height: 0; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--el-raised); border-radius: var(--r-lg); overflow:hidden; }

/* ─── Demo banner ─── */
.alerts-source {
  display:flex; flex-direction:column; gap:3px;
  padding:8px 10px; margin-bottom:8px;
  border:1px solid var(--border); border-radius:var(--r-sm);
  background:rgba(255,255,255,.62);
}
.alerts-source-label { font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--text-muted); }
.alerts-source-value { font-size:12px; font-weight:600; color:var(--text-strong); }

/* ─── Summary column ─── */
.alerts-summary {
  width: 148px; flex: 0 0 148px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.alerts-summary-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.alerts-stat-card {
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-3);
}
.alerts-stat-card-label {
  font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 3px;
}
.alerts-stat-card-val {
  font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  color: var(--text-strong); line-height: 1;
}
.alerts-stat-card[data-tone="new"]      .alerts-stat-card-val { color: var(--crit); }
.alerts-stat-card[data-tone="new"]      { background: rgba(220,38,38,.04); }
.alerts-stat-card[data-tone="critical"] .alerts-stat-card-val { color: #f97316; }
.alerts-stat-card[data-tone="critical"] { background: rgba(249,115,22,.04); }
.alerts-stat-card[data-tone="warn"]     .alerts-stat-card-val { color: #eab308; }
.alerts-stat-card[data-tone="warn"]     { background: rgba(234,179,8,.04); }
.alerts-stat-card[data-tone="ok"]       .alerts-stat-card-val { color: var(--ok); }
.alerts-stat-card[data-tone="flag"]     .alerts-stat-card-val { color: #809cff; }
.alerts-stat-card[data-tone="flag"] { background: rgba(128,156,255,.05); }
.alerts-last-check {
  font-size: 10px; color: var(--text-muted); margin-top: auto; padding-top: 4px;
}

/* ─── Alert table panel ─── */
.alerts-table-panel {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  padding: 14px; gap: 10px; overflow: hidden;
}
.alerts-table-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex: 0 0 auto;
}
.alerts-table-title {
  font-size: 12px; font-weight: 700; color: var(--text-strong);
}
.alerts-table-wrap {
  flex: 1; min-height: 0; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.alerts-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.alerts-table th {
  position: sticky; top: 0; z-index: 2;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-soft); background: var(--surface-2);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.alerts-table td {
  padding: 9px 12px; color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 12px; white-space: nowrap;
}
.alerts-row {
  border-left: 3px solid var(--level-color, transparent);
  cursor: pointer;
  transition: background .1s;
}
.alerts-row:hover { background: var(--accent-soft); }
.alerts-row.sel   { background: rgba(37,99,235,.07); }
.alerts-row.expanded { background: var(--surface-3); }

/* ─── Expanded row ─── */
.alerts-exp-row td { padding: 0; border-bottom: 1px solid var(--border); max-width: 0; overflow: hidden; }
.alerts-exp-body { padding: 10px 14px 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; overflow: hidden; }
.alerts-exp-triggers { display: flex; gap: 6px; flex-wrap: wrap; }
.alert-trigger-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-3); color: var(--text-muted);
}
.alert-trigger-chip.active { background: rgba(37,99,235,.08); border-color: var(--accent); color: var(--accent); }
.alert-trigger-chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* stacked Δ metrics */
.alerts-exp-deltas { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.exp-delta-row { display: flex; align-items: baseline; gap: 8px; font-size: 11px; }
.exp-delta-label { color: var(--text-muted); font-size: 11px; min-width: 64px; }
.exp-delta-val { font-family: var(--font-mono); font-weight: 700; color: var(--text-strong); }
.exp-delta-unit { font-weight: 400; color: var(--text-muted); font-size: 10px; }
/* flag indicator (in state cell) */
.alert-row-flag { color: #809cff; font-size: 12px; margin-left: 4px; cursor: default; }
.alerts-row.row-flagged { background: rgba(128,156,255,.04); }
.alerts-exp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.alrt-act-btn {
  height: 28px; padding: 0 10px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: var(--surface-3);
  color: var(--text-soft); font-size: 11px; font-weight: 600; letter-spacing: .03em;
  white-space: nowrap; cursor: pointer; transition: background .1s, color .1s, border-color .1s;
}
.alrt-act-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.alrt-act-btn.act-ack:hover     { background: rgba(234,179,8,.1); color: #ca8a04; border-color: #ca8a04; }
.alrt-act-btn.act-resolve:hover { background: rgba(22,163,74,.08);  color: var(--ok);     border-color: var(--ok); }
.alrt-act-btn.act-retrigger:hover { background: rgba(220,38,38,.08); color: var(--crit);  border-color: var(--crit); }
.alrt-act-btn.act-flag        { color: var(--text-muted); }
.alrt-act-btn.act-flag.flagged { background: rgba(128,156,255,.10); color: #809cff; border-color: #809cff; }
.alrt-act-btn.act-section:hover { background: rgba(8,145,178,.08); color: var(--accent-teal); border-color: var(--accent-teal); }
.alrt-act-btn.act-delete       { color: var(--text-muted); }
.alrt-act-btn.act-delete:hover { background: rgba(220,38,38,.10); color: var(--crit); border-color: var(--crit); }

/* ─── Styled confirmation dialog ─── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: confirm-fade-in .15s ease;
}
@keyframes confirm-fade-in { from { opacity: 0; } }
.confirm-dialog {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 380px; max-width: 90vw; overflow: hidden;
}
.confirm-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px 0; font-size: 15px; font-weight: 700; color: var(--text);
}
.confirm-icon { font-size: 20px; }
.confirm-body {
  padding: 12px 20px 20px; font-size: 13px; line-height: 1.5;
  color: var(--text-soft);
}
.confirm-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.confirm-btn {
  height: 32px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; border: 1px solid var(--border); transition: all .12s;
}
.confirm-btn-cancel {
  background: var(--surface-3); color: var(--text-soft);
}
.confirm-btn-cancel:hover { background: var(--surface-4); }
.confirm-btn-danger {
  background: var(--crit); color: #fff; border-color: var(--crit);
}
.confirm-btn-danger:hover { background: #b91c1c; }
.confirm-btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.confirm-btn-primary:hover { opacity: .9; }

/* ─── Alert level badge ─── */
.alert-level-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 7px; border-radius: 999px; border: 1px solid transparent;
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
}

/* ─── Alert state badge ─── */
.alert-state-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 7px; border-radius: 999px;
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.alert-state-badge[data-state="NEW"]      { background: rgba(220,38,38,.1);   color: var(--crit); }
.alert-state-badge[data-state="ACTIVE"]   { background: rgba(249,115,22,.1);  color: #f97316; }
.alert-state-badge[data-state="ACK"]      { background: rgba(234,179,8,.12);  color: #eab308; }
.alert-state-badge[data-state="RESOLVED"] { background: rgba(22,163,74,.1);   color: var(--ok); }

/* ─── Alerts detail panel ─── */
.alerts-detail {
  width: 320px; flex: 0 0 320px;
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.alerts-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.alerts-detail-kicker {
  font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.alerts-detail-id {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-strong);
}
.alerts-detail-body {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.alerts-detail-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.alerts-detail-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0;
}
.alerts-detail-key  { font-size: 11px; color: var(--text-soft); }
.alerts-detail-val  { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-strong); text-align: right; }
.alerts-detail-actions {
  flex: 0 0 auto; padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px;
}
.alerts-action-btn {
  flex: 1; height: var(--ctrl-sm); border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-3);
  color: var(--text-soft); font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; transition: background .13s, color .13s, border-color .13s;
}
.alerts-action-btn.btn-ack:hover     { background: rgba(37,99,235,.08); color: var(--accent); border-color: var(--accent); }
.alerts-action-btn.btn-resolve:hover { background: rgba(22,163,74,.08);  color: var(--ok);     border-color: var(--ok); }
.alerts-detail-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-muted); padding: 24px;
}
.alerts-detail-empty svg { width: 32px; height: 32px; stroke: var(--text-muted); opacity: .4; }
.alerts-detail-empty p   { font-size: 12px; text-align: center; }

/* ─── Nav alert badge ─── */
.nav-alert-badge {
  margin-left: auto; min-width: 18px; height: 16px; border-radius: 999px;
  background: var(--crit); color: #fff;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; flex-shrink: 0;
}
.nav-alert-badge[data-count="0"] { display: none; }

/* ─── Alerts table-panel empty state ─── */
.alerts-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-muted);
}
.alerts-empty svg        { width: 40px; height: 40px; opacity: .35; stroke: var(--text-muted); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.alerts-empty-title      { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.alerts-empty-sub        { font-size: 12px; }

/* ── Alerts ribbon (legacy cleanup) ── */

/* ── Checkbox column ── */
.alerts-table th:first-child,
.alerts-table td:first-child { width:28px; text-align:center; }
.alert-chk { cursor:pointer; }

/* ── Alert ID column ── */
.alert-id-cell { white-space:nowrap; font-family:var(--font-mono, monospace); font-size:12px; }
.alert-id-text { cursor:pointer; border-bottom:1px dashed var(--text-soft); }
.alert-id-text:hover { color:var(--accent); }
.alert-id-input { width:120px; font-size:12px; font-family:var(--font-mono, monospace); padding:1px 4px; border:1px solid var(--accent); border-radius:var(--r-sm); }

/* ── Group parent row ── */
.alerts-group-parent { background:var(--surface-2); }
.alert-group-toggle { cursor:pointer; font-size:14px; user-select:none; }
.alert-group-badge { font-size:10px; background:var(--accent); color:#fff; padding:1px 5px; border-radius:8px; margin-left:4px; }

/* ── Group child row ── */
.alerts-child-row { opacity:0.85; }
.alert-child-indent { color:var(--text-soft); margin-right:4px; }

/* ── Per-row delete ── */
.alert-row-del { width:24px!important; height:24px!important; font-size:14px; opacity:0.4; }
.alert-row-del:hover { opacity:1; }

/* ── Flag icon ── */
.alert-flag { color:#ca8a04; }

/* ── Empty state (new) ── */
.alerts-empty p { font-size:14px; }

/* ═══ Toast notifications ═══ */
.toast-container {
  position:fixed; top:16px; right:16px; z-index:9999;
  display:flex; flex-direction:column; gap:8px;
  pointer-events:none;
}
.toast {
  pointer-events:auto;
  display:flex; align-items:center; gap:10px;
  padding:10px 16px; border-radius:8px;
  background:var(--surface); color:var(--text);
  box-shadow:0 4px 16px rgba(0,0,0,.15);
  border-left:4px solid #3b82f6;
  font-size:13px; line-height:1.4;
  animation:toast-in .3s ease;
  max-width:360px;
}
.toast.toast-alert { border-left-color:#ef4444; }
.toast.toast-report { border-left-color:#10b981; }
.toast.toast-info { border-left-color:#3b82f6; }
.toast-icon { font-size:18px; flex-shrink:0; }
.toast-body { flex:1; }
.toast-dismiss {
  background:none; border:none; cursor:pointer;
  font-size:16px; color:var(--text-soft,#64748b); padding:0 0 0 8px;
}
.toast-dismiss:hover { color:var(--text); }
@keyframes toast-in {
  from { opacity:0; transform:translateX(40px); }
  to { opacity:1; transform:translateX(0); }
}
@keyframes toast-out {
  from { opacity:1; transform:translateX(0); }
  to { opacity:0; transform:translateX(40px); }
}

/* ── Measure tool labels ── */
.measure-label, .measure-total {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--text);
  box-shadow: var(--el-raised);
}
.measure-total { font-weight: 600; }

/* ═══ Alert toast ═══ */
.alert-toast {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 90;
  transform: translateY(20px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  pointer-events: none;
}
.alert-toast.vis {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.alert-toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--el-float);
  font-size: var(--t-sm);
}
.alert-toast-icon { color: var(--crit); flex-shrink: 0; }
.alert-toast-text { color: var(--text); }
.alert-toast-action {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.alert-toast-action:hover { text-decoration: underline; }
.alert-toast-close {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
}

