/**
 * Iron Route GPS — Styles (Re-skinned to TruckerProfit brand)
 * Mobile-first, dark theme default
 * TruckerProfit Inc. / Sultan Freight Logistics
 *
 * NOTE: Layout, grid, flexbox, padding and margin are unchanged.
 * Only color + typography tokens were re-mapped to align with brand.
 * Source of truth for tokens: ./tokens.css
 */

/* ========== CSS CUSTOM PROPERTIES (RE-MAPPED TO BRAND TOKENS) ========== */
:root {
  /* Brand colors — now navy + gold (was navy + teal/orange) */
  --navy: var(--color-navy-900);
  --navy-light: var(--color-navy-800);
  --navy-mid: var(--color-navy-700);
  --navy-surface: var(--color-surface);
  --accent: var(--color-gold-500);
  --accent-hover: var(--color-gold-400);
  --accent-dim: rgba(212, 168, 75, 0.15);
  --gold: var(--color-gold-500);
  --gold-dim: rgba(212, 168, 75, 0.15);
  --danger: var(--color-danger);
  --danger-dim: rgba(217, 83, 79, 0.15);
  --warning: var(--color-warning);
  --success: var(--color-success);
  --info: var(--color-info);

  /* Theme (dark default) */
  --bg: var(--color-bg);
  --bg-surface: var(--color-bg-elev);
  --bg-elevated: var(--color-bg-card);
  --bg-card: var(--color-surface);
  --text: var(--color-text);
  --text-secondary: var(--color-text-muted);
  --text-muted: var(--color-text-muted);
  --border: var(--color-border);
  --border-strong: var(--color-border-strong);
  --shadow: rgba(0, 0, 0, 0.4);
  --glass: rgba(3, 13, 28, 0.85);
  --glass-border: rgba(212, 168, 75, 0.10);

  /* Sizing */
  --touch: var(--touch-min, 48px);
  --radius: var(--r-lg, 12px);
  --radius-sm: var(--r-md, 8px);
  --radius-lg: var(--r-xl, 20px);
  --nav-height: 64px;
  --search-height: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Typography — point at canonical brand stacks */
  --font: var(--font-body);
  --font-heading: var(--font-display);
  --font-mono: var(--font-mono);
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 0.25s;
  --duration-slow: 0.4s;
}

/* ========== LIGHT THEME (kept for opt-in, but Iron Route ships dark-only) ========== */
[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-elevated: #f0f2f5;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8e8ea0;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --shadow: rgba(0, 0, 0, 0.1);
  --glass: rgba(245, 247, 250, 0.9);
  --glass-border: rgba(0, 0, 0, 0.06);
}

/* ========== RESET ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: var(--font-size-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: var(--touch);
  outline: none;
  width: 100%;
  transition: border-color var(--duration) var(--ease);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder {
  color: var(--text-muted);
}

ul, ol {
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ========== SKIP LINK ========== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  background: var(--accent);
  color: var(--navy);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--font-size-sm);
  transition: top 0.2s;
}

.skip-link:focus {
  top: calc(var(--safe-top) + 8px);
}

/* ========== STATUS BAR SPACER ========== */
.status-bar-spacer {
  height: var(--safe-top);
  background: var(--glass);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
}

/* ========== SEARCH HEADER ========== */
.search-header {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 8px 12px;
  pointer-events: none;
}

.search-container {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 4px 8px;
  box-shadow: 0 4px 20px var(--shadow);
  pointer-events: auto;
  height: var(--search-height);
}

.search-menu-btn,
.search-voice-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.search-menu-btn:hover,
.search-voice-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 4px;
  font-size: var(--font-size-base);
  min-height: 48px; /* a11y: ≥48px touch target — auto-fixer 2026-05-05 */
  color: var(--text);
}

.search-input:focus {
  box-shadow: none;
  border: none;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(var(--search-height) + 8px);
  left: 12px;
  right: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow);
  max-height: 50vh;
  overflow-y: auto;
  pointer-events: auto;
  overscroll-behavior: contain;
}

.search-results[hidden] {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  border-bottom: 1px solid var(--border);
  min-height: var(--touch);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
  background: var(--accent-dim);
}

.search-result-item:active {
  background: var(--accent-dim);
  transform: scale(0.98);
}

.result-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: 50%;
  color: var(--accent);
}

.result-text {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== MAP ========== */
.map-wrapper {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.map-container {
  width: 100%;
  height: 100%;
}

/* Dark theme tiles */
[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.7) contrast(1.1) saturate(0.4) hue-rotate(180deg) invert(1);
}

[data-theme="dark"] .leaflet-control-zoom a {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border);
}

