/* ══════════════════════════════════════════════════════════════
   Fish Stocking Alert — styles.css
   Palette: navy #0a1628 | teal #0ea5e9 | green #10b981
   Font: Inter (loaded via Google Fonts in index.html)
   ══════════════════════════════════════════════════════════════ */

/* ── CSS variables ─────────────────────────────────────────── */
:root {
  --navy:          #0a1628;
  --navy-mid:      #152339;
  --teal:          #0ea5e9;
  --teal-dark:     #0284c7;
  --teal-light:    #e0f2fe;
  --teal-xlight:   #f0f9ff;
  --green:         #10b981;
  --green-light:   #d1fae5;
  --orange:        #f97316;
  --orange-light:  #ffedd5;
  --indigo:        #6366f1;
  --indigo-light:  #e0e7ff;
  --grey-pin:      #94a3b8;
  --white:         #ffffff;
  --bg:            #f5f7fa;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --border-mid:    #cbd5e1;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 30px rgba(0,0,0,0.12);
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-pill:   999px;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Site header ───────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.logo-icon { font-size: 1.4rem; line-height: 1; }

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.3px;
  text-decoration: none;
}

.logo-accent { color: var(--teal); }

/* "Get Alerts" button in header */
/* Groups Get Alerts + dark mode button together on the right */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-shrink: 0;
}

.btn-alerts {
  background: var(--teal);
  color: var(--white);
  border: none;
  padding: 0.5rem 1.35rem;
  border-radius: var(--radius-pill);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-alerts:hover  { background: var(--teal-dark); }
.btn-alerts:active { transform: scale(0.97); }

/* ── Stats bar ──────────────────────────────────────────────── */
.stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
  z-index: 999;
}

/* State identifier — first item in stats bar, same rhythm as .stat */
.stat-state-id {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 2.5rem;
  flex-shrink: 0;
}

.stat-state-name {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.5px;
  text-align: center;
}

.stat-state-sub {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-align: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 2.5rem;
}

.stat-number {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Tab navigation ─────────────────────────────────────────── */
.tab-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 1rem;
  gap: 0.25rem;
  position: relative;
  z-index: 998;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab-btn .tab-icon { font-size: 0.9rem; }

.tab-btn:hover  { color: var(--teal); }

.tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* ── View panels ─────────────────────────────────────────────── */
.view-panel          { display: none; }
.view-panel.active   { display: block; }

/* Calendar still needs bottom padding so content clears the fixed footer */
#view-calendar.active { padding-bottom: 48px; }

/* List view: full-height flex column so three columns fill the viewport */
#view-list.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 210px);
  overflow: hidden;
}

/* Map panel gets flex so the map fills remaining height */
#view-map.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 210px); /* header + stats + tabs + fixed footer */
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem;
  gap: 1.25rem;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ── Error message ──────────────────────────────────────────── */
