/*
  Surface polish: MiniMax + Replicate-inspired accents (minimax/DESIGN.md, replicate/DESIGN.md).
  Truck load UI (.detail-load-visual … cargo fill) is intentionally unchanged.
*/
:root {
  /* Replicate-inspired (replicate/DESIGN.md) — blaze, ink, playground energy */
  --rep-dark: #202020;
  --rep-red: #ea2804;
  --rep-red-warm: #dd4425;
  --rep-green: #2b9a66;
  --rep-link-dotted: #bbbbbb;
  --rep-github: #24292e;
  --rep-blaze-mid: #e11d48;
  --rep-blaze-pink: #f472b6;

  /* MiniMax palette (reference) */
  --mm-brand-6: #1456f0;
  --mm-primary-500: #3b82f6;
  --mm-primary-600: #2563eb;
  --mm-primary-700: #1d4ed8;
  --mm-primary-light: #60a5fa;
  --mm-brand-pink: #ea5ec1;
  --mm-text-00: #222222;
  --mm-text-04: #45515e;
  --mm-border: #e5e7eb;
  --mm-shadow-card: rgba(0, 0, 0, 0.08) 0px 4px 6px;
  --mm-shadow-brand-glow: rgba(44, 30, 116, 0.16) 0px 0px 15px;
  --mm-shadow-elevated: rgba(36, 36, 36, 0.08) 0px 12px 16px -4px;
  --mm-radius-product: 22px;
  --mm-radius-ui: 8px;
  --font-ui: "DM Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Outfit", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mid: "Poppins", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-data: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono", Menlo, Monaco, Consolas, monospace;

  --bg: #05070b;
  --bg2: #0b1118;
  --text: #f2f7ff;
  --muted: rgba(242, 247, 255, 0.86);
  --muted2: rgba(242, 247, 255, 0.68);
  --border: rgba(148, 163, 184, 0.34);
  --border2: rgba(148, 163, 184, 0.48);

  --glass: #0d141d;
  --glass2: #121c28;
  --shadow: 0 22px 56px rgba(1, 6, 14, 0.55);
  --shadow2: 0 10px 28px rgba(1, 6, 14, 0.35);

  --accent1: var(--mm-primary-light);
  --accent2: #5ee7ff;
  --accent3: #22c55e;

  --radius: 24px;
  --focus: rgba(59, 130, 246, 0.45);
  --ring: rgba(59, 130, 246, 0.22);

  /* Typography scale */
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: clamp(1.75rem, 3.5vw, 2.25rem);
  --leading-tight: 1.1;
  --leading-snug: 1.35;
  --leading-body: 1.5;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: var(--leading-body);
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern" 1, "liga" 1;
}

* {
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

@keyframes pixelMeshDrift {
  0% {
    transform: scale(1) translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    transform: scale(1.06) translate3d(-2%, 1.5%, 0);
    opacity: 0.96;
  }
}

.page-bg {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.page-bg::before {
  content: "";
  position: absolute;
  inset: -200px;
  background:
    /* Replicate “blaze” energy — orange → red → magenta (subtle, with MiniMax mesh) */
    radial-gradient(ellipse 58% 42% at 8% 88%, rgba(234, 40, 4, 0.14), transparent 52%),
    radial-gradient(ellipse 52% 48% at 94% 22%, rgba(225, 29, 72, 0.11), transparent 50%),
    radial-gradient(ellipse 45% 38% at 78% 78%, rgba(244, 114, 182, 0.1), transparent 48%),
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(44, 30, 116, 0.22), transparent 55%),
    radial-gradient(ellipse 85% 55% at 12% 18%, rgba(20, 86, 240, 0.28), transparent 52%),
    radial-gradient(ellipse 75% 50% at 88% 12%, rgba(234, 94, 193, 0.12), transparent 55%),
    radial-gradient(ellipse 65% 55% at 72% 85%, rgba(52, 168, 83, 0.2), transparent 52%),
    radial-gradient(ellipse 95% 55% at 38% 100%, rgba(251, 188, 4, 0.1), transparent 58%),
    radial-gradient(ellipse 50% 40% at 50% 45%, rgba(59, 130, 246, 0.12), transparent 50%),
    linear-gradient(168deg, #070910 0%, #0c1220 38%, #06080e 100%);
  pointer-events: none;
  transform: translateZ(0);
  animation: pixelMeshDrift 22s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

.page-bg::after {
  content: none;
}

.content,
.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(1560px, 94vw);
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  padding-left: clamp(0.5rem, 1.8vw, 1.15rem);
  padding-right: clamp(0.5rem, 1.8vw, 1.15rem);
}

@media (min-width: 1536px) {
  .content,
  .app-shell {
    max-width: min(1680px, 92vw);
  }
}

/* Replicate-style in-content links: dotted underline, red hint on hover */
.app-shell a[href]:where(:not(.btn):not([class*="btn-"]):not(.theme-toggle-btn)) {
  text-decoration: underline dotted rgba(187, 187, 187, 0.4);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
}

.app-shell a[href]:where(:not(.btn):not([class*="btn-"]):not(.theme-toggle-btn)):hover {
  text-decoration-color: rgba(234, 40, 4, 0.55);
}

html.theme-light .app-shell a[href]:where(:not(.btn):not([class*="btn-"]):not(.theme-toggle-btn)) {
  text-decoration-color: rgba(187, 187, 187, 0.85);
}

.app-shell .leaflet-container a,
.app-shell .leaflet-control a,
.app-shell .leaflet-popup-content-wrapper a {
  text-decoration: none !important;
}

/* Primary system identity — crisp gradient title + thin “blaze” underline (dark) */
.app-brand-hero {
  position: relative;
  margin-bottom: 1.75rem;
  padding: 1.5rem 0 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.app-brand-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(234, 40, 4, 0.45) 22%,
    rgba(225, 29, 72, 0.4) 48%,
    rgba(244, 114, 182, 0.35) 72%,
    transparent 100%
  );
  pointer-events: none;
  opacity: 0.85;
}

.app-brand-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 52rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand-hero-text {
  min-width: 0;
  flex: 1;
}

.theme-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.45);
  color: rgba(226, 232, 240, 0.95);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: rgba(234, 40, 4, 0.42);
  background: rgba(30, 41, 59, 0.65);
  box-shadow: 0 0 0 1px rgba(234, 40, 4, 0.12), 0 10px 28px rgba(234, 40, 4, 0.08);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.app-brand-title {
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
}

.app-brand-title-line {
  display: block;
  font-size: clamp(2.85rem, 8.5vw, 5rem);
  letter-spacing: -0.045em;
  background: linear-gradient(
    102deg,
    #fef2f2 0%,
    #fecaca 8%,
    #fb923c 16%,
    #f97316 24%,
    #22d3ee 38%,
    #818cf8 52%,
    #e879f9 66%,
    #fda4af 80%,
    #fde68a 92%,
    #fef3c7 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 20px rgba(234, 40, 4, 0.12));
}

.app-brand-byline {
  margin: 0.65rem 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(241, 245, 249, 0.95);
}

.app-brand-unit {
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fbbf24;
}

.dashboard-page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: #f8fafc;
}

.dashboard-page-lede {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  max-width: 40rem;
}

/* --- Dashboard: search / filter (synchronous grid) --- */
.filter-panel {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 1.35rem;
  overflow: hidden;
}

.filter-panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    rgba(234, 40, 4, 0.75) 0%,
    rgba(225, 29, 72, 0.65) 35%,
    rgba(219, 39, 119, 0.55) 65%,
    rgba(59, 130, 246, 0.55) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.filter-panel-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f1f5f9;
}

/* Notifications panel (delivery-approval queue) */
.notif-panel {
  position: relative;
  border: 1px solid rgba(250, 204, 21, 0.22);
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.05), rgba(255, 255, 255, 0)),
    rgba(15, 23, 42, 0.55);
}
.notif-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.notif-panel-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fde68a;
  font-weight: 600;
}
.notif-panel-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f8fafc;
  margin-top: 0.15rem;
}
.notif-panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.38);
  color: #fde68a;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.notif-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
}
.notif-item-body {
  min-width: 0;
  flex: 1 1 260px;
}
.notif-item-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-weight: 600;
  color: #f1f5f9;
}
.notif-item-vehicle {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.notif-item-arrow {
  color: rgba(148, 163, 184, 0.8);
}
.notif-item-dest {
  color: #cbd5e1;
  font-weight: 500;
}
.notif-item-meta {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  line-height: 1.4;
}
.notif-item-meta strong {
  color: #e2e8f0;
  font-weight: 600;
}
.notif-item-note {
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-left: 2px solid rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.06);
  border-radius: 0 8px 8px 0;
}
.notif-item-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.notif-item-actions form.inline {
  display: inline;
  margin: 0;
}

