:root {
  --ink: #0b1d2c;
  --muted: #4a5b6f;
  --navy: #0b4f8a;
  --sky: #1ea7c6;
  --bg: #eef2f7;
  --surface: #ffffff;
  --border: #d6dde6;
  --pill: #e6f3f8;
  --shadow: 0 18px 40px rgba(11, 31, 52, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, rgba(0, 161, 199, 0.08), transparent 35%),
    radial-gradient(circle at 80% 10%, rgba(11, 79, 138, 0.08), transparent 40%), var(--bg);
}

.page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1002;
  background: linear-gradient(120deg, #002a52 0%, #00498c 60%, #00a1c7 100%);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 20px;
  flex-wrap: wrap;
}

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

.brand-logo {
  height: 46px;
  width: auto;
  display: inline-block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 600;
}

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

.top-pill {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  padding: 11px;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  font-size: 12px;
}

.panel h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 20px rgba(11, 31, 52, 0.06);
}

.control label {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.control select,
.age-row input {
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.age-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}

#clear-filters {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--navy);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

#clear-filters:hover {
  border-color: var(--navy);
}

.control-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--navy);
}

.hint {
  color: var(--muted);
  font-size: 11px;
}

.help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 1px solid #9ab1c6;
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  background: #f8fafc;
}

.pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-list {
  max-height: 160px;
  overflow-y: auto;
  padding-right: 2px;
}

.pick-item {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  cursor: pointer;
}

.pick-item:hover {
  background: #f1f6fb;
  color: var(--ink);
}

.pick-item.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

#refresh,
#zoom {
  padding: 9px 12px;
  border: none;
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
}

#refresh {
  background: var(--navy);
  box-shadow: 0 10px 25px rgba(11, 79, 138, 0.25);
}

#zoom {
  background: #116f95;
  box-shadow: 0 10px 25px rgba(17, 111, 149, 0.25);
}

.meta {
  font-size: 11px;
  color: var(--muted);
  white-space: pre-line;
  background: #f4f7fc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px;
}

.stop-list {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: min(56vh, 510px);
  font-size: 12px;
}

.stop-item {
  padding: 8px;
  border-bottom: 1px solid #edf2f7;
  cursor: pointer;
}

.stop-item:hover {
  background: #f8fafc;
}

.stop-title {
  font-weight: 700;
  color: var(--ink);
}

.stop-meta {
  color: var(--muted);
  margin-top: 2px;
}

.dwell-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.dwell-long {
  font-size: 14px;
  font-weight: 800;
  color: #dc2626;
}

.pill {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.stop-index {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d6dde6;
  color: #0f172a;
  padding: 0;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.map-wrap {
  position: relative;
  min-height: 0;
  background: radial-gradient(circle at 35% 10%, rgba(0, 161, 199, 0.08), transparent 35%),
    radial-gradient(circle at 70% 20%, rgba(11, 79, 138, 0.08), transparent 40%), var(--bg);
}

.overlay-stack {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  max-width: 380px;
  width: min(380px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.respondent-info {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d6dde6;
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 11px;
  line-height: 1.35;
  color: #334155;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.itinerary-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d6dde6;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100%;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 48vh;
  }
}

@media (max-width: 720px) {
  .topbar-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .age-row {
    grid-template-columns: 1fr;
  }

  .overlay-stack {
    top: 8px;
    right: 8px;
    width: min(360px, calc(100vw - 16px));
  }
}