.error-msg {
  margin: 2rem 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff0f0;
  border: 1.5px solid #fca5a5;
  border-radius: var(--radius-md);
  color: #b91c1c;
  font-size: 0.95rem;
  font-weight: 600;
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   LIST VIEW
   ══════════════════════════════════════════════════════════════ */

/* ── Filter bar (above both panels) ────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.85rem 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 160px;
}

.filter-group label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.filter-group select {
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.93rem;
  font-weight: 600;
  background: var(--white);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-pill {
  padding: 0.55rem 1.1rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-pill:hover { border-color: var(--teal); color: var(--teal); }

.btn-pill.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}

.btn-reset {
  padding: 0.55rem 1.1rem;
  background: var(--bg);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-reset:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-xlight); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-trout   { background: var(--teal-light);   color: #0369a1; }
.badge-catfish { background: var(--orange-light);  color: #c2410c; }
.badge-bass    { background: var(--green-light);   color: #065f46; }
.badge-salmon  { background: var(--indigo-light);  color: #4338ca; }
.badge-other   { background: #f1f5f9;              color: #475569; }

.badge-fresh { background: var(--teal-light); color: #0369a1; margin-left: 0.4rem; }

.days-ago {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

/* ── Three-column wrapper ───────────────────────────────────── */
.list-cols {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Column 1: water list (460px fixed, internal scroll) */
.list-col-waters {
  width: 460px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

/* Column 2: preview card (580px fixed: moon widget + satellite map + metric cards) */
.list-col-preview {
  flex: 0 0 580px;
  min-width: 580px;
  overflow: hidden;
  padding: 0.85rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Preview card wraps the map and the metric strip as a visual unit */
.preview-card {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--white);
  flex-shrink: 0;
}

/* Satellite map at the top of the preview card */
.preview-map-wrap {
  position: relative;
  height: 400px;
  background: #0f172a;
  flex-shrink: 0;
}

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

/* "Open in full map →" pill overlaid on the preview map */
.preview-open-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 500;
  background: rgba(0,0,0,0.60);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}

.preview-open-btn:hover { background: rgba(0,0,0,0.80); color: #fff; }

/* Moon widget: horizontal two-column layout above the map */
.preview-moon-row {
  display: flex;
  margin-bottom: 8px;
}

.moon-widget {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  padding: 2px 10px 6px;
  gap: 8px;
}

.moon-widget-side {
  display: flex;
  flex-direction: column;
}

.moon-widget-side--right { align-items: flex-end; }

.moon-widget-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.moon-widget-date {
  font-size: 12px;
  color: #374151;
  margin-top: 2px;
  white-space: nowrap;
}

.moon-widget-emoji {
  font-size: 28px;
  line-height: 1;
  margin-top: 5px;
}

.moon-widget-phase {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-top: 2px;
  white-space: nowrap;
}

/* Metric cards: 4 individual cards stacked below the map */
#metric-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  flex-shrink: 0;
}

.metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
}

.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  white-space: nowrap;
}

.mc-value {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.mc-bar-wrap {
  position: relative;
  height: 14px;
  border-radius: 7px;
  margin-top: 8px;
  overflow: visible;
}

/* Column 3: detail info (fills remaining space, min 500px) */
.list-col-detail {
  flex: 1;
  min-width: 500px;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: #f9fafb;
}

/* Column 3 header elements (name, county, pills, distance, alert button) */
.detail-col-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.detail-col-county {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.detail-col-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.6rem;
}

.detail-col-distance {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Sticky search at top of left panel */
.list-search-wrap {
  padding: 0.7rem 0.75rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#list-search {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

#list-search:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

/* Geo invite banner */
.geo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: var(--teal-xlight);
  border-bottom: 1px solid var(--teal-light);
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.geo-banner-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal-dark);
  flex: 1;
  min-width: 0;
}

.geo-banner-btns { display: flex; gap: 0.4rem; flex-shrink: 0; flex-wrap: nowrap; }

.geo-btn {
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s;
}

.geo-btn-allow {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.geo-btn-allow:hover { background: var(--teal-dark); border-color: var(--teal-dark); }

.geo-btn-skip {
  background: transparent;
  color: var(--teal-dark);
  border-color: rgba(14,165,233,0.35);
}

.geo-btn-skip:hover { background: var(--teal-light); }

/* Active geo bar (shown after permission granted) */
.geo-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  background: rgba(14,165,233,0.07);
  border-bottom: 1px solid var(--teal-light);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--teal-dark);
  flex-shrink: 0;
}

.geo-clear-link {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  transition: color 0.1s, border-color 0.1s;
}

.geo-clear-link:hover { color: var(--teal); border-color: var(--teal); }

/* Amber warning: no waters within 100 miles */
.geo-no-results-banner {
  padding: 0.55rem 0.9rem;
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.45;
  flex-shrink: 0;
}