/* Recent-activity log (below pending section inside the notifications panel) */
.notif-log-section {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
}
.notif-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.notif-log-label {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #cbd5e1;
  font-weight: 600;
}
.notif-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.notif-log-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.1rem;
  font-size: 0.85rem;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.notif-log-item:last-child {
  border-bottom: 0;
}
.notif-log-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
}
.notif-log-item--approved .notif-log-dot {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}
.notif-log-item--rejected .notif-log-dot {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18);
}
.notif-log-item--claimed .notif-log-dot {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
}
.notif-log-action {
  flex-shrink: 0;
  min-width: 5.4rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #e2e8f0;
}
.notif-log-item--approved .notif-log-action { color: #6ee7b7; }
.notif-log-item--rejected .notif-log-action { color: #fca5a5; }
.notif-log-item--claimed .notif-log-action { color: #fde68a; }
.notif-log-body {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-log-body strong {
  color: #f1f5f9;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}
.notif-log-time {
  flex-shrink: 0;
  font-size: 0.78rem;
}

html[data-theme="light"] .notif-log-section {
  border-top-color: rgba(15, 23, 42, 0.18);
}
html[data-theme="light"] .notif-log-label {
  color: #475569;
}
html[data-theme="light"] .notif-log-item {
  color: #475569;
  border-bottom-color: rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .notif-log-action {
  color: #334155;
}
html[data-theme="light"] .notif-log-item--approved .notif-log-action { color: #047857; }
html[data-theme="light"] .notif-log-item--rejected .notif-log-action { color: #b91c1c; }
html[data-theme="light"] .notif-log-item--claimed .notif-log-action { color: #92400e; }
html[data-theme="light"] .notif-log-body strong {
  color: #0f172a;
}

/* Light theme tuning */
html[data-theme="light"] .notif-panel {
  border-color: rgba(202, 138, 4, 0.28);
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.12), rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, 0.92);
}
html[data-theme="light"] .notif-panel-kicker {
  color: #a16207;
}
html[data-theme="light"] .notif-panel-count {
  background: rgba(250, 204, 21, 0.25);
  border-color: rgba(202, 138, 4, 0.5);
  color: #854d0e;
}
html[data-theme="light"] .notif-panel-title {
  color: #0f172a;
}
html[data-theme="light"] .notif-item {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.08);
}
html[data-theme="light"] .notif-item-title {
  color: #0f172a;
}
html[data-theme="light"] .notif-item-dest {
  color: #334155;
}
html[data-theme="light"] .notif-item-meta {
  color: #64748b;
}
html[data-theme="light"] .notif-item-meta strong {
  color: #1f2937;
}
html[data-theme="light"] .notif-item-note {
  color: #374151;
  background: rgba(250, 204, 21, 0.12);
  border-left-color: rgba(202, 138, 4, 0.55);
}

/* Public page: delivery claim / confirmation */
.detail-delivery {
  position: relative;
  overflow: hidden;
}
.detail-delivery-state {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.detail-delivery-state--claim {
  flex-direction: column;
  align-items: stretch;
}
.detail-delivery-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.detail-delivery-state--pending .detail-delivery-icon {
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
  border: 1px solid rgba(250, 204, 21, 0.38);
}
.detail-delivery-state--done .detail-delivery-icon {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.38);
}
.detail-delivery-text {
  min-width: 0;
  flex: 1 1 0;
}
.detail-delivery-title {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: #f1f5f9;
}
.detail-delivery-note {
  font-size: 0.88rem;
  color: #cbd5e1;
  padding: 0.45rem 0.7rem;
  border-left: 2px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.45);
  border-radius: 0 10px 10px 0;
}
.detail-delivery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .detail-delivery-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  }
}
.detail-delivery-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

html[data-theme="light"] .detail-delivery-title {
  color: #0f172a;
}
html[data-theme="light"] .detail-delivery-note {
  color: #334155;
  background: rgba(241, 245, 249, 0.9);
  border-left-color: rgba(100, 116, 139, 0.5);
}
html[data-theme="light"] .detail-delivery-state--pending .detail-delivery-icon {
  background: rgba(250, 204, 21, 0.22);
  color: #92400e;
  border-color: rgba(202, 138, 4, 0.5);
}
html[data-theme="light"] .detail-delivery-state--done .detail-delivery-icon {
  background: rgba(16, 185, 129, 0.22);
  color: #065f46;
  border-color: rgba(5, 150, 105, 0.5);
}

.filter-form-grid {
  display: grid;
  gap: 1rem 1.15rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .filter-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .filter-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.filter-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(186, 198, 214, 0.88);
}

.filter-field .field {
  margin-top: 0;
}

.filter-field--vehicle {
  grid-column: 1 / -1;
}

@media (min-width: 1280px) {
  .filter-field--vehicle {
    grid-column: span 2;
  }
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding-top: 0.35rem;
}

@media (min-width: 1280px) {
  .filter-actions {
    grid-column: span 2;
    justify-content: flex-start;
    align-self: end;
    padding-top: 0;
  }
}

/* Dashboard CHT cards — ETA urgency (not shown when delivered) */
.eta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
}

.eta-badge--overdue {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.5);
  border-color: rgba(248, 113, 113, 0.55);
}

.eta-badge--urgent {
  color: #fef3c7;
  background: rgba(180, 83, 9, 0.45);
  border-color: rgba(251, 191, 36, 0.5);
}

.eta-badge--soon {
  color: #e0f2fe;
  background: rgba(12, 74, 110, 0.45);
  border-color: rgba(56, 189, 248, 0.45);
}

/* --- Stat summary tiles (distinct accents) --- */
.stat-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.125rem;
  padding: 1.35rem 1.35rem;
  border-radius: var(--mm-radius-product);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.22),
    0 0 18px rgba(44, 30, 116, 0.1);
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 1;
  pointer-events: none;
}

.stat-tile::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 22px 0 0 22px;
  pointer-events: none;
}

.stat-tile-icon {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: clamp(3.75rem, 5.5vw, 4.75rem);
  height: clamp(3.75rem, 5.5vw, 4.75rem);
  border-radius: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
}

.stat-tile-icon svg {
  width: clamp(2rem, 3.8vw, 2.75rem);
  height: clamp(2rem, 3.8vw, 2.75rem);
  flex-shrink: 0;
}

.stat-tile-body {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.stat-tile-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.72);
}

.stat-tile-value {
  margin-top: 0.35rem;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: #f8fafc;
}

.stat-tile-value--emerald {
  color: #6ee7b7;
}
.stat-tile-value--amber {
  color: #fcd34d;
}
.stat-tile-value--violet {
  color: #c4b5fd;
}

.stat-tile--sky::before {
  background: linear-gradient(155deg, rgba(14, 116, 144, 0.35) 0%, rgba(12, 21, 34, 0.94) 42%, rgba(10, 17, 27, 0.92) 100%);
}
.stat-tile--sky::after {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
}
.stat-tile--sky .stat-tile-icon {
  color: #7dd3fc;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.22), rgba(12, 21, 34, 0.5));
}

.stat-tile--emerald::before {
  background: linear-gradient(155deg, rgba(5, 95, 70, 0.4) 0%, rgba(12, 24, 22, 0.94) 40%, rgba(10, 17, 27, 0.9) 100%);
}
.stat-tile--emerald::after {
  background: linear-gradient(180deg, #34d399, #059669);
}
.stat-tile--emerald .stat-tile-icon {
  color: #6ee7b7;
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.22), rgba(12, 21, 34, 0.5));
}

.stat-tile--amber::before {
  background: linear-gradient(155deg, rgba(146, 64, 14, 0.35) 0%, rgba(28, 22, 12, 0.94) 40%, rgba(10, 17, 27, 0.9) 100%);
}
.stat-tile--amber::after {
  background: linear-gradient(180deg, #fbbf24, #d97706);
}
.stat-tile--amber .stat-tile-icon {
  color: #fcd34d;
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.22), rgba(12, 21, 34, 0.5));
}

.stat-tile--violet::before {
  background: linear-gradient(155deg, rgba(76, 29, 149, 0.38) 0%, rgba(18, 16, 38, 0.94) 40%, rgba(10, 17, 27, 0.9) 100%);
}
.stat-tile--violet::after {
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
}
.stat-tile--violet .stat-tile-icon {
  color: #c4b5fd;
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.24), rgba(12, 21, 34, 0.5));
}

.dispatch-card-grid {
  align-items: stretch;
}

@media (min-width: 1024px) {
  .dispatch-card-grid .dispatch-row {
    padding: 1.15rem 1.15rem;
  }
}

/* Vehicle line — larger when two cards per row */
.dispatch-card-grid .dispatch-row .cht-card-vehicle {
  font-size: 1.15rem;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .dispatch-card-grid .dispatch-row .cht-card-vehicle {
    font-size: 1.3rem;
  }
}

/* Three columns from lg — keep vehicle line readable without overflowing */
@media (min-width: 1024px) {
  .dispatch-card-grid .dispatch-row .cht-card-vehicle {
    font-size: 1.2rem;
  }
}

@media (min-width: 1536px) {
  .dispatch-card-grid .dispatch-row .cht-card-vehicle {
    font-size: 1.32rem;
  }
}

.dispatch-card-grid .dispatch-row .muted,
.dispatch-card-grid .dispatch-row .muted2 {
  font-size: 0.98rem;
  line-height: 1.45;
}

@media (min-width: 640px) {
  .dispatch-card-grid .dispatch-row .muted,
  .dispatch-card-grid .dispatch-row .muted2 {
    font-size: 1.02rem;
  }
}

.dispatch-card-grid .dispatch-row .status-chip {
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
}

.dispatch-card-grid .dispatch-row .glass .muted {
  font-size: 0.875rem;
}

.dispatch-card-grid .dispatch-row .glass .title {
  font-size: 1.02rem;
  font-weight: 700;
}

@media (min-width: 1280px) {
  .dispatch-card-grid .dispatch-row .glass .title {
    font-size: 1.0625rem;
  }
}

@media (min-width: 1024px) {
  .dispatch-card-grid .dispatch-row .btn-sm {
    font-size: 0.8125rem;
    padding: 0.4rem 0.7rem;
  }
}

.app-toast {
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 14, 24, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.glass {
  background: rgba(10, 14, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
  box-shadow:
    0 20px 56px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.07) inset;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.glass::before {
  content: none;
}

.glass-strong {
  background: rgba(10, 14, 24, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.09) inset,
    var(--mm-shadow-brand-glow);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.glass-strong::before {
  content: none;
}

.card-hover {
  transition:
    transform 0.35s cubic-bezier(0.34, 1.15, 0.64, 1),
    border-color 0.35s ease,
    background 0.35s ease,
    box-shadow 0.35s ease,
    filter 0.35s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  border-bottom-color: rgba(234, 40, 4, 0.35);
  filter: saturate(1.06);
}

html.theme-light .card-hover:hover {
  border-bottom-color: rgba(234, 40, 4, 0.42);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.82rem 1.2rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: linear-gradient(180deg, rgba(16, 25, 38, 0.95), rgba(12, 20, 32, 0.95));
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.15, 0.64, 1),
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease,
    filter 0.3s ease;
  box-shadow: 0 8px 24px rgba(1, 6, 14, 0.36);
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(55, 212, 255, 0.58);
  background: linear-gradient(180deg, rgba(21, 34, 52, 0.98), rgba(15, 27, 43, 0.98));
}

.btn:active {
  transform: translateY(0px);
}

.btn:focus-visible {
  outline: none;
  border-color: rgba(55, 212, 255, 0.78);
  box-shadow: 0 0 0 4px rgba(55, 212, 255, 0.2), 0 10px 24px rgba(1, 6, 14, 0.34);
}

.btn-primary {
  border-color: rgba(37, 99, 235, 0.65);
  background: linear-gradient(180deg, var(--mm-primary-light) 0%, var(--mm-primary-500) 42%, var(--mm-primary-700) 100%);
  color: #ffffff;
  font-weight: 600;
  font-family: var(--font-ui);
  border-radius: var(--mm-radius-ui);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.28),
    0 0 20px rgba(44, 30, 116, 0.18);
}

.btn-primary:hover {
  border-color: rgba(96, 165, 250, 0.85);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.32),
    0 0 24px rgba(44, 30, 116, 0.22);
  filter: brightness(1.04);
}

.btn-danger {
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.12);
}

.btn-ghost {
  background: rgba(16, 25, 38, 0.4);
  box-shadow: none;
  border-color: rgba(148, 163, 184, 0.45);
}

.field {
  width: 100%;
  border-radius: 18px;
  background: rgba(10, 17, 27, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.42);
  padding: 0.9rem 1.1rem;
  font-size: 1.0625rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.field::placeholder {
  color: rgba(242, 247, 255, 0.38);
}

.field:focus {
  border-color: rgba(84, 197, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(55, 212, 255, 0.2);
  background: rgba(12, 23, 36, 0.95);
}

.field:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.60);
  box-shadow: 0 0 0 4px var(--ring);
}

/* Native dropdown theming (best-effort; browser option styling is limited). */
select {
  font-size: 1.0625rem;
  /* If the browser ignores deeper styling for <option>,
     force readable contrast. */
  color: #000 !important;
  background-color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
select option {
  background-color: #fff !important;
  color: #000 !important;
  font-size: 1.0625rem;
}

/* Form labels — match dispatch readability */
label.muted {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  font-size: 0.9375rem;
  font-weight: 700;
  background: rgba(12, 20, 31, 0.86);
  white-space: nowrap;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

.status-green {
  background: rgba(43, 154, 102, 0.14);
  border-color: rgba(43, 154, 102, 0.38);
  box-shadow: 0 0 0 1px rgba(43, 154, 102, 0.08), 0 18px 55px rgba(43, 154, 102, 0.1);
}

.status-amber {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08), 0 18px 55px rgba(245, 158, 11, 0.10);
}

.status-blue {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.08), 0 18px 55px rgba(56, 189, 248, 0.10);
}

