/* ═══════════════════════════════════════════════════════════

   GUIDE MONTANA — Drought Hub Module

   Drought intelligence dashboard

   ═══════════════════════════════════════════════════════════ */



/* ═══════════════════════════════════════════════════════════
   DROUGHT MAP MODE — map + right drawer + left panel
   ═══════════════════════════════════════════════════════════ */

/* Layer rail hides; map, left panel, and right drawer stay */
#main-content.drought-map-mode > #layer-column { display: none !important; }

/* Drought hub becomes visible inside the left panel */
#main-content.drought-map-mode #drought-hub {
  display: flex !important;
  flex-direction: column;
  height: auto;
  overflow: visible;
}

/* Fit the full-screen scroll container within the narrower left panel */
#main-content.drought-map-mode #cat-drought.drought-fs { padding: 0; background: transparent; }
#main-content.drought-map-mode #cat-drought.drought-fs > .drought-fs-scroll {
  padding: 0;
  max-width: none;
}

/* Compact the journey header in the left panel */
#main-content.drought-map-mode #drought-hub .dh-header { padding: 10px 12px; }

/* ─── Drought Map Panel — right-drawer content ─────────────────────────── */

.dmp-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.dmp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-default);
}
.dmp-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.875rem;
}
.dmp-panel-title [data-lucide] { width: 15px; height: 15px; color: var(--guide-color-mt-warm, #B45309); }
.dmp-date-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* KPI tiles */
.dmp-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-default);
  border-bottom: 1px solid var(--border-default);
}
.dmp-kpi {
  background: var(--bg-0, var(--guide-color-paper));
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 3px solid transparent;
}
.dmp-kpi-label { font-size: 0.75rem; color: var(--text-muted); text-transform: var(--guide-label-case, uppercase); letter-spacing: 0.03em; }
.dmp-kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.dmp-kpi-unit  { font-size: 0.75rem; color: var(--text-muted); }

/* Sections */
.dmp-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dmp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.04em;
}
.dmp-section-link {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--guide-color-link, #2563EB);
  text-decoration: none;
}
.dmp-section-link:hover { text-decoration: underline; }

/* USDM stacked bar */
.dmp-bar-stack {
  display: flex;
  height: 10px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--guide-color-line);
}
.dmp-bar-seg { height: 100%; transition: width 0.3s ease; }