/* List result count */
.list-count {
  padding: 0.42rem 0.9rem;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ── Water cards (left panel) ───────────────────────────────── */
.water-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.8rem 0.9rem;
  border-left: 4px solid var(--wc-border-color, #94a3b8);   /* species color via JS custom property */
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  background: #f8fafc;
}

.water-card:hover { background: #eef7fc; }

.water-card.selected {
  background: #e0f2fe;
  border-left: 4px solid var(--teal);
}

.water-card-body { flex: 1; min-width: 0; }

.water-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.water-card-meta {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.water-card-distance {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal-dark);
  background: var(--teal-xlight);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
}

/* Plain-text freshness indicator below the county line */
.water-card-status {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.water-list-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* (right panel now handled by .list-col-detail in three-column layout) */

/* Placeholder (nothing selected) */
.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  gap: 0.65rem;
  color: var(--text-muted);
}

.detail-placeholder-icon { font-size: 3rem; opacity: 0.35; }

.detail-placeholder-text { font-size: 1rem; font-weight: 600; }

/* ── Detail panel sections ──────────────────────────────────── */

/* Status dot row (replaces announce-pill in column 3 header) */
.detail-col-status-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0.55rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-text {
  font-size: 0.82rem;
  font-weight: 600;
}

/* Species dot (used in Latest Stocking and History) */
.species-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 5px;
}

/* Alert button — solid teal fill */
.detail-alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  height: 40px;
  padding: 0 24px;
  background: var(--teal);
  color: #ffffff;
  border: 2px solid var(--teal);
  border-radius: var(--radius-pill);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 1.1rem;
  letter-spacing: 0.01em;
}

.detail-alert-btn:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #ffffff;
}

/* Section 3: Snapshot card */
.snapshot-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.1rem;
}

.snapshot-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.snapshot-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.875rem;
}

.snapshot-row-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 80px;
  flex-shrink: 0;
}

.snapshot-row-value { font-weight: 600; color: var(--text); }

/* Section 4: Stocking history */
.history-section { margin-bottom: 1.1rem; }

.history-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.history-row:last-child { border-bottom: none; }

.history-date {
  font-weight: 700;
  color: var(--text);
  min-width: 105px;
  flex-shrink: 0;
  font-size: 0.82rem;
}

.history-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-extra {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Section 5: Data source footer */
.detail-source-footer {
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
}

.detail-source-footer a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 600;
}

.detail-source-footer a:hover { text-decoration: underline; }

/* Water type pill (in column 3 pills row) */
.water-type-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: #f1f5f9;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ── Collapsible sections ───────────────────────────────────── */

.collapsible {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.collapsible-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s;
}

/* Per-section header tints */
#det-stocking .collapsible-header { background: #f0f9ff; }
#det-regs     .collapsible-header { background: #f0f4ff; }
#det-water    .collapsible-header { background: #f0fdf4; }
#det-tips     .collapsible-header { background: #fffbeb; }
#det-history  .collapsible-header { background: #faf5ff; }

/* Fishing tips content area: warm wash */
#det-tips .collapsible-content { background: rgba(254,251,235,0.40); padding: 16px; font-size: 14px; }

/* Fishing Tips: always expanded, no toggle */
.collapsible--notoggle .collapsible-header { cursor: default; pointer-events: none; }
.collapsible--notoggle .collapsible-chevron { display: none; }

/* Metric card note (small grey subtitle below value) */
.mc-note {
  font-size: 10px;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
  text-align: right;
}

/* Metric bar dot — border set here so dark mode can override it */
.mc-bar-dot { border: 2px solid #fff; }

/* ── Species multi-select dropdown ──────────────────────────── */
.species-ms {
  position: relative;
}

.species-ms-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.93rem;
  font-weight: 600;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.species-ms-btn:focus,
.species-ms-btn.is-open {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.species-ms-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.species-ms-chevron { flex-shrink: 0; }

.species-ms-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--teal);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 4px 0;
  min-width: 160px;
}

.species-ms-panel.is-open { display: block; }

