/* ────────────────────────────────────────────────────────────
   Dispecerine — Fleet Operations
   Dark glassmorphism UI for transit dispatch
   ──────────────────────────────────────────────────────────── */

:root {
  --bg-0: oklch(0.13 0.005 240);
  --bg-1: oklch(0.16 0.006 240);
  --bg-2: oklch(0.20 0.008 240);
  --bg-3: oklch(0.24 0.010 240);

  --fg-0: oklch(0.97 0.005 90);
  --fg-1: oklch(0.82 0.008 90);
  --fg-2: oklch(0.62 0.010 90);
  --fg-3: oklch(0.45 0.010 90);
  --fg-4: oklch(0.32 0.010 90);

  --line: oklch(1 0 0 / 0.07);
  --line-strong: oklch(1 0 0 / 0.14);
  --rim: oklch(1 0 0 / 0.22);

  --accent-amber: oklch(0.78 0.15 65);
  --accent-amber-soft: oklch(0.78 0.15 65 / 0.18);
  --accent-blue: oklch(0.72 0.12 235);
  --accent-blue-soft: oklch(0.72 0.12 235 / 0.18);
  --accent-green: oklch(0.74 0.16 150);
  --accent-green-soft: oklch(0.74 0.16 150 / 0.18);
  --accent-red: oklch(0.62 0.20 25);
  --accent-red-soft: oklch(0.62 0.20 25 / 0.20);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-1: 0 1px 0 var(--rim) inset, 0 8px 24px rgba(0,0,0,.35);
  --shadow-2: 0 1px 0 var(--rim) inset, 0 16px 48px rgba(0,0,0,.45);
  --shadow-3: 0 1px 0 var(--rim) inset, 0 24px 64px rgba(0,0,0,.55);

  --font-sans: 'Inter Tight', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  color: var(--fg-0);
  background: var(--bg-0);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  overflow: hidden;
}

#root { width: 100vw; height: 100vh; overflow: hidden; }

/* ────────── Layout shell ────────── */

.app-shell {
  display: grid;
  /* minmax(0,1fr): keep the single grid column at viewport width. Without it
     the column sizes to the topbar's max-content and stretches every screen
     (cut-off filters, horizontally scrolling dashboards). */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 56px 1fr;
  height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  background: radial-gradient(120% 80% at 70% 0%, var(--shell-glow-0) 0%, var(--bg-0) 60%);
  position: relative;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 30% at 90% 90%, var(--shell-glow-1) 0%, transparent 70%),
    radial-gradient(50% 40% at 10% 100%, var(--shell-glow-2) 0%, transparent 70%);
}

.viewport {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ────────── Glass surface ────────── */

.glass {
  background:
    linear-gradient(180deg, var(--glass-sheen-top) 0%, var(--glass-sheen-mid) 50%, var(--glass-sheen-bot) 100%),
    var(--surface-glass);
  backdrop-filter: blur(40px) saturate(140%);
  -webkit-backdrop-filter: blur(40px) saturate(140%);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  position: relative;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, var(--glass-hi) 0%, transparent 30%);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 0.5px;
}

.glass-flat {
  background: var(--surface-flat);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-md);
}

.glass-deep {
  background:
    linear-gradient(180deg, oklch(1 0 0 / .03) 0%, transparent 40%),
    var(--surface-glass-deep);
  backdrop-filter: blur(60px) saturate(160%);
  -webkit-backdrop-filter: blur(60px) saturate(160%);
  border: 0.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}