/* USDM class list */
.dmp-class-list { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.dmp-class-row  { display: flex; align-items: center; gap: 8px; }
.dmp-class-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dmp-class-label { flex: 1; color: var(--text-secondary); }
.dmp-class-pct  { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.dmp-class-normal .dmp-class-label { color: var(--text-muted); }
.dmp-class-normal .dmp-class-pct  { color: var(--text-muted); font-weight: 400; }

.dmp-loading {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.75rem; padding: 4px 0;
}
.dmp-loading [data-lucide] { width: 14px; height: 14px; animation: spin 1s linear infinite; }

/* Index selector pills */
.dmp-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dmp-pill {
  padding: 3px 10px;
  border: 1px solid var(--border-default);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dmp-pill.active {
  background: var(--guide-color-ochre-fill);
  border-color: var(--guide-color-ochre-fill);
  color: var(--guide-color-on-ochre-fill);
  font-weight: 600;
}
.dmp-pill:hover:not(.active) {
  background: var(--guide-color-line);
  color: var(--text-primary);
}
.dmp-pill-sm .dmp-pill { padding: 2px 7px; font-size: 0.75rem; }

/* Index figure */
.dmp-idx-fig { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.dmp-idx-img  { width: 100%; border-radius: 4px; display: block; }
.dmp-idx-cap  { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.dmp-link     { color: var(--guide-color-link, #2563EB); text-decoration: none; }
.dmp-link:hover { text-decoration: underline; }
.dmp-img-err  { font-size: 0.75rem; color: var(--text-muted); padding: 6px 0; }

.dmp-eddi-note {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px;
  background: var(--guide-color-raised, var(--bg-1));
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.5;
}
.dmp-eddi-note [data-lucide] { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.dmp-eddi-note p { margin: 0; }

/* Map overlay button */
.dmp-map-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  align-self: flex-start;
}
.dmp-map-btn [data-lucide] { width: 13px; height: 13px; }
.dmp-map-btn:hover {
  background: var(--guide-color-ochre-fill);
  border-color: var(--guide-color-ochre-fill);
  color: var(--guide-color-on-ochre-fill);
}

/* Action row */
.dmp-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}
.dmp-action-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.dmp-action-btn [data-lucide] { width: 14px; height: 14px; flex-shrink: 0; }
.dmp-action-btn:hover { background: var(--guide-color-line); color: var(--text-primary); }
.dmp-action-ai {
  background: var(--guide-color-ochre-fill);
  border-color: var(--guide-color-ochre-fill);
  color: var(--guide-color-on-ochre-fill);
  font-weight: 600;
}
.dmp-action-ai:hover {
  background: color-mix(in srgb, var(--guide-color-ochre-fill) 85%, var(--guide-color-on-ochre-fill));
  border-color: color-mix(in srgb, var(--guide-color-ochre-fill) 85%, var(--guide-color-on-ochre-fill));
}

/* ═══════════════════════════════════════════════════════════
   DROUGHT HUB — World-Class Drought Intelligence Mode
   ═══════════════════════════════════════════════════════════ */

/* --- Layout: flat content-only fullscreen (Enforce/Parcels pattern) --- */

#main-content.drought-mode > #layer-column,
#main-content.drought-mode > #map-area,
#main-content.drought-mode > #right-drawer { display: none !important; }

#main-content.drought-mode > #left-panel {
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 auto !important;
  border-right: none !important;
  background: var(--bg-0, #E8E4D9) !important;
  overflow: hidden !important;
}
#main-content.drought-mode > #left-panel > .lp-head,
#main-content.drought-mode > #left-panel > .lp-expand-btn,
#main-content.drought-mode > #left-panel > .lp-collapse-btn { display: none !important; }

#main-content.drought-mode #panel-scroll {
  background: var(--bg-0, #E8E4D9);
  padding: 0 !important;
}
#main-content.drought-mode #cat-drought.drought-fs {
  padding: 0;
  background: var(--bg-0, #E8E4D9);
}
#main-content.drought-mode #cat-drought.drought-fs > .drought-fs-scroll {
  padding: 24px 32px;
  scroll-behavior: smooth;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}
#main-content.drought-mode #drought-hub {
  display: flex !important;
  flex-direction: column;
  width: 100%;
}
#drought-hub {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
.dh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--guide-color-raised);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.dh-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dh-header-badge {
  width: 40px;
  height: 40px;
  background: var(--guide-color-paper-2);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--radius-md, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--guide-color-ink);
  flex-shrink: 0;
}
.dh-header-badge svg { width: 20px; height: 20px; }
.dh-title {
  font-size: var(--guide-fs-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}
.dh-subtitle {
  font-size: var(--text-xxs);
  color: var(--text-tertiary, rgba(0,0,0,0.22));
  margin: 2px 0 0;
  letter-spacing: 0.3px;
}
.dh-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dh-timestamp {
  font-size: var(--text-xxs);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-tertiary);
}

/* KPI Row */
.dh-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-0, #E8E4D9);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.dh-kpi {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.dh-kpi:hover {
  box-shadow: var(--guide-shadow-raised);
}
.dh-kpi-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.dh-kpi-icon svg { width: 16px; height: 16px; }
.dh-kpi-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dh-kpi-val {
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-primary);
  line-height: 1.1;
}
.dh-kpi-val.shimmer {
  min-width: 36px;
  min-height: 20px;
  border-radius: 4px;
}
.dh-kpi-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main: Sidebar + Map */
.dh-main {
  flex: 1;
  display: flex;
  overflow: visible;
  min-height: 0;
}
.dh-sidebar {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px 32px;
  background: var(--bg-0, #E8E4D9);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.06) transparent;
}
.dh-sidebar::-webkit-scrollbar { width: 5px; }
.dh-sidebar::-webkit-scrollbar-thumb { background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.06); border-radius: 4px; }

/* Sections */
.dh-section {
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg, 12px);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.dh-sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.8px;
  color: var(--text-secondary, rgba(0,0,0,0.60));
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
}
.dh-sec-title svg { width: 14px; height: 14px; color: var(--text-tertiary); }

/* Severity Bars */
.dh-sev-summary {
  font-size: var(--text-md);
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.dh-sev-summary strong { color: var(--text-primary); font-weight: 700; }
.dh-sev-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.dh-sev-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dh-sev-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
}
.dh-sev-pct {
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-primary);
  width: 46px;
  text-align: right;
  flex-shrink: 0;
}
.dh-sev-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05);
  border-radius: 4px;
  overflow: hidden;
}
.dh-sev-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Timeline Chart */
.dh-chart-wrap {
  height: 200px;
  position: relative;
  background: var(--bg-5, #E0DCD2);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}
.dh-chart-wrap svg {
  width: 100%;
  height: 100%;
}

/* Reservoir / SNOTEL bars */
.dh-res-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.dh-res-name {
  font-size: var(--text-xxs);
  color: var(--text-secondary);
  width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.dh-res-bar-bg {
  flex: 1;
  height: 7px;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05);
  border-radius: 4px;
  overflow: hidden;
}
.dh-res-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.dh-res-val {
  font-size: var(--text-xs);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-tertiary);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}
.dh-total-stat {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-default);
}

/* Streamflow mini bar */
.dh-flow-summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.dh-flow-summary strong { color: var(--text-primary); font-weight: 600; }
.dh-flow-bar-wrap { margin-top: 8px; }