.muted {
  color: var(--muted);
}

.muted2 {
  color: var(--muted2);
}

.title {
  font-family: var(--font-ui);
  letter-spacing: -0.02em;
}

.shine {
  position: relative;
  overflow: hidden;
}

.shine::after {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.16) 40%,
    transparent 70%
  );
  transform: translateX(-60%);
  animation: shine 5.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine {
  0% {
    transform: translateX(-60%);
  }
  50% {
    transform: translateX(60%);
  }
  100% {
    transform: translateX(60%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-bg::before {
    animation: none;
  }
  .shine::after {
    animation: none;
  }
  .card-hover {
    transition: none;
  }
}

.reveal {
  animation: revealIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* --- Tailwind-linter-friendly helpers (avoid arbitrary `[...]` + `!` classes) --- */

.btn.btn-sm {
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.btn.btn-xs {
  padding: 0.45rem 0.78rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.rd-18 {
  border-radius: 18px;
}
.rd-22 {
  border-radius: 22px;
}
.rd-24 {
  border-radius: 24px;
}
.rd-26 {
  border-radius: 26px;
}
.rd-28 {
  border-radius: 28px;
}

.minh-110 {
  min-height: 110px;
}

/* Map type toggle */
.mapToggleBtn {
  color: rgba(234, 242, 255, 0.7);
}
.mapToggleBtn:hover {
  color: rgba(234, 242, 255, 0.95);
}
.mapToggleBtn.active {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

/* CHT card: anchor receives clicks, buttons capture their own */
.cht-card-link {
  display: block;
}

/* Leaflet map - transparent so static fallback shows when tiles fail */
#dashboardMap.leaflet-container,
#dashboardMap .leaflet-tile-pane,
#fleetMapFullscreen.leaflet-container,
#locationMap.leaflet-container,
#detailMapFullscreen.leaflet-container {
  min-height: 280px;
  /* Preserve background-image fallback on the container.
     If we set `background: transparent !important`, it also wipes `background-image`. */
  background-color: transparent !important;
}
#dashboardMap .leaflet-tile-pane,
#locationMap .leaflet-tile-pane { background: transparent !important; }

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  font-size: 15px;
}
.leaflet-popup-content {
  font-size: 15px;
  line-height: 1.45;
}

/* Make detail page text readable (scope-limited, no global overrides). */
#detailRoot .text-xs {
  font-size: 0.9rem !important;
}
#detailRoot .text-sm {
  font-size: 1.05rem !important;
}
#detailMapModal .text-xs {
  font-size: 0.9rem !important;
}
#detailMapModal .text-sm {
  font-size: 1.05rem !important;
}

.maxw-80vw {
  max-width: 80vw;
}

/* Dashboard as layout sections instead of heavy card stack. */
aside .glass-strong,
main .glass-strong {
  padding-top: 1.15rem !important;
  padding-bottom: 1.15rem !important;
}

.dashboard-shell {
  width: 100%;
}

.dashboard-map-section {
  width: 100%;
}

.dashboard-map-canvas {
  position: relative;
  width: 100%;
  min-height: 300px;
  height: clamp(300px, 42vw, 520px);
  max-height: min(56vh, 640px);
}

@media (min-width: 768px) {
  .dashboard-map-canvas {
    min-height: 340px;
    height: clamp(340px, 38vw, 540px);
  }
}

@media (min-width: 1280px) {
  .dashboard-map-canvas {
    min-height: 380px;
    height: clamp(380px, 32vw, 560px);
  }
}

.map-panel--fullwidth {
  min-height: 0;
}

.map-panel--fullwidth #dashboardMap.leaflet-container,
.map-panel--fullwidth #dashboardMap {
  min-height: 100% !important;
  height: 100% !important;
}

.dispatch-row {
  position: relative;
  border-radius: 16px;
  border-left-width: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(165deg, rgba(14, 22, 34, 0.95) 0%, rgba(10, 17, 27, 0.88) 100%);
  overflow: hidden;
}

.dispatch-row[class*="dispatch-row--"]::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  z-index: 2;
  pointer-events: none;
  border-radius: 16px 16px 0 0;
}

.dispatch-row--mint::before {
  background: linear-gradient(90deg, #34d399, #2dd4bf, #5eead4);
}
.dispatch-row--iris::before {
  background: linear-gradient(90deg, #818cf8, #a78bfa, #c4b5fd);
}
.dispatch-row--saffron::before {
  background: linear-gradient(90deg, #fbbf24, #fb923c, #fcd34d);
}
.dispatch-row--ocean::before {
  background: linear-gradient(90deg, #38bdf8, #22d3ee, #67e8f9);
}

.dispatch-row--mint {
  border-top-color: rgba(52, 211, 153, 0.35);
  border-bottom-color: rgba(45, 212, 191, 0.25);
  background: linear-gradient(165deg, rgba(12, 28, 26, 0.96) 0%, rgba(10, 18, 28, 0.9) 100%);
}
.dispatch-row--iris {
  border-top-color: rgba(129, 140, 248, 0.4);
  border-bottom-color: rgba(99, 102, 241, 0.28);
  background: linear-gradient(165deg, rgba(18, 16, 40, 0.95) 0%, rgba(10, 17, 30, 0.9) 100%);
}
.dispatch-row--saffron {
  border-top-color: rgba(251, 191, 36, 0.38);
  border-bottom-color: rgba(245, 158, 11, 0.22);
  background: linear-gradient(165deg, rgba(32, 22, 10, 0.96) 0%, rgba(12, 18, 28, 0.9) 100%);
}
.dispatch-row--ocean {
  border-top-color: rgba(56, 189, 248, 0.4);
  border-bottom-color: rgba(14, 165, 233, 0.28);
  background: linear-gradient(165deg, rgba(10, 26, 42, 0.96) 0%, rgba(10, 17, 28, 0.9) 100%);
}

.dispatch-row--mint .cht-card-vehicle {
  background: linear-gradient(92deg, #ecfdf5 0%, #6ee7b7 55%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dispatch-row--iris .cht-card-vehicle {
  background: linear-gradient(92deg, #eef2ff 0%, #a5b4fc 50%, #818cf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dispatch-row--saffron .cht-card-vehicle {
  background: linear-gradient(92deg, #fffbeb 0%, #fcd34d 45%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dispatch-row--ocean .cht-card-vehicle {
  background: linear-gradient(92deg, #f0f9ff 0%, #7dd3fc 50%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.dispatch-row .glass {
  background: rgba(12, 21, 32, 0.78);
  border-radius: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}

/* Make metrics read like premium data strips, not mini cards. */
.grid .glass.card-hover.p-5 {
  border-radius: 12px;
  border-top-color: rgba(255, 255, 255, 0.1);
  border-bottom-color: rgba(55, 212, 255, 0.26);
}

/* Force readable dark text for native option dropdown menus. */
select,
option {
  color-scheme: light;
}

/* --- Pixel-inspired public dispatch preview (detail page) --- */
@keyframes detailQrAura {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(360deg) scale(1.05);
  }
}

@keyframes detailPixelReveal {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.detail-pixel-scope .title {
  font-family: var(--font-ui);
  letter-spacing: -0.02em;
}

#loadBarFill {
  transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-pixel-header .detail-pixel-kicker {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(165, 214, 255, 0.9);
}

.detail-pixel-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #f8fafc;
}

.detail-pixel-page-title--brand {
  background: linear-gradient(100deg, #e0f2fe 0%, #22d3ee 35%, #a78bfa 68%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.detail-pixel-subtitle {
  font-size: 1.0625rem;
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.82);
  max-width: 40rem;
}

.detail-pixel-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.1rem;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.35s ease;
}

.detail-pixel-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
}

.detail-pixel-status.status-green {
  background: rgba(43, 154, 102, 0.18);
  border-color: rgba(43, 154, 102, 0.5);
  color: #d1fae5;
}

.detail-pixel-status.status-amber {
  background: rgba(251, 188, 4, 0.14);
  border-color: rgba(251, 188, 4, 0.42);
  color: #fde68a;
}

.detail-pixel-status.status-blue {
  background: rgba(66, 133, 244, 0.16);
  border-color: rgba(66, 133, 244, 0.45);
  color: #bfdbfe;
}

.detail-preview.detail-pixel-surface {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 24, 0.58);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.detail-pixel-reveal {
  animation: detailPixelReveal 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.detail-pixel-vehicle {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.35rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: #ffffff;
}

.detail-hero {
  position: relative;
  border-radius: 0;
}

.detail-hero-divider {
  border-color: rgba(255, 255, 255, 0.08);
}

.detail-map-frame {
  border-color: rgba(255, 255, 255, 0.1);
}

.detail-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  border-radius: 2px;
  opacity: 0.95;
  pointer-events: none;
}

.detail-hero--wave::before {
  background: linear-gradient(90deg, #22d3ee, #38bdf8, #818cf8);
}
.detail-hero--wave {
  background: linear-gradient(180deg, rgba(14, 40, 52, 0.42) 0%, transparent 100%);
}

.detail-hero--aurora::before {
  background: linear-gradient(90deg, #34d399, #2dd4bf, #a78bfa);
}
.detail-hero--aurora {
  background: linear-gradient(180deg, rgba(12, 42, 38, 0.4) 0%, transparent 100%);
}

.detail-hero--dusk::before {
  background: linear-gradient(90deg, #fbbf24, #fb923c, #f472b6);
}
.detail-hero--dusk {
  background: linear-gradient(180deg, rgba(42, 24, 12, 0.38) 0%, transparent 100%);
}

.detail-hero--reef::before {
  background: linear-gradient(90deg, #60a5fa, #22d3ee, #4ade80);
}
.detail-hero--reef {
  background: linear-gradient(180deg, rgba(12, 28, 48, 0.42) 0%, transparent 100%);
}

.detail-pixel-vehicle--wave {
  background: linear-gradient(95deg, #f0fdfa 0%, #5eead4 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.detail-pixel-vehicle--aurora {
  background: linear-gradient(95deg, #ecfdf5 0%, #6ee7b7 38%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.detail-pixel-vehicle--dusk {
  background: linear-gradient(95deg, #fffbeb 0%, #fcd34d 35%, #fb923c 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.detail-pixel-vehicle--reef {
  background: linear-gradient(95deg, #eff6ff 0%, #7dd3fc 40%, #4ade80 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.detail-pixel-lede {
  font-size: clamp(1.05rem, 2.4vw, 1.2rem);
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.9);
  max-width: 44rem;
}

.detail-pixel-lede-label {
  font-weight: 500;
  color: rgba(148, 163, 184, 0.95);
  margin-right: 0.35rem;
}

.detail-pixel-lede-accent {
  font-weight: 700;
  color: #7dd3fc;
}

.detail-pixel-lede-dot {
  margin: 0 0.5rem;
  color: rgba(148, 163, 184, 0.6);
}

.detail-pixel-lede-strong {
  font-weight: 700;
  color: #f1f5f9;
}

.detail-pixel-section-label {
  font-size: 0.78125rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.95);
}

.detail-qr-copy-text {
  font-size: 1.125rem;
  line-height: 1.58;
  color: rgba(226, 232, 240, 0.92);
  max-width: 38rem;
}

.detail-pixel-btn-lg {
  padding: 0.75rem 1.35rem;
  border-radius: 9999px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.detail-panel-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(186, 198, 214, 0.95);
}

.detail-panel-title {
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-location-title {
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-load-weight {
  font-size: clamp(1.65rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-load-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 1rem 1.1rem;
  align-items: stretch;
}

/* Load overview stats only — truck/cargo fill styles below are unchanged */
.detail-load-stats-card {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.42) 0%, rgba(30, 41, 59, 0.22) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: var(--font-ui);
  box-shadow: var(--mm-shadow-card), 0 0 20px rgba(44, 30, 116, 0.08);
}

.detail-load-kicker {
  font-size: 0.75rem;
  font-family: var(--font-mid);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.92);
}

.detail-load-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.detail-load-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.36);
  color: rgba(226, 232, 240, 0.92);
  font-size: 0.76rem;
  font-weight: 700;
}

.detail-load-pill--low {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(6, 78, 59, 0.45);
  color: #a7f3d0;
}

.detail-load-pill--medium {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(120, 53, 15, 0.48);
  color: #fde68a;
}

.detail-load-pill--high {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(127, 29, 29, 0.48);
  color: #fecaca;
}

.detail-load-visual {
  position: relative;
  min-height: 12.8rem;
  height: 100%;
  border-radius: 1rem;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.22) 0%, rgba(30, 41, 59, 0.08) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 10px 24px rgba(2, 6, 23, 0.22);
  overflow: hidden;
}

.detail-load-truck-assembly {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.8rem;
  height: 11rem;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.detail-load-truck-shadow {
  content: "";
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 1.25rem;
  height: 0.9rem;
  border-radius: 9999px;
  background: rgba(2, 6, 23, 0.22);
  filter: blur(10px);
  z-index: 1;
}

.detail-load-trailer {
  position: relative;
  width: min(78%, 36rem);
  height: 6.9rem;
  border: 3px solid #2f3743;
  border-radius: 0.35rem;
  background: linear-gradient(180deg, #f8fafc 0%, #e5e7eb 74%, #d1d5db 100%);
  box-shadow: inset 0 8px 14px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: stretch;
  z-index: 4;
}

.detail-load-cargo-track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.detail-load-cargo-fill {
  position: relative;
  height: 100%;
  min-width: 1.5rem;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 44%, rgba(0, 0, 0, 0.12) 100%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0) 20px,
      rgba(255, 255, 255, 0.12) 20px,
      rgba(255, 255, 255, 0.12) 38px
    ),
    linear-gradient(90deg, #ef4444 0%, #fb7185 100%);
  border-right: 3px solid #2f3743;
  box-shadow:
    inset 0 0 18px rgba(255, 255, 255, 0.22),
    0 0 14px rgba(248, 113, 113, 0.45),
    0 0 30px rgba(244, 63, 94, 0.28);
}

.detail-load-cargo-fill::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.22) 45%, transparent 100%);
  mix-blend-mode: screen;
  opacity: 0.72;
}

.detail-load-cargo-fill--low {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, 0.12) 100%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0) 20px,
      rgba(255, 255, 255, 0.1) 20px,
      rgba(255, 255, 255, 0.1) 38px
    ),
    linear-gradient(90deg, #16a34a 0%, #4ade80 100%);
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, 0.2),
    0 0 14px rgba(74, 222, 128, 0.48),
    0 0 28px rgba(22, 163, 74, 0.25);
}

.detail-load-cargo-fill--medium {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 46%, rgba(0, 0, 0, 0.12) 100%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0) 20px,
      rgba(255, 255, 255, 0.1) 20px,
      rgba(255, 255, 255, 0.1) 38px
    ),
    linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, 0.2),
    0 0 14px rgba(251, 191, 36, 0.5),
    0 0 28px rgba(245, 158, 11, 0.25);
}

.detail-load-cargo-fill--high {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 44%, rgba(0, 0, 0, 0.12) 100%),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0) 20px,
      rgba(255, 255, 255, 0.12) 20px,
      rgba(255, 255, 255, 0.12) 38px
    ),
    linear-gradient(90deg, #ef4444 0%, #fb7185 100%);
}