/* ────────── Top bar ────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  min-width: 0;
  overflow: hidden;
  border-bottom: 0.5px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 15px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--surface-raised) 0%, oklch(0.20 0.008 240) 100%);
  border: 0.5px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--rim) inset;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface-inset);
  border: 0.5px solid var(--line);
  border-radius: 999px;
}

.nav-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.nav-tab:hover { color: var(--fg-1); }

.nav-tab.active {
  background: var(--surface-raised);
  color: var(--fg-0);
  box-shadow: 0 1px 0 var(--rim) inset, 0 4px 12px rgba(0,0,0,.3);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 1;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 0.5px solid var(--line);
  min-width: 280px;
  color: var(--fg-2);
  font-size: 13px;
}

.search-box .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  padding: 2px 6px;
  border: 0.5px solid var(--line);
  border-radius: 4px;
  background: var(--surface-inset-solid);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 0.5px solid var(--line);
  color: var(--fg-1);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); }

.api-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 8px;
  background: var(--surface-chip);
  border: 1px solid var(--stroke-1);
  border-radius: 999px;
  font-size: 10.5px; letter-spacing: 0.06em; font-weight: 500;
  color: var(--fg-2);
}
.api-pill[data-tone="green"] { color: oklch(0.78 0.14 150); border-color: oklch(0.78 0.14 150 / 0.3); }
.api-pill[data-tone="amber"] { color: oklch(0.82 0.14 70);  border-color: oklch(0.82 0.14 70 / 0.3); }
.api-pill[data-tone="red"]   { color: oklch(0.74 0.16 25);  border-color: oklch(0.74 0.16 25 / 0.4); }
.api-pill[data-tone="blue"]  { color: oklch(0.74 0.10 235); border-color: oklch(0.74 0.10 235 / 0.3); }

.icon-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--accent-red);
  color: white;
  font-size: 9px;
  font-weight: 600;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--bg-0);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, oklch(0.62 0.10 60), oklch(0.40 0.08 50));
  border: 0.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  color: oklch(0.20 0.02 60);
}

/* ────────── Common bits ────────── */

.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }

.label-tiny {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-chip);
  border: 0.5px solid var(--line);
  color: var(--fg-1);
  white-space: nowrap;
}

.chip-online { color: var(--accent-green); background: var(--accent-green-soft); border-color: oklch(0.74 0.16 150 / .3); }
.chip-warn { color: var(--accent-amber); background: var(--accent-amber-soft); border-color: oklch(0.78 0.15 65 / .3); }
.chip-error { color: var(--accent-red); background: var(--accent-red-soft); border-color: oklch(0.62 0.20 25 / .3); }
.chip-info { color: var(--accent-blue); background: var(--accent-blue-soft); border-color: oklch(0.72 0.12 235 / .3); }

.btn {
  appearance: none;
  border: 0.5px solid var(--line-strong);
  background: var(--surface-chip);
  color: var(--fg-0);
  font: 500 12px/1 var(--font-sans);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary {
  background: var(--fg-0);
  color: var(--bg-0);
  border-color: transparent;
}
.btn-primary:hover { background: var(--fg-1); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.kbd-key {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: oklch(0.10 0.005 240);
  border: 0.5px solid var(--line);
  color: var(--fg-2);
}

/* ────────── Side rail ────────── */

.rail {
  position: absolute;
  left: 16px;
  top: 16px;
  bottom: 16px;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  z-index: 20;
}

.rail-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--fg-2);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.rail-btn:hover { color: var(--fg-0); background: var(--surface-flat); }
.rail-btn.active {
  color: var(--fg-0);
  background: oklch(0.24 0.010 240 / 0.9);
  border: 0.5px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--rim) inset;
}

/* ────────── Fleet — vehicle cards ────────── */

.vehicle-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.vehicle-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-3);
}
.vehicle-card.active {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 1px var(--accent-amber-soft), var(--shadow-3);
}

.vehicle-card .vehicle-illu {
  height: 80px;
  display: grid;
  place-items: center;
}

.vehicle-card .v-id {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.vehicle-card .v-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
}

.vehicle-card .v-route {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
}

/* mini map inside vehicle card */
.mini-map {
  height: 70px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-inset-solid);
  position: relative;
  border: 0.5px solid var(--line);
}

/* ────────── Stat blocks ────────── */

.stat-grid {
  display: grid;
  gap: 10px;
}

.stat-block {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-flat);
  border: 0.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  color: var(--fg-0);
}