/* Alert Cards */
.dh-alert-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.02);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  margin-bottom: 6px;
}
.dh-alert-sev {
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.dh-alert-sev--extreme { background: color-mix(in srgb, var(--guide-color-brick) 20%, transparent); color: var(--guide-color-status-crit); }
.dh-alert-sev--severe  { background: color-mix(in srgb, var(--guide-color-status-watch) 20%, transparent); color: var(--guide-color-status-watch); }
.dh-alert-sev--moderate { background: color-mix(in srgb, var(--guide-color-status-watch) 14%, transparent); color: var(--guide-color-status-watch); }
.dh-alert-sev--minor   { background: color-mix(in srgb, var(--guide-color-status-ok) 14%, transparent); color: var(--guide-color-status-ok); }
.dh-alert-body {
  min-width: 0;
}
.dh-alert-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.dh-alert-desc {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* AI Cards Grid */
.dh-ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.dh-ai-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: border-color 0.15s,
    box-shadow 0.15s,
    color 0.15s,
    transform 0.15s;
  font-size: var(--text-xxs);
  color: var(--charcoal);
}
.dh-ai-card [data-lucide] { color: var(--charcoal); }
.dh-ai-card:hover {
  border-color: var(--accent-ai-border-hover);
  box-shadow: var(--guide-shadow-raised);
  color: var(--text-primary);
}
.dh-ai-card svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--charcoal); }
.dh-ai-card:hover svg { color: var(--guide-color-action); }

/* Empty state */
.dh-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}
.dh-empty svg { width: 24px; height: 24px; margin-bottom: 8px; opacity: 0.4; }

/* --- Responsive --- */
@media (max-width: 1200px) {
  .dh-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dh-sidebar { width: 380px; }
}
@media (max-width: 900px) {
  .dh-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dh-main { flex-direction: column; }
  .dh-sidebar {
    width: 100%;
    max-height: 60vh;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }
  .dh-ai-grid { grid-template-columns: 1fr; }
  .dh-header { padding: 10px 14px; }
  .dh-title { font-size: var(--guide-fs-base); }
}
@media (max-width: 640px) {
  .dh-kpi-row { grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 12px; }
  .dh-kpi-val { font-size: var(--text-lg); }
  .dh-sidebar { padding: 8px 10px 20px; }
}

/* ═══════════════════════════════════════════════════════════
   DROUGHT HUB — Tabs, Indices, Mesonet, Legend
   ═══════════════════════════════════════════════════════════ */

/* Tab Bar — default inline mode */
.dh-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 8px 12px;
  background: var(--guide-color-paper-2);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--guide-radius-md, 8px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dh-tabs::-webkit-scrollbar { display: none; }

/* Tab Bar — grid mode (toolkit style) */
.dh-tabs.dh-tabs--grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  gap: 2px;
  padding: 3px;
  overflow: visible;
  margin: 0 10px 8px;
  box-shadow: none;
}
@media (min-width: 500px) {
  .dh-tabs.dh-tabs--grid { grid-template-columns: 1fr 1fr 1fr; }
}

.dh-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: var(--guide-fs-sm);
  font-weight: 600;
  color: var(--guide-color-ink-soft);
  background: transparent;
  border: none;
  border-radius: var(--guide-radius-sm, 6px);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) ease,
    color var(--duration-fast) ease;
}
/* The Infinimaker segmented control: a recessed paper track, the chosen tab a
   raised sheet in ink. Every tab bar in the app draws this way. */
.dh-tab svg { width: 13px; height: 13px; flex-shrink: 0; color: currentcolor; opacity: 1; }
.dh-tab:hover { color: var(--guide-color-ink); }
.dh-tab.active {
  color: var(--guide-color-ink);
  background: var(--guide-color-raised);
  box-shadow: var(--guide-shadow-rest);
}
.dh-tab.active svg { color: var(--guide-color-action); }

/* Tab Panels — flex child needs min-height:0 so overflow-y:auto actually scrolls
   inside a height:100% flex column. Also let content grow naturally with auto height. */
.dh-tab-panel { display: none; }
.dh-tab-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 24px;
}
.dh-tab-panel[hidden] { display: none !important; }

/* Drought Indices Controls */
.dh-indices-controls {
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dh-index-selector {
  display: flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  background: var(--guide-color-paper-2);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--guide-radius-md, 8px);
}
.dh-idx-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 14px;
  font-size: var(--guide-fs-sm);
  font-weight: 600;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--guide-radius-sm, 6px);
  background: transparent;
  color: var(--guide-color-ink-soft);
  cursor: pointer;
  transition: background 0.2s,
    border-color 0.2s,
    color 0.2s;
}
.dh-idx-btn:hover { color: var(--guide-color-ink); }
.dh-idx-btn.active {
  background: var(--guide-color-raised);
  box-shadow: var(--guide-shadow-rest);
  color: var(--guide-color-ink);
}

.dh-timescale-bar {
  display: flex;
  align-self: flex-start;
  gap: 2px;
  flex-wrap: wrap;
  padding: 3px;
  background: var(--guide-color-paper-2);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--guide-radius-md, 8px);
}
.dh-ts-btn {
  padding: 5px 10px;
  font-size: var(--guide-fs-xs);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--guide-radius-sm, 6px);
  background: transparent;
  color: var(--guide-color-ink-soft);
  cursor: pointer;
  transition: background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.dh-ts-btn:hover { color: var(--guide-color-ink); }
