:root {
  /* Core colors using HSL */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;

  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;

  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;

  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;

  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;

  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;

  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;

  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;

  /* Congestion colors - Google Sheets palette */
  --color-low: 137 55% 54%;
  --color-low-bg: 137 55% 54% / 0.15;
  --color-medium: 45 100% 51%;
  --color-medium-bg: 45 100% 51% / 0.15;
  --color-high: 0 73% 63%;
  --color-high-bg: 0 73% 63% / 0.15;

  /* Radius */
  --radius: 0.5rem;

  /* Header */
  --header-height: 56px;
  --header-total-offset: 4.5rem; /* top (1rem) + height (3.5rem) */

  /* Panel */
  --panel-width: 540px;
  --panel-bottom-spacing: 1.5rem;
}

/* Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

svg {
  vertical-align: middle;
}

body {
  font-family: "Inter", sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
}

#site-header {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  min-width: 320px;
  max-width: 1200px;
  height: 3.5rem;
  background: hsl(var(--background) / 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem 0 1.25rem;
  z-index: 2000;
  box-shadow:
    0 4px 20px -2px rgb(0 0 0 / 0.1),
    0 2px 8px -2px rgb(0 0 0 / 0.05);
  gap: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: hsl(var(--foreground));
  height: 100%;
}

.brand-logo {
  display: flex;
  align-items: center;
  height: 100%;
}

.brand-logo img {
  display: block;
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Shadcn Button Variants */
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) * 4); /* Pill shape */
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 150ms ease;
  outline: none;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: hsl(var(--foreground));
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  height: 2.25rem;
}

.nav-link:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.nav-link:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Variant: Default (Primary) - "Book a Demo" */
.nav-cta {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.nav-cta:hover {
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

/* Variant: Outline - "Talk to Expert" */
.nav-outline {
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.nav-outline:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.nav-whatsapp {
  background: hsl(142 70% 45%);
  color: white;
}

.nav-whatsapp:hover {
  background: hsl(142 70% 40%);
  color: white;
}

.nav-whatsapp svg {
  flex-shrink: 0;
}

#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 2);
  padding: 1.5rem;
  max-width: 28rem;
  width: calc(100% - 2rem);
  text-align: center;
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  animation: modalFadeIn 150ms ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 150ms ease;
}

.modal-close:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.75rem;
  background: hsl(var(--muted));
  border-radius: 50%;
  color: hsl(var(--foreground));
}

.modal-icon svg {
  width: 1.75rem;
  height: 1.75rem;
}

.modal-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.modal-content p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0 1rem;
  text-decoration: none;
  transition: all 150ms ease;
  cursor: pointer;
  border: none;
}

.modal-btn.primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.modal-btn.primary:hover {
  background: hsl(var(--primary) / 0.9);
}

.modal-btn.secondary {
  background: hsl(142 70% 45%);
  color: white;
}

.modal-btn.secondary:hover {
  background: hsl(142 70% 40%);
}

#control-panel {
  position: fixed;
  bottom: var(--panel-bottom-spacing);
  left: 1.5rem;
  width: var(--panel-width);
  max-height: calc(
    100vh - var(--header-total-offset) - var(--panel-bottom-spacing) - 1rem
  );
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) * 1.5);
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  z-index: 1000;
  overflow: hidden;
  transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#control-panel.collapsed {
  max-height: 3.5rem;
}

#control-panel.collapsed .panel-body {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#control-panel.collapsed .panel-header {
  border-bottom-color: transparent;
}

#control-panel.collapsed .caret-icon {
  transform: rotate(180deg);
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  transition: border-color 300ms ease;
}

.panel-title-container {
  display: flex;
  flex-direction: column;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: hsl(var(--card-foreground));
  line-height: 1.2;
}

.date-subtitle {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  line-height: 1.2;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Icon Button - Shadcn Ghost */
.icon-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 150ms ease;
}

.icon-btn:hover {
  background: hsl(var(--accent));
}

.caret-btn .caret-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 200ms ease;
}

/* Panel Body */
.panel-body {
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-total-offset) - 8rem);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 200ms ease,
    visibility 200ms ease;
}

/* Section Label */
.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.city-selection {
  margin-bottom: 1rem;
}

.city-dropdown-wrapper {
  position: relative;
}

.city-dropdown {
  width: 100%;
  height: 2.25rem;
  padding: 0 2rem 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: all 150ms ease;
}

.city-dropdown:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.depot-selection {
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.section-header .section-label {
  margin-bottom: 0;
}

/* Multi-select Toggle - Shadcn Outline Button Small */
.multi-select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  border-radius: var(--radius);
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 150ms ease;
}

.multi-select-toggle:hover {
  border-color: hsl(var(--foreground));
  color: hsl(var(--foreground));
}

.multi-select-toggle svg {
  width: 0.75rem;
  height: 0.75rem;
}

.depot-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

/* Depot Button - Shadcn Toggle Style */
.depot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.625rem 0.5rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 150ms ease;
}