.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.ms-item:hover { background: var(--teal-xlight, #e0f2fe); }

.ms-item input[type="checkbox"] {
  accent-color: #0ea5e9;
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* Regulations disclaimer */
.regs-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Water detail disclaimer + dimmed empty fields */
.water-detail-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

.field-row--empty .field-label { color: #cbd5e1; }
.field-row--empty .field-value { color: #cbd5e1; }

/* Alert button Lucide bell icon sizing */
.detail-alert-btn i[data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.collapsible-header:hover { filter: brightness(0.97); }

.collapsible-header-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Lucide icon in section header */
.sec-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sec-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--grey-pin);
  stroke-width: 1.5;
  display: block;
}

.collapsible-header-title {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

/* Chevron on right */
.collapsible-chevron {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.collapsible-chevron svg {
  width: 14px;
  height: 14px;
  stroke: #0ea5e9;
  stroke-width: 2;
  transition: transform 0.25s ease;
}

.collapsible.is-collapsed .collapsible-chevron svg {
  transform: rotate(-90deg);
}

/* Animated body */
.collapsible-body {
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible.is-collapsed .collapsible-body {
  max-height: 0;
}

.collapsible-content { padding: 0.9rem 1rem; }

/* ── Field rows (inside collapsible sections) ───────────────── */

.field-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.32rem 0;
  font-size: 0.875rem;
}

.field-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 110px;
  flex-shrink: 0;
}

.field-value {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.field-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.field-calc {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* "Buy License →" and "Verify regulations →" inline action links */
.field-action-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal-dark);
  text-decoration: none;
  white-space: nowrap;
}

.field-action-link:hover { text-decoration: underline; }

/* Empty-state note (when no data available yet) */
.detail-no-data {
  font-size: 0.82rem;
  font-style: italic;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.65rem;
}

/* Link row in Regulations empty state */
.regs-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

/* Fishing tips body text */
.tip-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.65;
}

/* ── Stocking history — timeline layout ─────────────────────── */

.timeline-wrap { padding: 0.15rem 0; }

.timeline-item {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.42rem 0;
}

/* Track column: holds the vertical line and the dot */
.tl-track {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-track-top {
  width: 2px;
  flex: 0 0 7px;
  background: var(--border);
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1.5px var(--border);
  z-index: 1;
}

.tl-track-bottom {
  width: 2px;
  flex: 1;
  min-height: 7px;
  background: var(--border);
}

/* No line below the last dot */
.tl-track-bottom--last { background: transparent; }

/* Content column */
.tl-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding-bottom: 0.3rem;
}

/* ══════════════════════════════════════════════════════════════
   MAP VIEW
   ══════════════════════════════════════════════════════════════ */

#leaflet-map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Map legend (injected by Leaflet control) */
.map-legend {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem;
  font-family: 'Inter', sans-serif;
  min-width: 140px;
  margin-bottom: 28px; /* clear the Leaflet attribution bar at the bottom */
}

.legend-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.2rem 0;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.7);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Tile selector panel — bottom-right corner of map */
.map-tile-panel {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.7rem 0.9rem;
  font-family: 'Inter', sans-serif;
  min-width: 130px;
  margin-bottom: 28px; /* clear the Leaflet attribution bar at the bottom */
}

/* Make Leaflet's attribution bar always visible and legible */
.leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important;
  font-size: 0.72rem !important;
  padding: 2px 6px !important;
  border-radius: 4px 0 0 0 !important;
}

.tile-radio,
.tile-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 0.2rem 0;
  user-select: none;
}

.tile-radio input,
.tile-check input {
  accent-color: var(--teal);
  cursor: pointer;
  width: 15px;
  height: 15px;
  margin: 0;
}

.tile-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.4rem 0;
}