.dh-ts-btn.active {
  background: var(--guide-color-raised);
  box-shadow: var(--guide-shadow-rest);
  color: var(--guide-color-ink);
}

/* Index Info */
.dh-idx-info {
  padding: 8px 16px 4px;
}
.dh-idx-name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.dh-idx-desc {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  line-height: 1.4;
}
.dh-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
  margin: 4px 0 0;
}

/* Legend Bar */
.dh-legend {
  padding: 8px 16px 12px;
}
.dh-legend-bar {
  display: flex;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-default);
}
.dh-legend-swatch {
  flex: 1;
  min-width: 0;
}
.dh-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary);
  margin-top: 3px;
  padding: 0 2px;
}

/* Toggle Switch */
.dh-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  cursor: pointer;
}
.dh-toggle-wrap input[type="checkbox"] { display: none; }
.dh-toggle-slider {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.08);
  position: relative;
  transition: background 0.2s;
}
.dh-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all 0.2s;
}
.dh-toggle-wrap input:checked + .dh-toggle-slider {
  background: color-mix(in srgb, var(--guide-color-ochre) 30%, transparent);
}
.dh-toggle-wrap input:checked + .dh-toggle-slider::after {
  left: 16px;
  background: var(--guide-color-ochre);
}
.dh-toggle-label {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
}

/* Mesonet Controls */
.dh-mesonet-controls {
  padding: 14px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* .dh-element-select — base styles now in components.css unified charcoal select */
.dh-element-select { flex: 1; min-width: 160px; }
.dh-element-select optgroup { color: rgba(255,255,255,0.6); }

/* Mesonet Summary */
.dh-mesonet-summary {
  padding: 4px 16px 8px;
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
}
.dh-meso-stat strong { color: var(--text-primary); }

/* Mesonet Station List */
.dh-mesonet-list {
  padding: 0 16px 16px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* Mesonet infographic tile cards (Item 33) */
.dh-mesonet-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.02);
  cursor: pointer;
  transition: background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
.dh-mesonet-card:hover {
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05);
  border-color: var(--border-default);
  box-shadow: var(--guide-shadow-raised);
}
.dh-meso-condition-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: none;
}
.dh-meso-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dh-meso-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dh-meso-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dh-meso-trend {
  font-size: var(--text-xxs);
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.dh-meso-trend--up   { color: var(--guide-color-ink); }
.dh-meso-trend--down { color: var(--guide-color-lake); }
.dh-meso-trend--steady { color: #71717a; }
.dh-meso-elev {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary);
  letter-spacing: 0.2px;
}
.dh-meso-val-block {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.dh-meso-val {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}
.dh-meso-unit {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary);
  font-weight: 500;
}
/* Legacy compat: keep .dh-meso-dot for any external references */
.dh-meso-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Snow KPIs */
.dh-snow-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 16px 8px;
}

/* Playback Controls */
.dh-playback {
  padding: 4px 0 8px;
}
.dh-playback-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dh-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.08);
  border-radius: 2px;
  outline: none;
}
.dh-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-drought, #D97706);
  cursor: pointer;
}
.dh-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-drought, #D97706);
  border: none;
  cursor: pointer;
}
.dh-playback-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  min-width: 80px;
  text-align: right;
}

