/* ==========================================================================
   STATIONI OPS · COMMAND CENTER v5
   ==========================================================================
   Heavy enterprise dashboard styling — Datadog / Cloudflare / Auth0 / Plaid
   command-center inspirations. NOT generic SaaS gray, NOT cyberpunk neon.

   Brand: Stationi lime #C6F23E used liberally as the brand identity.
   Default: DARK theme (command centers feel more "enterprise" dark).
   Light mode supported but secondary.

   Sections:
     1. CSS variables / theme tokens
     2. Reset + body
     3. Layout (sidebar + topbar + page grid)
     4. Sidebar (sectioned, branded)
     5. Topbar (search, system pulse, accent picker)
     6. Page header
     7. Dashboard hero (KPI strip, map, activity, charts, system pulse)
     8. KPI tiles (legacy)
     9. Section cards
     10. Tables (list view) + kebab menu (NO eye icon)
     11. Detail / inline expansion
     12. Forms / inputs / buttons
     13. Status pills
     14. Misc utilities
     15. Cmd-K palette
     16. Responsive
   ========================================================================== */

/* ==========================================================================
   1. CSS VARIABLES / THEME TOKENS
   ========================================================================== */

:root {
  /* Brand — Stationi LIME, the brand identity color. */
  --stn-brand: #C6F23E;
  --stn-brand-dim: #A8D52E;
  --stn-brand-fg: #0A0F03;
  --stn-brand-glow: rgba(198, 242, 62, 0.18);
  --stn-brand-rgb: 198, 242, 62;

  /* User-selectable accent (chart palette + pill colors). */
  --stn-accent: #C6F23E;
  --stn-accent-fg: #0A0F03;
  --stn-accent-rgb: 198, 242, 62;

  /* Status semantic colors */
  --stn-success: #10B981;
  --stn-success-bg: rgba(16, 185, 129, 0.12);
  --stn-warn: #F59E0B;
  --stn-warn-bg: rgba(245, 158, 11, 0.12);
  --stn-danger: #EF4444;
  --stn-danger-bg: rgba(239, 68, 68, 0.12);
  --stn-info: #3B82F6;
  --stn-info-bg: rgba(59, 130, 246, 0.12);
  --stn-neutral: #71717A;
  --stn-neutral-bg: rgba(113, 113, 122, 0.12);

  /* Source colors for parking pins */
  --stn-source-curated: #C6F23E;
  --stn-source-osm: #3B82F6;
  --stn-source-waze: #A855F7;
  --stn-source-cluster: #F59E0B;

  /* Typography */
  --stn-font-sans: 'Inter', -apple-system, system-ui, sans-serif;
  --stn-font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  /* Sizing */
  --stn-sidebar-w: 264px;
  --stn-topbar-h: 64px;
  --stn-radius: 8px;
  --stn-radius-lg: 12px;

  /* DARK MODE — DEFAULT */
  --stn-bg-deepest: #07090C;
  --stn-bg: #0E1116;
  --stn-elev: #161A22;
  --stn-elev-2: #1D222C;
  --stn-border: rgba(255, 255, 255, 0.06);
  --stn-border-strong: rgba(255, 255, 255, 0.12);
  --stn-text: #EAEEF4;
  --stn-text-dim: #8590A0;
  --stn-text-mut: #5C6675;
  --stn-text-faint: #3D4452;
  --stn-surface: var(--stn-bg);
  --stn-surface-2: var(--stn-elev);
  --stn-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --stn-shadow: 0 2px 8px rgba(0, 0, 0, 0.40);
  --stn-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
  --stn-shadow-brand: 0 0 0 1px var(--stn-brand-glow), 0 4px 16px var(--stn-brand-glow);
}

/* Light-mode override */
html[data-stn-theme='light'] {
  --stn-bg-deepest: #F4F5F7;
  --stn-bg: #FFFFFF;
  --stn-elev: #FAFBFC;
  --stn-elev-2: #F1F3F5;
  --stn-border: rgba(0, 0, 0, 0.08);
  --stn-border-strong: rgba(0, 0, 0, 0.14);
  --stn-text: #14181F;
  --stn-text-dim: #6B7280;
  --stn-text-mut: #9CA3AF;
  --stn-text-faint: #C0C5CC;
  --stn-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --stn-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --stn-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ---- ACCENT VARIANTS ---- */
html[data-stn-accent='cyan']    { --stn-accent: #06B6D4; --stn-accent-fg: #04212A; --stn-accent-rgb: 6, 182, 212; }
html[data-stn-accent='lime']    { --stn-accent: #C6F23E; --stn-accent-fg: #0A0F03; --stn-accent-rgb: 198, 242, 62; }
html[data-stn-accent='violet']  { --stn-accent: #A855F7; --stn-accent-fg: #1A0533; --stn-accent-rgb: 168, 85, 247; }
html[data-stn-accent='amber']   { --stn-accent: #F59E0B; --stn-accent-fg: #1A0F00; --stn-accent-rgb: 245, 158, 11; }
html[data-stn-accent='rose']    { --stn-accent: #F43F5E; --stn-accent-fg: #2A0006; --stn-accent-rgb: 244, 63, 94; }

/* ==========================================================================
   2. RESET + BODY
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--stn-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--stn-text);
  background: var(--stn-bg-deepest);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
html { background: var(--stn-bg-deepest); }

a { color: var(--stn-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--stn-border); }

/* ---- ACCENT-DRIVEN HIGHLIGHTS ----
   The user-pickable accent (cyan / lime / violet / amber / rose) drives a
   handful of visible-but-non-brand elements so picking a color is actually
   noticeable. Brand lime stays put on logo, primary buttons, sidebar
   active link, and KPI tone='brand' — those identify the product.
   Picked accent shows up in: page-header underline, kbd chips, accent
   picker active swatch, scrollbar thumb hover, syspulse pill text.
   ---- */
.stn-page-accent-bar {
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--stn-accent) 30%,
    var(--stn-accent) 70%,
    transparent 100%);
  opacity: 0.55;
  margin: 0 0 14px;
}
.stn-kbd, kbd.stn-kbd {
  background: rgba(var(--stn-accent-rgb), 0.14);
  border: 1px solid rgba(var(--stn-accent-rgb), 0.40);
  color: var(--stn-accent);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--stn-accent-rgb), 0.55) !important;
}
.stn-syspulse-label {
  /* Subtly tint the pill label so the accent pick is visible even when
     no kbd chip / hover is on screen. */
  text-shadow: 0 0 8px rgba(var(--stn-accent-rgb), 0.35);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--stn-border-strong);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--stn-text-faint); background-clip: padding-box; border: 2px solid transparent; }

.stn-num, .stn-mono, .stn-kpi-value, .stn-detail-val,
table.dataTable td, [data-stn-num] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */

.page {
  display: flex;
  min-height: 100vh;
  background: var(--stn-bg-deepest);
}
.page-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--stn-sidebar-w);
  background: var(--stn-bg-deepest);
}
.page-body { padding: 0; flex-grow: 1; }
.page-body > .container-fluid {
  padding: 24px;
  max-width: 1800px;
  margin: 0 auto;
}
.page-header { padding: 20px 24px 0; max-width: 1800px; margin: 0 auto; }

.row-deck.row-cards { gap: 16px; margin: 0; }
.row-deck.row-cards > * { padding: 0; }

/* ==========================================================================
   4. SIDEBAR — sectioned, branded heavy (Datadog/Cloudflare style)
   ========================================================================== */

