:root {
  --bg: #ffffff;
  --bg-sub: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-active: #3b82f6;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.08);
  --kitchen: #f59e0b;
  --kitchen-soft: rgba(245, 158, 11, 0.1);
  --success: #22c55e;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

.testing-container {
  width: calc(100% + 48px);
  height: calc(100vh - 88px);
  margin: -24px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  overflow: hidden;
  position: relative;
}

/* Embedded mode: rendered inside a parent container (e.g. a Dialog),
   so drop the negative margin and viewport-based sizing that assumes
   the standalone /dispatch page is wrapped in MainCard's 24px padding. */
.testing-container.embedded {
  width: 100%;
  height: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
}

.testing-container * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Header */
.testing-container #hdr {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.testing-container .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.testing-container .logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

.testing-container .logo-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.testing-container .logo-name em {
  color: var(--accent);
  font-style: normal;
  opacity: 0.8;
}

.testing-container .hdr-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.testing-container .hdr-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.testing-container #clock {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-sub);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Tabs */
.testing-container #strat-row {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.testing-container .sbt {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.testing-container .sbt:hover {
  background: var(--bg-sub);
  color: var(--text);
  border-color: var(--text-muted);
}

.testing-container .sbt.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* SVG icon slot inside each tab button — fixed square, color inherits from button
   so active-state white propagates without per-tab overrides. */
.testing-container .sbt .sbt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  color: inherit;
}

.testing-container .sbt .sbt-icon svg {
  width: 1em;
  height: 1em;
  display: block;
  /* react-icons SVGs fill with currentColor by default — this just ensures
     consistent baseline alignment with the label next to them. */
  vertical-align: middle;
}

/* Live data controls (date picker + load status) */
.testing-container .live-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.testing-container .live-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
}

.testing-container .live-status-ready { color: var(--success); }
.testing-container .live-status-error { color: #ef4444; }

.testing-container .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.2s ease-in-out infinite;
}

.testing-container .live-dot.ready { background: var(--success); animation: none; }
.testing-container .live-dot.error { background: #ef4444; animation: none; }

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.testing-container .live-date-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.testing-container .live-date-label input[type="date"] {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.testing-container .live-date-label input[type="date"]:hover,
.testing-container .live-date-label input[type="date"]:focus {
  border-color: var(--accent);
}

/* ── Batch selector (live /dispatch only) ─────────────────────── */

.testing-container #batch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.testing-container .batch-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
}

.testing-container .batch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.testing-container .batch-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  transform: translateY(-1px);
}

.testing-container .batch-btn.active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Per-batch active color so each wave reads at a glance */
.testing-container .batch-btn.batch-all.active     { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.testing-container .batch-btn.batch-morning.active { background: linear-gradient(135deg, #f59e0b, #f97316); }
.testing-container .batch-btn.batch-lunch.active   { background: linear-gradient(135deg, #10b981, #14b8a6); }
.testing-container .batch-btn.batch-dinner.active  { background: linear-gradient(135deg, #6366f1, #8b5cf6); }

.testing-container .batch-btn-icon {
  font-size: 14px;
  line-height: 1;
}

.testing-container .batch-btn-label {
  letter-spacing: 0.01em;
}

.testing-container .batch-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-sub);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.testing-container .batch-btn.active .batch-btn-count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* Status chips on step rows (kept for marker popup which still uses pill style) */
.testing-container .status-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 8px;
  flex-shrink: 0;
}

/* Flag indicator inside step rows — matches the map marker flag visually */
.testing-container .step-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  flex-shrink: 0;
}

.testing-container .step-flag-svg {
  width: 14px;
  height: 18px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.testing-container .step-flag-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Marker status flag (pole + banner above the numbered marker) */
.testing-container .cmark {
  position: relative;
}

/* Pulse: a marker glows when its row is hovered in the assignment table */
.testing-container .cmark.pulse {
  z-index: 1500 !important;
  animation: cmark-pulse 0.8s ease-out infinite;
}

@keyframes cmark-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(59, 130, 246, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4); transform: scale(1); }
  70%  { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0),   0 4px 12px rgba(0, 0, 0, 0.4); transform: scale(1.18); }
  100% { box-shadow: 0 0 0 0   rgba(59, 130, 246, 0),   0 4px 12px rgba(0, 0, 0, 0.4); transform: scale(1); }
}

/* Leaflet sets overflow:hidden on its panes; the flag pokes up past the marker bounds,
   so we let the divIcon container overflow visibly. */
.testing-container .cmark .cmark-flag {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-2px);
  width: 18px;
  height: 22px;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

/* Live rider position bike */
.testing-container .rider-bike {
  --rider-color: #475569;
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.testing-container .rider-bike-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--rider-color);
  border: 3px solid #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.25);
  animation: rider-pulse 1.8s ease-in-out infinite;
}

.testing-container .rider-bike-svg {
  position: relative;
  width: 26px;
  height: 26px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Bike stays upright — direction is conveyed by the route line. */
}

.testing-container .rider-bike-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.testing-container .rider-bike-progress {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

@keyframes rider-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 255, 255, 0.25); }
  50%      { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 8px rgba(255, 255, 255, 0.15); }
}