/* Soil Moisture in Detail Panel */
.det-soil-depths {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}
.det-soil-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.det-soil-label {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  width: 50px;
  flex-shrink: 0;
}
.det-soil-bar-bg {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05);
  overflow: hidden;
}
.det-soil-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.det-soil-val {
  font-size: var(--text-xxs);
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SNOTEL Sparklines & % Median (Item 34)
   ═══════════════════════════════════════════════════════════ */
.dh-snotel-spark {
  flex-shrink: 0;
  vertical-align: middle;
}
.dh-snotel-pct-median {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   Reservoir Historical Context Markers (Item 35)
   ═══════════════════════════════════════════════════════════ */
.dh-res-bar-bg--ctx {
  position: relative;
}
.dh-res-marker-avg,
.dh-res-marker-ly {
  position: absolute;
  top: -1px;
  width: 2px;
  height: calc(100% + 2px);
  pointer-events: none;
}
.dh-res-marker-avg {
  background: rgba(0,0,0,0.35);
  border-radius: 1px;
}
.dh-res-marker-ly {
  background: rgba(59,130,246,0.6);
  border-radius: 1px;
}
.dh-res-whisker-min,
.dh-res-whisker-max {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}
.dh-res-whisker-min {
  border-left: 1px dashed var(--guide-color-border-strong, rgba(0,0,0,0.18));
}
.dh-res-whisker-max {
  border-left: 1px dashed var(--guide-color-border-strong, rgba(0,0,0,0.18));
}
/* Tooltip on hover for reservoir context markers */
.dh-res-row--enhanced .dh-res-bar-bg--ctx [title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: var(--guide-color-text-on-accent, #fff);
  font-size: var(--guide-fs-2xs);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}

/* ═══════════════════════════════════════════════════════════
   USDM Playback Speed & Loop Controls (Item 37)
   ═══════════════════════════════════════════════════════════ */
.dh-playback-extras {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 0;
}
.dh-speed-control {
  display: flex;
  gap: 2px;
}
.dh-speed-btn {
  padding: 3px 8px;
  font-size: var(--guide-fs-xs);
  font-weight: 600;
  border: 1px solid var(--guide-color-line-strong);
  border-radius: var(--guide-radius-xs, 4px);
  background: var(--guide-color-raised);
  color: var(--guide-color-ink-soft);
  cursor: pointer;
  transition: background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.dh-speed-btn:hover {
  color: var(--guide-color-ink);
}
.dh-speed-btn.active {
  border-color: var(--guide-color-action);
  box-shadow: inset 0 0 0 1px var(--guide-color-action);
  color: var(--guide-color-ink);
}
.dh-loop-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
.dh-loop-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-drought, #D97706);
  cursor: pointer;
}
.dh-loop-label {
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   Responsive overrides for drought elements
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .dh-tabs { padding: 0 10px; }
  .dh-tab { padding: 8px 10px; font-size: var(--text-xxs); }
  .dh-snow-kpis { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 12px 6px; }
  .dh-mesonet-list { max-height: 50vh; }
}

/* ═══════════════════════════════════════════════════════════
   Mobile responsive fix for drought tabs (Item 39)
   6-tab navigation on <640px: horizontal scroll, active indicator
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dh-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    gap: 4px;
    padding: 6px 10px;
  }
  .dh-tabs::-webkit-scrollbar { display: none; }
  .dh-tab {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: var(--text-xs);
    scroll-snap-align: start;
    position: relative;
    white-space: nowrap;
    min-width: 0;
  }
  .dh-tab span {
    display: inline;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Active tab indicator: bottom accent border */
  .dh-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--guide-color-action);
    border-radius: 2px 2px 0 0;
  }
  .dh-indices-controls { padding: 10px 12px 6px; }
  .dh-timescale-bar { gap: 2px; }
  .dh-ts-btn { padding: 4px 7px; font-size: var(--text-xs); }
  .dh-snow-kpis { grid-template-columns: 1fr 1fr 1fr; }
  /* Mesonet cards: compact on mobile */
  .dh-meso-val { font-size: var(--text-base); }
  .dh-meso-name { font-size: var(--text-xxs); }
  /* Playback extras: wrap on narrow screens */
  .dh-playback-extras { flex-wrap: wrap; gap: 8px; }
}

/* ── Map Overlay Gallery (SPI/SPEI preview tiles) ── */

/* ═══════════════════════════════════════════════════════════════════════
 * Methods & Citations panel (Phase 1 scaffold) — Montana Editorial
 * ═══════════════════════════════════════════════════════════════════ */