.stn-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--stn-sidebar-w);
  background: var(--stn-bg);
  border-right: 1px solid var(--stn-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1030;
}
.stn-sidebar .container-fluid {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.stn-sidebar .navbar-toggler { display: none; }

.stn-brand-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--stn-border);
  margin: 0;
  position: relative;
  flex-shrink: 0;
}
.stn-brand-block::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--stn-brand) 30%,
    var(--stn-brand) 70%,
    transparent 100%);
  opacity: 0.6;
}

.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-link:hover { text-decoration: none; }

.stn-wordmark {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--stn-font-sans);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--stn-text);
}
.stn-wordmark .stn-s {
  display: inline-block;
  background: var(--stn-brand);
  color: var(--stn-brand-fg);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 2px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 2px 8px var(--stn-brand-glow);
}
.stn-wordmark .stn-dot { display: none; }
.stn-wordmark .stn-rest { color: var(--stn-text); font-weight: 700; }
.stn-wordmark .stn-sub {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stn-text-dim);
  border: 1px solid var(--stn-border-strong);
  border-radius: 3px;
  align-self: center;
}

.stn-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stn-success);
  background: var(--stn-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 4px;
  align-self: flex-start;
  font-family: var(--stn-font-mono);
}
.stn-status-pill .stn-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--stn-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  animation: stn-pulse 2.6s ease-in-out infinite;
}
.stn-status-pill[data-state='degraded'] { color: var(--stn-warn); background: var(--stn-warn-bg); border-color: rgba(245, 158, 11, 0.25); }
.stn-status-pill[data-state='degraded'] .stn-status-dot { background: var(--stn-warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.stn-status-pill[data-state='down'] { color: var(--stn-danger); background: var(--stn-danger-bg); border-color: rgba(239, 68, 68, 0.25); }
.stn-status-pill[data-state='down'] .stn-status-dot { background: var(--stn-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
@keyframes stn-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---- NAV STACK ---- */
.stn-sidebar .navbar-collapse {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 16px;
}
.stn-nav-stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stn-nav-pinned { margin: 8px 12px 4px; list-style: none; }
.stn-nav-pinned .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--stn-text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: background 100ms ease;
}
.stn-nav-pinned .nav-link:hover { background: var(--stn-elev); }
.stn-nav-pinned .nav-link.active { background: var(--stn-elev); color: var(--stn-brand); }
.stn-nav-pinned .nav-link.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--stn-brand);
  border-radius: 0 2px 2px 0;
}
.stn-nav-pinned .nav-link-icon { width: 16px; text-align: center; color: var(--stn-text-dim); font-size: 14px; }
.stn-nav-pinned .nav-link.active .nav-link-icon { color: var(--stn-brand); }

/* Section header */
.stn-nav-section { margin: 12px 12px 2px; list-style: none; }
.stn-section-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--stn-text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: color 100ms ease;
}
.stn-section-toggle:hover { color: var(--stn-text); text-decoration: none; }
.stn-section-caret { font-size: 9px; transition: transform 200ms ease; width: 10px; text-align: center; }
.stn-section-toggle.collapsed .stn-section-caret { transform: rotate(-90deg); }
.stn-section-label { flex: 1; }
.stn-badge-cat {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0;
  font-family: var(--stn-font-mono);
  background: var(--stn-elev-2); color: var(--stn-text);
  border-radius: 3px;
  text-transform: none;
}

.stn-section-list { margin: 0 12px; padding: 0; }
.stn-section-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.stn-section-items .nav-item { list-style: none; }
.stn-section-items .nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 12px;
  border-radius: 5px;
  color: var(--stn-text-dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: background 100ms ease, color 100ms ease;
}
.stn-section-items .nav-link:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.stn-section-items .nav-link.active { background: var(--stn-elev-2); color: var(--stn-brand); font-weight: 600; }
.stn-section-items .nav-link.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 5px; bottom: 5px;
  width: 3px;
  background: var(--stn-brand);
  border-radius: 0 2px 2px 0;
}
.stn-section-items .nav-link-icon { width: 14px; text-align: center; color: var(--stn-text-mut); font-size: 12px; flex-shrink: 0; }
.stn-section-items .nav-link.active .nav-link-icon { color: var(--stn-brand); }
.stn-section-items .nav-link-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stn-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  font-size: 9.5px; font-weight: 700;
  font-family: var(--stn-font-mono);
  background: var(--stn-elev-2); color: var(--stn-text-dim);
  border-radius: 3px;
}

/* Sidebar footer */
.stn-sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--stn-border);
  font-size: 10.5px;
  color: var(--stn-text-mut);
  font-family: var(--stn-font-mono);
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

/* ==========================================================================
   5. TOPBAR
   ========================================================================== */

.stn-topbar {
  height: var(--stn-topbar-h);
  position: sticky; top: 0; z-index: 1020;
  background: var(--stn-bg);
  border-bottom: 1px solid var(--stn-border);
  display: flex; align-items: center;
  padding: 0; margin: 0;
}
.stn-topbar .container-xl {
  max-width: 1800px;
  display: flex; align-items: center; width: 100%;
  padding: 0 24px;
  gap: 16px;
}
.stn-crumbs-wrap { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
.stn-crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--stn-text-dim);
  white-space: nowrap; overflow: hidden;
}
.stn-crumb { display: inline-flex; align-items: center; gap: 4px; }
.stn-crumb-current { color: var(--stn-text); font-weight: 600; }
.stn-crumb-sep { color: var(--stn-text-faint); font-size: 12px; user-select: none; }

.stn-cmdk-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--stn-elev);
  color: var(--stn-text-dim);
  border: 1px solid var(--stn-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  width: 420px; max-width: 100%;
  font-family: inherit;
  transition: all 100ms ease;
}
.stn-cmdk-trigger:hover { background: var(--stn-elev-2); border-color: var(--stn-border-strong); color: var(--stn-text); }
.stn-cmdk-trigger > i { font-size: 13px; color: var(--stn-text-mut); }
.stn-cmdk-trigger > span { flex: 1; text-align: left; }

.stn-kbd {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  font-family: var(--stn-font-mono);
  font-size: 10.5px; font-weight: 600;
  color: var(--stn-text-dim);
  background: var(--stn-bg-deepest);
  border: 1px solid var(--stn-border);
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.stn-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.stn-icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  color: var(--stn-text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all 100ms ease;
}
.stn-icon-btn:hover { background: var(--stn-elev); border-color: var(--stn-border-strong); color: var(--stn-text); }

.stn-theme-toggle {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  color: var(--stn-text-dim);
  font-size: 13px;
  cursor: pointer;
}
.stn-theme-toggle:hover { background: var(--stn-elev); color: var(--stn-text); }
.stn-theme-icon-light, .stn-theme-icon-dark { display: none; }
html[data-stn-theme='dark'] .stn-theme-icon-dark { display: inline; }
html:not([data-stn-theme='dark']):not([data-stn-theme='light']) .stn-theme-icon-dark { display: inline; }
html[data-stn-theme='light'] .stn-theme-icon-light { display: inline; }

/* System pulse pill — TOPBAR */
.stn-syspulse {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
  color: var(--stn-text-dim);
  cursor: pointer;
  transition: all 100ms ease;
}
.stn-syspulse:hover { background: var(--stn-elev-2); border-color: var(--stn-border-strong); }
.stn-syspulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--stn-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.20);
  animation: stn-pulse 2.6s ease-in-out infinite;
  flex-shrink: 0;
}
.stn-syspulse[data-state='degraded'] .stn-syspulse-dot { background: var(--stn-warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22); }
.stn-syspulse[data-state='down']     .stn-syspulse-dot { background: var(--stn-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22); }
.stn-syspulse-label {
  font-family: var(--stn-font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px;
}

.stn-wapill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
  color: var(--stn-text-dim);
  font-family: var(--stn-font-mono);
}
.stn-wapill[data-state='ok']       { color: var(--stn-success); border-color: rgba(16, 185, 129, 0.20); background: rgba(16, 185, 129, 0.06); }
.stn-wapill[data-state='degraded'] { color: var(--stn-warn);    border-color: rgba(245, 158, 11, 0.20); background: rgba(245, 158, 11, 0.06); }
.stn-wapill[data-state='down']     { color: var(--stn-danger);  border-color: rgba(239, 68, 68, 0.20);  background: rgba(239, 68, 68, 0.06); }

