/* ─────────────────────────────────────────────────────────────────
   CARRO — WhatsGPS-style light theme
   Information-dense fleet UI. Brand blue topbar, white panels,
   compact rows, colored status pills.
   ───────────────────────────────────────────────────────────────── */
:root {
  /* Brand — refined enterprise blue. Swap --brand to rebrand the whole app. */
  --brand:        #2563eb;
  --brand-hover:  #1d4ed8;
  --brand-dark:   #1e40af;
  --brand-soft:   #eff4ff;
  --header-bg:    #ffffff;
  --header-fg:    #0f172a;

  /* Surfaces */
  --bg:     #f6f8fb;
  --panel:  #ffffff;
  --panel-2:#f7f9fc;
  --border: #e8ecf2;
  --border-strong: #d7dce4;

  /* Text */
  --text:        #0f172a;
  --text-2:      #475569;
  --muted:       #64748b;
  --link:        var(--brand);

  /* Status (fleet-vehicle states) */
  --status-moving:  #16a34a;
  --status-idle:    #f59e0b;
  --status-offline: #94a3b8;
  --status-alarm:   #ef4444;

  /* Fuel/gauge colors (used in tiles) */
  --fuel-good:  #16a34a;
  --fuel-warn:  #f59e0b;
  --fuel-low:   #dc2626;

  /* Accent compat for older selectors */
  --accent:     var(--brand);
  --accent-dim: var(--brand-hover);
  --success:    var(--status-moving);
  --error:      var(--status-alarm);

  /* Elevation — soft, layered */
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.05);
  --shadow-md: 0 2px 4px rgba(15,23,42,0.04), 0 8px 20px rgba(15,23,42,0.08);
  --shadow-lg: 0 16px 40px rgba(15,23,42,0.14);
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.18);

  /* Geometry — larger, softer corners */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --row-h:     52px;
  --header-h:  60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Arial, Helvetica, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.5rem;
  height: var(--header-h);
  background: var(--header-bg);
  color: var(--header-fg);
  border-bottom: 1px solid var(--border);
  /* Boven Leaflet (panes 200-700, controls 1000): de kaart mag nooit óver de
     sticky topbar schilderen. Zie ook de isolation-regel bij de map-containers. */
  position: sticky; top: 0; z-index: 1100;
}
.topbar .brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 600; letter-spacing: 0.02em; font-size: 1.02rem;
  color: var(--text); flex: none;
}
.topbar .brand::before {
  content: "C";
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  font-weight: 600; font-size: 0.95rem; letter-spacing: 0;
}
.topbar a { color: var(--text); text-decoration: none; }

.topbar nav { display: flex; align-items: center; gap: 0.15rem; height: 100%; flex: 1; }
.topnav { display: flex; align-items: center; gap: 0.15rem; height: 100%; flex: 1; }
.topnav a {
  color: var(--text-2);
  padding: 0.45rem 0.8rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  transition: background 0.12s, color 0.12s;
  display: inline-flex; align-items: center;
}
.topnav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topnav a.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.topnav-spacer { flex: 1; }
.topnav .email { color: var(--muted); font-size: 0.85rem; margin-left: 0.25rem; }

/* Dropdown nav group (e.g. Alerts → Overzicht / Alarmregels).
   Pure CSS: revealed on hover and on keyboard/touch focus-within, so it needs
   no JavaScript. The toggle is a <button> so it opens the menu instead of
   navigating; the child links do the navigation. */
.topnav-dropdown { position: relative; display: inline-flex; align-items: center; height: 100%; }
.topnav-dropdown-toggle {
  background: none; border: 0; cursor: pointer;
  color: var(--text-2);
  padding: 0.45rem 0.8rem; border-radius: var(--radius);
  font: inherit; font-size: 0.9rem; font-weight: 500;
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: background 0.12s, color 0.12s;
}
.topnav-dropdown-toggle::after { content: "\25BE"; font-size: 0.7em; opacity: 0.7; }
.topnav-dropdown-toggle:hover { background: var(--panel-2); color: var(--text); }
.topnav-dropdown.active .topnav-dropdown-toggle { background: var(--brand-soft); color: var(--brand-dark); }
.topnav-dropdown-menu {
  position: absolute; top: 100%; left: 0;
  min-width: 12rem;
  display: none; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.3rem;
  z-index: 200;
}
.topnav-dropdown:hover .topnav-dropdown-menu,
.topnav-dropdown:focus-within .topnav-dropdown-menu { display: flex; }
.topnav-dropdown-menu a {
  color: var(--text-2);
  padding: 0.45rem 0.7rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; white-space: nowrap;
}
.topnav-dropdown-menu a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topnav-dropdown-menu a.active { background: var(--brand-soft); color: var(--brand-dark); }

.inline { display: inline; }
button.link {
  background: none; border: 0;
  color: var(--text-2); cursor: pointer;
  font: inherit; font-weight: 500; font-size: 0.9rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
}
button.link:hover { background: var(--panel-2); color: var(--text); }

/* ── Layout shell ───────────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 1.25rem auto;
  padding: 0 1.5rem;
}

.footer {
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  font-size: 0.82rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ── Hero / landing ─────────────────────────────────────────────── */
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero h1 {
  font-size: 2.5rem; margin: 0 0 0.5rem 0;
  letter-spacing: 0.05em; color: var(--brand);
  font-weight: 600;
}
.hero .lead { font-size: 1.1rem; color: var(--muted); margin: 0.25rem 0 1rem; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn, .button {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.4;
}
.btn:hover, .button:hover {
  border-color: var(--brand); color: var(--brand);
  text-decoration: none;
}
.btn.primary, .button.primary, .button-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 500;
}
.btn.primary:hover, .button.primary:hover, .button-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: white;
}