.detail-load-cargo-percent {
  color: #fff;
  font-size: clamp(1.35rem, 2.5vw, 2.05rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.4);
}

.detail-load-cab {
  position: relative;
  width: 8.2rem;
  height: 8.2rem;
  margin-left: 0.4rem;
  z-index: 6;
}

.detail-load-cab-shell {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #f8fafc 0%, #e5e7eb 74%, #d1d5db 100%);
  border: 3px solid #2f3743;
  box-sizing: border-box;
  clip-path: polygon(0 100%, 100% 100%, 100% 36%, 84% 14%, 0 14%);
  position: relative;
}

.detail-load-windshield {
  position: absolute;
  top: 1.2rem;
  right: 0.2rem;
  width: 5.5rem;
  height: 2.9rem;
  background: linear-gradient(160deg, #334155 0%, #0f172a 100%);
  clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%);
  border-right: 2px solid #111827;
}

.detail-load-grille {
  position: absolute;
  bottom: 1.35rem;
  right: 0.45rem;
  width: 4.3rem;
  height: 2.25rem;
  background: repeating-linear-gradient(0deg, #e5e7eb 0, #e5e7eb 4px, #334155 5px);
  border: 2px solid #2f3743;
}

.detail-load-hitch {
  position: absolute;
  bottom: 1.9rem;
  left: -1.45rem;
  width: 2.7rem;
  height: 0.65rem;
  background: #1f2937;
  z-index: 1;
}

.detail-load-wheel {
  position: absolute;
  bottom: -1.35rem;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 9999px;
  background: #111827;
  border: 3px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.28), inset 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 12;
}

.detail-load-wheel-t1 { left: 1.5rem; }
.detail-load-wheel-t2 { left: 4.9rem; }
.detail-load-wheel-t3 { left: 8.3rem; }
.detail-load-wheel-c1 { left: 0.65rem; }
.detail-load-wheel-c2 { right: 0.7rem; }

.detail-load-rim {
  width: 1.16rem;
  height: 1.16rem;
  border-radius: 9999px;
  border: 1.5px solid #4b5563;
  background: radial-gradient(circle, #ffffff 0%, #9ca3af 100%);
}

.detail-panel-muted {
  font-size: 1rem;
  line-height: 1.45;
  color: rgba(186, 198, 214, 0.88);
}

.detail-stat-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(186, 198, 214, 0.92);
}

.detail-stat-number {
  font-size: clamp(1.75rem, 4vw, 2.125rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.detail-stat-eta {
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.detail-stat-sub {
  font-size: 1rem;
  line-height: 1.4;
  color: rgba(186, 198, 214, 0.88);
}

.detail-map-hint {
  font-size: 0.875rem;
  color: rgba(186, 198, 214, 0.75);
}

.detail-footnote-label {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.9);
}

.detail-footnote-body {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.78);
}

.detail-pixel-scope .detail-panel .btn-sm {
  padding: 0.55rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 9999px;
}

.detail-map-stage .btn.btn-sm {
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
}

.detail-pixel-scope .status-chip {
  font-size: 0.9375rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
}

.detail-pixel-btn {
  transition:
    transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.3s ease,
    filter 0.3s ease;
}

.detail-pixel-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.detail-pixel-btn:active {
  transform: translateY(0);
  transition-duration: 0.12s;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
}

@media (min-width: 640px) {
  .detail-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem 0.85rem;
  }
}

.detail-meta-label {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(186, 198, 214, 0.92);
  margin: 0;
  line-height: 1.25;
}

.detail-meta-value {
  margin: 0.28rem 0 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.98);
  word-break: break-word;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .detail-meta-value {
    font-size: 1.125rem;
  }
}

@media (min-width: 1024px) {
  .detail-meta-value {
    font-size: 1.1875rem;
  }
}

