/* ═══════════════════════════════════════════════════════════════
   MILELE TRANSPORT — Design System
   Palette: Deep Navy / Saffron Gold / Slate surfaces
   Type: Sora (display) / DM Sans (body) / DM Mono (data)
   ═══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ────────────────────────────────────────────── */
:root {
  /* Brand */
  --navy-950:  #070E1F;
  --navy-900:  #0F1C36;
  --navy-800:  #1A2744;
  --navy-700:  #243356;
  --navy-600:  #2E4068;
  --navy-500:  #3A5080;
  --gold-500:  #F4C542;
  --gold-400:  #F9D675;
  --gold-300:  #FCE7A3;
  --gold-600:  #D4A92A;

  /* Surfaces (light mode) */
  --bg-base:      #F4F6FA;
  --bg-surface:   #FFFFFF;
  --bg-raised:    #FFFFFF;
  --bg-sunken:    #EAEEF5;
  --border:       #DDE3EE;
  --border-strong:#C5CEDD;

  /* Text */
  --text-primary:   #0F1C36;
  --text-secondary: #4A5670;
  --text-tertiary:  #8492AA;
  --text-inverse:   #FFFFFF;

  /* Semantic */
  --success:    #1A9E5A;
  --success-bg: #E8F7EF;
  --warning:    #D4870A;
  --warning-bg: #FEF4E0;
  --danger:     #C9313B;
  --danger-bg:  #FDEAEB;
  --info:       #1A6BC5;
  --info-bg:    #E8F1FC;

  /* Sidebar */
  --sidebar-bg:         var(--navy-900);
  --sidebar-text:       rgba(255,255,255,0.65);
  --sidebar-text-hover: rgba(255,255,255,0.92);
  --sidebar-active-bg:  rgba(244,197,66,0.12);
  --sidebar-active-txt: var(--gold-500);
  --sidebar-section:    rgba(255,255,255,0.28);
  --sidebar-icon:       rgba(255,255,255,0.45);
  --sidebar-icon-hover: var(--gold-500);

  /* Dimensions */
  --sidebar-w:    240px;
  --navbar-h:     60px;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15,28,54,0.06);
  --shadow-sm:  0 2px 8px rgba(15,28,54,0.08);
  --shadow-md:  0 4px 16px rgba(15,28,54,0.10);
  --shadow-lg:  0 8px 32px rgba(15,28,54,0.14);

  /* Transitions */
  --t-fast: 150ms ease-out;
  --t-base: 220ms ease-out;
  --t-slow: 350ms ease-out;

  /* Z-index scale */
  --z-base:    0;
  --z-raised:  10;
  --z-overlay: 40;
  --z-modal:   9000;   /* Above Leaflet map panes (max 700) */
  --z-toast:   9999;

  /* Type scale */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;
}

/* ── RESET ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
h1, h2, h3, h4, h5 { font-family: 'Sora', sans-serif; line-height: 1.25; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

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

/* ── LOGIN ────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex;
}

.login-card {
  width: 420px;
  min-width: 320px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 44px;
}

.login-logo-mark {
  display: none;  /* replaced by real logo image */
}

.login-logo-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--navy-900);
  line-height: 1.2;
}

.brand-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
  flex-shrink: 0;
}

.field-input {
  width: 100%;
  padding: 12px 44px 12px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 46px;
}

.field-input:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(15,28,54,0.08);
}

.field-input::placeholder { color: var(--text-tertiary); }

.field-toggle {
  position: absolute;
  right: 10px;
  color: var(--text-tertiary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast);
}
.field-toggle:hover { color: var(--text-primary); }
.field-toggle svg { width: 16px; height: 16px; }

.login-error {
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid rgba(201,49,59,0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 500;
}

.login-footer {
  margin-top: 36px;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
}

.login-bg {
  flex: 1;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--navy-600) 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 48px;
}

.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(244,197,66,0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(244,197,66,0.04) 0%, transparent 50%),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(255,255,255,0.015) 40px,
      rgba(255,255,255,0.015) 41px
    );
}

.login-bg-tagline {
  position: relative;
  z-index: 1;
  color: rgba(255,255,255,0.55);
  font-family: 'Sora', sans-serif;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  border-left: 3px solid var(--gold-500);
  padding-left: 16px;
}