/* Bell */
.stn-bell { position: relative; }
.stn-bell-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--stn-danger);
  color: white;
  border-radius: 8px;
  font-size: 10px; font-weight: 700;
  font-family: var(--stn-font-mono);
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--stn-bg);
}
.stn-bell-menu {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: 8px;
  box-shadow: var(--stn-shadow-lg);
  min-width: 280px;
  padding: 0; margin: 4px 0 0 0;
}
.stn-bell-menu-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stn-border);
  font-size: 12px; font-weight: 600;
  color: var(--stn-text-dim);
  display: flex; align-items: center; justify-content: space-between;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.stn-bell-menu-total { font-family: var(--stn-font-mono); color: var(--stn-text); }
.stn-bell-menu-list { display: flex; flex-direction: column; }
.stn-bell-menu-empty { padding: 16px 12px; color: var(--stn-text-mut); font-size: 13px; text-align: center; }
.stn-bell-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--stn-text); text-decoration: none;
  border-bottom: 1px solid var(--stn-border);
}
.stn-bell-item:hover { background: var(--stn-elev); text-decoration: none; }
.stn-bell-item:last-child { border-bottom: 0; }
.stn-bell-item-count { color: var(--stn-brand); font-family: var(--stn-font-mono); font-size: 12px; font-weight: 700; }

/* Accent picker */
.stn-accent-picker {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: 8px;
  margin: 0 4px;
}
.stn-accent-swatch {
  /* Bumped from 16×16 → 20×20 so the swatches are tappable + visibly
     a "color picker" instead of decorative pixels. The user could not
     tell they were even buttons at 16px. */
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  cursor: pointer;
  background: var(--swatch);
  padding: 0;
  transition: transform 120ms ease, box-shadow 120ms ease;
  position: relative;
}
.stn-accent-swatch:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06), 0 2px 8px rgba(0,0,0,0.35);
}
.stn-accent-swatch.is-active {
  /* Outline in the SWATCH color (not text color) so the picked accent
     is visually loud — was barely visible before. */
  outline: 2px solid var(--swatch);
  outline-offset: 2px;
  box-shadow: 0 0 8px var(--swatch);
}
.stn-accent-reset {
  width: 22px; height: 22px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--stn-text-mut);
  font-size: 10px; cursor: pointer;
  padding: 0;
  border-radius: 50%;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.stn-accent-reset:hover {
  background: var(--stn-elev-2);
  color: var(--stn-text);
  border-color: var(--stn-border-strong);
}

.stn-avatar-link { display: flex !important; align-items: center; gap: 8px; padding: 4px 6px !important; border-radius: 6px; }
.stn-avatar-link:hover { background: var(--stn-elev); }
.stn-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--stn-brand);
  color: var(--stn-brand-fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.stn-avatar-name { font-size: 12.5px; font-weight: 600; color: var(--stn-text); line-height: 1.1; }
.stn-avatar-sub { font-size: 10px; color: var(--stn-text-mut); text-transform: uppercase; letter-spacing: 0.08em; }
.stn-avatar-menu {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: 8px;
  box-shadow: var(--stn-shadow-lg);
  padding: 4px;
  min-width: 180px;
}
.stn-avatar-menu-head { padding: 8px 10px; border-bottom: 1px solid var(--stn-border); margin-bottom: 4px; }
.stn-avatar-menu .dropdown-item {
  padding: 8px 10px;
  border-radius: 5px;
  color: var(--stn-text);
  font-size: 13px;
  text-decoration: none;
}
.stn-avatar-menu .dropdown-item:hover { background: var(--stn-elev); color: var(--stn-text); }

/* ==========================================================================
   6. PAGE HEADER
   ========================================================================== */

.stn-page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  padding: 24px 0 16px;
  flex-wrap: wrap;
}
.stn-page-title-block { display: flex; flex-direction: column; gap: 4px; }
.stn-eyebrow {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--stn-brand);
  font-family: var(--stn-font-mono);
}
.stn-page-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--stn-text);
  line-height: 1.15;
}
.stn-page-subtitle { font-size: 14px; color: var(--stn-text-dim); font-weight: 400; margin-top: 2px; }
.stn-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ==========================================================================
   7. DASHBOARD HERO LAYOUT
   ========================================================================== */

.stn-cc { display: flex; flex-direction: column; gap: 18px; width: 100%; }

.stn-cc-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1400px) { .stn-cc-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .stn-cc-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stn-cc-strip { grid-template-columns: 1fr; } }

.stn-cc-kpi {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 100ms ease;
}
.stn-cc-kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--stn-border-strong);
  transition: background 100ms ease;
}
.stn-cc-kpi:hover { border-color: var(--stn-border-strong); background: var(--stn-elev); text-decoration: none; color: inherit; }
.stn-cc-kpi:hover::before { background: var(--stn-brand); }
.stn-cc-kpi[data-tone='brand']::before    { background: var(--stn-brand); }
.stn-cc-kpi[data-tone='success']::before  { background: var(--stn-success); }
.stn-cc-kpi[data-tone='warn']::before     { background: var(--stn-warn); }
.stn-cc-kpi[data-tone='danger']::before   { background: var(--stn-danger); }
.stn-cc-kpi[data-tone='info']::before     { background: var(--stn-info); }

.stn-cc-kpi-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--stn-text-dim);
  display: flex; align-items: center; gap: 6px;
}
.stn-cc-kpi-label i { font-size: 11px; color: var(--stn-text-mut); }
.stn-cc-kpi-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--stn-text);
  font-family: var(--stn-font-mono);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px;
}
.stn-cc-kpi-value-unit { font-size: 13px; font-weight: 600; color: var(--stn-text-dim); letter-spacing: 0; }
.stn-cc-kpi-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
  font-size: 11.5px; font-weight: 600;
  font-family: var(--stn-font-mono);
}
.stn-cc-trend-up   { color: var(--stn-success); }
.stn-cc-trend-down { color: var(--stn-danger); }
.stn-cc-trend-flat { color: var(--stn-text-mut); }
.stn-cc-kpi-sub { font-size: 11px; color: var(--stn-text-mut); font-weight: 400; letter-spacing: 0; }

/* Dashboard hero row */
.stn-cc-hero {
  display: grid;
  grid-template-columns: 2.4fr 1fr;
  gap: 16px;
  min-height: 540px;
}
@media (max-width: 1400px) { .stn-cc-hero { grid-template-columns: 1fr; } }