.depot-btn:hover {
  background: hsl(var(--accent));
}

.depot-btn.active {
  background: hsl(var(--accent));
  border-color: hsl(var(--foreground));
}

.depot-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--foreground));
}

.depot-btn.active .depot-btn-icon {
  color: hsl(var(--accent-foreground));
}

.depot-btn-name {
  font-size: 0.625rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  text-align: center;
  line-height: 1.2;
}

/* Add Depot Card */
.depot-btn-add {
  border-style: dashed;
  color: hsl(var(--muted-foreground));
}

.depot-btn-add:hover {
  border-color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.depot-btn-add .depot-btn-name {
  color: hsl(var(--muted-foreground));
}

.travel-grid {
  margin-bottom: 1rem;
}

.travel-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  table-layout: fixed;
}

.travel-table th,
.travel-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}

/* Delivery Area Column - wider */
.travel-table th:first-child,
.travel-table td:first-child {
  width: 40%;
}

/* Time Slot Columns - equal width */
.travel-table th:not(:first-child),
.travel-table td:not(:first-child) {
  width: 20%;
}

.travel-table th {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  height: 2.5rem;
}

/* Clickable time slot headers */
.travel-table th.time-header {
  cursor: pointer;
  text-align: center;
  transition: all 150ms ease;
  user-select: none;
  position: relative;
}

.travel-table th.time-header::after {
  content: "";
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: hsl(var(--foreground));
  transition: width 150ms ease;
}

.travel-table th.time-header:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.travel-table th.time-header:hover::after {
  width: 2rem;
}

.travel-table th.time-header.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.travel-table th.time-header.active::after {
  display: none;
}

.travel-table tbody tr:last-child td {
  border-bottom: none;
}

/* Area rows - clickable */
.area-row {
  cursor: pointer;
  transition: background 150ms ease;
}

.area-row:hover {
  background: hsl(var(--muted));
}

.area-row.selected {
  background: hsl(var(--accent));
}

.area-name {
  position: relative;
  padding-right: 1.5rem;
}

.area-name-text {
  display: block;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.area-depot-hint {
  display: block;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
  font-weight: 400;
}

.area-click-indicator {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  opacity: 0;
  transition: opacity 150ms ease;
}

.area-row:hover .area-click-indicator {
  opacity: 1;
}

/* Travel cells with gradient backgrounds */
.travel-cell {
  text-align: center;
  padding: 0.625rem 0.5rem !important;
  transition: all 150ms ease;
}

.travel-cell.severity-low {
  background: hsl(var(--color-low-bg));
}

.travel-cell.severity-medium {
  background: hsl(var(--color-medium-bg));
}

.travel-cell.severity-high {
  background: hsl(var(--color-high-bg));
}

.travel-cell.selected-column {
  box-shadow: inset 0 0 0 2px hsl(var(--ring) / 0.3);
}

.cell-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.travel-time {
  font-weight: 600;
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
}

.delay-info-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.delay-text {
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.delay-text.delay-low {
  color: hsl(var(--color-low));
}

.delay-text.delay-medium {
  color: hsl(var(--color-medium));
}

.delay-text.delay-high {
  color: hsl(var(--color-high));
}

.peak-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 0.5625rem;
  font-weight: 600;
  color: hsl(var(--color-high));
  background: hsl(var(--color-high-bg));
  padding: 0.125rem 0.25rem;
  border-radius: calc(var(--radius) / 2);
}

/* Table Action Buttons - Shadcn Ghost Button */
.table-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px dashed hsl(var(--border));
  background: transparent;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 150ms ease;
}

.action-btn:hover {
  border-color: hsl(var(--foreground));
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

.action-btn svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Traffic insight - Muted info box */
.traffic-insight {
  display: flex;
  gap: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.traffic-insight .info-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.traffic-insight strong {
  color: hsl(var(--foreground));
  font-weight: 500;
}

.subscribe-section {
  margin-bottom: 1rem;
}

.subscribe-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 150ms ease;
}

.subscribe-btn:hover {
  background: hsl(var(--accent));
}

.subscribe-btn svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
}

/* Traffic Explainer - Shadcn Muted */
.traffic-explainer {
  display: flex;
  gap: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  padding: 0.75rem;
  border-radius: var(--radius);
}

.traffic-explainer .info-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.traffic-explainer strong {
  color: hsl(var(--foreground));
  font-weight: 500;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#loading-overlay.hidden {
  display: none;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid hsl(var(--muted));
  border-top-color: hsl(var(--foreground));
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-content p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.loading-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  color: hsl(var(--muted-foreground));
}

.loading-message .spinner {
  width: 1.5rem;
  height: 1.5rem;
  border-width: 2px;
  margin: 0;
}

/* Error Message */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  color: hsl(var(--destructive));
}

.retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.retry-btn:hover {
  background: hsl(var(--primary) / 0.9);
}

.marker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}

