:root {
  --bg: #090B0E;
  --surface: #11151B;
  --surface-2: #171C24;
  --surface-3: #1E2530;
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(255, 255, 255, 0.15);
  --text: #F2F5F8;
  --text-2: #A6B1C2;
  --text-3: #6B7688;
  --accent: #B8F135;
  --accent-ink: #090B0E;
  --accent-dim: rgba(184, 241, 53, 0.14);
  --quiet: #2ED47A;
  --ideal: #B8F135;
  --moderate: #F5A623;
  --busy: #FF5252;
  --closed: #525C6A;
  --r-sheet: 24px;
  --r-hero: 20px;
  --r-card: 16px;
  --r-ctrl: 12px;
  --r-pill: 999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: #050608;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100dvh;
}

.app-shell {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 520px) {
  .app-shell {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.75);
  }
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }

/* Icons */
.ic {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  display: block;
}
.ic .fill { fill: currentColor; stroke: none; }

/* Offline banner */
.offline-banner {
  background: #2A1E0A;
  color: #F8C563;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(245, 166, 35, 0.25);
}

/* Sticky Top Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(9, 11, 14, 0.84);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2.5px;
  padding: 6px 5px;
  flex-shrink: 0;
}
.brand-mark span {
  width: 3px;
  border-radius: 2px;
  background: #4A5568;
}
.brand-mark span:nth-child(1) { height: 7px; }
.brand-mark span:nth-child(2) { height: 11px; }
.brand-mark span:nth-child(3) { height: 16px; background: var(--accent); }
.brand-mark span:nth-child(4) { height: 10px; background: var(--quiet); }

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

.hdr-sub {
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.loc-pill {
  height: 36px;
  max-width: 150px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.loc-pill #loc-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-pill .ic { width: 14px; height: 14px; color: var(--accent); }
.loc-pill:active, .icon-btn:active, .btn-primary:active, .btn-ghost:active, .gym-card:active {
  transform: scale(0.98);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, color 0.15s ease;
}
.icon-btn:hover { color: var(--text); }
.icon-btn.spinning .ic { animation: spin 0.8s linear infinite; }

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

/* Main View Container */
.main-scroll {
  flex: 1;
  padding: 14px 16px calc(102px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view.active {
  display: block;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Source Transparency Strip */
.source-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: var(--r-ctrl);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
}
.source-strip-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-2);
}
.source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-dot.live {
  background: var(--quiet);
  box-shadow: 0 0 0 3px rgba(46, 212, 122, 0.22);
}
.source-dot.est {
  background: var(--moderate);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.18);
}
.source-strip-btn {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--accent);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  cursor: pointer;
}