.stn-cc-map-panel {
  display: flex; flex-direction: column;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 540px;
}
.stn-cc-map-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stn-border);
  background: var(--stn-elev);
  flex-shrink: 0;
}
.stn-cc-map-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stn-text);
}
.stn-cc-map-title i { color: var(--stn-brand); font-size: 14px; }
.stn-cc-map-title-sub {
  color: var(--stn-text-dim);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-family: var(--stn-font-mono);
}
.stn-cc-map-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stn-cc-map-tool {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 11.5px; font-weight: 600;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  color: var(--stn-text-dim);
  border-radius: 5px;
  cursor: pointer;
  transition: all 100ms ease;
}
.stn-cc-map-tool:hover { border-color: var(--stn-border-strong); color: var(--stn-text); }
.stn-cc-map-tool.is-active {
  border-color: var(--stn-brand);
  color: var(--stn-brand);
  background: rgba(var(--stn-brand-rgb), 0.08);
}
.stn-cc-map-tool i { font-size: 10px; }
.stn-cc-map-host { flex: 1; position: relative; background: var(--stn-bg-deepest); }
.stn-cc-map-host #stn-cc-leaflet { position: absolute; inset: 0; width: 100%; height: 100%; }

.leaflet-container { background: var(--stn-bg-deepest) !important; font-family: var(--stn-font-sans) !important; }
html[data-stn-theme='dark'] .leaflet-tile,
html:not([data-stn-theme='light']) .leaflet-tile {
  filter: brightness(0.78) invert(1) contrast(0.95) hue-rotate(190deg) saturate(0.55);
}
.leaflet-control-zoom a {
  background: var(--stn-bg) !important;
  color: var(--stn-text) !important;
  border-color: var(--stn-border) !important;
}
.leaflet-control-attribution {
  background: rgba(0,0,0,0.6) !important;
  color: var(--stn-text-dim) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--stn-text-dim) !important; }

.stn-cc-map-legend {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 500;
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  box-shadow: var(--stn-shadow);
  font-size: 11.5px;
  pointer-events: none;
  font-family: var(--stn-font-mono);
}
.stn-cc-map-legend-row { display: flex; align-items: center; gap: 6px; color: var(--stn-text); }
.stn-cc-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--stn-bg);
  box-shadow: 0 0 0 1px var(--stn-border-strong);
}

/* Activity feed panel */
.stn-cc-activity {
  display: flex; flex-direction: column;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
  min-height: 540px;
  max-height: 720px;
}
.stn-cc-activity-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stn-border);
  background: var(--stn-elev);
  flex-shrink: 0;
}
.stn-cc-activity-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stn-text);
  display: flex; align-items: center; gap: 10px;
}
.stn-cc-activity-title i { color: var(--stn-brand); }
.stn-cc-activity-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.stn-cc-activity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--stn-border);
  text-decoration: none; color: inherit;
  transition: background 100ms ease;
}
.stn-cc-activity-row:hover { background: var(--stn-elev); color: inherit; text-decoration: none; }
.stn-cc-activity-row:last-child { border-bottom: 0; }
.stn-cc-activity-icon {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: var(--stn-elev-2);
  color: var(--stn-text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.stn-cc-activity-row[data-sev='success'] .stn-cc-activity-icon { background: var(--stn-success-bg); color: var(--stn-success); }
.stn-cc-activity-row[data-sev='warn']    .stn-cc-activity-icon { background: var(--stn-warn-bg);    color: var(--stn-warn); }
.stn-cc-activity-row[data-sev='danger']  .stn-cc-activity-icon { background: var(--stn-danger-bg);  color: var(--stn-danger); }
.stn-cc-activity-row[data-sev='info']    .stn-cc-activity-icon { background: var(--stn-info-bg);    color: var(--stn-info); }
.stn-cc-activity-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.stn-cc-activity-titletext { font-size: 13px; font-weight: 600; color: var(--stn-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stn-cc-activity-sub { font-size: 11.5px; color: var(--stn-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stn-cc-activity-ts {
  font-size: 10.5px;
  color: var(--stn-text-mut);
  font-family: var(--stn-font-mono);
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

/* Charts row */
.stn-cc-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) { .stn-cc-charts { grid-template-columns: 1fr; } }

.stn-cc-chart-panel {
  display: flex; flex-direction: column;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
}
.stn-cc-chart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
}
.stn-cc-chart-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--stn-text-dim); }
.stn-cc-chart-total { font-family: var(--stn-font-mono); font-size: 18px; font-weight: 700; color: var(--stn-text); letter-spacing: -0.01em; }
.stn-cc-chart-host { height: 180px; padding: 0 16px 16px; position: relative; }

/* System pulse panel */
.stn-cc-syspulse-panel {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
}
.stn-cc-syspulse-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stn-border);
  background: var(--stn-elev);
}
.stn-cc-syspulse-title { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--stn-text); display: flex; align-items: center; gap: 10px; }
.stn-cc-syspulse-title i { color: var(--stn-brand); }
.stn-cc-syspulse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--stn-border);
}
@media (max-width: 1100px) { .stn-cc-syspulse-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stn-cc-syspulse-grid { grid-template-columns: 1fr; } }
.stn-cc-syspulse-cell {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--stn-bg);
}
.stn-cc-syspulse-cell-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stn-text-dim); }
.stn-cc-syspulse-cell-head .stn-syspulse-dot { width: 7px; height: 7px; margin: 0; }
.stn-cc-syspulse-cell-value { font-size: 18px; font-weight: 700; color: var(--stn-text); font-family: var(--stn-font-mono); letter-spacing: -0.01em; }
.stn-cc-syspulse-cell-sub { font-size: 10.5px; color: var(--stn-text-mut); font-family: var(--stn-font-mono); }

/* ==========================================================================
   8. KPI TILES (legacy support)
   ========================================================================== */

.stn-kpi {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 100ms ease;
}
.stn-kpi:hover { border-color: var(--stn-border-strong); color: inherit; text-decoration: none; }
.stn-kpi-icon { position: absolute; top: 14px; right: 14px; font-size: 14px; color: var(--stn-text-mut); }
.stn-kpi-label { font-size: 11px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: var(--stn-text-dim); }
.stn-kpi-value { font-size: 28px; font-weight: 700; font-family: var(--stn-font-mono); color: var(--stn-text); letter-spacing: -0.02em; }
.stn-kpi-meta { display: flex; align-items: center; gap: 8px; }
.stn-kpi-sub { font-size: 11px; color: var(--stn-text-mut); }
.stn-kpi-spark-wrap { margin-top: 6px; }

/* ==========================================================================
   9. SECTION CARDS
   ========================================================================== */

.stn-section-card {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
}
.stn-section-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stn-border);
  background: var(--stn-elev);
}
.stn-section-card-title {
  margin: 0;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stn-text);
}
.stn-section-card-sub { font-size: 11.5px; color: var(--stn-text-mut); font-family: var(--stn-font-mono); }
.stn-section-card-body { padding: 16px; }
.stn-section-card-body--flush { padding: 0; }
.stn-section-card-actions { display: flex; align-items: center; gap: 8px; }

/* Footer for create.html / edit.html — save / cancel button row. Mirrors
   the head padding so the form feels balanced. */
.stn-section-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--stn-border);
  background: var(--stn-elev);
}

/* Used by edit.html / create.html to wrap each <label> + <input> pair so
   spacing between fields is consistent. starlette-admin's form macros
   only emit raw label + input pairs — without this wrapper they collapse
   into the body padding with no breathing room. */
.stn-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.stn-form-field:last-child { margin-bottom: 0; }
.stn-form-field label,
.stn-form-field .form-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stn-text-dim);
}
.stn-form-field .form-text,
.stn-form-field .help-text {
  font-size: 11.5px;
  color: var(--stn-text-mut);
}
.stn-form-field .invalid-feedback,
.stn-form-field .field-error {
  font-size: 12px;
  color: var(--stn-danger);
}