/* Body layout */
.testing-container #body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.testing-container #sidebar {
  width: 400px;
  background: var(--bg-sub);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  z-index: 5;
}

.testing-container #stats-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.testing-container .sc {
  background: var(--bg-sub);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.testing-container .sc-lbl {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.testing-container .sc-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.testing-container .sc-val.g {
  color: var(--success);
}

.testing-container .sc-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.testing-container #riders-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.testing-container .ph {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.testing-container .ph::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Cards */
.testing-container .rcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
}

.testing-container .rcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.testing-container .rcard-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.testing-container .kitchen-mark {
  background: #f59e0b;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  border: 3px solid #fff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6), 0 0 40px rgba(245, 158, 11, 0.3);
}

.testing-container .rcard-info {
  flex: 1;
}

.testing-container .rcard-emo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1.5px solid var(--border);
}


.testing-container .rcard-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.testing-container .rcard-zone {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.testing-container .rcard-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-sub);
}

.testing-container .bar-bg {
  background: var(--bg-sub);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
  margin-bottom: 12px;
}

.testing-container .bar-fg {
  height: 100%;
  border-radius: 4px;
}

.testing-container .rcard-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.testing-container .step-ids {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.testing-container .step-id {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-sub);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Detail View */
.testing-container #route-detail {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}

.testing-container .rd-back {
  background: var(--bg-sub);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.testing-container .rd-back:hover {
  background: var(--border);
}

.testing-container .rd-rider-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  line-height: 1.1;
}

.testing-container .rd-rider-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
}

/* Focused-rider stat grid — three tiles: orders / distance / profit */
.testing-container .rd-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 22px;
}

.testing-container .rd-stat {
  padding: 14px 10px 12px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--bg-sub);
  transition: transform 0.15s, box-shadow 0.15s;
}

.testing-container .rd-stat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.testing-container .rd-stat-icon {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 6px;
  opacity: 0.9;
}

.testing-container .rd-stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.testing-container .rd-stat-unit {
  font-size: 12px;
  font-weight: 700;
  margin-left: 3px;
  opacity: 0.7;
}

.testing-container .rd-stat-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
}