/* Place names label dims when Streets is active (checkbox has no effect) */
.tile-check-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Pin hover tooltip — dark card with full stocking detail */
.map-pin-tooltip {
  background: rgba(10, 22, 40, 0.92);
  border: none;
  border-radius: 7px;
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  padding: 8px 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.4);
  white-space: nowrap;
  pointer-events: none;
}

.map-pin-tooltip::before { display: none; } /* remove default white arrow */

.tip-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #e0f2fe;
  margin-bottom: 5px;
}

.tip-row {
  display: flex;
  gap: 0.5rem;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.6;
}

.tip-label {
  color: #64748b;
  font-weight: 700;
  min-width: 52px;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: 'Inter', sans-serif !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.map-popup {
  padding: 1rem 1.1rem;
  min-width: 210px;
}

.popup-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.popup-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.2rem 0;
}

.popup-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 50px;
}

.leaflet-popup-tip { display: none; }

/* ══════════════════════════════════════════════════════════════
   CALENDAR VIEW
   ══════════════════════════════════════════════════════════════ */

.calendar-outer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1.25rem;
}

.cal-nav-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.cal-nav-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-xlight);
}

.cal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}

/* Calendar grid + detail side by side */
.calendar-body {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.cal-grid-wrap { flex: 1; min-width: 0; }

/* Day-of-week header row */
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.cal-dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.4rem 0;
}

/* The actual day cells */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  cursor: default;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  position: relative;
  box-shadow: var(--shadow-sm);
}

/* Empty cells (padding before month starts) */
.cal-day.empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

/* Days that have stocking records */
.cal-day.has-data {
  cursor: pointer;
  background: var(--teal-xlight);
  border-color: var(--teal-light);
  color: var(--teal-dark);
}

.cal-day.has-data:hover {
  background: var(--teal-light);
  border-color: var(--teal);
}

/* Dot indicator for days with data */
.cal-day.has-data::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}

/* Selected day */
.cal-day.selected {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: var(--white) !important;
}

.cal-day.selected::after {
  background: var(--white);
}

/* Detail panel on the right */
.cal-detail {
  width: 290px;
  flex-shrink: 0;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  min-height: 240px;
}

.cal-detail-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  padding-top: 3rem;
  line-height: 1.6;
}

.cal-detail-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--teal-light);
}

.cal-detail-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.cal-detail-item:last-child { border-bottom: none; }