.stn-side-panel {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  overflow: hidden;
}
.stn-side-panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--stn-border);
  background: var(--stn-elev);
  display: flex; align-items: center; justify-content: space-between;
}
.stn-side-panel-title { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--stn-text); }
.stn-side-panel-body { padding: 16px; }

.stn-cc-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stn-cc-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stn-cc-row-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1100px) {
  .stn-cc-row-2, .stn-cc-row-3, .stn-cc-row-2-1 { grid-template-columns: 1fr; }
}

.stn-list { display: flex; flex-direction: column; }
.stn-list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--stn-border);
  text-decoration: none;
  color: var(--stn-text);
  transition: background 100ms ease;
}
.stn-list-row:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.stn-list-row:last-child { border-bottom: 0; }
.stn-list-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.stn-list-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stn-list-meta { font-size: 11px; color: var(--stn-text-mut); font-family: var(--stn-font-mono); white-space: nowrap; }

/* ==========================================================================
   10. TABLES (LIST VIEW) + KEBAB MENU (NO EYE ICON)
   ========================================================================== */

table.dataTable {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 13px;
  color: var(--stn-text);
  background: var(--stn-bg);
}

table.dataTable thead th {
  background: var(--stn-elev) !important;
  color: var(--stn-text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--stn-border) !important;
  border-top: 0 !important;
  text-align: left;
  white-space: nowrap;
}

table.dataTable tbody td {
  padding: 10px 14px !important;
  border-top: 0 !important;
  border-bottom: 1px solid var(--stn-border) !important;
  vertical-align: middle;
  background: var(--stn-bg);
  color: var(--stn-text);
}
table.dataTable tbody tr:hover td { background: var(--stn-elev); cursor: pointer; }
table.dataTable tbody tr.stn-row-active td { background: var(--stn-elev-2); }

/* HIDE the upstream "actions" / "show" / eye icons.
   starlette-admin renders an actions column with Edit/Delete + a "show/eye"
   link. We kill the eye entirely (per user demand: NO EYE ICON ANYWHERE). */
table.dataTable td.col-action a.show-row,
table.dataTable td.col-action button.show-row,
table.dataTable td.col-action a[href*='/detail/'],
table.dataTable td.col-action a[title*='Show'],
table.dataTable td.col-action a[title*='View'],
table.dataTable td.col-action a[aria-label*='Show'],
table.dataTable td.col-action a[aria-label*='View'],
table.dataTable a.fa-eye,
table.dataTable .fa-eye,
table.dataTable td a[title*='Show'],
table.dataTable td a[title*='View'],
.show-row,
i.fa-eye,
.fa.fa-eye,
.btn-detail {
  display: none !important;
}

table.dataTable td.col-action,
table.dataTable th.col-action {
  width: 60px;
  text-align: right;
  white-space: nowrap;
}
table.dataTable td.col-action .btn,
table.dataTable td.col-action a {
  font-size: 11.5px;
  padding: 3px 7px;
}

/* Kebab menu — replaces the eye/actions column */
.stn-kebab { position: relative; display: inline-block; }
.stn-kebab-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--stn-text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  transition: all 100ms ease;
}
.stn-kebab-btn:hover { background: var(--stn-elev-2); color: var(--stn-text); border-color: var(--stn-border-strong); }
.stn-kebab-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  min-width: 160px;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border-strong);
  border-radius: 6px;
  box-shadow: var(--stn-shadow-lg);
  padding: 4px;
  z-index: 100;
  display: none;
}
.stn-kebab.is-open .stn-kebab-menu { display: block; }
.stn-kebab-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  color: var(--stn-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
  text-align: left;
}
.stn-kebab-item:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.stn-kebab-item i { font-size: 12px; color: var(--stn-text-mut); width: 14px; text-align: center; }
.stn-kebab-item.is-danger { color: var(--stn-danger); }
.stn-kebab-item.is-danger:hover { background: var(--stn-danger-bg); }
.stn-kebab-item.is-danger i { color: var(--stn-danger); }

/* ID cell formatting */
.stn-id-cell { display: inline-flex; align-items: center; font-family: var(--stn-font-mono); font-size: 12px; }
.stn-id-head { font-weight: 700; color: var(--stn-text); }
.stn-id-tail { color: var(--stn-text-mut); font-weight: 400; }

.stn-ts-cell { font-family: var(--stn-font-mono); font-size: 12px; color: var(--stn-text-dim); }
.stn-ts-cell strong { color: var(--stn-text); font-weight: 600; }

/* DataTables wrapper */
.dataTables_wrapper { background: transparent; }
.dataTables_wrapper .row { margin: 0; padding: 8px 16px; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_length input {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  color: var(--stn-text);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label {
  color: var(--stn-text-dim);
  font-size: 12px;
  font-family: var(--stn-font-mono);
  padding: 12px 16px !important;
  margin: 0 !important;
}
/* Footer row that holds info + paginate — give it breathing room above/below
   so "Showing 0 to 0 of 0 entries" doesn't kiss the bottom border. */
.dataTables_wrapper .row + .row {
  padding: 8px 4px !important;
  align-items: center !important;
}
.dataTables_wrapper .dataTables_paginate {
  padding: 12px 16px !important;
}
.dataTables_paginate .paginate_button {
  padding: 4px 10px !important;
  margin: 0 2px !important;
  border: 1px solid var(--stn-border) !important;
  background: var(--stn-bg) !important;
  color: var(--stn-text-dim) !important;
  border-radius: 4px !important;
  font-size: 12px !important;
}
.dataTables_paginate .paginate_button.current {
  background: var(--stn-brand) !important;
  color: var(--stn-brand-fg) !important;
  border-color: var(--stn-brand) !important;
  font-weight: 700 !important;
}
.dataTables_paginate .paginate_button:hover:not(.current) {
  background: var(--stn-elev) !important;
  color: var(--stn-text) !important;
  border-color: var(--stn-border-strong) !important;
}

/* ==========================================================================
   11. INLINE ROW EXPANSION + DETAIL LIST
   ========================================================================== */

tr.stn-row-expand td {
  padding: 0 !important;
  background: var(--stn-elev) !important;
  border-bottom: 1px solid var(--stn-border-strong) !important;
}
.stn-expand-pane { max-height: 0; overflow: hidden; transition: max-height 220ms ease; }
.stn-expand-pane.is-open { max-height: 800px; }
.stn-expand-inner {
  padding: 16px 20px;
  border-top: 2px solid var(--stn-brand);
}
.stn-expand-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stn-expand-head-title { font-size: 15px; font-weight: 700; color: var(--stn-text); }
.stn-expand-actions { display: flex; gap: 6px; align-items: center; }
.stn-expand-close {
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--stn-border);
  color: var(--stn-text-dim);
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.stn-expand-close:hover { background: var(--stn-elev-2); color: var(--stn-text); }

.stn-expand-loading { display: flex; flex-direction: column; gap: 8px; }
.stn-skel {
  height: 10px;
  background: linear-gradient(90deg,
    var(--stn-elev-2) 0%,
    var(--stn-border-strong) 50%,
    var(--stn-elev-2) 100%);
  background-size: 200% 100%;
  animation: stn-skel 1.4s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes stn-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.stn-detail-list {
  display: flex; flex-direction: column;
  background: var(--stn-bg);
  border-radius: var(--stn-radius);
  overflow: hidden;
}
.stn-detail-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--stn-border);
}
.stn-detail-row:last-child { border-bottom: 0; }
.stn-detail-key {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stn-text-dim);
}
.stn-detail-val { font-size: 13px; color: var(--stn-text); word-break: break-word; }

