/* ================================================================
   UNPAD — Dark cartographic aesthetic
   Warm amber on deep charcoal · editorial serif + clean sans
   ================================================================ */

:root {
  --bg-deep:    #0e0e10;
  --bg-surface: #18181c;
  --bg-raised:  #222228;
  --bg-glass:   rgba(18, 18, 22, 0.82);
  --border:     rgba(255, 255, 255, 0.06);
  --border-focus: rgba(218, 165, 80, 0.4);

  --text-primary:   #f0ece4;
  --text-secondary: #8a867e;
  --text-muted:     #5a5750;

  --amber:       #daa550;
  --amber-dim:   #b8893f;
  --amber-glow:  rgba(218, 165, 80, 0.15);
  --red:         #d44;
  --green:       #4a6;
  --blue:        #5b9bd5;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'SF Mono', monospace;

  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  4px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
}

/* ----------------------------------------------------------------
   MAP
   ---------------------------------------------------------------- */
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Dark map tiles override */
.leaflet-tile-pane { filter: brightness(0.72) contrast(1.1) saturate(0.3); }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
}
.leaflet-control-zoom a {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-raised) !important;
}

/* ----------------------------------------------------------------
   OVERLAY (login)
   ---------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(24px) saturate(0.8);
  -webkit-backdrop-filter: blur(24px) saturate(0.8);
  animation: overlayIn 0.5s ease;
}

.overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-card {
  width: 380px;
  max-width: 92vw;
  padding: 48px 40px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brand */
.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--amber), var(--amber-dim));
  color: var(--bg-deep);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px var(--amber-glow);
}

.brand-mark.small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  margin-bottom: 0;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#access-overlay { z-index: 1100; }

.pin-card .code-inputs { margin-top: 8px; }
.pin-card .code-inputs input { width: 52px; height: 60px; font-size: 24px; }

.person-select-label {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 18px;
}

.person-select-buttons {
  display: flex;
  gap: 12px;
}

.person-select-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.person-select-btn:hover {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.person-select-btn .person-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Login steps */
.login-step { display: none; }
.login-step.active { display: block; animation: stepIn 0.35s ease; }

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

/* Inputs */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

/* 2FA code inputs */
.twofa-hint {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.code-inputs input {
  width: 44px;
  height: 54px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.code-inputs input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

/* Buttons */
button[type="submit"],
.timeline-back {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--amber), var(--amber-dim));
  color: var(--bg-deep);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

button[type="submit"]:hover {
  box-shadow: 0 4px 20px var(--amber-glow);
  transform: translateY(-1px);
}

button[type="submit"]:active {
  transform: translateY(0);
}

.btn-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(14, 14, 16, 0.3);
  border-top-color: var(--bg-deep);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.error-msg {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  margin-top: 14px;
}

/* ----------------------------------------------------------------
   SIDEBAR
   ---------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  z-index: 900;
  background: var(--bg-glass);
  backdrop-filter: blur(32px) saturate(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(1.2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.hidden {
  transform: translateX(-100%);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  flex: 1;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: color var(--transition);
}
.sidebar-close:hover { color: var(--text-primary); }

/* Date list */
.date-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.date-list::-webkit-scrollbar { width: 4px; }
.date-list::-webkit-scrollbar-track { background: transparent; }
.date-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.date-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
}

.date-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.date-item.active {
  background: var(--amber-glow);
  border-color: rgba(218, 165, 80, 0.2);
}

.date-item-day {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-primary);
}

.date-item-full {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.date-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.date-item-dist {
  font-size: 12px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-weight: 500;
}

.date-item-count {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.timeline-distance {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--amber);
  margin-bottom: 8px;
}

/* Play All */
.play-all-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.play-all-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-all-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
}

.play-all-duration {
  display: flex;
  align-items: center;
  gap: 4px;
}

.play-all-duration input {
  width: 56px;
  padding: 6px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  outline: none;
}

.play-all-duration input:focus {
  border-color: var(--border-focus);
}

.play-all-unit {
  font-size: 12px;
  color: var(--text-muted);
}

/* No dates placeholder */
.date-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Timeline */
.timeline-section {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.timeline-section.hidden { display: none; }

.timeline-date-label {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 4px;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--amber);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* Scrubber */
.timeline-scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-raised);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.timeline-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 2px 8px rgba(218, 165, 80, 0.4);
  cursor: grab;
  transition: transform 0.15s;
}

.timeline-scrubber::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.timeline-scrubber::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 2px 8px rgba(218, 165, 80, 0.4);
  cursor: grab;
}

.timeline-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 14px;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.timeline-play:hover {
  background: var(--amber-glow);
  border-color: rgba(218, 165, 80, 0.3);
}

.timeline-back {
  display: inline-flex;
  align-items: center;
  width: auto;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.timeline-back:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: transparent;
  transform: none;
  box-shadow: none;
}

.back-to-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.back-to-live:hover {
  background: rgba(68, 170, 102, 0.1);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   SIDEBAR TOGGLE
   ---------------------------------------------------------------- */
.sidebar-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--bg-raised);
  border-color: var(--text-muted);
}

.sidebar-toggle.hidden { display: none; }