.dh-methods-pblock .pb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dh-methods-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dh-cap-pill {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  background: var(--bg-3, #F7F5F0);
  color: var(--text-secondary, #4A4A52);
  letter-spacing: 0.02em;
}
.dh-cap-pill[data-state="ready"] {
  background: rgba(15, 118, 110, 0.10);
  color: var(--mt-teal-deep, #115E59);
  border-color: rgba(15, 118, 110, 0.30);
}
.dh-cap-pill[data-state="offline"] {
  background: color-mix(in srgb, var(--guide-color-ochre-fill) 12%, transparent);
  color: var(--guide-color-status-watch);
  border-color: color-mix(in srgb, var(--guide-color-ochre-fill) 30%, transparent);
}
.dh-cap-pill[data-state="not-configured"] {
  background: color-mix(in srgb, var(--guide-color-lake) 10%, transparent);
  color: var(--guide-color-ink-soft);
  border-color: color-mix(in srgb, var(--guide-color-lake) 30%, transparent);
}
.dh-cap-pill[data-state="loading"] {
  opacity: 0.7;
}
.dh-methods-sort {
  font: inherit;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--guide-radius-sm, 6px);
  border: 1px solid var(--guide-color-line-strong);
  background: var(--guide-color-raised);
  color: var(--guide-color-ink-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.dh-methods-sort:hover {
  color: var(--guide-color-ink);
}
.dh-methods-sort.active {
  border-color: var(--guide-color-action);
  box-shadow: inset 0 0 0 1px var(--guide-color-action);
  color: var(--guide-color-ink);
}

.dh-methods-panel {
  padding: 4px 0 0;
}
.dh-methods-intro {
  font-size: var(--guide-fs-sm);
  line-height: 1.55;
  color: var(--text-secondary, #4A4A52);
  margin: 4px 0 14px;
  max-width: 720px;
}
.dh-cite-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.dh-cite-card {
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.dh-cite-card:hover {
  border-left-color: var(--guide-color-action);
}
.dh-cite-method {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--guide-color-mt-red-deep-text, #8E1B29);
  margin-bottom: 4px;
}
.dh-cite-one-line {
  font-size: var(--guide-fs-sm);
  line-height: 1.5;
  color: var(--text-primary, #1A1A1F);
  margin-bottom: 6px;
}
.dh-cite-ref {
  font-size: var(--guide-fs-xs);
  line-height: 1.5;
  color: var(--text-tertiary, #6B6B73);
}
.dh-cite-ref em {
  color: var(--text-secondary, #4A4A52);
  font-style: italic;
}
.dh-cite-doi {
  margin-top: 4px;
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
}
.dh-cite-doi a {
/* The DOI and outlook anchors take the link token: --mt-slate-deep never
   flips, so these citation links measured 1.35:1 on dark across 43
   elements. The three other mt-slate-deep uses in this file sit on
   .dh-cap-pill rules that paint their own 10% slate wash — those are
   chips, not links, and are left alone. */
  color: var(--guide-color-link);
  text-decoration: none;
  border-bottom: 1px dotted var(--mt-slate, #3B5A7A);
}
.dh-cite-doi a:hover {
  color: var(--guide-color-mt-red-deep-text, #8E1B29);
  border-bottom-color: var(--guide-color-action);
}

/* Inline footnote chip used by drought-citations.js chip() */
.dh-cite-chip {
  display: inline-block;
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 1px 5px;
  margin-left: 4px;
  border-radius: 4px;
  background: rgba(59, 90, 122, 0.10);
  color: var(--mt-slate-deep, #2A4361);
  border: 1px solid rgba(59, 90, 122, 0.20);
  text-decoration: none;
  vertical-align: baseline;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.dh-cite-chip:hover {
  background: color-mix(in srgb, var(--guide-color-action) 10%, transparent);
  border-color: color-mix(in srgb, var(--guide-color-action) 30%, transparent);
  color: var(--guide-color-mt-red-deep-text, #8E1B29);
}
.dh-methods-empty {
  font-size: var(--guide-fs-sm);
  color: var(--text-tertiary, #6B6B73);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
 * Drought Outlook & Discussion widget (Phase 4 wired endpoints)
 * ═══════════════════════════════════════════════════════════════════ */
.dh-outlook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.dh-outlook-card {
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dh-outlook-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.dh-outlook-card h4 {
  margin: 0;
  font-size: var(--guide-fs-sm);
  font-weight: 600;
  color: var(--text-primary, #1A1A1F);
}
.dh-outlook-cite {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
  white-space: nowrap;
}
.dh-outlook-img {
  background: #fff;
  border-radius: 4px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dh-outlook-img img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.dh-outlook-img-link {
  display: block;
  width: 100%;
}
.dh-outlook-img-link:hover img {
  filter: brightness(1.04);
}
.dh-outlook-card--text {
  background: var(--bg-1, #F2EFE8);
}
.dh-outlook-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--guide-fs-sm);
  line-height: 1.45;
  color: var(--text-secondary, #4A4A52);
}
.dh-outlook-list a {
  color: var(--guide-color-link);
  text-decoration: none;
  border-bottom: 1px dotted var(--mt-slate, #3B5A7A);
}
.dh-outlook-list a:hover {
  color: var(--guide-color-mt-red-deep-text, #8E1B29);
  border-bottom-color: var(--guide-color-action);
}
.dh-outlook-meta {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
}
.dh-outlook-empty {
  font-size: var(--guide-fs-xs);
  font-style: italic;
  color: var(--text-tertiary, #6B6B73);
  padding: 10px 0;
}
.dh-outlook-img .shimmer {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════
 * Drought tool footnote in chat bubbles (Phase 6)
 * ═══════════════════════════════════════════════════════════════════ */
.dh-tool-footnote {
  margin-top: 8px;
  border-top: 1px dashed var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  padding-top: 6px;
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4A4A52);
}
.dh-tool-footnote details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dh-tool-footnote details summary::-webkit-details-marker { display: none; }
.dh-tool-footnote details summary::before {
  content: '▸';
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
}
.dh-tool-footnote details[open] summary::before { content: '▾'; }
.dh-tool-footnote code {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  background: rgba(59, 90, 122, 0.10);
  color: var(--mt-slate-deep, #2A4361);
  padding: 1px 5px;
  border-radius: 3px;
}
.dh-tool-source {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6B6B73);
}
.dh-tool-payload {
  margin: 6px 0 0;
  padding: 6px 8px;
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 4px;
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  line-height: 1.4;
  color: var(--text-secondary, #4A4A52);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow: auto;
}

/* ═══════════════════════════════════════════════════════════════════════
 * INTENT JOURNEY SHELL (2026 redesign)
 * Status → Diagnose → Outlook → Act. The whole hub flows & scrolls as one
 * document; the legacy per-tab inner scroll is neutralised so the story
 * card, cockpit, rail, intent cards & intelligence card scroll together.
 * ═══════════════════════════════════════════════════════════════════════ */
#main-content.drought-mode #drought-hub {
  display: block !important;
  height: auto !important;
  overflow: visible !important;
}
.dh-stage-panel .dh-tab-panel.active {
  display: block;
  flex: none;
  min-height: 0;
  overflow: visible;
  padding-bottom: 0;
}
.dh-stage-panel[hidden] { display: none; }

/* Story card spacing (base .tu-story-card is global) */
.dh-story-card { margin: 0 0 14px; }

/* Persistent conditions cockpit */
.dh-conditions {
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: var(--guide-radius-lg, 12px);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.dh-conditions-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm, 13px);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.8px;
  color: var(--text-secondary, #4A4A52);
  margin-bottom: 12px;
}
.dh-conditions-title svg { width: 14px; height: 14px; color: var(--guide-color-drought-d2, #e65c00); }
.dh-conditions .dh-kpi-row {
  padding: 0;
  background: transparent;
  border-bottom: none;
  grid-template-columns: repeat(7, 1fr);
}
.dh-basin-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; min-height: 24px; }

/* Journey rail */
.dh-journey {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.dh-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  text-align: left;
  background: var(--guide-color-raised);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--guide-radius-lg, 12px);
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
/* A stage is a choice card: hover darkens the rule, the chosen one takes the
   action border and a 1px ring. */
.dh-stage:hover {
  border-color: var(--guide-color-line-strong);
}
.dh-stage:focus-visible { outline: 2px solid var(--guide-color-action); outline-offset: 2px; }
.dh-stage-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.05);
  font-weight: 700;
  font-size: var(--text-sm, 13px);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--text-tertiary, #6B6B73);
  transition: background 0.15s ease, color 0.15s ease;
}
.dh-stage-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dh-stage-label { font-weight: 700; font-size: var(--text-md, 14px); color: var(--text-primary, #1A1A1F); }
.dh-stage-q {
  font-size: var(--text-xxs, 11px);
  color: var(--text-tertiary, #6B6B73);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dh-stage.active {
  border-color: var(--guide-color-action);
  box-shadow: inset 0 0 0 1px var(--guide-color-action);
}
.dh-stage.active .dh-stage-num {
  background: var(--guide-color-action);
  color: var(--guide-color-on-action);
}

/* Stage panels + relocated-panel mounts */
.dh-stage-mount { margin-top: 4px; }
.dh-stage-mount > .pblock:first-child { margin-top: 0; }

/* Diagnose sub-tabs */
.dh-subtabs {
  display: inline-flex;
  gap: 2px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
  padding: 3px;
  background: var(--guide-color-paper-2);
  border: 1px solid var(--guide-color-line);
  border-radius: var(--guide-radius-md, 8px);
}
.dh-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: var(--guide-fs-sm);
  font-weight: 600;
  border: 0;
  border-radius: var(--guide-radius-sm, 6px);
  background: transparent;
  color: var(--guide-color-ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.dh-subtab svg { width: 14px; height: 14px; }
.dh-subtab:hover { color: var(--guide-color-ink); }
.dh-subtab.active {
  background: var(--guide-color-raised);
  box-shadow: var(--guide-shadow-rest);
  color: var(--guide-color-ink);
}
.dh-subtab.active svg { color: var(--guide-color-action); }
.dh-subtab:focus-visible { outline: 2px solid var(--guide-color-action); outline-offset: 2px; }

/* Intent cards (connect a question to an outcome) */
.dh-intent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.dh-intent-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 12px 14px;
  text-align: left;
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: var(--guide-radius-md, 8px);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-left-width 0.15s ease;
}
.dh-intent-card:hover {
  box-shadow: var(--guide-shadow-raised);
}
.dh-intent-card:focus-visible { outline: 2px solid var(--ic-color, #e65c00); outline-offset: 2px; }
.dh-intent-ic { grid-row: 1 / span 2; width: 20px; height: 20px; color: var(--ic-color, #e65c00); }
.dh-intent-label { font-weight: 700; font-size: var(--text-md, 14px); color: var(--text-primary, #1A1A1F); }
.dh-intent-sub { grid-column: 2; font-size: var(--text-xxs, 11px); color: var(--text-tertiary, #6B6B73); }
.dh-intent-go {
  grid-row: 1 / span 2;
  width: 16px;
  height: 16px;
  color: var(--text-tertiary, #6B6B73);
  opacity: 0.5;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.dh-intent-card:hover .dh-intent-go { opacity: 1; transform: translateX(2px); color: var(--ic-color, #e65c00); }

.dh-act-tools { margin-bottom: 6px; }

/* Drought Intelligence card (alerts + cross-domain insights) */
.dh-intel-card { margin-top: 6px; }
.dh-intel-alerts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.dh-intel-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--guide-radius-md, 8px);
  font-size: var(--text-xs, 12px);
  line-height: 1.4;
  background: rgba(var(--guide-wash-rgb, 0, 0, 0), 0.03);
  border: 1px solid var(--guide-color-line);
  color: var(--text-secondary, #4A4A52);
}
.dh-intel-alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.dh-intel-alert--critical {
  background: rgba(204, 0, 0, 0.10);
  
  color: var(--guide-color-mt-red-deep-text, #8E1B29);
}
.dh-intel-alert--warn {
  background: color-mix(in srgb, var(--guide-color-ochre) 10%, transparent);
  
  color: var(--mt-gold-deep, #92710A);
}
.dh-intel-alert--ok {
  background: color-mix(in srgb, var(--guide-color-moss) 8%, transparent);
  
  color: var(--guide-color-status-ok, #157347);
}
.dh-intel-insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.dh-intel-insight {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: var(--guide-radius-md, 8px);
  background: var(--bg-3, #F7F5F0);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
}
.dh-intel-insight-ic { color: var(--text-tertiary, #6B6B73); flex-shrink: 0; }
.dh-intel-insight-ic svg { width: 18px; height: 18px; }
.dh-intel-insight-title { font-weight: 700; font-size: var(--text-sm, 13px); color: var(--text-primary, #1A1A1F); margin-bottom: 3px; }
.dh-intel-insight-desc { font-size: var(--text-xxs, 11px); line-height: 1.45; color: var(--text-secondary, #4A4A52); }

/* Responsive */
@media (max-width: 1024px) {
  .dh-journey { grid-template-columns: 1fr 1fr; }
  .dh-conditions .dh-kpi-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .dh-journey { grid-template-columns: 1fr 1fr; gap: 6px; }
  .dh-stage { padding: 10px; gap: 8px; }
  .dh-stage-q { display: none; }
  .dh-conditions .dh-kpi-row { grid-template-columns: 1fr 1fr; }
  .dh-intent-grid { grid-template-columns: 1fr; }
}

/* ─── Dark theme overrides ─────────────────────────────────────────── */
[data-theme="dark"] .dh-toggle-wrap input:checked + .dh-toggle-slider::after {
  background: var(--guide-color-paper);
}


/* ── Drought index explorer (Diagnose > Indices) ────────────────────────────
   The map first, in plain language: what to measure, how far back, then the real
   picture, how to read it, the official designation beside it, and the next
   question. One sheet column on a phone; figure and reading side by side wide. */
.dh-explorer { display: flex; flex-direction: column; gap: var(--guide-sp-5); padding: var(--guide-sp-4); }
.dh-ex-head h3 { margin: 0 0 var(--guide-sp-1); font-family: var(--guide-font-display); font-size: var(--guide-fs-xl); font-weight: 600; color: var(--guide-color-ink); }
.dh-ex-head p { margin: 0; max-width: 72ch; font-size: var(--guide-fs-sm); line-height: 1.5; color: var(--guide-color-ink-soft); }
.dh-ex-controls { display: flex; flex-wrap: wrap; gap: var(--guide-sp-4) var(--guide-sp-6); }
.dh-ex-group { display: flex; flex-direction: column; gap: var(--guide-sp-1); }
.dh-ex-label { font-size: var(--guide-fs-xs); font-weight: 600; color: var(--guide-color-ink-soft); }
.dh-idx-btn small { font-size: var(--guide-fs-2xs); font-weight: 600; color: var(--guide-color-ink-soft); }
.dh-ex-stage { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: var(--guide-sp-5); align-items: start; }
.dh-ex-figure { margin: 0; background: var(--guide-color-raised); border: 1px solid var(--guide-color-line); border-radius: var(--guide-radius-lg); padding: var(--guide-sp-3); }
.dh-ex-figure img { display: block; width: 100%; height: auto; border-radius: var(--guide-radius-md); background: var(--guide-color-paper); }
.dh-ex-figure img[hidden] { display: none; }
.dh-ex-figure figcaption { margin-top: var(--guide-sp-2); font-size: var(--guide-fs-xs); line-height: 1.5; color: var(--guide-color-ink-soft); }
.dh-ex-side { display: flex; flex-direction: column; gap: var(--guide-sp-3); }
.dh-ex-side .dh-idx-name { margin: 0; font-size: var(--guide-fs-md); font-weight: 600; color: var(--guide-color-ink); }
.dh-ex-side .dh-idx-desc { margin: 0; font-size: var(--guide-fs-sm); line-height: 1.5; color: var(--guide-color-ink-soft); }
.dh-ex-side .dh-legend { padding: 0; }
.dh-ex-side .btn-pri { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--guide-sp-2); }
.dh-ex-usdm, .dh-ex-next { border-top: 1px solid var(--guide-color-line); padding-top: var(--guide-sp-4); }
.dh-ex-usdm h4, .dh-ex-next h4 { margin: 0 0 var(--guide-sp-3); font-family: var(--guide-font-display); font-size: var(--guide-fs-lg); font-weight: 600; color: var(--guide-color-ink); }
.dh-ex-next-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--guide-sp-2); }
.dh-ex-link {
  display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit;
  padding: var(--guide-sp-3) var(--guide-sp-4);
  background: var(--guide-color-raised); border: 1px solid var(--guide-color-line); border-radius: var(--guide-radius-lg);
  color: var(--guide-color-ink); cursor: pointer;
}
.dh-ex-link:hover { border-color: var(--guide-color-action); }
.dh-ex-link:focus-visible { outline: 2px solid var(--guide-color-action); outline-offset: 2px; }
.dh-ex-link strong { font-size: var(--guide-fs-sm); color: var(--guide-color-action); }
.dh-ex-link span { font-size: var(--guide-fs-xs); color: var(--guide-color-ink-soft); }
@media (max-width: 860px) { .dh-ex-stage { grid-template-columns: 1fr; } }