/* ==========================================================================
   12. FORMS / INPUTS / BUTTONS
   ========================================================================== */

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 100ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-lg { font-size: 14px; padding: 9px 16px; }

.btn-primary {
  background: var(--stn-brand);
  color: var(--stn-brand-fg);
  border-color: var(--stn-brand);
  box-shadow: 0 0 0 1px var(--stn-brand-glow);
}
.btn-primary:hover {
  background: var(--stn-brand-dim);
  border-color: var(--stn-brand-dim);
  color: var(--stn-brand-fg);
  box-shadow: 0 0 0 2px var(--stn-brand-glow), 0 4px 12px var(--stn-brand-glow);
  text-decoration: none;
}
.btn-secondary {
  background: var(--stn-bg);
  color: var(--stn-text);
  border-color: var(--stn-border-strong);
}
.btn-secondary:hover {
  background: var(--stn-elev);
  border-color: var(--stn-text-mut);
  color: var(--stn-text);
  text-decoration: none;
}
.btn-ghost { background: transparent; color: var(--stn-text-dim); border-color: transparent; }
.btn-ghost:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.btn-danger { background: var(--stn-danger); color: white; border-color: var(--stn-danger); }
.btn-danger:hover { filter: brightness(0.92); color: white; text-decoration: none; }
.btn-outline-secondary {
  background: transparent;
  color: var(--stn-text-dim);
  border-color: var(--stn-border-strong);
}
.btn-outline-secondary:hover { background: var(--stn-elev); color: var(--stn-text); border-color: var(--stn-text-mut); }
.btn-success { background: var(--stn-success); color: white; border-color: var(--stn-success); }
.btn-success:hover { filter: brightness(0.92); color: white; text-decoration: none; }

.form-control,
input[type='text'],
input[type='search'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='url'],
input[type='tel'],
textarea,
select {
  background: var(--stn-bg) !important;
  color: var(--stn-text) !important;
  border: 1px solid var(--stn-border-strong) !important;
  border-radius: 6px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
  font-family: inherit !important;
  transition: all 100ms ease;
}
.form-control:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 0 !important;
  border-color: var(--stn-brand) !important;
  box-shadow: 0 0 0 3px var(--stn-brand-glow) !important;
}
.form-control::placeholder { color: var(--stn-text-mut); }

label { color: var(--stn-text); font-size: 12.5px; font-weight: 600; }

/* ==========================================================================
   13. STATUS PILLS
   ========================================================================== */

.stn-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--stn-font-mono);
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  text-transform: uppercase;
}
.stn-pill i { font-size: 9px; }
.stn-pill-success { color: var(--stn-success); background: var(--stn-success-bg); border-color: rgba(16, 185, 129, 0.20); }
.stn-pill-warn    { color: var(--stn-warn);    background: var(--stn-warn-bg);    border-color: rgba(245, 158, 11, 0.20); }
.stn-pill-danger  { color: var(--stn-danger);  background: var(--stn-danger-bg);  border-color: rgba(239, 68, 68, 0.20); }
.stn-pill-info    { color: var(--stn-info);    background: var(--stn-info-bg);    border-color: rgba(59, 130, 246, 0.20); }
.stn-pill-neutral { color: var(--stn-text-dim); background: var(--stn-neutral-bg); border-color: var(--stn-border-strong); }
.stn-pill-brand   { color: var(--stn-brand-fg); background: var(--stn-brand); border-color: var(--stn-brand); }
.stn-pill--bare   { background: transparent; border-color: transparent; padding: 0; }

/* ==========================================================================
   14. MISC UTILITIES
   ========================================================================== */

.stn-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 8px;
}
.stn-empty--inline { padding: 24px 16px; }
.stn-empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--stn-elev-2);
  color: var(--stn-text-mut);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 8px;
}
.stn-empty-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--stn-text); }
.stn-empty-body { margin: 0; font-size: 13px; color: var(--stn-text-dim); max-width: 320px; }
.stn-empty-actions { margin-top: 12px; }

.stn-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--stn-border);
  font-size: 11.5px;
  color: var(--stn-text-mut);
  font-family: var(--stn-font-mono);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.stn-foot-brand a { color: var(--stn-text-dim); }
.stn-foot-dot {
  display: inline-block;
  width: 3px; height: 3px;
  background: var(--stn-text-faint);
  margin: 0 8px;
  vertical-align: middle;
  border-radius: 50%;
}

.stn-init-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Workspace switcher */
.stn-workspace-wrap { position: relative; display: inline-block; }
.stn-workspace {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px;
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  color: var(--stn-text);
  border-radius: 6px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: all 100ms ease;
}
.stn-workspace:hover { border-color: var(--stn-border-strong); background: var(--stn-elev-2); }
.stn-workspace-init {
  width: 22px; height: 22px;
  background: var(--stn-brand);
  color: var(--stn-brand-fg);
  border-radius: 4px;
  font-weight: 800; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.stn-workspace-name { letter-spacing: 0.04em; }
.stn-workspace-caret { font-size: 9px; color: var(--stn-text-mut); transition: transform 120ms ease; }
.stn-workspace-wrap.is-open .stn-workspace-caret { transform: rotate(180deg); }
.stn-workspace-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px;
  background: var(--stn-surface);
  border: 1px solid var(--stn-border-strong);
  border-radius: 8px;
  box-shadow: var(--stn-shadow-lg);
  z-index: 100;
  padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.stn-workspace-menu[hidden] { display: none; }
.stn-workspace-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--stn-text);
  text-decoration: none;
  font-size: 12.5px; font-weight: 500;
  transition: background 100ms ease;
}
.stn-workspace-menu-item:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.stn-workspace-menu-item.is-active {
  background: rgba(var(--stn-brand-rgb), 0.10);
  color: var(--stn-text);
  font-weight: 700;
}
.stn-workspace-menu-item.is-active::after {
  content: 'current';
  margin-left: auto;
  font-size: 9.5px;
  font-family: var(--stn-font-mono);
  font-weight: 600;
  color: var(--stn-text-mut);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.stn-workspace-menu-item-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--stn-text-mut);
  flex-shrink: 0;
}
.stn-workspace-menu-empty {
  padding: 8px 10px;
  color: var(--stn-text-dim);
  font-size: 12px;
  font-style: italic;
}

/* ==========================================================================
   15. CMD-K PALETTE
   ========================================================================== */

.stn-cmdk {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.stn-cmdk.is-open { display: flex; }
.stn-cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.stn-cmdk-panel {
  position: relative;
  width: min(640px, 95vw);
  background: var(--stn-bg);
  border: 1px solid var(--stn-border-strong);
  border-radius: 12px;
  box-shadow: var(--stn-shadow-lg);
  overflow: hidden;
}
.stn-cmdk-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stn-border);
}
.stn-cmdk-icon { color: var(--stn-text-dim); font-size: 14px; }
.stn-cmdk-input {
  flex: 1;
  background: transparent !important;
  border: 0 !important;
  font-size: 16px !important;
  color: var(--stn-text) !important;
  outline: 0;
  padding: 0 !important;
}
.stn-cmdk-input:focus { box-shadow: none !important; }
.stn-cmdk-esc { border-color: var(--stn-border-strong); }
.stn-cmdk-list { max-height: 50vh; overflow-y: auto; padding: 4px; }
.stn-cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--stn-text);
  text-decoration: none;
  cursor: pointer;
}
.stn-cmdk-item.is-selected { background: var(--stn-elev-2); color: var(--stn-brand); }
.stn-cmdk-item:hover { background: var(--stn-elev); color: var(--stn-text); text-decoration: none; }
.stn-cmdk-row-icon { color: var(--stn-text-dim); width: 16px; text-align: center; }
.stn-cmdk-row-title { flex: 1; font-weight: 500; }
.stn-cmdk-row-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--stn-text-mut);
  text-transform: uppercase;
  font-family: var(--stn-font-mono);
}
.stn-cmdk-empty { padding: 20px; text-align: center; color: var(--stn-text-mut); font-size: 13px; }
.stn-cmdk-empty-q { font-family: var(--stn-font-mono); color: var(--stn-text); }
.stn-cmdk-footer {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--stn-border);
  background: var(--stn-elev);
  font-size: 11px;
  color: var(--stn-text-mut);
}