button[type=submit] {
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius);
  background: var(--brand);
  color: white;
  border: 1px solid var(--brand);
  font: inherit;
  cursor: pointer;
}
button[type=submit]:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

/* ── Cards & notices ────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }
.card h1 { margin-top: 0; font-weight: 500; }

.notice {
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
}
.notice.success { border-left-color: var(--status-moving); background: #f0fdf4; }
.notice.warn    { border-left-color: var(--status-alarm);  background: #fef2f2; }

/* asp-validation-summary renders an (initially empty) .notice error box on every
   form. With no errors ASP.NET marks it .validation-summary-valid — without this
   rule that empty box shows as a stray bordered bar above the form. Hide it until
   the server populates it with errors (.validation-summary-errors). */
.validation-summary-valid { display: none; }
.notice code {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--brand-dark);
}

/* ── Forms ──────────────────────────────────────────────────────── */
label {
  display: block;
  margin: 0.8rem 0;
  font-size: 0.88rem;
  color: var(--text-2);
}
input[type=text], input[type=email], input[type=password],
input[type=number], select, textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin-top: 0.25rem;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.actions {
  display: flex; gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.2rem;
}
.error { color: var(--status-alarm); }
.error li { list-style: none; }

/* ── Page headers ───────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 1.25rem 0 1rem;
  flex-wrap: wrap; gap: 0.5rem;
}
.page-header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; }

/* Lightweight sub-section heading (uppercase eyebrow above tables) */
.section-label {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.table th, .table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.table th {
  background: var(--panel-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
}
.table tr:last-child td { border-bottom: none; }
table.clickable-rows tr:hover { background: #e8f4ff; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--brand-dark);
  font-size: 0.88rem;
}

/* ── Topnav (post-nav-pass) — kept compatible ───────────────────── */
.topnav-spacer { flex: 1; }

/* Vehicle-context layout */
.vehicle-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}
@media (max-width: 800px) {
  .vehicle-layout { grid-template-columns: 1fr; gap: 0.75rem; }
}
.vehicle-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  height: fit-content;
  position: sticky;
  top: calc(var(--header-h) + 0.75rem);
}
.vehicle-sidebar-header h2 {
  font-size: 1rem; margin: 0.25rem 0 0.1rem;
  font-weight: 600; color: var(--text);
}
.vehicle-sidebar-header .small { font-size: 0.8rem; color: var(--muted); }
.vehicle-sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.85rem; }
.vehicle-sidebar-nav a {
  display: block; padding: 0.5rem 0.75rem;
  color: var(--text-2); border-radius: var(--radius);
  font-size: 0.88rem;
}
.vehicle-sidebar-nav a:hover { background: #e8f4ff; color: var(--brand); text-decoration: none; }
.vehicle-sidebar-nav a.active {
  background: var(--brand);
  color: white;
  font-weight: 500;
}
.vehicle-sidebar-nav a.active:hover { background: var(--brand-hover); color: white; }
.vehicle-content { min-width: 0; }

/* Smal scherm: de zijbalk was een hoge, plakkende kolom die tijdens het scrollen
   over de inhoud heen bleef hangen. Nu wordt het een compacte balk met een
   horizontaal-scrollbare tab-pill-rij, netjes onder de header plakkend.
   (Staat bewust ná de basis-.vehicle-sidebar*-regels zodat die niet terugkaatsen.) */
@media (max-width: 800px) {
  .vehicle-sidebar {
    position: sticky;
    top: var(--header-h);
    z-index: 5;
    height: auto;
    padding: 0.7rem 0.85rem;
  }
  .vehicle-sidebar-header p { margin-bottom: 0; }

  .vehicle-sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.3rem;
  }
  .vehicle-sidebar-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    background: var(--panel-2);
    font-size: 0.85rem;
  }
  .vehicle-sidebar-nav a:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
  }
  .vehicle-sidebar-nav a.active,
  .vehicle-sidebar-nav a.active:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-dark);
    font-weight: 600;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs span[aria-hidden] { color: var(--border-strong); }
.breadcrumbs code {
  font-size: 0.82rem;
  background: var(--panel-2);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* ── Dashboard stat-tiles (tenant-dashboard) ────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}
.stat-tile {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border-left: 4px solid var(--border-strong);
  transition: border-left-color 0.12s, transform 0.1s;
}
.stat-tile:hover {
  border-left-color: var(--brand);
  text-decoration: none;
  transform: translateY(-1px);
}
.stat-tile.warn { border-left-color: var(--status-alarm); }
.stat-tile.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  border-left-color: var(--brand-dark);
}
.stat-tile.primary:hover { background: var(--brand-hover); }
.stat-value { font-size: 2rem; font-weight: 600; line-height: 1; }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
.stat-tile.primary .stat-label { color: rgba(255,255,255,0.85); }

/* ── Status pills (vehicle states — WhatsGPS-style) ─────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 500;
  color: white;
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
}
.status-pill.moving  { background: var(--status-moving); }
.status-pill.idle    { background: var(--status-idle); }
.status-pill.offline { background: var(--status-offline); }
.status-pill.alarm   { background: var(--status-alarm); }

/* Smaller "dot only" indicator */
.status-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 0.35em;
  vertical-align: middle;
}
.status-dot.moving  { background: var(--status-moving); }
.status-dot.idle    { background: var(--status-idle); }
.status-dot.offline { background: var(--status-offline); }
.status-dot.alarm   { background: var(--status-alarm); }