.stat-block .stat-label {
  font-size: 11px;
  color: var(--fg-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-block .stat-val {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.stat-block .stat-val .unit {
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 400;
}

.stat-block .stat-delta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
}

/* ────────── Map canvas ────────── */

.map-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.map-stage svg { display: block; width: 100%; height: 100%; }

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.map-marker .pin {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-flat-strong);
  backdrop-filter: blur(8px);
  border: 1px solid var(--rim);
  display: grid;
  place-items: center;
  color: var(--fg-0);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,.4), 0 0 0 4px oklch(0 0 0 / .2);
}

.map-marker.amber .pin { color: var(--accent-amber); border-color: var(--accent-amber); }
.map-marker.green .pin { color: var(--accent-green); border-color: oklch(0.74 0.16 150 / .6); }
.map-marker.red .pin { color: var(--accent-red); border-color: oklch(0.62 0.20 25 / .6); }
.map-marker.blue .pin { color: var(--accent-blue); border-color: oklch(0.72 0.12 235 / .6); }

.map-marker .pulse {
  position: absolute;
  inset: -8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0;
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(2); opacity: 0; }
}

/* ────────── Mapbox markers ────────── */

.mb-marker {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.mb-marker .dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent-green);
  box-shadow:
    0 0 0 2px oklch(0.10 0.005 240),
    0 0 0 3.5px rgba(255,255,255,0.85),
    0 4px 14px oklch(0.10 0.005 240 / 0.7);
  transition: transform 180ms ease;
}
.mb-marker:hover .dot { transform: scale(1.18); }
.mb-marker-amber  .dot { background: var(--accent-amber); }
.mb-marker-blue   .dot { background: var(--accent-blue); }
.mb-marker-red    .dot { background: var(--accent-red); }
.mb-marker-green  .dot { background: var(--accent-green); }
.mb-marker-white  .dot { background: #ffffff; }

/* pulsing ring */
.mb-marker.pulsing::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  opacity: 0;
  animation: mb-pulse 2.6s ease-out infinite;
  pointer-events: none;
}
.mb-marker-amber.pulsing  { color: var(--accent-amber); }
.mb-marker-blue.pulsing   { color: var(--accent-blue); }
.mb-marker-red.pulsing    { color: var(--accent-red); }
.mb-marker-green.pulsing  { color: var(--accent-green); }
.mb-marker-white.pulsing  { color: #ffffff; }

@keyframes mb-pulse {
  0%   { transform: scale(0.5); opacity: 0.85; }
  100% { transform: scale(2.4);  opacity: 0; }
}

/* Mapbox popup overrides — match the glass aesthetic */
.mb-popup .mapboxgl-popup-content {
  background: var(--surface-glass-deep);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 0.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--fg-0);
  box-shadow: var(--shadow-3);
  font-family: var(--font-sans, 'Inter Tight', sans-serif);
}
.mb-popup .mapboxgl-popup-tip { display: none; }
.mb-popup-route {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mb-popup-id {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.mb-popup-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--fg-2);
}
.mb-pop-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-green);
}
.mb-pop-dot-amber { background: var(--accent-amber); }
.mb-pop-dot-blue  { background: var(--accent-blue); }
.mb-pop-dot-red   { background: var(--accent-red); }
.mb-pop-dot-green { background: var(--accent-green); }
.mb-pop-dot-gray  { background: #94a3b8; }

/* Hide Mapbox attribution text but keep the logo for ToS compliance */
.mapboxgl-ctrl-attrib { display: none !important; }
.mapboxgl-ctrl-logo {
  opacity: 0.5;
  filter: brightness(2);
}

/* ────────── Charts ────────── */

.chart-area {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart-axis-text {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--fg-3);
}

/* ────────── Scrollbars ────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: oklch(0.30 0.010 240 / 0.5);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: oklch(0.40 0.012 240 / 0.7);
  background-clip: content-box;
  border: 2px solid transparent;
}

/* ────────── Animations ────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
.slide-in { animation: slideIn 0.25s ease-out; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.blink { animation: blink 1.6s ease-in-out infinite; }

/* ────────── Density tweak ────────── */

[data-density="compact"] .glass { border-radius: var(--radius-md); }
[data-density="compact"] .stat-block { padding: 10px 12px; }
[data-density="compact"] .stat-block .stat-val { font-size: 22px; }
[data-density="compact"] .vehicle-card { padding: 10px; gap: 6px; }
[data-density="comfy"] .stat-block { padding: 18px 20px; }
[data-density="comfy"] .stat-block .stat-val { font-size: 32px; }
[data-density="comfy"] .vehicle-card { padding: 18px; gap: 14px; }

/* hue rotate via accent tweak */
[data-accent="amber"] { --accent-primary: var(--accent-amber); }
[data-accent="blue"]  { --accent-primary: var(--accent-blue); }
[data-accent="green"] { --accent-primary: var(--accent-green); }
[data-accent="violet"] { --accent-primary: oklch(0.70 0.16 300); }


/* ════════════════════════════════════════════════════════════════
   THEME TOKENS — from claude.ai/design light-mode handoff.
   Semantic surfaces (used by .glass* / .topbar / .nav-tabs classes and
   by admin/tikaops inline styles). Dark = glassy dark; light = frosted white.
   Accents are NOT flipped — they inherit (amber stays amber on light).
   ════════════════════════════════════════════════════════════════ */
:root {
  --surface-glass:        oklch(0.18 0.008 240 / 0.72);
  --surface-glass-deep:   oklch(0.14 0.006 240 / 0.86);
  --surface-flat:         oklch(0.20 0.008 240 / 0.6);
  --surface-flat-strong:  oklch(0.20 0.008 240 / 0.85);
  --surface-inset:        oklch(0.10 0.005 240 / 0.6);
  --surface-inset-solid:  oklch(0.14 0.006 240);
  --surface-raised:       oklch(0.28 0.010 240);
  --surface-chip:         oklch(0.22 0.008 240 / 0.6);
  --surface-hover:        oklch(0.26 0.010 240 / 0.8);
  --topbar-bg:            oklch(0.14 0.006 240 / 0.72);
  --glass-hi:             oklch(1 0 0 / .14);
  --glass-sheen-top:      oklch(1 0 0 / .04);
  --glass-sheen-mid:      oklch(1 0 0 / .01);
  --glass-sheen-bot:      oklch(0 0 0 / .04);
  --shell-glow-0:         oklch(0.22 0.01 240);
  --shell-glow-1:         oklch(0.24 0.01 240 / .8);
  --shell-glow-2:         oklch(0.20 0.01 240 / .6);
  /* helper aliases for admin/tikaops inline styles */
  --surface-1:  var(--surface-flat);
  --surface-2:  var(--surface-chip);
  --hairline:   var(--line);
  --on-accent:  #1a1408;
  --panel:      var(--surface-flat);
  --panel-hi:   var(--surface-raised);
  --sticky-head: var(--surface-inset-solid);
}

[data-theme="light"] {
  --bg-0: oklch(0.95 0.004 240);
  --bg-1: oklch(0.97 0.003 240);
  --bg-2: oklch(0.99 0.002 240);
  --bg-3: oklch(0.92 0.005 240);

  --fg-0: oklch(0.24 0.012 250);
  --fg-1: oklch(0.36 0.012 250);
  --fg-2: oklch(0.50 0.012 250);
  --fg-3: oklch(0.62 0.010 250);
  --fg-4: oklch(0.72 0.008 250);

  --line:        oklch(0.30 0.02 250 / 0.10);
  --line-strong: oklch(0.30 0.02 250 / 0.20);
  --rim:         oklch(1 0 0 / 0.85);

  --shadow-1: 0 1px 0 var(--rim) inset, 0 6px 18px oklch(0.40 0.03 250 / .10);
  --shadow-2: 0 1px 0 var(--rim) inset, 0 12px 34px oklch(0.40 0.03 250 / .14);
  --shadow-3: 0 1px 0 var(--rim) inset, 0 20px 50px oklch(0.40 0.03 250 / .18);

  /* frosted-white surfaces */
  --surface-glass:        oklch(1 0 0 / 0.66);
  --surface-glass-deep:   oklch(1 0 0 / 0.80);
  --surface-flat:         oklch(1 0 0 / 0.55);
  --surface-flat-strong:  oklch(1 0 0 / 0.85);
  --surface-inset:        oklch(0.50 0.02 250 / 0.08);
  --surface-inset-solid:  oklch(0.94 0.004 240);
  --surface-raised:       oklch(1 0 0);
  --surface-chip:         oklch(1 0 0 / 0.6);
  --surface-hover:        oklch(0.50 0.02 250 / 0.10);
  --topbar-bg:            oklch(0.98 0.003 240 / 0.78);
  --shell-glow-0:         oklch(0.90 0.012 250);
  --shell-glow-1:         oklch(0.94 0.010 250 / .8);
  --shell-glow-2:         oklch(0.92 0.012 250 / .6);
  --glass-hi:             oklch(1 0 0 / .9);
  --glass-sheen-top:      oklch(1 0 0 / .5);
  --glass-sheen-mid:      oklch(1 0 0 / .12);
  --glass-sheen-bot:      oklch(0.40 0.02 250 / .03);

  /* helper aliases flip with the surfaces; accent (--accent-amber) inherits = amber */
  --hairline:    oklch(0.30 0.02 250 / 0.10);
  --surface-1:   oklch(1 0 0 / 0.55);
  --surface-2:   oklch(1 0 0 / 0.6);
  --panel:       oklch(1 0 0);
  --panel-hi:    oklch(0.94 0.004 240);
  --sticky-head: oklch(1 0 0);
  --on-accent:   #1a1408;
}

/* Smooth theme switch */
body, .glass, .glass-flat, .glass-deep, .topbar, .nav-tabs, .nav-tab {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* ────────── Responsive layout ──────────
   Desktop-first: the dashboard is designed for ≥1440px; below that we
   progressively compress the topbar, narrow the Live Map side panel, and
   finally stack panel-over-map for tablet widths. Tables gain horizontal
   scroll instead of squeezing columns into unreadability. */

/* Live Map: side panel + map. Inline grid moved here so media queries work. */
.live-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  padding: 16px;
  height: 100%;
}

@media (max-width: 1520px) {
  .live-layout { grid-template-columns: 380px 1fr; }
}

@media (max-width: 1280px) {
  .live-layout { grid-template-columns: 330px 1fr; gap: 12px; padding: 12px; }
  .topbar { gap: 12px; padding: 0 12px; }
  .search-box { min-width: 170px; }
  .nav-tab { padding: 7px 10px; font-size: 12px; }
}

@media (max-width: 1120px) {
  .search-box { display: none; }
  /* !important — the clock div carries an inline display:flex */
  .topbar-clock { display: none !important; }
  .nav-tabs { overflow-x: auto; scrollbar-width: none; max-width: 46vw; }
  .nav-tabs::-webkit-scrollbar { display: none; }
}

@media (max-width: 920px) {
  /* Stack: panel on top (scrolls), map below. Dispatch on a tablet. */
  .live-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 44%) minmax(0, 1fr);
  }
  .brand span:not(.brand-mark) { display: none; }
  .topbar { gap: 8px; }
}

/* Reports KPI row: 6 → 3 → 2 columns */
.stat-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 1420px) { .stat-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .stat-grid-6 { grid-template-columns: repeat(2, 1fr); } }

/* Wide tables (Fleet) scroll sideways instead of crushing columns */
.table-scroll { overflow-x: auto; min-width: 0; }
.table-scroll > * { min-width: 820px; }

/* ── Švieslentė ─────────────────────────────────────────────────
   The board is its own surface: it carries the tokens a stop display
   needs (--sv-*, set inline per theme/density), not the dashboard's.
   Only the pulse lives here — everything else is component-scoped. */
@keyframes sv-blip { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* Kiosk density on a narrow screen: let the board scroll rather than
   reflow into something unreadable at distance. */
@media (max-width: 1040px) {
  [data-screen-label="12 Svieslente"] { padding-left: 16px; padding-right: 16px; }
}