@media (max-width: 768px) {
  .login-screen { flex-direction: column; }
  .login-card { width: 100%; padding: 40px 28px; }
  .login-bg { display: none; }
}

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 38px;
  position: relative;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--navy-900);
  color: var(--gold-500);
  border: 1.5px solid var(--navy-900);
}
.btn-primary:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn-primary:active { transform: translateY(1px); }

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
  border: 1.5px solid var(--gold-500);
}
.btn-gold:hover { background: var(--gold-400); }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--border-strong); background: var(--bg-sunken); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid transparent;
}
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1.5px solid var(--danger);
}
.btn-danger:hover { filter: brightness(1.08); }

.btn-sm { padding: 6px 12px; font-size: var(--text-xs); min-height: 30px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── NAVBAR ───────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: var(--z-overlay);
  box-shadow: var(--shadow-xs);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.sidebar-toggle:hover { background: var(--bg-sunken); color: var(--text-primary); }
.sidebar-toggle svg { width: 20px; height: 20px; }

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: none;  /* replaced by real logo image */
}

.brand-title {
  display: none;  /* replaced by real logo image */
}

@media (max-width: 600px) { .brand-title { display: none; } }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.navbar-clock {
  font-family: 'DM Mono', monospace;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding-right: 8px;
}

.navbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.navbar-icon-btn:hover { background: var(--bg-sunken); color: var(--text-primary); }
.navbar-icon-btn svg { width: 18px; height: 18px; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
}
.navbar-user:hover { background: var(--bg-sunken); }

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--navy-800);
  color: var(--gold-500);
  border-radius: 50%;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.user-chevron { width: 14px; height: 14px; color: var(--text-tertiary); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  animation: dropIn var(--t-fast);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 14px 16px 12px;
}

.dropdown-user-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.dropdown-user-role {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all var(--t-fast);
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-sunken); color: var(--text-primary); }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-item-danger:hover { color: var(--danger); background: var(--danger-bg); }

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.app-body {
  display: flex;
  min-height: 100dvh;
  padding-top: var(--navbar-h);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  z-index: var(--z-raised);
  transition: transform var(--t-base);
  overflow: hidden;
}

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 32px;
}

.nav-list { display: flex; flex-direction: column; }

.nav-section-title {
  padding: 16px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-section);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 16px 10px 18px;
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 0;
  transition: all var(--t-fast);
  position: relative;
}

.nav-btn:hover {
  color: var(--sidebar-text-hover);
  background: rgba(255,255,255,0.05);
}
.nav-btn:hover .nav-icon { color: var(--sidebar-icon-hover); }

.nav-btn.active {
  color: var(--sidebar-active-txt);
  background: var(--sidebar-active-bg);
  font-weight: 600;
}
.nav-btn.active .nav-icon { color: var(--sidebar-active-txt); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--gold-500);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 17px;
  height: 17px;
  color: var(--sidebar-icon);
  flex-shrink: 0;
  transition: color var(--t-fast);
}

.nav-label { line-height: 1.2; }

/* ── MAIN CONTENT ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px;
  min-width: 0;
  transition: margin var(--t-base);
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ── PAGE STRUCTURE ───────────────────────────────────────────── */
.page {
  animation: fadeSlideIn var(--t-base);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── CARDS ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
}

.card-title {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { width: 16px; height: 16px; color: var(--text-tertiary); }

/* ── STAT CARDS ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-fast);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card-icon svg { width: 20px; height: 20px; }
.stat-icon-blue  { background: var(--info-bg);    color: var(--info); }
.stat-icon-gold  { background: var(--warning-bg); color: var(--warning); }
.stat-icon-green { background: var(--success-bg); color: var(--success); }
.stat-icon-red   { background: var(--danger-bg);  color: var(--danger); }

.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-change {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 99px;
}

.stat-change.up   { color: var(--success); background: var(--success-bg); }
.stat-change.down { color: var(--danger);  background: var(--danger-bg); }

/* ── TABLES ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table thead {
  background: var(--bg-sunken);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  padding: 11px 16px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 13px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-sunken); }

.data-table .col-id {
  font-family: 'DM Mono', monospace;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ── TABLE TOOLBAR ────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  width: 240px;
  transition: border-color var(--t-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--navy-700);
}

/* ── BADGES / STATUS ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-green   { color: var(--success); background: var(--success-bg); }
.badge-red     { color: var(--danger);  background: var(--danger-bg); }
.badge-yellow  { color: var(--warning); background: var(--warning-bg); }
.badge-blue    { color: var(--info);    background: var(--info-bg); }
.badge-gray    { color: var(--text-tertiary); background: var(--bg-sunken); }
.badge-navy    { color: var(--gold-500); background: var(--navy-800); }

/* ── FORMS ────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.span-2 { grid-column: span 2; }

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
  min-height: 42px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(15,28,54,0.07);
}

.form-textarea { min-height: 90px; resize: vertical; }

.form-helper { font-size: var(--text-xs); color: var(--text-tertiary); }

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  font-weight: 500;
}

.form-input.error,
.form-select.error { border-color: var(--danger); }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,14,31,0.55);
  backdrop-filter: blur(3px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--t-fast);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn var(--t-base);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy-900);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--bg-sunken); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 28px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── TOAST ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  background: var(--navy-900);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastIn var(--t-base);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.removing { animation: toastOut var(--t-base) forwards; }

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

.toast-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; line-height: 1.45; }
.toast-title { font-weight: 700; margin-bottom: 1px; }
.toast-msg   { opacity: 0.8; font-size: var(--text-xs); }

.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); }
.toast-danger  { background: var(--danger); }

/* ── SKELETON LOADING ─────────────────────────────────────────── */
.page-loading { padding: 8px 0; }

.skeleton-header,
.skeleton-row {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-sunken) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 20px;
  margin-bottom: 12px;
}