/* ==========================================================================
   16. RESPONSIVE
   ========================================================================== */

@media (max-width: 991px) {
  .stn-sidebar {
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }
  .stn-sidebar.is-open { transform: translateX(0); }
  .page-wrapper { margin-left: 0; }
  .stn-topbar .container-xl { padding: 0 16px; }
  .page-body > .container-fluid { padding: 16px; }
  .page-header { padding: 16px 16px 0; }
  .stn-cmdk-trigger { width: 200px; }
  .stn-page-title { font-size: 24px; }
}

html[data-stn-density='compact'] table.dataTable thead th { padding: 6px 12px !important; font-size: 10px; }
html[data-stn-density='compact'] table.dataTable tbody td { padding: 6px 12px !important; font-size: 12.5px; }
html[data-stn-density='compact'] .stn-section-card-head { padding: 8px 12px; }
html[data-stn-density='compact'] .stn-cc-kpi { padding: 10px 12px; }

/* Bootstrap card overrides */
.card {
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius-lg);
  color: var(--stn-text);
}
.card-body { padding: 16px; color: var(--stn-text); }
.card-header { background: var(--stn-elev); border-bottom: 1px solid var(--stn-border); }
.card-actions { padding: 0; }

.modal-content {
  background: var(--stn-bg);
  color: var(--stn-text);
  border: 1px solid var(--stn-border-strong);
  border-radius: var(--stn-radius-lg);
}
.modal-header, .modal-footer { border-color: var(--stn-border); }

.login-page, body.login-page { background: var(--stn-bg-deepest); }

/* Tabler/Bootstrap utility resets where they conflict */
.text-muted { color: var(--stn-text-dim) !important; }
.text-secondary { color: var(--stn-text-dim) !important; }
.text-reset { color: var(--stn-text) !important; }
.bg-transparent { background: transparent !important; }

/* Generic .stn-table — used by custom views (funnel, docs_pending, vehicle_contribution_review). */
table.stn-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--stn-text);
}
table.stn-table thead th {
  background: var(--stn-elev);
  color: var(--stn-text-dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-bottom: 1px solid var(--stn-border);
  text-align: left;
  white-space: nowrap;
}
table.stn-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--stn-border);
  vertical-align: middle;
}
table.stn-table tbody tr:hover td { background: var(--stn-elev); }
table.stn-table tbody tr:last-child td { border-bottom: 0; }

table.stn-table-mobile-stack { width: 100%; }
@media (max-width: 700px) {
  table.stn-table-mobile-stack thead { display: none; }
  table.stn-table-mobile-stack tr { display: block; padding: 12px; border-bottom: 1px solid var(--stn-border); }
  table.stn-table-mobile-stack td {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 4px 0; border: 0;
  }
  table.stn-table-mobile-stack td::before {
    content: attr(data-label);
    color: var(--stn-text-dim);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

/* Inline code blocks in views */
code, .stn-code {
  font-family: var(--stn-font-mono);
  background: var(--stn-elev-2);
  color: var(--stn-text);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* Buttons that look like outline danger */
.btn-outline-danger {
  background: transparent;
  color: var(--stn-danger);
  border-color: var(--stn-danger);
}
.btn-outline-danger:hover { background: var(--stn-danger-bg); color: var(--stn-danger); }

/* Bootstrap form-check / switch */
.form-check-input {
  background-color: var(--stn-elev) !important;
  border-color: var(--stn-border-strong) !important;
}
.form-check-input:checked {
  background-color: var(--stn-brand) !important;
  border-color: var(--stn-brand) !important;
}

/* Spinner */
.spinner-border, .stn-spinner {
  border-color: var(--stn-border-strong);
  border-top-color: var(--stn-brand);
}

/* Bootstrap alerts */
.alert {
  background: var(--stn-elev);
  border: 1px solid var(--stn-border-strong);
  color: var(--stn-text);
  border-radius: var(--stn-radius);
}
.alert-success { background: var(--stn-success-bg); border-color: rgba(16, 185, 129, 0.30); color: var(--stn-success); }
.alert-warning { background: var(--stn-warn-bg); border-color: rgba(245, 158, 11, 0.30); color: var(--stn-warn); }
.alert-danger  { background: var(--stn-danger-bg); border-color: rgba(239, 68, 68, 0.30); color: var(--stn-danger); }
.alert-info    { background: var(--stn-info-bg); border-color: rgba(59, 130, 246, 0.30); color: var(--stn-info); }

/* Backwards-compat aliases for older custom view templates */
:root, html[data-stn-theme='dark'], html[data-stn-theme='light'] {
  --stn-bg-2: var(--stn-elev);
  --stn-accent-soft: var(--stn-border-strong);
  --stn-danger: var(--stn-danger);
}

/* form-select to match form-control */
.form-select {
  background: var(--stn-bg) !important;
  color: var(--stn-text) !important;
  border: 1px solid var(--stn-border-strong) !important;
  border-radius: 6px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
}

/* Bootstrap progress bar (used by some custom views) */
.progress {
  background: var(--stn-elev-2);
  border-radius: 4px;
  height: 6px;
}
.progress-bar {
  background: var(--stn-brand);
  border-radius: 4px;
}

/* Tabler/Bootstrap nav-tabs */
.nav-tabs { border-bottom: 1px solid var(--stn-border); }
.nav-tabs .nav-link {
  color: var(--stn-text-dim);
  border: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}
.nav-tabs .nav-link:hover { color: var(--stn-text); }
.nav-tabs .nav-link.active {
  color: var(--stn-brand);
  background: transparent;
  border-bottom: 2px solid var(--stn-brand);
}

/* List groups */
.list-group-item {
  background: var(--stn-bg);
  color: var(--stn-text);
  border-color: var(--stn-border);
}

@media print {
  .stn-sidebar, .stn-topbar, .stn-page-actions, .stn-footer { display: none !important; }
  .page-wrapper { margin-left: 0; }
}

/* ==========================================================================
   ANALYTICS DASHBOARDS (PR #30)
   ----------------------------------------------------------------------------
   Heatmaps, retention matrix, replay player, KPI strip.
   All reuse the v5 design tokens — no new colors.
   ========================================================================== */

/* KPI strip used at the top of every analytics-* page */
.stn-an-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stn-an-kpi {
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stn-an-kpi-label {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .65rem;
  font-weight: 700;
  color: var(--stn-text-dim);
}
.stn-an-kpi-value {
  font-family: var(--stn-font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--stn-text);
  line-height: 1.05;
}
.stn-an-kpi-sub {
  font-size: .72rem;
  color: var(--stn-text-mut);
}

/* Two-column / four-column responsive analytics grids */
.stn-an-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stn-an-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stn-an-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1100px) { .stn-an-grid-3, .stn-an-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .stn-an-grid-2, .stn-an-grid-3, .stn-an-grid-4 { grid-template-columns: 1fr; } }

/* 24x7 heatmap (time-of-day) */
.stn-tod-heatmap {
  display: grid;
  grid-template-columns: 44px repeat(24, 1fr);
  gap: 2px;
  font-size: .62rem;
  font-family: var(--stn-font-mono);
}
.stn-tod-heatmap .stn-tod-corner,
.stn-tod-heatmap .stn-tod-hour {
  color: var(--stn-text-mut);
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stn-tod-heatmap .stn-tod-day {
  color: var(--stn-text-dim);
  text-align: right;
  padding: 0 6px;
  align-self: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.stn-tod-cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--stn-elev-2);
  border: 1px solid var(--stn-border);
  position: relative;
  cursor: default;
  transition: transform .12s ease;
}
.stn-tod-cell:hover {
  outline: 1px solid var(--stn-accent);
  z-index: 2;
}
.stn-tod-cell[data-tod-tip]::after {
  content: attr(data-tod-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 6px;
  background: var(--stn-bg-deepest);
  color: var(--stn-text);
  font-size: .65rem;
  font-family: var(--stn-font-mono);
  border: 1px solid var(--stn-border);
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 3;
}
.stn-tod-cell:hover[data-tod-tip]::after { opacity: 1; }

/* Cohort retention matrix */
.stn-cohort-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
  font-size: .76rem;
}
.stn-cohort-matrix th,
.stn-cohort-matrix td {
  padding: 6px 8px;
  text-align: center;
  font-family: var(--stn-font-mono);
}
.stn-cohort-matrix thead th {
  background: var(--stn-elev);
  color: var(--stn-text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .62rem;
  border-radius: 4px;
}
.stn-cohort-matrix tbody th {
  background: var(--stn-elev);
  color: var(--stn-text);
  text-align: left;
  font-weight: 600;
  border-radius: 4px;
}
.stn-cohort-cell {
  border-radius: 4px;
  background: var(--stn-elev-2);
  position: relative;
  color: var(--stn-text);
}
.stn-cohort-cell[data-pct] {
  /* fallback color — JS sets bg-color inline based on pct */
  background: var(--stn-elev-2);
}
.stn-cohort-cell-pct {
  font-weight: 700;
  font-size: .82rem;
}
.stn-cohort-cell-abs {
  font-size: .58rem;
  color: var(--stn-text-dim);
  letter-spacing: .04em;
}

/* Generic chart wrap */
.stn-chart-wrap { position: relative; width: 100%; }
.stn-chart-wrap.h-160 { height: 160px; }
.stn-chart-wrap.h-220 { height: 220px; }
.stn-chart-wrap.h-280 { height: 280px; }
.stn-chart-wrap.h-380 { height: 380px; }

/* Trajectory replay player */
.stn-replay-host {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.stn-replay-map {
  height: 480px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--stn-border);
  background: var(--stn-elev-2);
}
.stn-replay-controls {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: var(--stn-radius);
  padding: 8px 12px;
}
.stn-replay-btn {
  background: var(--stn-elev-2);
  color: var(--stn-text);
  border: 1px solid var(--stn-border);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--stn-font-mono);
  font-size: .72rem;
  cursor: pointer;
}
.stn-replay-btn.is-active {
  background: var(--stn-brand);
  color: var(--stn-brand-fg);
  border-color: var(--stn-brand);
}
.stn-replay-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--stn-elev-2);
  border-radius: 4px;
  outline: none;
}
.stn-replay-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--stn-brand);
  border-radius: 50%;
  cursor: pointer;
}
.stn-replay-time {
  font-family: var(--stn-font-mono);
  font-size: .72rem;
  color: var(--stn-text-dim);
  min-width: 90px;
  text-align: right;
}

