* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #111827;
  background: #f3f6fb;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 22px 18px;
  color: #e5efff;
  background: linear-gradient(180deg, #08192c 0%, #05101e 100%);
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #123b70;
  color: #58a6ff;
  border: 3px solid #2677f2;
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img,
.stat-icon img,
.nav-gif,
.vehicle-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span {
  display: block;
  color: #9fb2cc;
  font-size: 12px;
  margin-top: 3px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 8px;
  color: #dbeafe;
  font-weight: 650;
  font-size: 14px;
}

.sidebar nav a span,
.sidebar nav a .nav-gif {
  width: 26px;
  height: 26px;
  text-align: center;
  color: #eef6ff;
  flex: 0 0 26px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: linear-gradient(135deg, #1d6cff, #267df8);
  color: #fff;
}

.side-summary {
  margin-top: 30px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.side-summary h3 {
  font-size: 15px;
  margin: 0 0 14px;
}

.side-summary div {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.side-summary small {
  color: #c7d2fe;
}

.side-summary strong {
  color: #fff;
  font-size: 22px;
}

.dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: block;
}

.dot.blue { background: #2563eb; }
.dot.green { background: #22c55e; }
.dot.red { background: #ef4444; }
.dot.orange { background: #f59e0b; }

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.icon-btn,
.refresh-btn {
  min-height: 36px;
  border: 1px solid #dbe7fb;
  background: #fff;
  color: #2563eb;
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn {
  width: 38px;
}

.refresh-btn {
  padding: 0 14px;
  font-weight: 700;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.clock {
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  font-size: 13px;
}

.admin-chip {
  display: flex;
  align-items: center;
  column-gap: 9px;
  min-width: 150px;
}

.admin-chip .avatar {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #9ca3af;
  background: #eef2f7;
}

.admin-chip strong,
.admin-chip small {
  line-height: 1.1;
}

.admin-chip small {
  color: #64748b;
}

.stats-grid,
.content-grid,
.reports-grid,
.table-panel,
.history-panel {
  margin: 18px 24px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card,
.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.stat-card {
  position: relative;
  min-height: 148px;
  padding: 18px;
}

.stat-card small {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 36px;
  letter-spacing: 0;
}

.stat-card em {
  font-style: normal;
  margin-left: 6px;
}

.stat-card b {
  display: block;
  color: #22c55e;
  margin-top: 6px;
}

.stat-card a {
  position: absolute;
  left: 18px;
  bottom: 16px;
  color: #334155;
  font-size: 14px;
}

.stat-icon {
  width: 66px;
  height: 66px;
  position: absolute;
  right: 18px;
  top: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 900;
}

.stat-icon img {
  width: 58px;
  height: 58px;
}

.stat-icon.blue { color: #2563eb; background: #dbeafe; }
.stat-icon.green { color: #16a34a; background: #dcfce7; }
.stat-icon.red { color: #ef4444; background: #fee2e2; }
.stat-icon.orange { color: #f59e0b; background: #fff7ed; }

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 16px;
  margin: 0;
}

.panel-head a {
  color: #2563eb;
  font-weight: 700;
  font-size: 14px;
}

.tabs {
  display: flex;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.tabs button {
  border: 0;
  padding: 8px 18px;
  background: #fff;
  cursor: pointer;
}

.tabs button.active {
  background: #111827;
  color: #fff;
}

#fleetMap {
  height: 520px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.legend {
  position: absolute;
  left: 28px;
  bottom: 26px;
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  z-index: 10;
  font-size: 13px;
}

.map-panel {
  position: relative;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.legend .green { background: #22c55e; }
.legend .red { background: #ef4444; }
.legend .blue { background: #2563eb; }
.legend .orange { background: #f59e0b; }
.legend .cyan { background: #0891b2; }

.car-marker span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  border: 4px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.workflow-marker span {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
  font-weight: 900;
}

.car-marker img,
.workflow-marker img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.workflow-marker em {
  position: absolute;
  right: -8px;
  bottom: -5px;
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 5px;
  background: #111827;
  color: #fff;
  font-size: 9px;
  font-style: normal;
  line-height: 1;
}

.map-link {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.vehicle-list {
  display: grid;
}

.vehicle-row {
  display: grid;
  grid-template-columns: 42px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
}

.vehicle-row:last-child {
  border-bottom: 0;
}

.vehicle-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  padding: 3px;
}

.vehicle-icon.online { background: #22c55e; }
.vehicle-icon.moving { background: #2563eb; }
.vehicle-icon.idle { background: #f59e0b; }
.vehicle-icon.out_of_area { background: #f97316; }
.vehicle-icon.offline { background: #ef4444; }

.vehicle-row strong,
.vehicle-row small {
  display: block;
}

.vehicle-row small,
.vehicle-row time {
  color: #64748b;
  font-size: 13px;
}

.vehicle-row small + small {
  margin-top: 3px;
}

.vehicle-row b {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.vehicle-row b.online,
.vehicle-row b.moving { color: #15803d; background: #dcfce7; }
.vehicle-row b.idle { color: #1d4ed8; background: #dbeafe; }
.vehicle-row b.out_of_area { color: #c2410c; background: #ffedd5; }
.vehicle-row b.offline { color: #dc2626; background: #fee2e2; }

.reports-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.metric-panel strong {
  display: block;
  font-size: 30px;
  margin: 18px 0 4px;
}

.trend {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.trend.up { color: #16a34a; }
.trend.down { color: #ef4444; }

.donut {
  width: 142px;
  height: 142px;
  margin: 8px auto 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#7c3aed 0 68%, #d8b4fe 68% 100%);
}

.donut span {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  text-align: center;
  white-space: pre-line;
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
}

.table-panel,
.history-panel {
  margin-bottom: 22px;
}

.data-form-panel {
  margin: 18px 24px 0;
}

.data-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.data-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 800;
  font-size: 13px;
}

.data-form input,
.data-form select {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-weight: 400;
}

.data-form button,
.delete-btn {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: #2563eb;
  font-weight: 900;
  cursor: pointer;
}

.delete-btn {
  background: #ef4444;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.notice.ok {
  color: #15803d;
  background: #dcfce7;
}

.notice.error {
  color: #b91c1c;
  background: #fee2e2;
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions-cell form {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #334155;
}

.pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.new {
  color: #dc2626;
  background: #fee2e2;
}

.pill.read {
  color: #15803d;
  background: #dcfce7;
}

.empty-cell {
  text-align: center;
  color: #64748b;
  padding: 24px 14px;
}

#historyMap {
  height: 340px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.login-page,
.driver-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.24), transparent 30%),
    linear-gradient(135deg, #061629, #0f172a 52%, #1d4ed8);
}

.driver-card {
  width: min(430px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.login-card {
  width: min(560px, 100%);
  padding: 48px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.login-card .brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.login-card h1,
.login-card p {
  text-align: center;
  margin: 0;
}

.login-card h1 {
  font-size: 32px;
}

.login-card p {
  color: #64748b;
  margin-top: 8px;
  font-size: 16px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
  font-size: 15px;
}

.login-form input {
  min-height: 52px;
  padding: 0 16px;
  font-size: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.login-form button,
.driver-actions button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #2563eb;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.alert.error {
  margin-top: 18px;
  padding: 12px;
  border-radius: 8px;
  color: #b91c1c;
  background: #fee2e2;
}

.demo-note {
  margin-top: 16px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.driver-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.driver-top span {
  color: #64748b;
  font-size: 13px;
}

.driver-top h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.driver-top a {
  color: #2563eb;
  font-weight: 800;
}

.driver-status {
  margin: 20px 0;
  padding: 16px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 900;
  text-align: center;
}

.driver-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.driver-actions .stop {
  background: #ef4444;
}

.driver-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.driver-meta {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.driver-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f7;
}

.driver-meta dt {
  color: #64748b;
}

.driver-meta dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.driver-hint {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .stats-grid,
  .reports-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .data-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 40;
  }

  .sidebar-collapsed .sidebar {
    transform: translateX(0);
  }

  .topbar {
    padding: 0 14px;
  }

  .top-actions {
    gap: 6px;
  }

  .clock,
  .admin-chip small {
    display: none;
  }

  .admin-chip {
    min-width: 0;
    grid-template-columns: 28px auto;
  }

  .stats-grid,
  .reports-grid {
    grid-template-columns: 1fr;
    margin-left: 14px;
    margin-right: 14px;
  }

  .content-grid,
  .table-panel,
  .history-panel,
  .data-form-panel {
    margin-left: 14px;
    margin-right: 14px;
  }

  .data-form {
    grid-template-columns: 1fr;
  }

  #fleetMap {
    height: 360px;
  }

  .vehicle-row {
    grid-template-columns: 38px 1fr auto;
  }

  .vehicle-row time {
    display: none;
  }
}

/* Dedicated tracking page */
.tracking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin: 22px; align-items: start; }
.tracking-layout #fleetMap { height: max(420px, calc(100vh - 255px)); }
.tracking-layout .map-panel { scroll-margin-top: 100px; }
.tracking-vehicles .vehicle-list { display: grid; max-height: calc(100vh - 250px); overflow-y: auto; }
.tracking-vehicles .vehicle-row { grid-template-columns: 34px minmax(0, 1fr) auto; align-items: start; }
.tracking-vehicles .vehicle-row > div { overflow-wrap: anywhere; }
.tracking-vehicles .vehicle-row time { grid-column: 2; }
.tracking-vehicles .vehicle-row b { grid-column: 3; grid-row: 1; }
.tracking-vehicles .vehicle-locate { grid-column: 2 / -1; justify-self: start; }
.vehicle-locate:disabled { opacity: .5; cursor: default; }
.tracking-hint, .vehicle-count { color: #6c80a5; font-size: 13px; }
.company-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 13px; }
.company-summary-item { display: grid; gap: 2px; padding: 9px 7px; border-radius: 8px; text-align: center; }
.company-summary-item b { font-size: 20px; line-height: 1; }
.company-summary-item small { font-size: 11px; font-weight: 700; white-space: nowrap; }
.company-summary-item.inside { color: #087e4a; background: #e1faed; }
.company-summary-item.outside { color: #c2410c; background: #fff1df; }
.company-summary-item.unknown { color: #64748b; background: #f1f5f9; }
.company-presence { display: flex !important; align-items: center; gap: 5px; margin-top: 5px; font-weight: 800; }
.company-presence i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: #94a3b8; }
.company-presence.in { color: #087e4a; }
.company-presence.in i { background: #10b981; }
.company-presence.out { color: #c2410c; }
.company-presence.out i { background: #f97316; }
.company-presence.unconfirmed_out { color: #a16207; }
.company-presence.unconfirmed_out i { background: #eab308; }
.company-presence.unknown { color: #64748b; }
.company-map-label { border: 0; border-radius: 7px; color: #0f3b78; background: rgba(255, 255, 255, .94); box-shadow: 0 2px 8px rgba(15, 59, 120, .2); font-weight: 800; padding: 5px 8px; }
.latest-job { margin-top: 4px; color: #0f766e !important; font-weight: 800; }
.car-marker span { position: relative; }
.car-marker .job-badge { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); padding: 2px 5px; border-radius: 999px; color: #075985; background: #e0f2fe; box-shadow: 0 1px 5px rgba(15, 23, 42, .2); font-size: 8px; font-style: normal; font-weight: 800; line-height: 1; white-space: nowrap; }
.tracking-empty { padding: 35px 10px; text-align: center; color: #7284a6; }
.tracking-empty > .ui-icon { display: block; width: 44px; height: 44px; margin: 0 auto 18px; color: #6e9ada; }
.tracking-empty strong { display: block; color: #273e6c; }
.tracking-empty p { font-size: 13px; margin-bottom: 24px; }
.latest-vehicle-summary { margin: 8px 0 0 60px; color: #5b719c; font-size: 14px; }
.tracking-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 15px 2px 0; color: #607498; font-size: 12px; }
.tracking-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tracking-legend .dot { width: 10px; height: 10px; }
.tracking-page .vehicle-icon { width: 34px; height: 34px; padding: 3px; border-radius: 10px; border: 2px solid rgba(255,255,255,.62); box-shadow: inset 0 3px 3px rgba(255,255,255,.58), inset 0 -5px 8px rgba(0,0,0,.24), 0 6px 12px rgba(15, 46, 87, .24); transform: perspective(90px) rotateX(5deg); }
.tracking-page .vehicle-icon .ui-icon { filter: drop-shadow(0 2px 1px rgba(0,0,0,.25)); }
.tracking-page .vehicle-icon.online { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #4ade80, #16a34a); }
.tracking-page .vehicle-icon.moving { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #60a5fa, #2563eb); }
.tracking-page .vehicle-icon.idle { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #fbbf24, #d97706); }
.tracking-page .vehicle-icon.out_of_area { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #fb923c, #ea580c); }
.tracking-page .vehicle-icon.offline { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #f87171, #dc2626); }
.tracking-page .vehicle-row:nth-child(1) .vehicle-icon { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #4ade80, #16a34a); }
.tracking-page .vehicle-row:nth-child(2) .vehicle-icon { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #60a5fa, #2563eb); }
.tracking-page .vehicle-row:nth-child(3) .vehicle-icon { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #c084fc, #7e22ce); }
.tracking-page .vehicle-row:nth-child(4) .vehicle-icon { background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.58), transparent 28%), linear-gradient(145deg, #fb923c, #ea580c); }
.dot.cyan { background: #0891b2; }
.back-dashboard { white-space: nowrap; }
.tracking-page .page-title h1 { font-size: clamp(18px, 1.6vw, 25px); }
@media (max-width: 1280px) {
  .tracking-layout { grid-template-columns: minmax(0, 1fr); }
  .tracking-vehicles .vehicle-list { max-height: 420px; }
  .tracking-page .admin-chip { display: none; }
}
@media (max-width: 820px) {
  .tracking-layout { margin: 14px; }
  .tracking-layout #fleetMap { height: 440px; }
  .tracking-page .topbar { gap: 10px; padding: 0 14px; }
  .tracking-page .refresh-btn { padding: 0 8px; }
  .tracking-page .page-title { min-width: 0; }
  .tracking-page .page-title h1 { font-size: 16px; line-height: 1.4; }
  .tracking-layout .panel-title { gap: 8px; }
  .tracking-layout .panel-title h2 { font-size: 16px; }
  .company-summary-item small { font-size: 10px; }
}

/* Local vector icons match the dashboard reference at every display density. */
.ui-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.sidebar nav .ui-icon { width: 24px; height: 24px; margin: 0 2px; color: #e6efff; }
.sidebar nav a.active .ui-icon { color: #fff; }
.stat-icon .ui-icon { width: 34px; height: 34px; }
.stat-icon.blue .ui-icon { color: #0876ff; }
.stat-icon.green .ui-icon { color: #00b365; }
.stat-icon.red .ui-icon { color: #f01429; }
.stat-icon.orange .ui-icon { color: #ff9900; }
.stat-card a .ui-icon { width: 17px; height: 17px; }
.panel-title-icon .ui-icon { width: 28px; height: 28px; }
.tabs button .ui-icon { width: 22px; height: 22px; margin-right: 8px; }
.metric-icon .ui-icon { width: 28px; height: 28px; stroke-width: 2.2; }
.trend .ui-icon { width: 18px; height: 18px; color: #00ae63; }
.metric-arrow .ui-icon, .latest-panel .panel-head > a .ui-icon { width: 20px; height: 20px; }
.topbar .clock-icon { width: 21px; height: 21px; }
.refresh-btn .ui-icon { width: 21px; height: 21px; }
.admin-chip .avatar .ui-icon { width: 32px; height: 32px; }
.admin-chip .avatar:has(.ui-icon) { background: #e0edff; overflow: hidden; }
.admin-chip .ui-icon.caret { width: 18px; height: 18px; }
.car-marker .ui-icon, .vehicle-icon .ui-icon { width: 21px; height: 21px; color: #fff; }

/* Dashboard visual refresh */
body.app-shell {
  background: linear-gradient(135deg, #edf5ff 0%, #f8fbff 56%, #eef6ff 100%);
  color: #07153f;
}

.app-shell {
  grid-template-columns: 276px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px;
  background:
    radial-gradient(circle at 14% 8%, rgba(34, 117, 255, .28), transparent 26%),
    linear-gradient(160deg, #08274a 0%, #061c37 48%, #04172d 100%);
  box-shadow: inset -1px 0 rgba(131, 185, 255, .13);
}

.brand { margin-bottom: 30px; gap: 11px; }
.brand-mark { width: 52px; height: 52px; border: 0; background: transparent; }
.brand strong { font-size: 18px; letter-spacing: -.35px; }
.brand span { color: #b6c7e0; font-size: 12px; }
.sidebar nav { gap: 7px; }
.sidebar nav a { min-height: 48px; padding: 11px 15px; border-radius: 9px; font-size: 15px; }
.sidebar nav a.active,
.sidebar nav a:hover { background: linear-gradient(120deg, #0979ff, #1e74ee); box-shadow: 0 8px 18px rgba(11, 112, 255, .25); }
.sidebar nav a span,
.sidebar nav a .nav-gif { width: 28px; height: 28px; flex-basis: 28px; }
.side-summary { margin-top: 31px; padding: 18px 20px; border: 1px solid rgba(176, 211, 255, .1); border-radius: 10px; background: linear-gradient(145deg, rgba(31, 74, 119, .65), rgba(14, 48, 84, .65)); }
.side-summary h3 { font-size: 16px; margin-bottom: 13px; }
.side-summary div { grid-template-columns: 30px 1fr auto; margin: 11px 0; }
.side-summary small { font-size: 14px; color: #d6e3f5; }
.side-summary strong { font-size: 21px; }
.dot { width: 26px; height: 26px; }

.topbar {
  height: 84px;
  gap: 28px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .79);
  border-color: #dbe8fb;
}
.icon-btn { width: 40px; min-height: 40px; display: grid; place-content: center; gap: 4px; border-radius: 9px; box-shadow: 0 3px 11px rgba(34, 84, 159, .05); }
.icon-btn span { width: 18px; height: 3px; display: block; border-radius: 999px; background: #146ff2; }
.page-title h1, .topbar h1 { margin: 0; color: #07154d; font-size: 25px; line-height: 1.08; letter-spacing: -.7px; }
.page-title p { margin: 4px 0 0; color: #6c80ad; font-size: 14px; font-weight: 600; }
.top-actions { gap: 11px; }
.clock { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 0 15px; border: 1px solid #d9e6fa; border-radius: 9px; color: #365281; background: rgba(255,255,255,.66); font-size: 13px; font-weight: 700; box-shadow: 0 3px 11px rgba(34,84,159,.04); }
.clock-icon { color: #345a95; font-size: 20px; line-height: 1; }
.refresh-btn { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-color: #71aaff; color: #116af3; font-size: 14px; border-radius: 9px; background: #fff; }
.refresh-btn span { font-size: 22px; line-height: 1; }
.admin-chip { min-width: 0; column-gap: 9px; }
.admin-chip .avatar { width: 40px; height: 40px; color: #6ca5f4; background: radial-gradient(circle at 50% 34%, #81b8ff 0 16%, transparent 17%), radial-gradient(ellipse at 50% 90%, #81b8ff 0 30%, transparent 31%), #e5f0ff; font-size: 0; }
.admin-chip strong { font-size: 13px; color: #14234e; }
.admin-chip small { font-size: 12px; color: #5c71a0; font-weight: 600; }
.admin-chip .caret { grid-row: 1 / span 2; grid-column: 3; color: #315384; font-size: 23px; }

.stats-grid, .content-grid, .reports-grid, .table-panel, .history-panel { margin-left: 22px; margin-right: 18px; }
.stats-grid { margin-top: 22px; gap: 16px; }
.stat-card, .panel { border: 1px solid #e2eaf7; border-radius: 10px; box-shadow: 0 8px 22px rgba(30, 85, 160, .06); }
.stat-card { min-height: 173px; padding: 20px 34px; overflow: hidden; }
.stat-card::before { position: absolute; content: ""; top: 9px; bottom: auto; left: 8px; width: 7px; height: 37px; border-radius: 999px; background: #1f80f7; }
.online-stat::before { background: #0bb36b; }
.offline-stat::before { background: #f11522; }
.alert-stat::before { background: #ffa408; }
.stat-card small { margin-bottom: 7px; color: #0c1e55; font-size: 17px; font-weight: 800; }
.stat-card strong { color: #07154d; font-size: 42px; line-height: 1; letter-spacing: -1px; }
.stat-card em { color: #182859; font-size: 18px; font-weight: 800; }
.stat-card > b { margin-top: 5px; font-size: 16px; }
.online-stat > b { color: #02a95b; }
.offline-stat > b { color: #f10a1b; }
.stat-card a { right: 18px; left: 30px; bottom: 0; height: 47px; display: flex; align-items: center; gap: 9px; border-top: 1px solid #dce8f8; color: #6076a4; font-weight: 700; }
.stat-card a span { color: #4d74a8; font-size: 20px; }
.stat-card a b { margin-left: 1px; color: #3c679d; font-size: 22px; font-weight: 500; }
.stat-icon { top: 24px; right: 18px; width: 70px; height: 70px; }
.stat-icon img { width: 62px; height: 62px; }

.content-grid { margin-top: 20px; }
.panel { padding: 15px 16px; }
.panel-head { min-height: 48px; margin-bottom: 13px; }
.panel-title, .metric-title { display: flex; align-items: center; gap: 13px; }
.panel-title-icon { width: 50px; height: 50px; display: grid; place-items: center; flex: 0 0 50px; border-radius: 50%; background: #e8f2ff; color: #1475f5; font-size: 28px; font-weight: 900; }
.panel h2 { color: #061548; font-size: 18px; letter-spacing: -.3px; }
.panel-title p { margin: 3px 0 0; color: #7084ae; font-size: 13px; font-weight: 600; }
.tabs { gap: 6px; border: 0; overflow: visible; }
.tabs button { min-height: 45px; padding: 0 18px; border: 1px solid #dce7f8; border-radius: 9px; color: #36537f; font-size: 14px; font-weight: 800; }
.tabs button span { margin-right: 7px; font-size: 20px; vertical-align: -2px; }
.tabs button.active { border-color: #294b84; background: #1c407e; box-shadow: 0 6px 14px rgba(28,64,126,.16); }
#fleetMap { height: 385px; border: 0; border-radius: 8px; }
.legend { display: none; }

.reports-grid { margin-top: 16px; gap: 16px; align-items: stretch; }
.metric-panel, .vehicle-panel { position: relative; min-height: 124px; padding: 16px 18px; overflow: hidden; }
.metric-title { gap: 12px; }
.metric-title h2 { font-size: 15px; }
.metric-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 48px; border-radius: 50%; font-size: 27px; font-weight: 900; }
.metric-icon.blue { color: #1478f6; background: #e6f1ff; }
.metric-icon.purple { color: #7e29ea; background: #f0e6ff; }
.metric-icon.green { color: #00a85b; background: #dcfaeb; }
.metric-panel strong { margin: 7px 0 6px 67px; color: #07154d; font-size: 26px; line-height: 1; letter-spacing: -.6px; }
.trend { margin: 0 0 0 1px; color: #6277a1; font-size: 13px; font-weight: 600; }
.trend.up, .trend.down { color: #6277a1; }
.trend.up::first-letter { color: #00ae63; }
.trend b { color: #00a85b; }
.metric-panel canvas { position: absolute; right: 17px; bottom: 30px; width: 132px; height: 47px; opacity: .55; }
.metric-arrow { position: absolute; right: 20px; bottom: 16px; color: #43638f; font-size: 24px; font-weight: 500; }
.metric-spark { position: absolute; right: 42px; bottom: 31px; color: #a88bff; font-size: 58px; line-height: .4; letter-spacing: -9px; opacity: .8; }
.latest-panel .panel-head { min-height: 48px; margin: 0; }
.latest-panel .panel-head > a { color: #42628f; font-size: 25px; font-weight: 500; }
.vehicle-list { display: none; }
.donut { display: none; }

/* Dashboard hierarchy: give the key summaries more breathing room and make
   the two supporting tables visually distinct without changing other pages. */
.dashboard-page .stats-grid { gap: 20px; margin-top: 26px; }
.dashboard-page .stat-card { min-height: 148px; padding: 18px 26px; }
.dashboard-page .stat-card strong { font-size: 42px; }
.dashboard-page .stat-icon { width: 62px; height: 62px; top: 18px; right: 16px; }
.dashboard-page .reports-grid { gap: 20px; margin-top: 20px; }
.dashboard-page .table-panel { padding: 19px 20px; margin-top: 20px; }
.dashboard-page .table-panel .panel-head { padding-bottom: 12px; border-bottom: 1px solid #edf2fa; }
.dashboard-page #driverToday { border-top: 3px solid #2f80ed; }
.dashboard-page #alerts { border-top: 3px solid #f59e0b; }
.history-filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) minmax(150px, .8fr) minmax(150px, .8fr) auto auto; align-items: end; gap: 12px; margin: 0 0 18px; padding: 16px; border: 1px solid #dce8f8; border-radius: 12px; background: linear-gradient(135deg, #f8fbff, #f1f7ff); box-shadow: 0 6px 18px rgba(30, 85, 160, .06); }
.history-filters input { width: 100%; box-sizing: border-box; min-height: 42px; padding: 0 12px; border: 1px solid #cbdcf2; border-radius: 8px; color: #14234e; background: #fff; font: inherit; outline: none; transition: border-color .2s, box-shadow .2s; }
.history-filters input:focus { border-color: #3988f7; box-shadow: 0 0 0 3px rgba(57, 136, 247, .14); }
.history-filters label { display: grid; gap: 6px; color: #52698f; font-size: 12px; font-weight: 800; }
.history-filters label::first-line { color: #315384; }
.history-filters .refresh-btn { min-height: 42px; border: 0; border-radius: 8px; padding: 0 20px; color: #fff; background: linear-gradient(135deg, #1976f3, #3b8df8); box-shadow: 0 6px 14px rgba(25, 118, 243, .22); cursor: pointer; }
.export-btn { min-height: 42px; border: 0; border-radius: 8px; padding: 0 20px; color: #fff; background: #13835d; box-shadow: 0 6px 14px rgba(19, 131, 93, .22); cursor: pointer; font: inherit; font-weight: 700; }
.export-btn:hover { background: #0f6c4c; }
.report-date-range { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.report-date { display: inline-flex; align-items: center; gap: 9px; padding: 7px 10px 7px 13px; border: 1px solid #d6e4f7; border-radius: 9px; color: #52698f; background: #f8fbff; font-size: 13px; font-weight: 800; }
.report-date input { min-height: 38px; padding: 0 10px; border: 1px solid #cbdcf2; border-radius: 7px; color: #14234e; background: #fff; font: inherit; outline: none; }
.report-date input:focus { border-color: #3988f7; box-shadow: 0 0 0 3px rgba(57, 136, 247, .14); }
.report-date-range .refresh-btn, .report-date-range .export-btn { min-height: 40px; }
.report-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 24px 24px 22px; }
.report-summary article { position: relative; overflow: hidden; min-height: 132px; padding: 24px 26px 22px; border: 1px solid #dce8f8; border-radius: 14px; background: linear-gradient(135deg, #fff, #f7fbff); box-shadow: 0 10px 26px rgba(30, 85, 160, .09); }
.report-summary article::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: #3988f7; }
.report-summary article::after { content: ""; position: absolute; right: -18px; top: -22px; width: 88px; height: 88px; border-radius: 50%; background: rgba(57, 136, 247, .10); }
.report-summary small { display: block; color: #52698f; font-size: 13px; font-weight: 800; }
.report-summary strong { display: inline-block; margin-top: 5px; color: #07154d; font-size: 34px; line-height: 1; }
.report-summary span { margin-left: 6px; color: #6c80ad; font-size: 14px; font-weight: 700; }
.report-summary article:nth-child(2)::before { background: #10b981; }
.report-summary article:nth-child(2)::after { background: rgba(16, 185, 129, .11); }
.report-summary article:nth-child(3)::before { background: #f59e0b; }
.report-summary article:nth-child(3)::after { background: rgba(245, 158, 11, .13); }
.reports-page #reportTable th:nth-child(5) { color: #1d67b8; }
.reports-page #reportTable th:nth-child(6) { color: #13835d; }
.reports-page #reportTable td:nth-child(5) { color: #1d67b8; font-weight: 800; }
.reports-page #reportTable td:nth-child(6) { color: #13835d; font-weight: 800; }
.report-round-stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.report-round-stack > * { min-height: 22px; display: inline-flex; align-items: center; }
@media (max-width: 620px) { .report-summary { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .history-filters { grid-template-columns: 1fr 1fr; } .history-filters .refresh-btn, .export-btn { width: 100%; } }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .stats-grid, .reports-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .topbar { gap: 16px; }
  .clock { display: none; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { width: 276px; }
  .page-title p { display: none; }
  .page-title h1 { font-size: 20px; }
  .admin-chip { min-width: 40px; grid-template-columns: 40px; }
  .admin-chip strong, .admin-chip small, .admin-chip .caret { display: none; }
  .stats-grid, .content-grid, .reports-grid, .table-panel, .history-panel { margin-left: 14px; margin-right: 14px; }
  .stat-card { min-height: 160px; }
  .panel-title p { display: none; }
  .panel-title-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .tabs button { padding: 0 10px; }
  #fleetMap { height: 360px; }
}