.skeleton-header { height: 32px; width: 220px; margin-bottom: 28px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── EMPTY STATE ──────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  gap: 12px;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-sunken);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.empty-state-icon svg { width: 26px; height: 26px; }

.empty-state h3 {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 320px;
}

/* ── CHART GRID ───────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.chart-card-title {
  font-family: 'Sora', sans-serif;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 200px;
}

/* ── DASHBOARD QUICK ACTIONS ──────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  transition: all var(--t-fast);
  cursor: pointer;
}

.quick-action-btn:hover {
  border-color: var(--navy-700);
  color: var(--navy-900);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.quick-action-btn svg { width: 22px; height: 22px; }

/* ── PAGINATION ───────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  border: 1px solid transparent;
}

.page-btn:hover { background: var(--bg-sunken); color: var(--text-primary); }
.page-btn.active { background: var(--navy-900); color: var(--gold-500); font-weight: 700; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn svg { width: 14px; height: 14px; }

/* ── SECTION DIVIDER ──────────────────────────────────────────── */
.section-gap { margin-bottom: 24px; }

/* ── ALERT ────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid;
  margin-bottom: 16px;
}

.alert-success { color: var(--success); background: var(--success-bg); border-color: rgba(26,158,90,0.2); }
.alert-danger  { color: var(--danger);  background: var(--danger-bg);  border-color: rgba(201,49,59,0.2); }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: rgba(212,135,10,0.2); }
.alert-info    { color: var(--info);    background: var(--info-bg);    border-color: rgba(26,107,197,0.2); }

/* ── UTILITY ──────────────────────────────────────────────────── */
.text-mono { font-family: 'DM Mono', monospace; }
.text-sm   { font-size: var(--text-sm); }
.text-xs   { font-size: var(--text-xs); }
.text-muted { color: var(--text-tertiary); }
.fw-bold  { font-weight: 700; }
.fw-semi  { font-weight: 600; }
.d-flex   { display: flex; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.mt-4     { margin-top: 4px; }
.mt-16    { margin-top: 16px; }
.mb-16    { margin-bottom: 16px; }
.mb-24    { margin-bottom: 24px; }
.w-full   { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── GPS MAP ──────────────────────────────────────────────────── */
#map-container {
  height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ── REPORTS TABS ─────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--t-fast);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--navy-900); border-bottom-color: var(--navy-900); }

/* ── MOBILE SIDEBAR OVERLAY ───────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7,14,31,0.5);
  z-index: calc(var(--z-raised) - 1);
}

.sidebar-overlay.show { display: block; }

/* ── PRINT ────────────────────────────────────────────────────── */
@media print {
  .navbar, .sidebar, .page-actions, .btn { display: none !important; }
  .main-content { margin: 0; padding: 0; }
}

/* ── KANBAN (Dispatch Board) ─────────────────────────────────────
   Section 1 tokens only — App Shell system (navy/gold), never
   Royal Blue. Presentation-only; no logic lives in these classes. */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  align-items: start;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.kanban-col-header::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent, var(--navy-500));
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.kanban-col-title svg { width: 15px; height: 15px; color: var(--accent, var(--navy-500)); }

.kanban-col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--navy-500));
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.kanban-card-route {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin: 6px 0;
}

.kanban-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.kanban-card-meta svg { width: 12px; height: 12px; color: var(--text-tertiary); }

.kanban-card-revenue {
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--success);
}

.kanban-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.kanban-empty {
  text-align: center;
  padding: 32px 12px;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.kanban-empty svg { width: 24px; height: 24px; margin-bottom: 8px; opacity: 0.5; }