/* ── Trips header / month-nav ───────────────────────────────────── */
.trips-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.month-nav { display: flex; align-items: center; gap: 1rem; }
.month-nav-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border-strong);
  color: var(--text-2); font-size: 1.1rem;
  text-decoration: none;
}
.month-nav-arrow:hover { background: var(--brand); border-color: var(--brand); color: white; text-decoration: none; }
.month-nav-arrow.disabled { opacity: 0.3; pointer-events: none; }
.month-nav-current h1 { margin: 0; font-size: 1.35rem; font-weight: 600; text-transform: capitalize; }
.month-nav-current .small { display: block; color: var(--muted); }
.trips-header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 0.35rem; align-items: center; }
.inline-form select, .inline-form input {
  padding: 0.4rem 0.5rem; margin-top: 0; width: auto;
}
.inline-form input[name="year"] { width: 5em; }

/* ── Pager (vehicles-list e.a.) ─────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin: 1rem 0; flex-wrap: wrap;
}
.pager-info { font-size: 0.9rem; }
.pager-links { display: flex; gap: 0.5rem; }
.pager-links .btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* Trip stats */
.trip-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  padding: 0.95rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.stat-card-value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; color: var(--text); }
.stat-card-value .unit { font-size: 0.85rem; color: var(--muted); font-weight: 400; margin-left: 0.2em; }
.stat-card-label { color: var(--muted); font-size: 0.82rem; }
.stat-card-extra { margin-top: 0.2rem; }

.classification-split { padding-bottom: 0.85rem; }
.split-bar {
  display: flex; height: 8px; background: var(--panel-2); border-radius: 4px;
  overflow: hidden; margin: 0.55rem 0 0.5rem;
}
.split-bar .seg { height: 100%; transition: width 0.3s; }
.seg-zakelijk { background: var(--brand); }
.seg-prive    { background: var(--status-moving); }
.seg-onbekend { background: var(--status-offline); }
.split-legend {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  font-size: 0.78rem; color: var(--text-2);
}
.split-legend .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 0.3em; vertical-align: middle;
}
.dot-zakelijk { background: var(--brand); }
.dot-prive    { background: var(--status-moving); }
.dot-onbekend { background: var(--status-offline); }