/* Hide default Leaflet controls — we use custom */
.leaflet-control-zoom {
  display: none !important;
}

.leaflet-control-attribution {
  background: var(--glass) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 4px 0 0 0 !important;
}

.leaflet-control-attribution a {
  color: var(--text-muted) !important;
}

/* ========== MAP CONTROLS (right side) ========== */
.map-controls {
  position: fixed;
  right: 12px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 180px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
}

.map-ctrl-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text);
  box-shadow: 0 2px 12px var(--shadow);
  transition: all var(--duration) var(--ease);
}

.map-ctrl-btn:hover {
  background: var(--accent);
  color: var(--navy);
}

.map-ctrl-btn:active {
  transform: scale(0.92);
}

.map-ctrl-btn.active {
  background: var(--accent);
  color: var(--navy);
}

/* ========== FLOATING ACTION BUTTON ========== */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 100px);
  width: auto;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px 0 14px;
  background: var(--accent);
  color: var(--navy);
  border-radius: 26px;
  font-weight: 700;
  font-size: var(--font-size-sm);
  box-shadow: 0 4px 20px rgba(212, 168, 75, 0.4);
  z-index: 950;
  transition: all var(--duration) var(--ease-spring);
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(212, 168, 75, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

.fab-label {
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ========== QUICK ACCESS TILES ========== */
.quick-tiles {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  left: 0;
  right: 0;
  z-index: 800;
  padding: 0 12px;
}

.tiles-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0;
}

.tiles-scroll::-webkit-scrollbar {
  display: none;
}

.tile {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  min-width: 80px;
  scroll-snap-align: start;
  transition: all var(--duration) var(--ease);
}

.tile:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.tile:active {
  transform: scale(0.95);
}

.tile-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: 50%;
  color: var(--accent);
}

.tile-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== BOTTOM NAVIGATION ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
  z-index: 1000;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  min-height: var(--touch);
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease);
  position: relative;
}

.nav-tab span {
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.nav-tab.active {
  color: var(--accent);
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
}

/* ========== BOTTOM SHEET (Panels) ========== */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -8px 40px var(--shadow);
  z-index: 1100;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet[aria-hidden="true"] {
  pointer-events: none;
}

.bottom-sheet[aria-hidden="false"] {
  pointer-events: auto;
}

.sheet-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
  cursor: grab;
  flex-shrink: 0;
}

.handle-bar {
  width: 36px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 3px;
  opacity: 0.4;
}

.sheet-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 20px calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.sheet-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* ========== TRIP PLANNER ========== */
.trip-inputs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  margin-bottom: 16px;
}

.input-group {
  position: relative;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.origin-dot { background: var(--accent); }
.dest-dot { background: var(--danger); }

.trip-input {
  padding-left: 32px;
}

.swap-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  z-index: 5;
  transition: all var(--duration) var(--ease);
}

.swap-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Vehicle Config */
.vehicle-config {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.vehicle-config summary {
  padding: 14px 16px;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
}

.vehicle-config summary::-webkit-details-marker { display: none; }
.vehicle-config summary::marker { content: ''; }

.vehicle-config summary::before {
  content: '\25B6';
  font-size: 10px;
  transition: transform var(--duration) var(--ease);
}

.vehicle-config[open] summary::before {
  transform: rotate(90deg);
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}

.config-item label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.config-item input,
.config-item select {
  font-size: var(--font-size-sm);
  padding: 10px 12px;
}

/* Route Options (toggles) */
.route-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  min-height: var(--touch);
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-shrink: 0;
  transition: all var(--duration) var(--ease);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration) var(--ease);
}

.toggle-option input {
  display: none;
}

.toggle-option input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle-option input:checked + .toggle-slider::after {
  left: 22px;
  background: var(--accent);
}

/* Primary Button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: var(--navy);
  font-weight: 700;
  font-size: var(--font-size-base);
  border-radius: var(--radius);
  min-height: var(--touch);
  transition: all var(--duration) var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(212, 168, 75, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Route Results */
.route-results {
  margin-top: 20px;
}

.route-results[hidden] { display: none; }

.route-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all var(--duration) var(--ease);
}

.route-card:hover,
.route-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.route-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.route-card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.route-card-badge {
  padding: 4px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
}

.route-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.route-stat {
  text-align: center;
}

.route-stat-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text);
}