/* Logout button */
.logout-btn {
  position: fixed;
  top: 20px;
  left: 132px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.logout-btn:hover {
  background: var(--bg-raised);
  color: var(--red);
  border-color: var(--red);
}

.logout-btn.hidden { display: none; }

/* Switch person button */
.switch-person-btn {
  position: fixed;
  top: 20px;
  left: 76px;
  z-index: 800;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.switch-person-btn:hover {
  background: var(--bg-raised);
  color: var(--amber);
  border-color: var(--amber);
}

.switch-person-btn.hidden { display: none; }

/* ----------------------------------------------------------------
   PERSON PICKER
   ---------------------------------------------------------------- */
.person-picker {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 800;
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.person-picker.hidden { display: none; }

.person-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.person-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.person-btn.active {
  color: var(--text-primary);
  background: var(--bg-raised);
}

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

/* ----------------------------------------------------------------
   INFO PANEL
   ---------------------------------------------------------------- */
.info-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 800;
  width: 260px;
  padding: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(32px) saturate(1.2);
  -webkit-backdrop-filter: blur(32px) saturate(1.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  animation: panelIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.info-panel.hidden { display: none; }

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

.info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.info-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(68, 170, 102, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(68, 170, 102, 0); }
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
}

.info-key {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.info-val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}

/* ----------------------------------------------------------------
   EXPIRED BANNER
   ---------------------------------------------------------------- */
.expired-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: rgba(30, 20, 10, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(218, 165, 80, 0.3);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--amber);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  animation: bannerIn 0.4s ease;
}

.expired-banner.hidden { display: none; }

@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.expired-banner button {
  padding: 6px 14px;
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--amber);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.expired-banner button:hover {
  background: var(--amber-glow);
}

/* ----------------------------------------------------------------
   CUSTOM MARKER
   ---------------------------------------------------------------- */
.custom-marker {
  position: relative;
}

.marker-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  border: 3px solid var(--bg-deep);
  box-shadow: 0 2px 10px rgba(218, 165, 80, 0.5);
}

.marker-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid rgba(218, 165, 80, 0.3);
  animation: ring 2s ease-out infinite;
}

@keyframes ring {
  from { transform: scale(0.5); opacity: 1; }
  to   { transform: scale(1.5); opacity: 0; }
}

/* History trail marker */
.trail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(218, 165, 80, 0.5);
}

/* ----------------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------------- */
@media (max-width: 640px) {
  /* Safe area insets for notch/home indicator */
  body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }

  /* Login card */
  .login-card {
    padding: 32px 24px 28px;
    width: 94vw;
    border-radius: 16px;
  }

  .input-group input {
    padding: 14px 14px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .code-inputs input {
    width: 46px;
    height: 56px;
    font-size: 22px;
  }

  .code-inputs { gap: 6px; }

  button[type="submit"] {
    padding: 16px;
    font-size: 16px;
    min-height: 48px;
  }

  /* Sidebar — full screen sheet from bottom on mobile */
  .sidebar {
    width: 100%;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70dvh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.hidden {
    transform: translateY(100%);
  }

  /* Sidebar drag handle */
  .sidebar-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted);
    opacity: 0.5;
  }

  .sidebar-header {
    position: relative;
    padding-top: 28px;
  }

  .sidebar-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Sidebar backdrop */
  .sidebar:not(.hidden)::after {
    content: '';
    position: fixed;
    inset: 0;
    bottom: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
  }

  /* Date items — bigger touch targets */
  .date-item {
    padding: 16px 14px;
    min-height: 48px;
  }

  .date-list {
    max-height: 40dvh;
    padding: 8px 16px;
    -webkit-overflow-scrolling: touch;
  }

  /* Timeline controls — bigger touch targets */
  .timeline-play {
    width: 48px;
    height: 48px;
  }

  .timeline-back {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 14px;
  }

  /* Scrubber — fatter track and larger thumb for touch */
  .timeline-scrubber {
    height: 10px;
    border-radius: 5px;
  }

  .timeline-scrubber::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  .timeline-scrubber::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  /* Info panel — bottom sheet style */
  .info-panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    padding: 16px;
    border-radius: var(--radius);
  }

  /* When sidebar is open, hide info panel on mobile */
  .info-panel.sidebar-open {
    display: none;
  }

  /* Sidebar toggle — ensure 48px minimum */
  .sidebar-toggle {
    width: 48px;
    height: 48px;
    top: 16px;
    left: 16px;
    top: calc(16px + env(safe-area-inset-top));
  }

  .switch-person-btn {
    width: 48px;
    height: 48px;
    left: 76px;
    top: calc(16px + env(safe-area-inset-top));
  }

  .logout-btn {
    width: 48px;
    height: 48px;
    left: 136px;
    top: calc(16px + env(safe-area-inset-top));
  }

  /* Expired banner — full width on mobile */
  .expired-banner {
    left: 12px;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 10px;
    padding: 14px 16px;
  }

  .expired-banner button {
    padding: 10px 18px;
    min-height: 44px;
    font-size: 14px;
  }

  @keyframes bannerIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Map zoom controls — bigger on mobile */
  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 18px !important;
  }
}

/* Small phones (iPhone SE, etc.) */
@media (max-width: 380px) {
  .login-card { padding: 28px 20px 24px; }
  .login-brand h1 { font-size: 28px; }
  .brand-mark { width: 44px; height: 44px; font-size: 24px; }
  .code-inputs input { width: 40px; height: 50px; font-size: 20px; }
  .info-panel { padding: 14px; }
  .info-val { font-size: 12px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    max-height: 80dvh;
  }
  .login-card {
    padding: 20px 28px;
    max-height: 90dvh;
    overflow-y: auto;
  }
  .login-brand { margin-bottom: 16px; }
  .brand-mark { width: 36px; height: 36px; font-size: 20px; margin-bottom: 8px; }
  .login-brand h1 { font-size: 24px; }
}