.detail-meta-value--mono {
  font-family: var(--font-code);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.detail-meta-from-pin {
  font-weight: 500;
  font-size: 0.92em;
  color: rgba(186, 198, 214, 0.88);
}

.detail-meta-cell--from {
  border-left-color: rgba(234, 40, 4, 0.4);
}

@media (min-width: 640px) {
  .detail-meta-value--mono {
    font-size: 1.05rem;
  }
}

.detail-meta-cell {
  padding: 0.55rem 0.7rem 0.6rem;
  border-radius: 14px;
  background: rgba(6, 10, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid rgba(148, 163, 184, 0.35);
  transition:
    border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.35s ease,
    transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.detail-meta-grid .detail-meta-cell:nth-child(4n + 1) {
  border-left-color: rgba(56, 189, 248, 0.65);
  background: linear-gradient(135deg, rgba(12, 32, 48, 0.65) 0%, rgba(6, 10, 20, 0.5) 100%);
}
.detail-meta-grid .detail-meta-cell:nth-child(4n + 2) {
  border-left-color: rgba(52, 211, 153, 0.6);
  background: linear-gradient(135deg, rgba(10, 38, 32, 0.55) 0%, rgba(6, 10, 20, 0.5) 100%);
}
.detail-meta-grid .detail-meta-cell:nth-child(4n + 3) {
  border-left-color: rgba(167, 139, 250, 0.6);
  background: linear-gradient(135deg, rgba(28, 18, 48, 0.55) 0%, rgba(6, 10, 20, 0.5) 100%);
}
.detail-meta-grid .detail-meta-cell:nth-child(4n + 4) {
  border-left-color: rgba(251, 191, 36, 0.58);
  background: linear-gradient(135deg, rgba(40, 28, 10, 0.52) 0%, rgba(6, 10, 20, 0.5) 100%);
}

.detail-meta-cell:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.detail-qr-band {
  padding: 1.1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-qr-tile {
  position: relative;
  padding: 1.35rem 1.5rem;
  border-radius: 28px;
  background: #ffffff;
  box-shadow:
    0 24px 60px rgba(66, 133, 244, 0.18),
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
  transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.4s ease;
}

.detail-qr-tile:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 32px 72px rgba(66, 133, 244, 0.22),
    0 16px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

.detail-qr-glow {
  position: absolute;
  inset: -18%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 45%,
    rgba(56, 189, 248, 0.22) 0%,
    rgba(99, 102, 241, 0.12) 42%,
    transparent 70%
  );
  opacity: 0.55;
  filter: blur(28px);
  pointer-events: none;
  animation: none;
}

.detail-qr-img {
  position: relative;
  z-index: 1;
  display: block;
  border-radius: 16px;
}

.detail-qr-caption {
  position: relative;
  z-index: 1;
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.detail-panel {
  border-radius: 20px;
}

.detail-pixel-panel {
  transition:
    transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.4s ease,
    border-color 0.35s ease;
}

.detail-pixel-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.detail-stat {
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(6, 10, 20, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.35s ease, background 0.35s ease;
}

.detail-stat:hover {
  border-color: rgba(66, 133, 244, 0.25);
  background: rgba(8, 14, 26, 0.5);
}

/* Larger map stage — more vertical room, Pixel-like clarity */
.detail-map-stage {
  width: 100%;
  min-height: 300px;
  border-radius: 22px;
  transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s ease;
}

.detail-map-stage:not(.detail-map-stage--split) {
  aspect-ratio: 4 / 3;
}

.detail-map-stage--split {
  aspect-ratio: unset;
  flex: 1 1 auto;
  min-height: 280px;
}

.detail-map-stage:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

@media (min-width: 640px) {
  .detail-map-stage:not(.detail-map-stage--split) {
    min-height: 360px;
  }
  .detail-map-stage--split {
    min-height: 300px;
  }
}

@media (min-width: 1024px) {
  .detail-map-stage:not(.detail-map-stage--split) {
    min-height: 440px;
    aspect-ratio: 16 / 11;
  }
  .detail-map-stage--split {
    min-height: 320px;
    flex: 1 1 320px;
  }
}

/* Leaflet basemap switcher (detail + fullscreen) */
.map-basemap-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .map-basemap-bar {
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
  }
}

.map-basemap-bar-label {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(186, 198, 214, 0.78);
  white-space: nowrap;
}

.map-basemap-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.map-basemap-btn {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(8, 14, 24, 0.72);
  color: rgba(226, 232, 240, 0.88);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.map-basemap-btn:hover {
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(15, 26, 40, 0.88);
  color: #f8fafc;
}

.map-basemap-btn.is-active {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.22), rgba(14, 23, 36, 0.92));
  color: #e0f2fe;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-basemap-bar--modal .map-basemap-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.62rem;
}

.detail-map-chip {
  padding: 0.6rem 0.95rem;
  border-radius: 14px;
  background: rgba(6, 10, 18, 0.88);
  border: 1px solid rgba(66, 133, 244, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  max-width: min(100%, 17rem);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.detail-map-chip .muted2 {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(186, 198, 214, 0.9);
}

.detail-map-chip .title {
  font-size: 1.0625rem;
  font-weight: 800;
}

#locationMapWrap.detail-map-stage #locationMap.leaflet-container,
#locationMapWrap.detail-map-stage .leaflet-container {
  min-height: 100% !important;
  height: 100% !important;
}

#locationMapWrap.detail-map-stage {
  min-height: 300px;
}

.detail-pixel-footnote {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-pixel-footnote p {
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* Detail page: bump Tailwind utility text overrides for readability */
#detailRoot .text-xs {
  font-size: 0.9375rem !important;
}
#detailRoot .text-sm {
  font-size: 1.0625rem !important;
  line-height: 1.5 !important;
}

@media (prefers-reduced-motion: reduce) {
  .detail-qr-glow {
    animation: none;
  }
  .detail-pixel-reveal {
    animation: none;
  }
  .detail-meta-cell:hover,
  .detail-qr-tile:hover,
  .detail-pixel-panel:hover,
  .detail-pixel-status:hover,
  .detail-pixel-btn:hover {
    transform: none;
  }
  .reveal {
    animation: none;
  }
}

/* ========== QR modal — larger than inline preview for scan / print ========== */
.qr-modal-panel {
  width: min(96vw, 38rem);
  max-width: 100%;
}

.qr-modal-img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  /* ~2× inline preview (~256px); caps keep modal on-screen */
  width: min(88vmin, 34rem);
  height: min(88vmin, 34rem);
  max-width: 100%;
  object-fit: contain;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .qr-modal-img {
    width: min(92vw, 34rem);
    height: min(92vw, 34rem);
  }
}

html.theme-light .qr-modal-img {
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}

/* ========== Light theme — premium: vivid blaze mesh, ink UI, layered depth ========== */
html.theme-light {
  color-scheme: light;
  --light-ink: #18181b;
  --light-ink-soft: #3f3f46;
  --light-muted: #52525b;
  --light-border: rgba(24, 24, 27, 0.1);
  --light-edge: rgba(255, 255, 255, 0.85);
  --light-accent: #ea2804;
  --light-blaze: linear-gradient(135deg, #ea2804 0%, #e11d48 40%, #c026d3 72%, #7c3aed 100%);
  --light-surface: linear-gradient(160deg, #ffffff 0%, #fffbfb 50%, #ffffff 100%);
  --light-surface-2: linear-gradient(168deg, #ffffff 0%, #fff7f5 42%, #fefce8 100%);
  --light-shadow-premium:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 2px 4px rgba(15, 23, 42, 0.04),
    0 20px 50px -12px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(234, 40, 4, 0.06);
}

html.theme-light body {
  background: linear-gradient(180deg, #fffdfb 0%, #f8fafc 38%, #fff5f3 100%);
  color: var(--light-ink);
  font-size: 1.0625rem;
  line-height: 1.56;
  letter-spacing: 0.01em;
}

html.theme-light .page-bg::before {
  animation: none;
  opacity: 1;
  /* Saturated “festival poster” blooms + clean white core (replicate/DESIGN.md) */
  background:
    radial-gradient(ellipse 100% 70% at -5% -15%, rgba(234, 40, 4, 0.28), transparent 55%),
    radial-gradient(ellipse 90% 65% at 105% -5%, rgba(219, 39, 119, 0.22), transparent 52%),
    radial-gradient(ellipse 80% 55% at 95% 100%, rgba(124, 58, 237, 0.14), transparent 50%),
    radial-gradient(ellipse 70% 50% at 8% 95%, rgba(251, 146, 60, 0.16), transparent 48%),
    radial-gradient(ellipse 60% 45% at 50% 40%, rgba(244, 114, 182, 0.08), transparent 58%),
    linear-gradient(185deg, #fff7f5 0%, #ffffff 28%, #fafafa 55%, #fffdfb 100%);
}

/* Fine grain — very subtle on white */
html.theme-light .page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='144' height='144'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 144px 144px;
}

html.theme-light .theme-toggle-btn {
  border-color: rgba(32, 32, 32, 0.14);
  background: linear-gradient(165deg, #ffffff 0%, #fafafa 45%, #f5f5f5 100%);
  color: var(--rep-dark);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 8px 22px rgba(15, 23, 42, 0.1);
}

html.theme-light .theme-toggle-btn:hover {
  border-color: rgba(234, 40, 4, 0.45);
  background: linear-gradient(165deg, #fff7ed 0%, #ffedd5 35%, #ffe4e6 100%);
  color: #0f172a;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 8px 24px rgba(234, 40, 4, 0.12);
}

/* Light: brand card — soft blaze wash + crisp ink border */
html.theme-light .app-brand-hero::after {
  display: none;
}

html.theme-light .app-brand-hero {
  background: linear-gradient(
    145deg,
    rgba(255, 247, 245, 0.95) 0%,
    #ffffff 35%,
    rgba(254, 252, 255, 0.98) 100%
  );
  background-color: #ffffff;
  border: 1px solid rgba(24, 24, 27, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 0 0 1px rgba(234, 40, 4, 0.1),
    0 4px 16px rgba(234, 40, 4, 0.08),
    0 28px 80px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  padding: 1.35rem 1.4rem 1.45rem;
  margin-bottom: 1.5rem;
}

html.theme-light .app-brand-byline {
  color: #64748b;
  text-shadow: none;
}

html.theme-light .app-brand-unit {
  color: #ea580c;
  font-weight: 800;
  text-shadow: none;
}

/* Replicate “blaze” on light: orange → red → magenta → pink */
html.theme-light .app-brand-title-line {
  background: linear-gradient(
    105deg,
    #ea2804 0%,
    #dc2626 18%,
    #e11d48 32%,
    #db2777 48%,
    #c026d3 62%,
    #e879f9 78%,
    #f472b6 90%,
    #fb7185 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.95));
}

html.theme-light .glass,
html.theme-light .glass-strong {
  background: var(--light-surface);
  background-color: #ffffff;
  border: 1px solid rgba(24, 24, 27, 0.09);
  box-shadow: var(--light-shadow-premium);
}

html.theme-light .glass-strong {
  background: linear-gradient(165deg, #ffffff 0%, #fffcfc 45%, #ffffff 100%);
  background-color: #ffffff;
  border: 1px solid rgba(24, 24, 27, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 2px 8px rgba(234, 40, 4, 0.06),
    0 24px 60px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(234, 40, 4, 0.07);
}

html.theme-light .muted,
html.theme-light .dashboard-page-lede,
html.theme-light .filter-panel-desc {
  color: #646464 !important;
}

html.theme-light .title,
html.theme-light .dashboard-page-title,
html.theme-light .filter-panel-title {
  color: #202020 !important;
}

/* Dashboard page title — Replicate “blaze” gradient text */
html.theme-light .dashboard-page-head .dashboard-page-title,
html.theme-light .dashboard-page-head .title {
  background: linear-gradient(
    102deg,
    #ea2804 0%,
    #dc2626 18%,
    #e11d48 36%,
    #db2777 52%,
    #c026d3 68%,
    #ea580c 86%,
    #f97316 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 1));
}

/* Lede on page (readable on white / soft tint) */
html.theme-light .dashboard-page-head .dashboard-page-lede,
html.theme-light .dashboard-page-head .muted {
  color: #646464 !important;
}

/* Lede inside frosted dashboard head panel */
html.theme-light .dashboard-head-panel .dashboard-page-head .dashboard-page-lede,
html.theme-light .dashboard-head-panel .dashboard-page-head .muted {
  color: #64748b !important;
}

html.theme-light .detail-pixel-header .detail-pixel-kicker {
  color: #dd4425 !important;
  text-shadow: none;
  letter-spacing: 0.12em;
}

html.theme-light .detail-pixel-header .detail-pixel-page-title {
  background: linear-gradient(
    102deg,
    #ea2804 0%,
    #dc2626 22%,
    #e11d48 44%,
    #db2777 62%,
    #c026d3 82%,
    #f97316 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  filter: none;
}

html.theme-light .detail-pixel-header .detail-pixel-page-title--brand {
  background: linear-gradient(
    102deg,
    #ea2804 0%,
    #be123c 35%,
    #db2777 55%,
    #ea580c 78%,
    #f43f5e 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  filter: none;
}

html.theme-light .detail-pixel-header .detail-pixel-subtitle {
  color: #646464 !important;
}

/* Create / edit / similar top-of-page titles */
html.theme-light .app-shell > .flex .title.text-3xl,
html.theme-light .app-shell > .flex .title.text-4xl {
  background: linear-gradient(
    102deg,
    #ea2804 0%,
    #dc2626 25%,
    #db2777 55%,
    #c026d3 80%,
    #ea580c 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
}

html.theme-light .app-shell > .flex .muted {
  color: #646464 !important;
}

html.theme-light .field {
  background: #ffffff;
  border-color: rgba(32, 32, 32, 0.18);
  color: #202020;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) inset;
}

html.theme-light .field::placeholder {
  color: rgba(100, 100, 100, 0.65);
}

html.theme-light .field:focus {
  background: #ffffff;
  border-color: rgba(234, 40, 4, 0.45);
  box-shadow:
    0 0 0 3px rgba(234, 40, 4, 0.1),
    0 1px 2px rgba(15, 23, 42, 0.06) inset;
}

html.theme-light .btn {
  background: #ffffff;
  border: 1px solid rgba(32, 32, 32, 0.2);
  color: #202020;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 6px 20px rgba(15, 23, 42, 0.07);
}

html.theme-light .btn:hover {
  border-color: rgba(234, 40, 4, 0.35);
  background: linear-gradient(180deg, #ffffff 0%, #fff7f5 100%);
}

html.theme-light .btn-ghost {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(32, 32, 32, 0.16);
}

html.theme-light .btn-primary {
  background: linear-gradient(165deg, #ff5c33 0%, #ea2804 42%, #c41e04 100%);
  color: #fcfcfc;
  border-color: rgba(32, 32, 32, 0.12);
  font-weight: 600;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 8px 28px rgba(234, 40, 4, 0.28);
}

html.theme-light .stat-tile {
  border-color: rgba(32, 32, 32, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 14px 40px rgba(15, 23, 42, 0.06);
}

html.theme-light .stat-tile--sky::before {
  background: linear-gradient(
    155deg,
    rgba(224, 242, 254, 0.95) 0%,
    rgba(239, 246, 255, 0.9) 45%,
    rgba(250, 248, 255, 0.92) 100%
  );
}

html.theme-light .stat-tile--emerald::before {
  background: linear-gradient(
    155deg,
    rgba(209, 250, 229, 0.88) 0%,
    rgba(236, 253, 245, 0.92) 50%,
    rgba(245, 250, 252, 0.9) 100%
  );
}

html.theme-light .stat-tile--amber::before {
  background: linear-gradient(
    155deg,
    rgba(254, 243, 199, 0.9) 0%,
    rgba(255, 251, 235, 0.95) 48%,
    rgba(250, 245, 238, 0.9) 100%
  );
}

html.theme-light .stat-tile--violet::before {
  background: linear-gradient(
    155deg,
    rgba(237, 233, 254, 0.92) 0%,
    rgba(245, 243, 255, 0.95) 50%,
    rgba(248, 250, 252, 0.9) 100%
  );
}

html.theme-light .stat-tile .stat-tile-icon {
  border-color: rgba(15, 23, 42, 0.08);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.75), rgba(230, 238, 248, 0.5));
  color: #0369a1;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

html.theme-light .stat-tile--emerald .stat-tile-icon {
  color: #047857;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(209, 250, 229, 0.45));
}

html.theme-light .stat-tile--amber .stat-tile-icon {
  color: #b45309;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(254, 243, 199, 0.5));
}

html.theme-light .stat-tile--violet .stat-tile-icon {
  color: #6d28d9;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(237, 233, 254, 0.55));
}

html.theme-light .stat-tile-label {
  color: #64748b;
}

html.theme-light .stat-tile-value {
  color: #0f172a;
}

html.theme-light .stat-tile-value--emerald {
  color: #047857;
}
html.theme-light .stat-tile-value--amber {
  color: #b45309;
}
html.theme-light .stat-tile-value--violet {
  color: #6d28d9;
}

html.theme-light .filter-label {
  color: #475569;
}

html.theme-light .map-basemap-btn {
  background: linear-gradient(180deg, #fffefb 0%, #e8eef6 100%);
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

html.theme-light .map-basemap-btn:hover {
  border-color: rgba(14, 165, 233, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 100%);
  color: #0f172a;
}

html.theme-light .map-basemap-btn.is-active {
  border-color: rgba(14, 165, 233, 0.5);
  background: linear-gradient(165deg, #e0f2fe 0%, #f0f9ff 55%, #fdfcfa 100%);
  color: #0369a1;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 4px 14px rgba(14, 165, 233, 0.14);
}

html.theme-light .map-basemap-bar-label {
  color: #64748b;
}

html.theme-light .app-toast {
  background: linear-gradient(155deg, #fffefb 0%, #eef4fb 100%);
  border-color: rgba(15, 23, 42, 0.11);
  color: #0f172a;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 16px 40px rgba(15, 23, 42, 0.08);
}

html.theme-light .app-toast .muted {
  color: #475569 !important;
}

html.theme-light .dispatch-row {
  background: linear-gradient(
    168deg,
    rgba(255, 251, 248, 0.98) 0%,
    rgba(255, 243, 237, 0.95) 42%,
    rgba(254, 252, 251, 0.99) 100%
  );
  border-top-color: rgba(234, 88, 12, 0.22);
  border-bottom-color: rgba(15, 23, 42, 0.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 0 1px rgba(234, 40, 4, 0.05),
    0 18px 48px rgba(15, 23, 42, 0.09);
}

html.theme-light .dispatch-row .muted,
html.theme-light .dispatch-row .muted2 {
  color: #64748b !important;
}

html.theme-light .detail-meta-label {
  color: #64748b;
}

html.theme-light .detail-meta-value {
  color: #0f172a;
}

html.theme-light select.field,
html.theme-light select {
  color: #0f172a !important;
  background: linear-gradient(180deg, #e2edf8 0%, #d4e2f4 100%) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) inset;
}

html.theme-light .status-chip {
  background: linear-gradient(180deg, #f8fafc 0%, #e8edf5 100%);
  border-color: rgba(15, 23, 42, 0.11);
  color: #334155;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

html.theme-light .leaflet-popup-content-wrapper,
html.theme-light .leaflet-popup-tip {
  background: linear-gradient(165deg, #fffefb 0%, #eef2f8 100%);
  color: #0f172a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.11);
}

html.theme-light .detail-pixel-scope .detail-pixel-subtitle {
  color: #475569;
}

html.theme-light .detail-panel-label {
  color: #64748b;
}

html.theme-light .detail-footnote-body {
  color: #475569;
}

/* Light theme — dashboard CHT cards (Tailwind opacity utilities need explicit overrides) */
html.theme-light .dispatch-row .muted {
  color: #475569 !important;
}

html.theme-light .dispatch-row .muted2 {
  color: #334155 !important;
}

html.theme-light .dispatch-row .text-white\/80,
html.theme-light .dispatch-row .text-white\/90 {
  color: #1e293b !important;
}

html.theme-light .dispatch-row .cht-card-inner-grid .muted,
html.theme-light .dispatch-row .cht-card-inner-grid .muted2 {
  color: #475569 !important;
}

html.theme-light .dispatch-row .cht-card-inner-grid .title {
  color: #0f172a !important;
}

html.theme-light .dispatch-row--mint .cht-card-vehicle {
  background: linear-gradient(95deg, #064e3b 0%, #047857 45%, #0d9488 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html.theme-light .dispatch-row--iris .cht-card-vehicle {
  background: linear-gradient(95deg, #3730a3 0%, #4f46e5 50%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html.theme-light .dispatch-row--saffron .cht-card-vehicle {
  background: linear-gradient(95deg, #9a3412 0%, #c2410c 48%, #b45309 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html.theme-light .dispatch-row--ocean .cht-card-vehicle {
  background: linear-gradient(95deg, #075985 0%, #0369a1 50%, #0284c7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html.theme-light .dispatch-row .glass {
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 247, 243, 0.94) 100%
  ) !important;
  border-color: rgba(234, 88, 12, 0.14) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 8px 24px rgba(234, 40, 4, 0.04) !important;
}

html.theme-light .dispatch-row .status-chip {
  background: linear-gradient(180deg, #faf8f5 0%, #e8edf5 100%);
  border-color: rgba(15, 23, 42, 0.12);
  color: #1e293b;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

html.theme-light .dispatch-row a.text-red-300,
html.theme-light .dispatch-row .text-red-300 {
  color: #b91c1c !important;
}

html.theme-light .dashboard-map-section .text-sky-300 {
  color: #0369a1 !important;
}

html.theme-light .dashboard-map-section .muted2 {
  color: #475569 !important;
}

html.theme-light .fleet-map-embed,
html.theme-light .fleet-map-shell {
  background: linear-gradient(165deg, #dde5ee 0%, #e8ecf2 40%, #dfe8f0 100%) !important;
  border-color: rgba(15, 23, 42, 0.11) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

html.theme-light #dashboardMap .leaflet-tile-pane,
html.theme-light #fleetMapFullscreen .leaflet-tile-pane,
html.theme-light #locationMap .leaflet-tile-pane,
html.theme-light #detailMapFullscreen .leaflet-tile-pane {
  background: linear-gradient(180deg, #e2e8ed 0%, #d8e2ec 100%) !important;
}

html.theme-light .leaflet-container {
  background: linear-gradient(165deg, #e0e8f0 0%, #d9e3ee 100%) !important;
}

html.theme-light .leaflet-control-zoom a {
  background: linear-gradient(180deg, #fffefb 0%, #e8eef4 100%) !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

/* Detail / public page — base type (surfaces: see .detail-pixel-scope block below) */
html.theme-light .detail-pixel-kicker {
  color: #c2410c !important;
  font-weight: 600;
  letter-spacing: 0.08em;
}

html.theme-light .detail-pixel-vehicle--wave,
html.theme-light .detail-pixel-vehicle--aurora,
html.theme-light .detail-pixel-vehicle--dusk,
html.theme-light .detail-pixel-vehicle--reef {
  background: linear-gradient(95deg, #0f172a 0%, #1d4ed8 40%, #0369a1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

html.theme-light .detail-pixel-lede-label {
  color: #64748b !important;
}

html.theme-light .detail-pixel-lede-accent,
html.theme-light .detail-pixel-lede-strong {
  color: #0f172a !important;
}

html.theme-light .detail-qr-copy-text {
  color: #334155 !important;
}

html.theme-light .detail-meta-value.text-sky-200 {
  color: #0369a1 !important;
}

html.theme-light .detail-qr-caption {
  color: #475569 !important;
}

html.theme-light .detail-pixel-status {
  background: linear-gradient(155deg, #7dd3fc 0%, #60a5fa 50%, #38bdf8 100%);
  border-color: rgba(14, 165, 233, 0.4);
  color: #0c4a6e !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 8px 22px rgba(14, 165, 233, 0.2);
}

html.theme-light .detail-pixel-status.status-green {
  color: #ffffff !important;
  background: linear-gradient(155deg, #2b9a66 0%, #208056 100%);
  border-color: rgba(43, 154, 102, 0.55);
}

html.theme-light .detail-pixel-status.status-amber {
  color: #422006 !important;
  background: linear-gradient(155deg, #fcd34d 0%, #f59e0b 100%);
  border-color: rgba(245, 158, 11, 0.5);
}

html.theme-light .detail-pixel-status.status-blue {
  color: #eff6ff !important;
  background: linear-gradient(155deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(147, 197, 253, 0.45);
}

html.theme-light .glass-strong .text-white {
  color: #0f172a !important;
}

html.theme-light .dashboard-page-head .btn-primary {
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
}

/* Admin forms — checkbox / option text readable in light mode */
html.theme-light .nature-option-label {
  color: var(--light-ink-soft) !important;
}

/* Light — page section titles (create/edit/dashboard headers) */
html.theme-light .content .title.text-3xl,
html.theme-light .content .title.text-4xl,
html.theme-light .dashboard-page-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

html.theme-light .detail-panel-muted,
html.theme-light .detail-stat-sub {
  color: var(--light-muted) !important;
}

/* QR modal shell in light */
html.theme-light #qrModalBackdrop .glass-strong {
  background: var(--light-surface-2);
  background-color: #ffffff;
  border-color: rgba(234, 40, 4, 0.14);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 28px 72px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(234, 40, 4, 0.06);
}

html.theme-light #qrModalBackdrop .title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

html.theme-light .filter-panel {
  border-color: rgba(24, 24, 27, 0.09);
  background: linear-gradient(165deg, #ffffff 0%, #fffdfb 100%);
  background-color: #ffffff;
  box-shadow: var(--light-shadow-premium);
}

/* ========== Light: public dispatch — clean white + Replicate blaze accents ========== */
html.theme-light .detail-pixel-scope .detail-preview.detail-pixel-surface {
  background: linear-gradient(
    165deg,
    #ffffff 0%,
    #fffbfb 35%,
    #fff7f5 70%,
    #ffffff 100%
  );
  border: 1px solid rgba(32, 32, 32, 0.1);
  border-left: 3px solid rgba(234, 40, 4, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.9) inset,
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 20px 56px rgba(234, 40, 4, 0.06),
    0 32px 80px rgba(15, 23, 42, 0.06);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  backdrop-filter: blur(12px) saturate(130%);
}

html.theme-light .detail-meta-from-pin {
  color: #8d8d8d;
}

html.theme-light .detail-pixel-scope .detail-hero-divider {
  border-color: rgba(234, 40, 4, 0.15);
}

html.theme-light .detail-pixel-scope .detail-hero--wave {
  background: linear-gradient(180deg, rgba(254, 215, 170, 0.5) 0%, rgba(254, 202, 202, 0.35) 55%, transparent 100%);
}

html.theme-light .detail-pixel-scope .detail-hero--aurora {
  background: linear-gradient(180deg, rgba(251, 207, 232, 0.45) 0%, rgba(196, 181, 253, 0.28) 50%, transparent 100%);
}

html.theme-light .detail-pixel-scope .detail-hero--dusk {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.55) 0%, rgba(254, 202, 202, 0.32) 55%, transparent 100%);
}

html.theme-light .detail-pixel-scope .detail-hero--reef {
  background: linear-gradient(180deg, rgba(252, 231, 243, 0.55) 0%, rgba(167, 243, 208, 0.25) 55%, transparent 100%);
}

html.theme-light .detail-pixel-scope .detail-pixel-lede {
  color: #202020;
}

html.theme-light .detail-pixel-scope .detail-pixel-lede-accent {
  color: #c41e04 !important;
}

html.theme-light .detail-pixel-scope .detail-pixel-lede-strong {
  color: #0f172a !important;
}

html.theme-light .detail-pixel-scope .detail-pixel-section-label {
  color: #dd4425 !important;
}

html.theme-light .detail-pixel-scope .detail-map-hint {
  color: #646464;
}

html.theme-light .detail-pixel-scope .glass,
html.theme-light .detail-pixel-scope .glass-strong {
  background: #ffffff;
  background-color: #ffffff;
  border: 1px solid rgba(24, 24, 27, 0.09);
  box-shadow: var(--light-shadow-premium);
}

html.theme-light .detail-pixel-scope .detail-panel.detail-pixel-panel.glass-strong {
  background: #ffffff;
  background-color: #ffffff;
}

html.theme-light .detail-pixel-scope .detail-meta-grid .detail-meta-cell:nth-child(4n + 1) {
  border-left-color: rgba(234, 40, 4, 0.5);
  background: linear-gradient(135deg, #fff8f6 0%, #ffffff 100%);
  border-color: rgba(32, 32, 32, 0.08);
}

html.theme-light .detail-pixel-scope .detail-meta-grid .detail-meta-cell:nth-child(4n + 2) {
  border-left-color: rgba(43, 154, 102, 0.55);
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border-color: rgba(32, 32, 32, 0.08);
}

html.theme-light .detail-pixel-scope .detail-meta-grid .detail-meta-cell:nth-child(4n + 3) {
  border-left-color: rgba(219, 39, 119, 0.45);
  background: linear-gradient(135deg, #fdf2f8 0%, #ffffff 100%);
  border-color: rgba(32, 32, 32, 0.08);
}

html.theme-light .detail-pixel-scope .detail-meta-grid .detail-meta-cell:nth-child(4n + 4) {
  border-left-color: rgba(234, 88, 12, 0.5);
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border-color: rgba(32, 32, 32, 0.08);
}

html.theme-light .detail-pixel-scope .detail-meta-label {
  color: #646464;
}

html.theme-light .detail-pixel-scope .detail-meta-value {
  color: #202020;
}

html.theme-light .detail-pixel-scope .detail-panel-label {
  color: #4e4e4e;
}

html.theme-light .detail-pixel-scope .detail-panel-muted {
  color: #646464;
}

html.theme-light .detail-pixel-scope .detail-stat {
  background: linear-gradient(145deg, #fafafa 0%, #ffffff 100%);
  border-color: rgba(32, 32, 32, 0.1);
}

html.theme-light .detail-pixel-scope .detail-stat:hover {
  border-color: rgba(234, 40, 4, 0.25);
  background: linear-gradient(145deg, #ffffff 0%, #fff7f5 100%);
}

html.theme-light .detail-pixel-scope .detail-stat-label {
  color: #646464;
}

html.theme-light .detail-pixel-scope .detail-stat .title,
html.theme-light .detail-pixel-scope .detail-stat-number,
html.theme-light .detail-pixel-scope .detail-stat-eta {
  color: #202020;
}

html.theme-light .detail-pixel-scope .detail-stat-sub {
  color: #64748b !important;
}

html.theme-light .detail-pixel-scope .detail-load-track {
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

html.theme-light .detail-qr-aside {
  padding: 1.15rem 1.05rem;
  border-radius: 1.35rem;
  background: linear-gradient(
    155deg,
    #fffefb 0%,
    #fff7f5 38%,
    #fef3f2 100%
  );
  border: 1px solid rgba(234, 40, 4, 0.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 0 0 1px rgba(225, 29, 72, 0.06),
    0 20px 50px rgba(15, 23, 42, 0.08),
    0 4px 20px rgba(234, 40, 4, 0.06);
}

html.theme-light .detail-pixel-scope .detail-qr-copy-text {
  color: #0f172a !important;
}

html.theme-light .detail-pixel-scope .detail-qr-tile {
  background: linear-gradient(165deg, #ffffff 0%, #fafafa 55%, #f4f4f5 100%);
  border: 1px solid rgba(24, 24, 27, 0.1);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 1) inset,
    0 0 0 1px rgba(234, 40, 4, 0.06),
    0 16px 40px rgba(15, 23, 42, 0.1);
}

html.theme-light .detail-pixel-scope .detail-qr-img {
  background: #ffffff;
  padding: 0.65rem;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

html.theme-light .detail-pixel-scope .detail-qr-caption {
  color: #52525b !important;
}

html.theme-light .detail-pixel-scope #locationMapWrap.detail-map-frame {
  border-color: rgba(234, 88, 12, 0.28) !important;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.6) inset,
    0 18px 44px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(234, 40, 4, 0.05);
}

html.theme-light .location-map-fallback {
  background: linear-gradient(165deg, #f8fafc 0%, #e2e8f0 100%) !important;
  color: #334155;
}

html.theme-light .detail-pixel-scope .map-basemap-bar-label {
  color: rgba(51, 65, 85, 0.92);
}

html.theme-light .detail-pixel-scope .map-basemap-btn {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(24, 24, 27, 0.12);
  color: #334155;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 1) inset;
}

html.theme-light .detail-pixel-scope .map-basemap-btn:hover {
  border-color: rgba(234, 88, 12, 0.35);
  background: linear-gradient(180deg, #fffdfb 0%, #fff7ed 100%);
  color: #0f172a;
}

html.theme-light .detail-pixel-scope .map-basemap-btn.is-active {
  border-color: rgba(234, 40, 4, 0.45);
  background: linear-gradient(180deg, #ea580c 0%, #ea2804 100%);
  color: #fff7ed;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 4px 16px rgba(234, 40, 4, 0.28);
}

html.theme-light .detail-pixel-footnote {
  padding: 1rem 0.75rem;
  border-radius: 16px;
  background: linear-gradient(
    95deg,
    rgba(254, 243, 199, 0.45) 0%,
    rgba(254, 226, 226, 0.35) 50%,
    transparent 100%
  );
  border: 1px solid rgba(234, 88, 12, 0.14);
}

html.theme-light .detail-pixel-scope .status-chip.status-blue {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #eff6ff !important;
  border-color: rgba(147, 197, 253, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

html.theme-light .detail-pixel-scope .detail-meta-cell:hover {
  border-color: rgba(234, 40, 4, 0.22);
}

/* Estimated current CHT location marker */
.cht-estimated-marker {
  background: transparent;
  border: 0;
}

.cht-estimated-marker__dot {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 5px;
  top: 5px;
  border-radius: 999px;
  background: #fb7185;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.45), 0 3px 10px rgba(244, 63, 94, 0.35);
}

.cht-estimated-marker__pulse {
  position: absolute;
  width: 20px;
  height: 20px;
  left: 0;
  top: 0;
  border-radius: 999px;
  border: 2px solid rgba(244, 63, 94, 0.55);
  animation: cht-estimated-pulse 1.6s ease-out infinite;
}

@keyframes cht-estimated-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.9;
  }
  80% {
    transform: scale(1.8);
    opacity: 0;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* Google Maps–style navigation pin for estimated position along route */
.cht-nav-pin-leaflet {
  background: transparent !important;
  border: 0 !important;
}

.cht-nav-pin {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
}

.cht-nav-pin__disc {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(165deg, #4a8eff 0%, #1a73e8 45%, #1558b8 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cht-nav-pin__arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid #ffffff;
  margin-top: -1px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.15));
}

.funds-table th,
.funds-table td {
  vertical-align: middle;
}

/* —— Funds summary dashboard —— */
.funds-hero {
  position: relative;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.92) 45%, rgba(15, 23, 42, 0.98) 100%);
}

.funds-hero-glow {
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 70%;
  background: radial-gradient(ellipse at 30% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.12), transparent 50%);
  pointer-events: none;
}

.funds-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.funds-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.funds-pill--ok {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.funds-pill--amber {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.funds-pill--danger {
  color: #fecaca;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.4);
}

.funds-pill--muted {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.funds-stat-card {
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.funds-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.95);
}

.funds-stat-value {
  margin-top: 0.35rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.funds-stat-value--sky {
  color: #7dd3fc;
}

.funds-stat-value--danger {
  color: #fda4af;
}

.funds-stat-meta {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.95);
}

.funds-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(186, 230, 253, 0.9);
}

.funds-panel {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.funds-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.funds-track--soft {
  height: 10px;
}

.funds-track--danger {
  border-color: rgba(251, 113, 133, 0.45);
}

.funds-track-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.funds-track-fill--spent {
  background: linear-gradient(90deg, #22d3ee, #38bdf8 40%, #818cf8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.funds-track--danger .funds-track-fill--spent {
  background: linear-gradient(90deg, #fb7185, #f43f5e 55%, #f97316);
  box-shadow: 0 0 14px rgba(244, 63, 94, 0.4);
}

.funds-track-fill--coverage {
  background: linear-gradient(90deg, #34d399, #10b981);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.funds-donut-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.funds-donut {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.funds-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 140px;
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.95);
}

.funds-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

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

.funds-legend-amt {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.68rem;
  color: #bae6fd;
}

.funds-stack-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.35rem;
}

.funds-stack-seg {
  min-width: 2px;
  transition: width 0.4s ease;
}

.funds-mix-legend {
  list-style: none;
  margin: 0;
  padding: 0;
}

.funds-mix-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.92);
}

.funds-mix-count {
  margin-left: auto;
  font-weight: 700;
  color: #f1f5f9;
}

.funds-mix-pct {
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: right;
  color: #94a3b8;
  font-size: 0.72rem;
}

.funds-month-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.25rem;
  height: 152px;
  padding: 0.25rem 0 0;
}

.funds-month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.funds-month-bar {
  flex: 1;
  width: 100%;
  max-width: 22px;
  margin: 0 auto;
  align-self: flex-end;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.95), rgba(14, 165, 233, 0.55));
  border: 1px solid rgba(56, 189, 248, 0.35);
  min-height: 2px;
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

.funds-month-lbl {
  font-size: 0.62rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  font-weight: 600;
}

.funds-hbar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.funds-hbar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  transition: width 0.45s ease;
}

/* Map: depot start dot + Google-style red destination pin */
.cht-depot-dot-leaflet,
.cht-red-pin-leaflet {
  background: transparent !important;
  border: 0 !important;
}

.cht-depot-dot {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cht-depot-dot__ring {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.95), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.cht-depot-dot__core {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fdba74 0%, #ea580c 100%);
}

.cht-red-pin-svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.38));
}

.cht-red-pin-svg--sm {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.cht-depot-dot--compact .cht-depot-dot__ring {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.cht-depot-dot--compact .cht-depot-dot__core {
  width: 8px;
  height: 8px;
}

.cht-depot-dot--mobile .cht-depot-dot__ring {
  width: 11px;
  height: 11px;
  border-width: 2px;
}

.cht-depot-dot--mobile .cht-depot-dot__core {
  width: 5px;
  height: 5px;
}

.cht-red-pin-leaflet--mobile .cht-red-pin-svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.funds-plan-card {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.funds-plan-card-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
}

.funds-plan-card-value {
  margin-top: 0.4rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
}

.funds-plan-card-meta {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(148, 163, 184, 0.95);
}

.funds-plan-note {
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(186, 230, 253, 0.92);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(30, 58, 138, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.22);
}

.funds-hbar-track--q {
  height: 10px;
}

.funds-hbar-fill--q {
  background: linear-gradient(90deg, #22d3ee, #818cf8);
}

.funds-month-col.funds-month--peak .funds-month-bar {
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.55), 0 4px 14px rgba(245, 158, 11, 0.2);
}

.funds-month-col.funds-month--quiet .funds-month-bar {
  opacity: 0.78;
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35);
}

.funds-month-col.funds-month--mid .funds-month-bar {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.funds-month-vol {
  margin-top: 0.15rem;
  font-size: 0.58rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #64748b;
}

html.theme-light .funds-plan-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(14, 165, 233, 0.15);
}

html.theme-light .funds-plan-card-value {
  color: #0f172a;
}

html.theme-light .funds-plan-note {
  background: rgba(224, 242, 254, 0.9);
  border-color: rgba(14, 165, 233, 0.2);
  color: #0c4a6e;
}

html.theme-light .funds-hero {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  border-color: rgba(14, 165, 233, 0.2);
}

html.theme-light .funds-hero-glow {
  background: radial-gradient(ellipse at 30% 0%, rgba(14, 165, 233, 0.12), transparent 55%);
}

html.theme-light .funds-stat-card,
html.theme-light .funds-panel {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(15, 23, 42, 0.08);
}

html.theme-light .funds-stat-value {
  color: #0f172a;
}

html.theme-light .funds-stat-value--sky {
  color: #0369a1;
}

html.theme-light .funds-panel-title {
  color: #0369a1;
}

html.theme-light .funds-month-bar {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
}

html.theme-light .eta-badge--overdue {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

html.theme-light .eta-badge--urgent {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

html.theme-light .eta-badge--soon {
  color: #075985;
  background: #e0f2fe;
  border-color: #bae6fd;
}

/* ===== Light: layout width (Replicate white canvas stays from rules above) ===== */
html.theme-light .content,
html.theme-light .app-shell {
  max-width: min(1480px, 94vw);
}

html.theme-light .glass,
html.theme-light .glass-strong,
html.theme-light .dispatch-row,
html.theme-light .detail-panel,
html.theme-light .stat-tile {
  border-radius: 20px;
}

html.theme-light .field,
html.theme-light select.field,
html.theme-light select {
  border-radius: 14px;
  min-height: 46px;
}

html.theme-light .btn {
  min-height: 42px;
}

html.theme-light .btn.btn-sm {
  min-height: 36px;
}

html.theme-light .dispatch-row .btn {
  border-radius: 10px;
}

html.theme-light .detail-load-visual {
  background: linear-gradient(165deg, #e2e8f0 0%, #d4deea 100%);
  border-color: rgba(51, 65, 85, 0.2);
}

html.theme-light .detail-load-stats-card {
  border-color: rgba(100, 116, 139, 0.28);
  background: linear-gradient(165deg, rgba(248, 250, 252, 0.92) 0%, rgba(226, 232, 240, 0.86) 100%);
}

html.theme-light .detail-load-cargo-percent {
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.4),
    0 2px 6px rgba(51, 65, 85, 0.35);
}

html.theme-light .detail-load-kicker {
  color: rgba(71, 85, 105, 0.92);
}

html.theme-light .detail-load-pill {
  border-color: rgba(100, 116, 139, 0.25);
  background: rgba(255, 255, 255, 0.75);
  color: #334155;
}

html:not(.theme-light) .detail-load-trailer {
  border-color: #374151;
  background: linear-gradient(180deg, #dbe1e8 0%, #cbd5e1 74%, #94a3b8 100%);
}

html:not(.theme-light) .detail-load-cab-shell {
  border-color: #374151;
  background: linear-gradient(180deg, #dbe1e8 0%, #cbd5e1 74%, #94a3b8 100%);
}

@media (max-width: 1024px) {
  .detail-load-layout {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .detail-load-visual {
    height: 12.5rem;
    min-height: 12.5rem;
  }

  .detail-load-stats-card {
    padding: 0.8rem 0.9rem;
  }

  .detail-load-truck-assembly {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.7rem;
    height: 10.4rem;
  }

  .detail-load-trailer {
    width: calc(100% - 8.2rem);
    min-width: 19rem;
    height: 6.2rem;
  }

  .detail-load-cab {
    width: 7.6rem;
    height: 7.6rem;
    margin-left: 0.25rem;
  }

  .detail-load-cargo-percent {
    font-size: clamp(1.1rem, 4vw, 1.7rem);
  }

  .detail-load-wheel-t3 {
    left: 7.6rem;
  }
}

@media (max-width: 768px) {
  .detail-load-layout {
    gap: 0.75rem;
  }

  .detail-load-visual {
    height: 10.75rem;
    min-height: 10.75rem;
    border-radius: 0.9rem;
  }

  .detail-load-truck-assembly {
    left: 0.25rem;
    right: 0.25rem;
    bottom: 0.55rem;
    height: 8.9rem;
    justify-content: center;
    transform: scale(0.82);
    transform-origin: center bottom;
  }

  .detail-load-trailer {
    width: 20.6rem;
    min-width: 0;
    height: 5.4rem;
  }

  .detail-load-cab {
    width: 6.5rem;
    height: 6.5rem;
    margin-left: 0.2rem;
  }

  .detail-load-wheel {
    width: 2.1rem;
    height: 2.1rem;
  }

  .detail-load-wheel-t1 { left: 1.25rem; }
  .detail-load-wheel-t2 { left: 4.15rem; }
  .detail-load-wheel-t3 { left: 7.05rem; }
  .detail-load-wheel-c1 { left: 0.56rem; }
  .detail-load-wheel-c2 { right: 0.58rem; }

  .detail-load-cargo-percent {
    font-size: clamp(1rem, 5vw, 1.45rem);
  }
}

@media (max-width: 520px) {
  .detail-load-visual {
    height: 9.8rem;
  }

  .detail-load-truck-assembly {
    transform: scale(0.72);
    transform-origin: center bottom;
    bottom: 0.45rem;
  }
}

/* ----- Funds portal: spend position split bar ------------------------------- */
.funds-pos-bar {
  display: flex;
  height: 14px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.funds-pos-seg {
  height: 100%;
  transition: width 0.45s ease;
}

.funds-pos-seg--realized {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.funds-pos-seg--inflight {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.funds-pos-legend {
  font-size: 0.82rem;
  line-height: 1.3;
}

.funds-pos-legend > li {
  display: grid;
  grid-template-columns: 14px auto 1fr auto;
  column-gap: 0.6rem;
  align-items: baseline;
}

.funds-pos-amt {
  text-align: right;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.85rem;
}

.funds-pos-sub {
  grid-column: 2 / -1;
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.funds-dot--realized {
  background: #8b5cf6;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  align-self: center;
}

.funds-dot--inflight {
  background: #10b981;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  align-self: center;
}

/* Rate-bar tint for "cost per tonne" ranking (amber = expensive lane). */
.funds-hbar-fill--rate {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* ----- Funds portal: revision (allocation history) list --------------------- */
.funds-revision-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.funds-revision-row {
  display: grid;
  grid-template-columns: 10px minmax(88px, auto) minmax(120px, auto) auto 1fr auto;
  column-gap: 0.7rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
}

.funds-revision-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.funds-revision-dot--up {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.funds-revision-dot--down {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.funds-revision-kind {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}

.funds-revision-note {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.funds-revision-when {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .funds-revision-row {
    grid-template-columns: 10px 1fr auto;
    row-gap: 0.25rem;
  }
  .funds-revision-total,
  .funds-revision-kind {
    grid-column: 2 / 3;
  }
  .funds-revision-note,
  .funds-revision-when {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* Light-theme tweaks --------------------------------------------------------- */
html.theme-light .funds-pos-bar {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(15, 23, 42, 0.08);
}

html.theme-light .funds-pos-amt,
html.theme-light .funds-pos-legend > li > span:nth-child(2) {
  color: rgba(15, 23, 42, 0.85);
}

html.theme-light .funds-revision-row {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.08);
}

html.theme-light .funds-revision-note,
html.theme-light .funds-revision-kind {
  color: rgba(15, 23, 42, 0.75);
}