/* Per-stat color theming */
.testing-container .rd-stat-orders {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.09), rgba(99, 102, 241, 0.04));
  border-color: rgba(59, 130, 246, 0.22);
}
.testing-container .rd-stat-orders .rd-stat-value { color: #2563eb; }

.testing-container .rd-stat-distance {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(249, 115, 22, 0.04));
  border-color: rgba(245, 158, 11, 0.25);
}
.testing-container .rd-stat-distance .rd-stat-value { color: #d97706; }

.testing-container .rd-stat-profit.is-gain {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(20, 184, 166, 0.04));
  border-color: rgba(34, 197, 94, 0.35);
}
.testing-container .rd-stat-profit.is-gain .rd-stat-value { color: #16a34a; }
.testing-container .rd-stat-profit.is-gain .rd-stat-label { color: #16a34a; opacity: 0.75; }

.testing-container .rd-stat-profit.is-loss {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(244, 63, 94, 0.04));
  border-color: rgba(239, 68, 68, 0.35);
}
.testing-container .rd-stat-profit.is-loss .rd-stat-value { color: #dc2626; }
.testing-container .rd-stat-profit.is-loss .rd-stat-label { color: #dc2626; opacity: 0.75; }

.testing-container .trip-block {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-sub);
  overflow: hidden;
}

.testing-container .trip-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.testing-container .th-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.testing-container .trip-stats {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.testing-container .step-wrap {
  padding: 16px;
}

.testing-container .step-row {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.testing-container .step-row:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.testing-container .step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  z-index: 2;
  flex-shrink: 0;
}

.testing-container .step-dot.kitchen {
  background: var(--kitchen);
  color: #fff;
}

.testing-container .step-dot.delivery {
  background: #fff;
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.testing-container .step-label {
  font-size: 15px;
  font-weight: 700;
}

.testing-container .kitchen-tag {
  color: var(--kitchen);
}

.testing-container .step-dest {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.testing-container .step-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

.testing-container .step-profit {
  color: var(--success);
}

/* Enriched step row metadata */
.testing-container .step-location {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

.testing-container .step-notes {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 4px 8px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 2px solid rgba(245, 158, 11, 0.6);
  border-radius: 4px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.testing-container .step-charges {
  color: #0074e7;
  font-weight: 600;
}

.testing-container .step-type {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.testing-container .step-type.type-economy   { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.testing-container .step-type.type-risky     { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.testing-container .step-type.type-express   { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.testing-container .step-type:not(.type-economy):not(.type-risky):not(.type-express) {
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
}

/* ── Zone card (in panel list) ──────────────────────────────── */

.testing-container .rcard.zone-card {
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  position: relative;
  overflow: hidden;
}

.testing-container .rcard.zone-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #3b82f6, #6366f1);
  opacity: 0.55;
  transition: opacity 0.2s, width 0.2s;
}

.testing-container .rcard.zone-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.12);
}

.testing-container .rcard.zone-card:hover::before {
  opacity: 1;
  width: 4px;
}

.testing-container .zone-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.testing-container .zone-card-emoji {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.14));
  border: 1px solid rgba(59, 130, 246, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.testing-container .zone-card-titles {
  flex: 1;
  min-width: 0;
}

.testing-container .zone-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.testing-container .zone-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.testing-container .zone-card-arrow {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.4;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.testing-container .rcard.zone-card:hover .zone-card-arrow {
  opacity: 1;
  transform: translateX(4px);
}

/* Progress row: status bar + delivered/total counter */
.testing-container .zone-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}

.testing-container .zone-progress-row .zone-status-bar {
  flex: 1;
  margin: 0;
  height: 6px;
}

.testing-container .zone-progress-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Stat pills row */
.testing-container .zone-stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.testing-container .zone-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}

.testing-container .zone-stat-icon {
  font-size: 12px;
  opacity: 0.85;
}

.testing-container .zone-stat-value {
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.testing-container .zone-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.testing-container .zone-stat-pill.profit-positive {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}
.testing-container .zone-stat-pill.profit-positive .zone-stat-value {
  color: var(--success);
}

.testing-container .zone-stat-pill.profit-negative {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}
.testing-container .zone-stat-pill.profit-negative .zone-stat-value {
  color: #ef4444;
}

/* Suburb preview line at the bottom of the card */
.testing-container .zone-card-suburbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.testing-container .zone-card-suburbs-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.testing-container .zone-card-suburbs-more {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
}

/* ── Status bar (proportional segments) ─────────────────────── */

.testing-container .zone-status-bar {
  display: flex;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
}

.testing-container .zone-status-bar.tall {
  height: 16px;
  border-radius: 4px;
}

.testing-container .zone-status-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s;
  min-width: 1px;
}

.testing-container .zone-status-bar.tall .zone-status-seg {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.testing-container .zone-status-seg:hover {
  filter: brightness(1.1);
}

.testing-container .zone-status-seg-label {
  padding: 0 4px;
}

.testing-container .zone-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.testing-container .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.testing-container .legend-item strong {
  color: var(--text);
  font-weight: 700;
  margin-left: 2px;
}

.testing-container .legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Zone detail sections ───────────────────────────────────── */

.testing-container .zone-detail-section {
  margin: 18px 0;
}

.testing-container .zone-section-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.testing-container .zone-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.testing-container .section-count {
  color: var(--accent);
  font-weight: 700;
}

/* ── Chips (suburbs + kitchens) ─────────────────────────────── */

.testing-container .zone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.testing-container .zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--bg-sub);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.15s;
}

.testing-container .zone-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.testing-container .zone-chip.kitchen {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
}

.testing-container .zone-chip.kitchen:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.5);
}

.testing-container .zone-chip-name {
  white-space: nowrap;
}

.testing-container .zone-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.testing-container .zone-chip-count.kitchen {
  background: var(--kitchen);
}

.testing-container .kitchen-transition {
  padding: 12px;
  background: var(--kitchen-soft);
  border: 1px dashed var(--kitchen);
  border-radius: 10px;
  margin: 8px 0 20px 40px;
  font-size: 12px;
  font-weight: 600;
}

/* Map */
.testing-container #map-wrap {
  flex: 1;
  position: relative;
}

.testing-container .leaflet-container {
  background: #f1f5f9 !important;
}

/* Overlays */
.testing-container #ov-tl {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1000;
}

.testing-container .ov-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
}

.testing-container .ov-stats {
  display: flex;
  gap: 24px;
}

.testing-container .osv {
  font-size: 24px;
  font-weight: 800;
}

.testing-container .osv.g {
  color: var(--success);
}

.testing-container .osl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.testing-container #ov-tr {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 200px;
}