/* Hero Decision Card */
.hero-card {
  position: relative;
  border-radius: var(--r-hero);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(184, 241, 53, 0.12) 0%, rgba(184, 241, 53, 0) 58%),
    linear-gradient(180deg, #151A22 0%, #10141A 100%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 36px rgba(0, 0, 0, 0.45);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.badge-live {
  background: rgba(46, 212, 122, 0.14);
  color: #5CE69D;
  border: 1px solid rgba(46, 212, 122, 0.28);
}
.badge-mac {
  background: rgba(184, 241, 53, 0.15);
  color: var(--accent);
  border: 1px solid rgba(184, 241, 53, 0.3);
}
.badge-est {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.hero-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.hero-info { min-width: 0; flex: 1; }

.hero-name {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}

.hero-meta {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.hero-metric {
  text-align: right;
  flex-shrink: 0;
}

.hero-pct {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.hero-tier {
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.hero-spark-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-ctrl);
  background: rgba(9, 11, 14, 0.55);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.hero-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.hero-trend .ic { width: 15px; height: 15px; }

.hero-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* Buttons */
.btn-primary {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-ctrl);
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.btn-primary.compact { height: 42px; padding: 0 14px; font-size: 13px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border-hi);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn-ghost.compact { height: 36px; padding: 0 11px; font-size: 12.5px; }
.btn-ghost.danger { color: #FF7878; border-color: rgba(255, 82, 82, 0.3); }

/* Horizontal Filter Chips */
.chips-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips-wrap::-webkit-scrollbar { display: none; }

.chip {
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.chip.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

/* Section Headers */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 10px;
}
.sec-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sec-head span { font-size: 12px; }

/* Gym Cards List */
.gym-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gym-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 14px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.12s ease, border-color 0.15s ease;
}
.gym-card.is-closed { opacity: 0.62; }

.gc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.gc-left {
  min-width: 0;
  flex: 1;
}

.gc-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.brand-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-2);
}
.brand-tag.macfit { background: rgba(255, 72, 72, 0.14); color: #FF8080; }
.brand-tag.macone { background: rgba(184, 241, 53, 0.14); color: var(--accent); }
.brand-tag.club { background: rgba(56, 189, 248, 0.14); color: #7DD3FC; }

.src-micro {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.src-micro.live { color: #5CE69D; }

.gc-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.gc-sub {
  font-size: 12.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gc-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gc-pct-wrap {
  text-align: right;
}
.gc-pct {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.gc-status {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.fav-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.fav-btn.on { color: var(--accent); }
.fav-btn .ic { width: 17px; height: 17px; }

.gc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.gc-best {
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Spark bars */
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 22px;
  width: 104px;
  flex-shrink: 0;
}
.spark-bar {
  flex: 1;
  border-radius: 2px;
  min-height: 2px;
  transition: height 0.2s ease;
}
.spark-bar.is-now {
  box-shadow: 0 0 8px rgba(184, 241, 53, 0.35);
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-hero);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Planla View */
.plan-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.plan-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin-bottom: 2px;
}
.plan-time-big {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.seg-ctrl {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg-ctrl button {
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.seg-ctrl button.on {
  background: var(--surface-3);
  color: var(--text);
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 14px;
}
.day-btn {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}
.day-btn.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.day-btn.on .day-dot { background: var(--accent-ink); }

.plan-curve-wrap {
  margin-bottom: 8px;
}
.plan-curve {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  height: 78px;
  align-items: end;
}
.plan-bar {
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}
.plan-bar-fill {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  transition: height 0.18s ease, background 0.15s ease;
}
.plan-curve-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 6px;
}

.slider-row {
  padding: 4px 0 12px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 2px 10px rgba(184, 241, 53, 0.45);
  cursor: pointer;
}

.verdict-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-ctrl);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}
.verdict-box strong { color: var(--text); }
.verdict-jump {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(184, 241, 53, 0.3);
  border-radius: var(--r-pill);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
  cursor: pointer;
}

/* Search & Forms */
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.field-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 7px;
}
.search-row {
  display: flex;
  gap: 8px;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-input-wrap input,
.text-input,
.select-input {
  width: 100%;
  height: 42px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border-hi);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 0 12px;
  outline: none;
}
.search-input-wrap input { padding-left: 36px; }
.search-input-wrap input::placeholder,
.text-input::placeholder { color: var(--text-3); }
.search-input-wrap input:focus,
.text-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184, 241, 53, 0.16);
}

.gmaps-results {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid rgba(184, 241, 53, 0.28);
  border-radius: var(--r-card);
  padding: 12px;
}
.gm-res-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}
.gm-res-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.gm-res-row:first-of-type { border-top: none; padding-top: 0; }

/* Sources View */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 12px;
}
.stat-val {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.stat-lbl {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.code-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #C7D2E0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Floating Bottom Tab Bar (iPhone 15 Pro optimized) */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 428px);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  border-radius: 26px;
  background: rgba(17, 21, 27, 0.86);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.tab-item {
  height: 50px;
  border: none;
  border-radius: 20px;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab-item .ic { width: 19px; height: 19px; }
.tab-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.01em; }
.tab-item.active {
  background: rgba(184, 241, 53, 0.14);
  color: var(--accent);
}

/* Bottom Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 8, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60;
}

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  z-index: 70;
  background: var(--surface);
  border-top-left-radius: var(--r-sheet);
  border-top-right-radius: var(--r-sheet);
  border-top: 1px solid var(--border-hi);
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.75);
  animation: sheetUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetUp {
  from { transform: translate(-50%, 40px); opacity: 0.4; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto 14px;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.sheet-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Interactive Detail Chart */
.dchart-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dchart-bars {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 4px;
  height: 118px;
  align-items: end;
  touch-action: none;
  user-select: none;
  padding: 8px 4px 4px;
  border-radius: var(--r-ctrl);
  background: var(--bg);
  border: 1px solid var(--border);
}
.dchart-col {
  height: 100%;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
}
.dchart-bar {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  transition: background 0.1s ease;
}
.dchart-col.sel .dchart-bar {
  box-shadow: 0 0 12px rgba(184, 241, 53, 0.35);
}
.dchart-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 6px;
  padding: 0 4px;
}

/* Check-in Strip inside Detail Sheet */
.checkin-box {
  margin-top: 14px;
  padding: 13px;
  border-radius: var(--r-card);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 9px;
}
.preset-btn {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}
.preset-btn span { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* District Picker List */
.loc-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.loc-opt {
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.loc-opt.on {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* Skeleton Loaders */
.skel {
  border-radius: var(--r-card);
  background: linear-gradient(90deg, #11151B 25%, #1A2029 50%, #11151B 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
.skel-hero { height: 206px; border-radius: var(--r-hero); margin-bottom: 16px; }
.skel-card { height: 104px; margin-bottom: 10px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: rgba(24, 30, 39, 0.96);
  color: var(--text);
  border: 1px solid rgba(184, 241, 53, 0.32);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #11151B;
  }
}