.cal-detail-water {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.cal-detail-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  text-align: center;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — medium desktop (≤ 1199px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1699px) {
  .list-col-waters  { width: 380px; }
  .list-col-preview { flex: 0 0 500px; min-width: 500px; }
  .list-col-detail  { min-width: 0; }
}

@media (max-width: 1399px) {
  .list-col-waters  { width: 320px; }
  .list-col-preview { flex: 0 0 440px; min-width: 440px; }
  .list-col-detail  { min-width: 0; }
}

@media (max-width: 1199px) {
  .list-col-waters  { width: 280px; }
  .list-col-preview { flex: 0 0 380px; min-width: 380px; }
  .list-col-detail  { min-width: 0; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — tablet / small laptop (≤ 899px)
   Columns 1, 2, 3 stack vertically.
   Column 1 collapses to a horizontal pill bar.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 899px) {
  #view-list.active { height: auto; overflow: visible; }

  .list-cols { flex-direction: column; overflow: visible; min-height: 0; }

  /* Col 1: compact horizontal pill strip */
  .list-col-waters {
    width: 100%;
    height: 50px;
    flex-shrink: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
    align-items: center;
  }

  /* Hide search / geo / count in pill-bar mode */
  .list-col-waters .list-search-wrap,
  .list-col-waters .geo-banner,
  .list-col-waters .geo-active-bar,
  .list-col-waters .geo-no-results-banner,
  .list-col-waters .list-count { display: none; }

  /* Water list container becomes horizontal flex */
  #water-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 0;
    align-items: center;
  }

  /* Each card → compact pill */
  .water-card {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    width: auto;
    padding: 4px 14px;
    border-left: none !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 999px;
    background: var(--bg);
    white-space: nowrap;
    min-height: 0;
  }

  .water-card:hover { background: var(--teal-xlight); border-color: var(--teal) !important; }

  .water-card.selected {
    background: var(--teal) !important;
    border-color: var(--teal) !important;
  }

  .water-card-body { flex: none; min-width: 0; }

  .water-card-name {
    font-size: 0.77rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    margin-bottom: 0;
    color: var(--text);
  }

  .water-card.selected .water-card-name { color: #fff; }

  .water-card-meta,
  .water-card-badge { display: none; }

  /* Col 2: full width, reduced map height */
  .list-col-preview {
    flex: none;
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .preview-map-wrap { height: 260px; }

  /* Col 3: full width, natural height */
  .list-col-detail { width: 100%; min-width: 0; overflow-y: visible; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE  (≤ 767px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Header */
  .site-header { height: 56px; padding: 0 1rem; }
  .logo-text    { font-size: 1.05rem; }
  .logo-icon    { font-size: 1.2rem; }
  .btn-alerts   { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

  /* Stats bar */
  .stats-bar { gap: 0; padding: 0.7rem 0.5rem; }
  .stat       { padding: 0 1.1rem; }
  .stat-number { font-size: 1.3rem; }
  .stat-label  { font-size: 0.62rem; }

  /* Tabs — full width */
  .tab-nav  { padding: 0; }
  .tab-btn  { flex: 1; justify-content: center; padding: 0.75rem 0.5rem; font-size: 0.82rem; }
  .tab-icon { display: none; }

  /* Map container: JS overrides with exact pixel value from visualViewport;
     these are CSS fallbacks so the container isn't 0px if JS is slow */
  #view-map.active {
    height: 100vh;                  /* non-Safari fallback */
    height: -webkit-fill-available; /* iOS Safari: visual viewport height */
  }

  /* Leaflet bottom controls: push above home indicator on notched iPhones.
     Requires viewport-fit=cover in the meta viewport tag. */
  .leaflet-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Filters */
  .controls       { padding: 0.75rem 1rem; gap: 0.6rem; }
  .filter-group   { min-width: 100%; flex: none; }
  .filter-actions { width: 100%; }
  .btn-pill, .btn-reset { flex: 1; justify-content: center; }

  /* List view: natural height, full vertical stack */
  #view-list.active { height: auto; overflow: visible; }

  .list-cols { flex-direction: column; overflow: visible; }

  /* Col 1 pill bar even smaller on mobile */
  .list-col-waters { height: 44px; padding: 0 6px; }

  /* Col 2 preview card: compact map */
  .preview-map-wrap { height: 200px; }
  #metric-strip     { gap: 5px; padding: 8px 10px; }
  .metric-row-label { width: 68px; font-size: 0.54rem; }
  .metric-row-value { width: 64px; font-size: 0.72rem; }

  /* Col 3: natural height */
  .list-col-detail { padding: 1rem; overflow-y: visible; }
  .detail-col-name { font-size: 1.2rem; }

  /* Calendar — stack detail below grid on mobile */
  .calendar-outer { padding: 0.85rem; }
  .calendar-body  { flex-direction: column; }
  .cal-detail     { width: 100%; min-height: auto; }
  .cal-day        { font-size: 0.78rem; }
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE TOGGLE BUTTON (in header)
   ══════════════════════════════════════════════════════════════ */

.btn-dark-mode {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
  /* emoji renders its own colour — no inherited colour needed */
}

.btn-dark-mode:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(14,165,233,0.1);
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE  — applied via html.dark-mode class
   Overrides CSS variables so every component updates automatically.
   ══════════════════════════════════════════════════════════════ */

html.dark-mode {
  --bg:          #0f172a;
  --white:       #1e293b;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --border:      #334155;
  --border-mid:  #475569;
  --teal-xlight: rgba(14,165,233,0.08);
  --teal-light:  rgba(14,165,233,0.18);
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.35);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg:   0 10px 30px rgba(0,0,0,0.55);
}

/* Select and input elements need explicit dark backgrounds
   because browsers don't inherit CSS variables into native form controls */
html.dark-mode .filter-group select,
html.dark-mode .filter-group input {
  background-color: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

html.dark-mode .filter-group select:focus,
html.dark-mode .filter-group input:focus {
  border-color: var(--teal);
}

/* Elements that use --navy or --white as TEXT colour need explicit overrides
   because --navy stays dark in dark mode (intentionally — it's the header colour)
   and --white gets flipped to a dark surface colour for backgrounds. */

/* Stats bar numbers + state identifier */
html.dark-mode .stat-number    { color: #e2e8f0; }
html.dark-mode .stat-label     { color: #94a3b8; }
html.dark-mode .stat-state-name { color: #e2e8f0; }

/* Moon widget dates in dark mode */
html.dark-mode .moon-widget-date  { color: #94a3b8; }
html.dark-mode .moon-widget-phase { color: #e2e8f0; }

/* Header logo text (uses var(--white) which becomes a dark surface in dark mode) */
html.dark-mode .logo-text { color: #f1f5f9; }

/* Table header text — thead uses color: var(--white) which is now dark */
html.dark-mode thead th { color: #f1f5f9; }

/* Card water name */
html.dark-mode .card-name { color: #e2e8f0; }

/* Calendar nav bar background and title */
html.dark-mode .calendar-nav-bar { background: #1e293b; border-color: #334155; }
html.dark-mode .cal-title        { color: #e2e8f0; }
html.dark-mode .cal-nav-btn      { background: #0f172a; border-color: #334155; color: #94a3b8; }
html.dark-mode .cal-nav-btn:hover { border-color: var(--teal); color: var(--teal); background: rgba(14,165,233,0.08); }

/* Calendar day cells */
html.dark-mode .cal-day       { background: #1e293b; color: #cbd5e1; box-shadow: none; }
html.dark-mode .cal-day.empty { background: transparent; }

/* Calendar detail panel */
html.dark-mode .cal-detail-heading { color: #e2e8f0; }
html.dark-mode .cal-detail-water   { color: #f1f5f9; }

/* Map legend stays white so it's readable over the map tiles */
html.dark-mode .map-legend {
  background: #1e293b;
  color: #f1f5f9;
}

/* Prevent light background bleed behind map tiles in dark mode */
html.dark-mode #view-map,
html.dark-mode #leaflet-map,
html.dark-mode .leaflet-container {
  background: #0f172a;
}

html.dark-mode .legend-title { color: #94a3b8; }
html.dark-mode .legend-item  { color: #e2e8f0; }

/* ── Dark mode: three-column list layout ────────────────────── */
html.dark-mode .list-col-waters    { background: #1a2332; border-color: #334155; }
html.dark-mode .list-col-preview   { background: #0f172a; border-color: #334155; }
html.dark-mode .list-col-detail    { background: #0f172a; }
html.dark-mode .preview-card       { border-color: #334155; background: #1e293b; }
html.dark-mode .preview-map-wrap   { background: #0f172a; }
html.dark-mode #metric-strip       { background: #1e293b; border-top-color: #334155; }
html.dark-mode .metric-card        { background: #1e293b; border-color: #334155; }
html.dark-mode .mc-label           { color: #64748b; }
html.dark-mode .mc-value           { color: #e2e8f0; }
html.dark-mode .mc-note            { color: #64748b; }
html.dark-mode .mc-bar-dot         { border-color: #1e293b; }
html.dark-mode .mc-bar-track       { filter: brightness(1.6); }
html.dark-mode .mc-bar-track--empty { background: #334155; filter: none; }

/* Species multi-select dark mode */
html.dark-mode .species-ms-btn       { background: #1e293b; color: #f1f5f9; border-color: #334155; }
html.dark-mode .species-ms-btn.is-open { border-color: var(--teal); }
html.dark-mode .species-ms-panel     { background: #1e293b; border-color: var(--teal); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
html.dark-mode .ms-item              { color: #f1f5f9; }
html.dark-mode .ms-item:hover        { background: rgba(14,165,233,0.12); }
html.dark-mode .species-ms-chevron path { stroke: #64748b; }
html.dark-mode .detail-col-name    { color: #e2e8f0; }
html.dark-mode .detail-col-county  { color: #94a3b8; }
html.dark-mode .detail-col-distance { color: #94a3b8; }

/* Water list panel elements */
html.dark-mode .list-search-wrap   { background: #1e293b; border-color: #334155; }
html.dark-mode #list-search        { background: #0f172a; color: #f1f5f9; border-color: #334155; }
html.dark-mode #list-search:focus  { border-color: var(--teal); }
html.dark-mode .list-count         { background: #0f172a; }
html.dark-mode .water-card         { background: #1a2332; border-bottom-color: #334155; }
html.dark-mode .water-card:hover   { background: #1e3044; }
html.dark-mode .water-card.selected { background: rgba(14,165,233,0.15); }
html.dark-mode .water-card-name    { color: #e2e8f0; }
html.dark-mode .water-card-status  { color: #64748b; }
html.dark-mode .geo-no-results-banner { background: #422006; color: #fed7aa; border-color: #92400e; }
html.dark-mode .water-type-pill    { background: #0f172a; color: #64748b; }
html.dark-mode .status-text        { /* color already inline */ }
html.dark-mode #det-stocking .collapsible-header { background: #0c1f2e; }
html.dark-mode #det-regs     .collapsible-header { background: #10142e; }
html.dark-mode #det-water    .collapsible-header { background: #0c1f18; }
html.dark-mode #det-tips     .collapsible-header { background: #1f1a0c; }
html.dark-mode #det-history  .collapsible-header { background: #180c1f; }
html.dark-mode #det-tips .collapsible-content    { background: rgba(30,20,5,0.40); }

/* ── Dark mode: detail panel elements ───────────────────────── */
html.dark-mode .detail-water-name  { color: #e2e8f0; }
html.dark-mode .snapshot-card      { background: #1e293b; border-color: #334155; }
html.dark-mode .announce-past      { background: #1e293b; color: #94a3b8; }
html.dark-mode .history-date       { color: #e2e8f0; }
html.dark-mode .detail-filter-group select { background: #1e293b; color: #f1f5f9; border-color: #334155; }
html.dark-mode .filter-group select { background-color: #1e293b; color: #f1f5f9; border-color: #334155; }

/* Collapsible sections */
html.dark-mode .collapsible                { background: #1e293b; border-color: #334155; }
html.dark-mode .collapsible-header         { border-bottom-color: #334155; }
html.dark-mode .collapsible-header:hover   { background: rgba(14,165,233,0.06); }
html.dark-mode .collapsible-header-title   { color: #94a3b8; }
html.dark-mode .sec-icon svg               { stroke: #475569; }
html.dark-mode .collapsible-chevron svg    { stroke: #475569; }

/* Field rows */
html.dark-mode .field-label   { color: #64748b; }
html.dark-mode .field-value   { color: #e2e8f0; }
html.dark-mode .field-divider { border-top-color: #334155; }
html.dark-mode .field-calc    { color: #64748b; }
html.dark-mode .field-action-link { color: #38bdf8; }
html.dark-mode .detail-no-data { color: #64748b; }

/* Timeline */
html.dark-mode .tl-track-top    { background: #334155; }
html.dark-mode .tl-track-bottom { background: #334155; }
html.dark-mode .tl-dot          { border-color: #1e293b; box-shadow: 0 0 0 1.5px #334155; }

/* Fishing tips */
html.dark-mode .tip-text { color: #e2e8f0; }

/* ── Utilities ──────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