.route-stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ========== ALERTS ========== */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: flex-start;
}

.alert-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-icon.danger { background: var(--danger-dim); color: var(--danger); }
.alert-icon.warning { background: var(--gold-dim); color: var(--gold); }
.alert-icon.info { background: var(--accent-dim); color: var(--accent); }

.alert-content { flex: 1; }

.alert-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.alert-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ========== SETTINGS ========== */
.settings-section {
  margin-bottom: 24px;
}

.settings-heading {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.theme-picker {
  display: flex;
  gap: 8px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  min-height: var(--touch);
  transition: all var(--duration) var(--ease);
}

.theme-option:hover {
  border-color: var(--text-muted);
}

.theme-option.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.lang-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.lang-option {
  flex: 1;
  padding: 12px 16px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
  min-height: var(--touch);
  transition: all var(--duration) var(--ease);
}

.lang-option.active {
  background: var(--accent);
  color: var(--navy);
}

.profile-summary {
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.about-info {
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.app-version {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.app-company {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.app-tagline {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* ========== ROUTES LIST ========== */
.routes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.6;
}

/* ========== SIDE MENU ========== */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1199;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-slow) var(--ease);
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-surface);
  z-index: 1200;
  transform: translateX(-100%);
  transition: transform var(--duration-slow) var(--ease);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

.side-menu.open {
  transform: translateX(0);
}

.menu-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.menu-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-app-name {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.menu-tagline {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.menu-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 20px;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  min-height: var(--touch);
  transition: all var(--duration) var(--ease);
}

.menu-item:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

.menu-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.menu-version {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s var(--ease);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--search-height) + 16px);
  left: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease-spring);
}

.toast.removing {
  animation: toastOut 0.25s var(--ease) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.96); }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.toast-message {
  flex: 1;
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

/* ========== TRUCK RESTRICTION MARKERS ========== */
.truck-restriction-marker {
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========== ROUTE POLYLINE STYLING (via Leaflet classes) ========== */
.route-line {
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-line-alt {
  stroke: var(--text-muted);
  stroke-width: 4;
  stroke-opacity: 0.5;
  stroke-dasharray: 8, 6;
}

/* ========== RESPONSIVE ========== */

/* Tablet+ */
@media (min-width: 768px) {
  .search-header {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .search-results {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 24px);
  }

  .bottom-sheet {
    max-width: 420px;
    left: 50%;
    transform: translate(-50%, 100%);
    border-radius: var(--radius-lg);
    bottom: 8px;
    box-shadow: 0 -4px 40px var(--shadow);
  }

  .bottom-sheet.open {
    transform: translate(-50%, 0);
  }

  .side-menu {
    width: 320px;
  }

  .quick-tiles {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .fab {
    right: calc(50% - 260px);
  }

  .map-controls {
    right: calc(50% - 260px);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .quick-tiles {
    bottom: calc(var(--nav-height) + 4px);
  }

  .tile {
    padding: 8px 12px;
    min-width: 70px;
  }

  .tile-icon {
    width: 32px;
    height: 32px;
  }

  .fab {
    bottom: calc(var(--nav-height) + 60px);
    height: 44px;
  }

  .map-controls {
    bottom: calc(var(--nav-height) + 120px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode system preference (auto theme) */
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg: #f5f7fa;
    --bg-surface: #ffffff;
    --bg-elevated: #f0f2f5;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8e8ea0;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --shadow: rgba(0, 0, 0, 0.1);
    --glass: rgba(245, 247, 250, 0.9);
    --glass-border: rgba(0, 0, 0, 0.06);
  }

  [data-theme="auto"] .leaflet-tile-pane {
    filter: none;
  }
}

/* === BRAND OVERRIDES === */
/* Headline / display surfaces — enforce Syne everywhere a heading lives,
   in case markup uses semantic h1..h4 directly without our utility classes. */
h1, h2, h3, h4,
.sheet-title,
.menu-app-name,
.route-card-title,
.app-version {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Gold focus ring (a11y) — overrides UA default and matches tokens.css */
:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--color-gold-400);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--color-gold-500);
  color: var(--color-text-on-gold);
}

/* Scrollbar (WebKit) — subtle gold-tinted to match brand */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-gold-600);
}

/* Re-skinned 2026-05-02 by Cowork sub-agent */

/* === v2.5 NEW MODULE STYLES (stubs from sub-agent ports) === */
.voice-interim { color: var(--color-text-muted); font-style: italic; }
.limit-no-data { color: var(--color-text-muted); }
.hud-hid