/* Crash drill-down list (single events) */
.stn-crash-event-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.stn-crash-event {
  background: var(--stn-elev-2);
  border-left: 3px solid var(--stn-danger);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--stn-font-mono);
  font-size: .72rem;
}
.stn-crash-event-stack {
  white-space: pre-wrap;
  word-break: break-all;
  margin: 6px 0 0;
  color: var(--stn-text-dim);
  max-height: 220px;
  overflow: auto;
  background: var(--stn-bg);
  border: 1px solid var(--stn-border);
  border-radius: 4px;
  padding: 8px;
}

/* Adoption progress bars */
.stn-adopt-list { list-style: none; padding: 0; margin: 0; }
.stn-adopt-row {
  display: grid;
  grid-template-columns: minmax(150px, 200px) 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--stn-border);
}
.stn-adopt-row:last-child { border-bottom: none; }
.stn-adopt-label {
  display: flex; gap: 8px; align-items: center;
  font-size: .85rem;
  color: var(--stn-text);
}
.stn-adopt-bar {
  background: var(--stn-elev-2);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.stn-adopt-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--stn-brand) 0%, var(--stn-brand-dim) 100%);
  border-radius: 4px;
  transition: width .35s ease;
}
.stn-adopt-pct {
  font-family: var(--stn-font-mono);
  font-size: .82rem;
  font-weight: 700;
  color: var(--stn-text);
  min-width: 64px;
  text-align: right;
}
.stn-adopt-users {
  font-family: var(--stn-font-mono);
  font-size: .68rem;
  color: var(--stn-text-mut);
  min-width: 80px;
  text-align: right;
}

/* Mini compact filter strip */
.stn-an-filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: .8rem;
}
.stn-an-filter-strip select,
.stn-an-filter-strip input[type="text"],
.stn-an-filter-strip input[type="number"] {
  background: var(--stn-elev);
  color: var(--stn-text);
  border: 1px solid var(--stn-border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  font-family: var(--stn-font-mono);
}

/* Loading and empty states inside analytics panels */
.stn-an-loading {
  display: flex; align-items: center; justify-content: center;
  height: 180px;
  color: var(--stn-text-mut);
  font-family: var(--stn-font-mono);
  font-size: .78rem;
}
.stn-an-loading::before {
  content: '';
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--stn-brand);
  margin-right: 10px;
  animation: stn-pulse 1s infinite;
}

/* Live trajectory side panel (live-map extension) */
.stn-live-traj-panel {
  position: absolute;
  top: 12px; right: 12px;
  width: 320px;
  max-height: calc(100% - 24px);
  background: var(--stn-elev);
  border: 1px solid var(--stn-border);
  border-radius: 10px;
  z-index: 600;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--stn-shadow-lg);
}
.stn-live-traj-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stn-border);
  display: flex; justify-content: space-between; align-items: center;
}
.stn-live-traj-head-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--stn-text);
}
.stn-live-traj-list {
  overflow: auto;
  padding: 4px;
  flex: 1;
}
.stn-live-traj-row {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .76rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: center;
}
.stn-live-traj-row:hover {
  background: var(--stn-elev-2);
}
.stn-live-traj-row.is-active {
  background: rgba(var(--stn-brand-rgb), 0.12);
  outline: 1px solid var(--stn-brand);
}
.stn-live-traj-name { font-weight: 600; color: var(--stn-text); }
.stn-live-traj-meta {
  font-family: var(--stn-font-mono);
  font-size: .64rem;
  color: var(--stn-text-mut);
}

/* Funnel hour-of-day mini-heatmap (used inside the funnel page) */
.stn-mini-hod {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 1px;
  width: 100%;
  height: 18px;
}
.stn-mini-hod-cell {
  background: var(--stn-elev-2);
  border-radius: 1px;
}