/* Active trip card */
.active-trip-card {
  position: relative;
  display: flex; align-items: stretch;
  background: linear-gradient(135deg, #e8f4ff 0%, #d0e9ff 100%);
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.active-trip-pulse {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--status-alarm);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: pulse 1.5s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.active-trip-body { flex: 1; }
.active-trip-label {
  font-size: 0.78rem; color: var(--brand-dark); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
  display: flex; align-items: center; gap: 0.4rem;
}
.badge-live {
  background: var(--status-alarm); color: white;
  padding: 0.08rem 0.45rem; border-radius: var(--radius-pill);
  font-size: 0.66rem; letter-spacing: 0; font-weight: 500;
}
.active-trip-card h2 { margin: 0.35rem 0; font-size: 1.25rem; font-weight: 600; color: var(--text); }
.active-trip-meta { color: var(--text-2); margin: 0.3rem 0 0.85rem; display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.88rem; }
.active-trip-elapsed { font-weight: 600; color: var(--brand-dark); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.6; }
.empty-state h2 { margin: 0.5rem 0; font-weight: 500; color: var(--text-2); font-size: 1.05rem; }

/* Timeline */
.trips-timeline { display: flex; flex-direction: column; gap: 1rem; }
.trips-day {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.trips-day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.7rem 1.1rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  /* sticky removed — caused overlap with topbar, sidebar and breadcrumbs */
}
.trips-day-header h3 {
  margin: 0; font-size: 0.85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-2);
}
.trips-day-list { list-style: none; margin: 0; padding: 0; }

.trip-row {
  display: grid;
  grid-template-columns: 100px 1fr 130px;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
}
.trip-row:last-child { border-bottom: none; }
.trip-row:hover { background: #e8f4ff; }

.trip-row-time {
  text-align: center;
  font-feature-settings: "tnum";
}
.trip-row-time-start { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.trip-row-time-arrow { color: var(--border-strong); line-height: 1; font-size: 0.65rem; margin: 0.1rem 0; }
.trip-row-time-end { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.trip-row-time-duration { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted); }

.trip-row-route { min-width: 0; }
.trip-row-addr {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--text-2); font-size: 0.85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 0.1rem 0;
}
.addr-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.addr-dot.start { background: var(--brand); }
.addr-dot.end   { background: var(--status-moving); }
.trip-row-purpose { margin-top: 0.25rem; font-size: 0.78rem; color: var(--muted); }

.trip-row-meta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.trip-row-distance { font-size: 1.05rem; color: var(--text); }
.trip-row-distance strong { font-weight: 600; }
.trip-row-distance .unit { color: var(--muted); font-size: 0.78rem; }

/* Classification badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.74rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.badge-zakelijk { background: #dbeafe; color: var(--brand-dark); }
.badge-prive    { background: #dcfce7; color: #166534; }
.badge-onbekend { background: #f3f4f6; color: var(--muted); }
/* Odometer-vs-GPS-vergelijking */
.badge-divergence { background: #fef3c7; color: #92400e; }
.badge-neutral    { background: #f3f4f6; color: var(--muted); }
.trip-row-distance-compare { margin-top: 0.15rem; font-size: 0.78rem; }
.trip-distance-compare { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

@media (max-width: 700px) {
  .trip-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .trip-row-time { text-align: left; }
  .trip-row-meta { text-align: left; align-items: flex-start; flex-direction: row; gap: 0.8rem; }
}

/* ── Trip detail page ───────────────────────────────────────────── */
.trip-detail dt {
  font-weight: 600; color: var(--text-2);
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 0.7rem;
}
.trip-detail dd { margin: 0.15rem 0 0; color: var(--text); }

/* ── Trips table (legacy fallback view, if still used) ──────────── */
.trips-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.88rem;
}
.trips-table th, .trips-table td {
  padding: 0.55rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.trips-table th {
  background: var(--panel-2);
  font-weight: 600; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-2);
}
.trips-table tr:last-child td { border-bottom: none; }

/* ── Landing feature-grid ───────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1rem 0 3rem;
}
.feature-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.25rem 1.4rem;
}
.feature-card h2 { font-size: 1.05rem; margin: 0 0 0.35rem; color: var(--text); }
.feature-card p { margin: 0; color: var(--muted); }

/* Map */
#map { background: var(--panel); }

/* Elke kaart-container krijgt een eigen stacking-context zodat Leaflet's interne
   z-indexes (markers 600, popups 700, controls 1000) en onze overlays
   (.track-panel/.playback-bar 1000) binnen de kaart blijven en nooit met de
   topbar of dropdowns concurreren. */
.map-with-controls,
.trip-map,
#geozone-map,
.alert-map {
  isolation: isolate;
}

/* ── Map + track-history panel ──────────────────────────────────── */
.map-with-controls {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
}
#map { height: 640px; }

.track-panel {
  position: absolute;
  top: 12px; right: 12px;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  font-size: 0.85rem;
}
.track-panel[hidden] { display: none; }
.track-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.track-close {
  background: none; border: 0; cursor: pointer;
  font-size: 1.3rem; line-height: 1; color: var(--muted);
  padding: 0 0.25rem;
}
.track-close:hover { color: var(--status-alarm); }
.track-panel-body { padding: 0.85rem; }
.track-presets {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.track-presets button {
  padding: 0.35rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-2);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.track-presets button:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.track-presets button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.track-stats { line-height: 1.5; }
.track-stats strong { color: var(--text); }

/* Popup-actions row */
.popup-actions {
  display: flex; flex-direction: column; gap: 0.25rem;
  margin-top: 0.4rem;
}
.popup-actions a {
  font-size: 0.85rem;
  color: var(--brand);
}
.popup-actions a:hover { text-decoration: underline; }
.popup-actions .track-history-link { color: var(--brand-dark); font-weight: 500; }

/* ── Track polyline decorations ─────────────────────────────────── */
.track-arrow {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  color: #0d47a1;
  text-shadow:
    -1px -1px 0 #fff,  1px -1px 0 #fff,
    -1px  1px 0 #fff,  1px  1px 0 #fff;
  pointer-events: none;
}
.track-checkpoint {
  padding: 0 6px; height: 18px;
  background: white;
  border: 1px solid #0d47a1;
  border-radius: 9px;
  color: #0d47a1;
  font-size: 11px; font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  cursor: pointer;
}
.track-checkpoint:hover { background: #e8f4ff; }

/* ── Playback feature ───────────────────────────────────────────── */
.map-shell {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 1000px) {
  .map-shell { grid-template-columns: 1fr; }
}
.map-with-controls {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
}
#map { height: 680px; }

/* ── Playback bar (overlay onderaan map) ────────────────────────── */
.playback-bar {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  background: rgba(255,255,255,0.97);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0.7rem 0.9rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.playback-bar[hidden] { display: none; }

.playback-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.playback-controls > button {
  width: 36px; height: 36px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
  padding: 0;
}
.playback-controls > button:hover { background: var(--brand); color: white; border-color: var(--brand); }
.playback-controls > button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  width: 44px; height: 44px; font-size: 1.05rem;
}
.playback-controls > button.primary:hover { background: var(--brand-hover); }

.playback-speed {
  display: inline-flex;
  margin-left: 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
}
.playback-speed button {
  width: 40px; height: 28px;
  background: var(--panel);
  border: 0;
  border-right: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.playback-speed button:last-child { border-right: 0; }
.playback-speed button:hover { background: #e8f4ff; color: var(--brand); }
.playback-speed button.active {
  background: var(--brand);
  color: white;
}

.playback-scrub {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.playback-scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  background: var(--brand);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border-radius: 50%;
  cursor: pointer;
}
.playback-scrub::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--brand);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border-radius: 50%;
  cursor: pointer;
}

.playback-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-2);
  font-feature-settings: "tnum";
}
.readout-time { font-weight: 600; color: var(--text); }
.readout-speed { color: var(--brand-dark); font-weight: 500; }
.readout-progress { color: var(--muted); }
.readout-stop {
  margin-left: auto;
  background: #fff3e0;
  color: #b85c00;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.82rem;
}
.playback-readout .sep { color: var(--border-strong); }

/* ── Sidebar ────────────────────────────────────────────────────── */
.playback-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  max-height: 680px;
  display: flex;
  flex-direction: column;
}
.playback-sidebar[hidden] { display: none; }
.playback-sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.playback-sidebar-body {
  overflow-y: auto;
  padding: 0.85rem;
  flex: 1;
}
.playback-section { margin-bottom: 1.1rem; }
.playback-section:last-child { margin-bottom: 0; }
.playback-section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.playback-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}
.playback-presets button {
  padding: 0.5rem 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-2);
}
.playback-presets button:hover { border-color: var(--brand); color: var(--brand); background: #e8f4ff; }
.playback-presets button.active { background: var(--brand); border-color: var(--brand); color: white; }

.playback-range { display: flex; flex-direction: column; gap: 0.5rem; }
.playback-range label {
  display: block; margin: 0;
  font-size: 0.78rem; color: var(--text-2);
}
.playback-range input[type="datetime-local"] {
  margin-top: 0.2rem; width: 100%;
  padding: 0.4rem 0.5rem; font-size: 0.85rem;
}
.playback-range .button { margin-top: 0.3rem; }

.playback-summary { font-size: 0.85rem; }
.summary-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--border);
}
.summary-row:last-child { border-bottom: 0; }
.summary-row strong { font-size: 1.1rem; color: var(--text); }