.testing-container #ov-br {
  position: absolute;
  bottom: 20px;
  right: 80px;
  z-index: 1000;
}

.testing-container .rchip {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.testing-container .rchip.active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.testing-container .rchip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.testing-container .rchip-n {
  margin-left: auto;
  font-weight: 800;
  color: var(--accent);
}

/* Markers */
.testing-container .cmark {
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.testing-container .kitchen-mark {
  background: var(--kitchen);
  border: 3px solid #fff;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.8), 0 0 40px rgba(245, 158, 11, 0.4);
}

/* Popups - Clean White Look */
.testing-container .leaflet-popup-content-wrapper {
  background: #ffffff;
  color: #1e293b;
  border-radius: 12px;
  padding: 0;
  /* overflow: hidden;  <-- This was cutting off the tip arrow */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

.testing-container .leaflet-popup-tip-container {
  width: 20px;
  height: 10px;
  left: 50%;
  margin-left: -10px;
  overflow: hidden;
  position: absolute;
  bottom: -10px;
}

.testing-container .leaflet-popup-tip {
  width: 14px;
  height: 14px;
  padding: 0;
  margin: -10px auto 0;
  transform: rotate(45deg);
  background: #ffffff;
  box-shadow: none;
}

.testing-container .pu-id {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 12px 12px 0 0;
  /* Apply rounding here instead */
}

.testing-container .pu-rider {
  padding: 12px 14px 4px;
  font-size: 15px;
  font-weight: 800;
}

.testing-container .pu-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 14px;
  font-size: 12px;
  color: #64748b;
}

.testing-container .pu-row:last-child {
  padding-bottom: 14px;
}

.testing-container .pu-row span:last-child {
  color: #1e293b;
  font-weight: 600;
}

/* Kitchen Popup */
.testing-container .kitchen-popup .kp-header {
  background: #f8fafc;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 8px 14px;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 12px 12px 0 0;
}

.testing-container .kitchen-popup .kp-name {
  padding: 14px 14px 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--kitchen);
}

.testing-container .kitchen-popup .kp-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px 16px;
}

.testing-container .kitchen-popup .kp-stat-lbl {
  font-size: 12px;
  color: #64748b;
}

.testing-container .kitchen-popup .kp-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}

.testing-container #desc {
  padding: 16px 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
}