.marker-icon.depot {
  width: 2.5rem;
  height: 2.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.marker-icon.depot svg {
  width: 1.5rem;
  height: 1.5rem;
}

.marker-icon.area {
  width: 2rem;
  height: 2rem;
}

.marker-icon.area svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Leaflet Popup - Shadcn Popover */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  border: 1px solid hsl(var(--border));
  padding: 0;
}

.leaflet-popup-content {
  margin: 0.75rem 1rem;
  font-family: inherit;
}

.leaflet-popup-tip {
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  box-shadow: none;
}

.popup-content {
  font-family: inherit;
  width: 140px;
}

.popup-header {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
}

.popup-header svg {
  flex-shrink: 0;
  opacity: 0.7;
  margin-top: 0.2rem;
}

.popup-content strong {
  font-size: 0.875rem;
  font-weight: 600;
  word-break: break-word;
  line-height: 1.3;
}

.popup-content small {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.popup-stats {
  margin-top: 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.popup-stats .stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.popup-stats .label {
  color: hsl(var(--muted-foreground));
}

.popup-stats .value {
  font-weight: 500;
}

.severity-badge {
  margin-top: 0.625rem;
  padding: 0.25rem 0.625rem;
  border-radius: calc(var(--radius) / 2);
  color: white;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
}

/* Highlighted Marker Styles */
.marker-icon.highlighted {
  transform: scale(1.25);
  box-shadow:
    0 0 0 3px hsl(var(--ring) / 0.4),
    0 4px 12px rgb(0 0 0 / 0.2);
  animation: marker-pulse 1.5s ease-in-out infinite;
  z-index: 1000 !important;
}

@keyframes marker-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px hsl(var(--ring) / 0.4),
      0 4px 12px rgb(0 0 0 / 0.2);
  }
  50% {
    box-shadow:
      0 0 0 6px hsl(var(--ring) / 0.2),
      0 4px 16px rgb(0 0 0 / 0.3);
  }
}

/* Tablet and below */
@media (max-width: 600px) {
  :root {
    --panel-bottom-spacing: 0.75rem;
  }

  #site-header {
    width: 90%;
    max-width: none;
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .brand-name {
    display: none;
  }

  .header-nav {
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    height: 2rem;
  }

  #control-panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: var(--panel-bottom-spacing);
    width: auto;
    /* More conservative max-height for mobile browsers with address bar */
    max-height: calc(
      100vh - 10rem
    ); /* Increased buffer to prevent navbar overlap */
  }

  .panel-body {
    /* Reduced height for mobile to prevent overflow with browser chrome */
    max-height: calc(100vh - 12rem);
  }

  .panel-header {
    padding: 0.625rem 0.875rem;
  }

  .panel-title {
    font-size: 0.9375rem;
  }

  .date-subtitle {
    font-size: 0.75rem;
  }

  /* Improve touch targets */
  .depot-btn {
    padding: 0.75rem 0.5rem;
    min-height: 44px;
  }

  .icon-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .action-btn {
    height: 2.75rem;
    min-height: 44px;
  }

  .depot-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-actions {
    flex-direction: column;
  }

  .table-actions .action-btn {
    width: 100% !important;
    flex: none !important;
  }

  /* Ensure table doesn't cause horizontal scroll */
  .travel-table {
    font-size: 0.8125rem;
  }

  .travel-table th,
  .travel-table td {
    padding: 0.5rem 0.5rem;
  }

  /* Better text wrapping for area names */
  .area-name-text {
    font-size: 0.8125rem;
    word-break: break-word;
  }

  .area-depot-hint {
    font-size: 0.625rem;
  }

  /* Leaflet controls - position above panel */
  .leaflet-bottom.leaflet-right {
    bottom: 5.5rem; /* Above collapsed panel (3.5rem) + spacing */
  }

  .leaflet-top.leaflet-right,
  .leaflet-top.leaflet-left {
    top: 5.5rem;
  }
}

/* Very small screens (iPhone SE and below) */
@media (max-width: 375px) {
  #site-header {
    width: 95%;
    padding: 0 0.5rem;
    gap: 0.375rem;
  }

  .brand-logo img {
    height: 28px !important;
  }

  .header-nav {
    gap: 0.25rem;
  }

  .nav-link {
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    height: 1.75rem;
  }

  #control-panel {
    left: 0.5rem;
    right: 0.5rem;
    /* Extra conservative on very small screens */
    max-height: calc(100vh - 11rem);
  }

  .panel-header {
    padding: 0.5rem 0.75rem;
  }

  .panel-title-row {
    gap: 0.375rem;
  }

  .panel-title {
    font-size: 0.875rem;
  }

  .date-subtitle {
    font-size: 0.6875rem;
  }

  .icon-btn {
    width: 2rem;
    height: 2rem;
  }

  .caret-btn .caret-icon {
    width: 0.875rem;
    height: 0.875rem;
  }

  /* Leaflet controls - ensure they're above panel on very small screens */
  .leaflet-bottom.leaflet-right {
    bottom: 5rem;
  }
}