.playback-stops {
  list-style: none; margin: 0; padding: 0;
}
.playback-stops li {
  display: flex; gap: 0.6rem; align-items: center;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 4px;
}
.playback-stops li:hover { background: #fff3e0; }
.playback-stops li:last-child { border-bottom: 0; }
.stop-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #f59e0b;
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.stop-num.offline {
  background: #6b7280;
}
.stop-meta { display: flex; flex-direction: column; min-width: 0; }
.stop-time { font-size: 0.85rem; color: var(--text); font-weight: 500; }
.stop-duration { font-size: 0.74rem; }
/* Vertrek = startmoment van beweging (groen); pijl gedimd; lopende stop gedimd. */
.stop-arrow { color: var(--muted); font-weight: 400; }
.stop-depart { color: var(--success); font-weight: 500; }
.stop-ongoing { color: var(--muted); font-weight: 400; font-style: italic; }

/* ── Map markers (playback + live) ──────────────────────────────── */

/* Teardrop map-pin (stops + endpoints). iconAnchor zit op de punt onderaan. */
.map-pin {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2.5px solid #fff;
  box-shadow: 0 3px 7px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
}
.map-pin .map-pin-glyph {
  transform: rotate(45deg);
  color: #fff; font-weight: 700; font-size: 0.82rem; line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.stop-pin  { background: linear-gradient(145deg, #fbbf24, #f59e0b); }
.stop-pin.offline {
  background: linear-gradient(145deg, #9ca3af, #6b7280);
  border-style: dashed;
}
.endpoint-pin.start { background: linear-gradient(145deg, #22c55e, #16a34a); }
.endpoint-pin.end   { background: linear-gradient(145deg, #475569, #334155); }
.endpoint-pin .map-pin-glyph { font-size: 0.72rem; }

/* Puls op de actieve stop tijdens afspelen. */
.map-pin.active {
  z-index: 500;
  animation: pin-pulse 1.4s ease-out infinite;
}
@keyframes pin-pulse {
  0%   { box-shadow: 0 3px 7px rgba(0,0,0,0.35), 0 0 0 0 rgba(245,158,11,0.55); }
  70%  { box-shadow: 0 3px 7px rgba(0,0,0,0.35), 0 0 0 14px rgba(245,158,11,0); }
  100% { box-shadow: 0 3px 7px rgba(0,0,0,0.35), 0 0 0 0 rgba(245,158,11,0); }
}

/* Voertuig-chip: ronde schijf + icoon + statuskleur-ring + heading-wig. */
.vehicle-chip {
  position: relative; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
}
.vehicle-chip-wedge {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 18px solid rgba(29,78,216,0.42);
  margin-left: -9px; margin-top: -18px;
  transform-origin: 50% 100%;
  z-index: 1;
}
.vehicle-chip-disc {
  position: relative; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 2.5px solid #2563eb;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  color: #1e3a8a;
}
.vehicle-chip-disc svg { width: 20px; height: 20px; display: block; fill: currentColor; }
.vehicle-chip.status-alert  .vehicle-chip-disc { border-color: #ef4444; color: #b91c1c; }
.vehicle-chip.status-door   .vehicle-chip-disc { border-color: #f59e0b; color: #b45309; }
.vehicle-chip.status-moving .vehicle-chip-disc { border-color: #1d4ed8; color: #1e3a8a; }
.vehicle-chip.status-alert  .vehicle-chip-wedge { border-top-color: rgba(239,68,68,0.42); }
.vehicle-chip.status-door   .vehicle-chip-wedge { border-top-color: rgba(245,158,11,0.45); }
.vehicle-chip.status-engine   .vehicle-chip-disc { border-color: #16a34a; color: #166534; }
.vehicle-chip.status-ignition .vehicle-chip-disc { border-color: #2563eb; color: #1e3a8a; }
.vehicle-chip.status-off      .vehicle-chip-disc { border-color: #94a3b8; color: #475569; }
.vehicle-chip.status-offline  .vehicle-chip-disc { border-color: #64748b; color: #334155; opacity: 0.85; }

/* ── Live-kaart layout met status-sidepanel ───────────────────────── */
.map-layout { display: flex; gap: 12px; align-items: stretch; }
.map-layout .map-with-controls { flex: 1 1 auto; min-width: 0; }
.map-sidebar {
  flex: 0 0 320px; max-width: 320px; height: 680px; overflow-y: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px;
}

.fleet-legend {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  padding: 4px 6px 10px; font-size: 11px; color: #64748b;
  border-bottom: 1px solid #e2e8f0; margin-bottom: 8px;
}
.fleet-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.fleet-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.fleet-group { margin-bottom: 10px; }
.fleet-group-header {
  display: flex; align-items: center; gap: 6px;
  padding: 4px; font-weight: 600; font-size: 12px; color: #334155;
}
.fleet-group-count {
  margin-left: auto; background: #f1f5f9; border-radius: 10px;
  padding: 0 8px; font-size: 11px; color: #475569;
}

.fleet-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 6px; cursor: pointer;
}
.fleet-row:hover { background: #f8fafc; }
.fleet-row-icon { width: 24px; height: 24px; flex: none; color: #475569; }
.fleet-row-icon svg { width: 24px; height: 24px; fill: currentColor; display: block; }
.fleet-row-main { display: flex; flex-direction: column; min-width: 0; }
.fleet-row-plate { font-weight: 600; font-size: 13px; color: #0f172a; }
.fleet-row-sub {
  font-size: 11px; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fleet-row-badge { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; }

@media (max-width: 860px) {
  .map-layout { flex-direction: column; }
  .map-sidebar { flex-basis: auto; max-width: none; height: 240px; }
}

/* Richtingpijl langs de route. */
.route-arrow { width: 16px; height: 16px; color: #1d4ed8; opacity: 0.9; }
.route-arrow svg { width: 16px; height: 16px; fill: currentColor;
  filter: drop-shadow(0 0 1.2px #fff) drop-shadow(0 0 1.2px #fff); }

/* Generieke voertuig-icoon-SVG (picker, lijsten). */
.vehicle-icon-svg { width: 100%; height: 100%; display: block; fill: currentColor; }

/* ── Voertuig-icoon picker (dashboard) ──────────────────────────── */
.icon-picker { margin: 0 0 1rem; }
.icon-picker-head {
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem;
}
.icon-picker-current {
  width: 44px; height: 44px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--panel, #fff);
  border: 2px solid #2563eb; color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.icon-picker-current svg { width: 26px; height: 26px; }
.icon-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.5rem;
}
.icon-option {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.6rem 0.35rem; cursor: pointer;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 10px;
  background: var(--panel, #fff); color: var(--text, #334155);
  transition: border-color .12s, background .12s, transform .06s;
}
.icon-option:hover { border-color: #93b4e6; background: #f1f6ff; }
.icon-option:active { transform: scale(0.97); }
.icon-option .icon-swatch { width: 30px; height: 30px; color: #475569; }
.icon-option .icon-label { font-size: 0.72rem; text-align: center; line-height: 1.1; }
.icon-option input { position: absolute; opacity: 0; pointer-events: none; }
.icon-option.selected {
  border-color: #2563eb; background: #eaf1ff;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.icon-option.selected .icon-swatch { color: #1d4ed8; }

/* ── Odometer-kalibratie ────────────────────────────────────────── */
.odometer-calibration {
  margin: 0 0 1rem; padding: 1rem;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 10px;
  background: var(--panel, #fff);
}
.odometer-calibration-head { margin-bottom: 0.75rem; }
.odometer-calibration-body {
  display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.odometer-calibration-body label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.85rem; font-weight: 500; color: var(--text, #334155);
}
.odometer-calibration .input-suffix {
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.odometer-calibration .input-suffix input {
  width: 9rem; padding: 0.5rem 0.6rem;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 8px;
  font-size: 0.95rem;
}
.odometer-calibration .input-suffix .unit { color: var(--muted, #64748b); font-size: 0.85rem; }
.metric-hint { margin-top: 0.2rem; }

/* Voertuig-icoon in de voertuigenlijst. */
.vehicle-row-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; color: #475569; vertical-align: middle;
}
.vehicle-row-icon svg { width: 24px; height: 24px; }

/* ── Command buttons ────────────────────────────────────────────── */
.command-buttons {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1rem;
}
.command-buttons .button {
  padding: 0.6rem 1rem;
  font-size: 0.92rem;
  font-weight: 500;
}
.button-danger {
  background: var(--status-alarm);
  border-color: var(--status-alarm);
  color: white;
}
.button-danger:hover {
  background: #c81e1e;
  border-color: #c81e1e;
  color: white;
}
.button.small { padding: 0.25rem 0.55rem; font-size: 0.78rem; }
.cmd-icon { font-size: 1.1rem; margin-right: 0.3em; }

/* Playback-only layout: tighter grid (sidebar smaller) */
.map-shell.playback-only { grid-template-columns: 1fr 320px; }
@media (max-width: 1000px) {
  .map-shell.playback-only { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────────
   Generic page grid (two-column section, used on tenant-dashboard
   for the Voertuigen / Trackers split).
   ───────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.grid > * { min-width: 0; }
.grid h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; gap: 1rem; }
}

/* ─────────────────────────────────────────────────────────────────
   Metric tiles (vehicle-dashboard live telemetry).
   2×2 grid of bordered tiles with big value + small label.
   ───────────────────────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 600px) {
  .metric-grid { grid-template-columns: 1fr; }
}

.metric-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.1s;
}
.metric-tile:hover { box-shadow: var(--shadow-md); }

.metric-value {
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  font-feature-settings: "tnum";
}
.metric-value.compact { font-size: 1.35rem; }
.metric-value .unit {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.2em;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}

/* Sub-grid inside a tile (Contact + Immobilizer side-by-side) */
.metric-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* Fuel bar inside a metric-tile */
.fuel-bar {
  height: 6px;
  background: var(--panel-2);
  border-radius: 3px;
  margin-top: 0.45rem;
  overflow: hidden;
}
.fuel-bar-fill {
  height: 100%;
  background: var(--fuel-good);
  transition: width 0.3s ease, background 0.3s ease;
}
.fuel-bar-fill.warn { background: var(--fuel-warn); }
.fuel-bar-fill.low  { background: var(--fuel-low); }

/* Stale-stamp ("Laatst gemeten X min geleden") */
.stale-stamp {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-feature-settings: "tnum";
}
/* Meetmoment-stempel bovenaan het boordcomputer-panel ("Gegevens van <datum>"). */
.can-top-stamp {
  margin-top: 0;
  margin-bottom: 0.85rem;
}
.can-top-stamp + .stale-hint {
  margin-top: -0.5rem;
  margin-bottom: 0.85rem;
}
/* Contact-uit-hint bij de CAN-tegels: legt uit dat de waarden laatst-bekend zijn. */
.stale-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 60ch;
}

/* Open-trip tile (HTMX target on vehicle dashboard) */
.open-trip-tile {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* ─────────────────────────────────────────────────────────────────
   Alert banner (active-alert summary at top of dashboards).
   ───────────────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  background: #fff8e6;
  border: 1px solid #facc15;
  border-left: 4px solid var(--status-idle);
  color: #7a4a00;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.alert-banner.danger {
  background: #fef2f2;
  border-color: #f87171;
  border-left-color: var(--status-alarm);
  color: #7a1d1d;
}
.alert-banner-icon { font-size: 1.1rem; line-height: 1.2; }
.alert-banner-body { flex: 1; line-height: 1.4; }
.alert-banner-body strong { display: block; margin-bottom: 0.1rem; }

/* ─────────────────────────────────────────────────────────────────
   Accessibility — visible focus rings on every interactive element.
   ───────────────────────────────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.button:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius);
}
.topnav a:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ─────────────────────────────────────────────────────────────────
   Clickable rows — make the whole row a hit target (no inline JS).
   Pair <tr class="row-link" data-href="..."> with table.clickable-rows.
   ───────────────────────────────────────────────────────────────── */
.row-link { cursor: pointer; }
.row-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* Highlight unresolved alert rows */
.table tr.unresolved { background: #fff8e7; }
.table tr.unresolved:hover { background: #ffefcc; }

/* Generic content-section spacer between major page sections */
.section-spacer { margin-top: 2.5rem; }

/* Subsection heading inside a page (h2 below a page-header) */
.subsection-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
  color: var(--text);
}

/* Constrained text input (reason fields, narrow forms) */
.input-constrained {
  width: 100%;
  max-width: 540px;
}

/* Form-label variant: small uppercase eyebrow above a control */
label.form-section-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

/* Empty-state size-modifier */
.empty-state.compact { padding: 1.25rem 1rem; }

/* ─────────────────────────────────────────────────────────────────
   Form patterns — vertical stacks and inline status feedback.
   ───────────────────────────────────────────────────────────────── */
.form-stack {
  display: flex; flex-direction: column;
  gap: 1rem;
  max-width: 560px;
}
.form-stack label { margin: 0; }
.form-stack textarea { resize: vertical; min-height: 4.5rem; }
.form-stack .actions {
  display: flex; align-items: center; gap: 0.85rem;
  justify-content: flex-start;
  margin-top: 0.25rem;
}

.form-status {
  font-size: 0.85rem;
  color: var(--muted);
  transition: opacity 0.2s;
}
.form-status.success { color: var(--status-moving); font-weight: 500; }
.form-status.error   { color: var(--status-alarm);  font-weight: 500; }

/* Trip-detail map height (no inline style on the element) */
.trip-map {
  height: 400px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* ── Alert-detail (locatie + context van het trigger-moment) ────── */
.alert-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
@media (max-width: 800px) {
  .alert-detail-grid { grid-template-columns: 1fr; }
}
.alert-facts { margin: 0; }
.alert-facts dt { font-weight: 600; margin-top: 0.75rem; }
.alert-facts dt:first-child { margin-top: 0; }
.alert-facts dd { margin: 0.15rem 0 0; color: var(--text); }
.alert-map {
  height: 400px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.badge.sev-info     { background: #e0f2fe; color: #075985; }
.badge.sev-warning  { background: #fef3c7; color: #92400e; }
.badge.sev-critical { background: #fee2e2; color: #991b1b; }
.badge.alert-burst-count { background: var(--brand-dark, #1d4ed8); color: #fff; margin-left: 0.4rem; }

/* CAN-momentopname op de alarm-detailpagina */
.alert-can-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.alert-can-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  background: var(--panel);
}
.alert-can-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #64748b);
}
.alert-can-readings {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.75rem;
}
.alert-can-readings dt { color: var(--muted, #64748b); font-weight: 400; }
.alert-can-readings dd { margin: 0; font-weight: 600; text-align: right; }

/* ── Voertuig-bovenaanzicht (Boordcomputer) ─────────────────────── */
.vehicle-topview {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.vehicle-topview svg { width: 210px; height: auto; flex: none; }
.tv-body  { fill: var(--panel); stroke: var(--border); stroke-width: 2; }
.tv-glass { fill: rgba(125, 211, 252, 0.22); stroke: var(--border); }
.tv-seat  { fill: #f1f5f9; stroke: var(--border); }
.tv-seat.empty { opacity: 0.45; }
.tv-hood.closed, .tv-trunk.closed { fill: #e2e8f0; stroke: var(--border); }
.tv-hood.open,   .tv-trunk.open   { fill: #fecaca; stroke: #ef4444; }
.tv-hood.unknown, .tv-trunk.unknown { fill: #f1f5f9; stroke: var(--border); stroke-dasharray: 4 3; }
.tv-door.closed  { fill: #94a3b8; }
.tv-door.open    { fill: #ef4444; }
.tv-door.unknown { fill: #cbd5e1; opacity: 0.5; }
.tv-belt { fill: none; stroke-width: 5; stroke-linecap: round; }
.tv-belt.fastened   { stroke: #16a34a; }
.tv-belt.unfastened { stroke: #ef4444; }
.tv-belt.unknown    { stroke: #94a3b8; stroke-dasharray: 4 3; }
.tv-occupant { fill: #0ea5e9; opacity: 0.85; }
.tv-side { max-width: 420px; }
.tv-legend { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.3rem; }
.tv-legend .chip {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  margin-right: 0.45rem; vertical-align: -2px; border: 1px solid var(--border);
}
.tv-legend .chip.door-open     { background: #ef4444; }
.tv-legend .chip.door-closed   { background: #94a3b8; }
.tv-legend .chip.belt-on       { background: #16a34a; }
.tv-legend .chip.belt-off      { background: #fca5a5; border-color: #ef4444; }
.tv-legend .chip.state-unknown { background: #e2e8f0; border-style: dashed; }
.tv-hint { font-size: 0.88rem; }

/* ═════════════════════════════════════════════════════════════════
   PREMIUM REFINEMENTS (2026 restyle)
   Later in the cascade so they elevate the existing components
   without editing each original rule. Every class name is preserved.
   ═════════════════════════════════════════════════════════════════ */

/* Rhythm + heading polish */
.container { margin-top: 1.75rem; margin-bottom: 3rem; }
h1, h2, h3 { letter-spacing: -0.015em; }
.page-header h1 { font-weight: 600; font-size: 1.55rem; letter-spacing: -0.025em; }

/* Cards, notices, panels — larger radius + soft elevation */
.card,
.empty-state,
.notice,
.alert-banner,
.metric-tile,
.stat-card,
.open-trip-tile,
.map-with-controls,
.trip-map,
.trips-day,
.vehicle-sidebar,
.playback-sidebar {
  border-radius: var(--radius-lg);
}
.card { box-shadow: var(--shadow-sm); }

/* Buttons */
.btn, .button, button[type=submit] { border-radius: var(--radius); font-weight: 500; }
.btn.primary, .button.primary, .button-primary, button[type=submit] {
  box-shadow: 0 1px 2px rgba(37,99,235,0.22);
}
.btn.primary:hover, .button.primary:hover, .button-primary:hover { box-shadow: 0 2px 8px rgba(37,99,235,0.28); }

/* Inputs — a touch more room */
input[type=text], input[type=email], input[type=password],
input[type=number], select, textarea {
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}

/* Tables — rounded shell, quieter headers */
.table, .trips-table {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.table th, .trips-table th {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}
table.clickable-rows tr:hover,
.trip-row:hover { background: var(--brand-soft); }

/* Stat tiles → clean metric cards (drop the dated left-accent bar) */
.stat-tile {
  border: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.3rem;
}
.stat-tile:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-tile.warn { border-left: 1px solid var(--border); }
.stat-tile.warn:hover { border-color: var(--status-alarm); }
.stat-tile.primary {
  border-left: 1px solid var(--brand);
  box-shadow: 0 2px 4px rgba(37,99,235,0.20), 0 10px 24px rgba(37,99,235,0.18);
}
.stat-value, .metric-value, .stat-card-value { letter-spacing: -0.025em; }

/* Softer, sentence-case metric labels */
.metric-label, .stat-card-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Status pills → tinted (cleaner in dense tables than solid fills) */
.status-pill { color: inherit; font-weight: 500; padding: 0.22rem 0.62rem; }
.status-pill::before { box-shadow: none; }
.status-pill.moving  { background: #e7f6ec; color: #15803d; }
.status-pill.idle    { background: #fef3e2; color: #b45309; }
.status-pill.offline { background: #eef1f5; color: #64748b; }
.status-pill.alarm   { background: #fdecec; color: #b91c1c; }

/* Classification badge → brand-soft */
.badge-zakelijk { background: var(--brand-soft); color: var(--brand-dark); }

/* Vehicle side-nav → soft active state (matches topnav) */
.vehicle-sidebar { box-shadow: var(--shadow-sm); }
.vehicle-sidebar-nav a:hover { background: var(--panel-2); color: var(--text); }
.vehicle-sidebar-nav a.active,
.vehicle-sidebar-nav a.active:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* Landing hero */
.hero h1 { font-weight: 600; letter-spacing: -0.03em; }

/* Keep the topbar logout a quiet ghost button (beats the generic
   button[type=submit] primary style via higher specificity). */
.topbar button.link {
  background: none; color: var(--text-2); border: 0; box-shadow: none;
  font-weight: 500; padding: 0.45rem 0.8rem;
}
.topbar button.link:hover { background: var(--panel-2); color: var(--text); }

/* Boordcomputer (VehicleCan) */
.can-section { margin-top: 1.25rem; }
.can-section-title { font-size: 1rem; margin: 0 0 .5rem; opacity: .85; }
.can-raw { margin-top: 1.5rem; }
.can-raw > summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
.can-raw-scroll { overflow-x: auto; margin-top: .5rem; }
.can-raw-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.can-raw-table th, .can-raw-table td {
  text-align: left; padding: .4rem .6rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}
.can-raw-table th { opacity: .7; font-weight: 600; }
.can-raw-table code { font-size: .8rem; opacity: .85; }

/* ── Additief (UX-teksten-opschoning) ───────────────────────────── */
/* Rood accent voor foutmeldingen in .notice (zelfde patroon als .success/.warn). */
.notice.error { border-left-color: var(--status-alarm); background: #fef2f2; }

/* "P"-badge voor stopmomenten in de playback-balk (vervangt het parkeer-emoji). */
.stop-p-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; border-radius: 4px;
  background: var(--brand); color: #fff;
  font-size: 0.7rem; font-weight: 700; line-height: 1;
}

/* Dashboard-stat-tegel met een icoon i.p.v. een getal (bv. Live kaart). */
.stat-value-icon svg { width: 1.4em; height: 1.4em; vertical-align: -0.25em; }
