.n-chart-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.25rem;
  padding: 1rem 1.1rem;
  background: var(--n-well);
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-md);
}

.theme-light .n-chart-wrap {
  background: var(--n-well);
  border-color: rgba(15, 23, 42, 0.06);
}

.n-chart-rain {
  height: 240px;
}

.n-chart-wrap--standard {
  height: 300px;
}

.n-chart-wrap--tall {
  height: 360px;
}

.n-chart-wrap--detail {
  height: 320px;
}

.n-chart-wrap--scatter {
  height: 220px;
  margin-top: 0.75rem;
}

.n-chart-canvas-fill {
  height: 100%;
}

/* Wind rose — same visual frame as line charts */
/* Wind rose panel: default .n-panel overflow:hidden clips N/S compass labels */
#panel-wind-rose-n.n-panel {
  overflow: visible;
}

/* Wind rose chart well — same frame as line charts */
.n-panel .n-rose-wrap {
  margin-top: 0.25rem;
  padding: 0.85rem 0.65rem 1rem;
  background: var(--n-well);
  border: 1px solid var(--n-border-subtle);
  border-radius: var(--n-radius-md);
  min-height: 280px;
}

/* ── CHART LEGEND CHIPS ──────────────────────────────────────── */
.n-chart-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.n-chart-legend--compact {
  margin-top: 0.5rem;
}

.n-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted, #64748b);
  padding: 0.35rem 0.65rem;
  border-radius: var(--n-radius-sm);
  border: 1px solid var(--n-border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.theme-light .n-legend-chip {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.06);
}

.n-legend-chip::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.n-chip-pm::before   { background: #ea580c; height: 3px; }
.n-chip-wind::before { background: #0e7490; height: 2px; }
.n-chip-no2::before  {
  background: repeating-linear-gradient(90deg, #7c3aed 0 6px, transparent 6px 10px);
  height: 2px;
  opacity: 0.72;
}
.n-chip-rain::before  { background: #0e7490; }
.n-chip-event::before {
  background: rgba(14, 116, 144, 0.16);
  border: 1px dashed #0e7490;
  height: 10px;
  border-radius: 2px;
}
.n-chip-rain-good::before { background: #22c55e; height: 10px; width: 10px; border-radius: 50%; }
.n-chip-rain-bad::before  { background: #ef4444; height: 10px; width: 10px; border-radius: 50%; }
.n-chip-pandora::before { background: #7c3aed; height: 3px; }
.n-chip-pandora-range::before {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.3);
  height: 10px;
  border-radius: 2px;
}
.n-chip-pandora-profile::before {
  width: 36px;
  height: 10px;
  background: linear-gradient(90deg, #f5f3ff, #7c3aed, #d97706, #fef3c7);
}

body:not(.theme-light):not(.theme-coastal):not(.theme-aqi) .n-chip-pandora-profile::before {
  background: linear-gradient(90deg, #1a0533, #a78bfa, #fbbf24, #fef3c7);
}

.n-context-grid--spaced {
  margin-top: 0.75rem;
}

.n-delayed-pill--inline-note {
  display: inline-flex;
  margin-top: 0.5rem;
}

.n-chart-note {
  margin-top: 0.5rem;
  font-size: 0.73rem;
  opacity: 0.62;
}

.n-chart-note--roomy {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  opacity: 0.72;
}

.n-detail-sensor-select--compact {
  font-size: 0.8rem;
}

.n-panel-title--flush {
  margin: 0;
}

.n-panel-sub--tight {
  margin: 0.25rem 0 0;
}

.n-driver-control-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.n-rose-chip--low { background: #22c55e; }
.n-rose-chip--moderate { background: #eab308; }
.n-rose-chip--elevated { background: #f97316; }
.n-rose-chip--high { background: #ef4444; }

/* Toggled series legend item */
.rp-legend-pandora-n.hidden { display: none; }

/* ── EXPLANATION CARDS ─────────────────────────────────────── */
.n-explain-card {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: var(--n-radius-md);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.09), rgba(14, 165, 233, 0.05));
  color: var(--text-muted, #94a3b8);
}

.theme-light .n-explain-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.07), rgba(14, 165, 233, 0.04));
  border-color: rgba(109, 40, 217, 0.14);
  color: #475569;
}

.n-explain-card--section {
  max-width: 980px;
}

.n-explain-card--compact {
  margin: 0 0 1rem;
}

.n-explain-summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary, #f8fafc);
}

.theme-light .n-explain-summary {
  color: #1e293b;
}

.n-explain-summary::-webkit-details-marker { display: none; }
.n-explain-summary::marker { display: none; }

.n-explain-summary::after {
  content: '▸';
  float: right;
  color: #a78bfa;
  transition: transform 0.15s ease;
}

.n-explain-card[open] .n-explain-summary::after {
  transform: rotate(90deg);
}

.n-explain-body {
  margin-top: 0.75rem;
}

.n-explain-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a78bfa;
}

.theme-light .n-explain-kicker {
  color: #6d28d9;
}

.n-explain-list {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.78rem;
  line-height: 1.6;
}

.n-explain-list--inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding-left: 0;
  list-style: none;
}

.n-explain-list strong,
.n-explain-text strong {
  color: var(--text-primary, #f8fafc);
}

.theme-light .n-explain-list strong,
.theme-light .n-explain-text strong {
  color: #0f172a;
}

.n-explain-note,
.n-explain-text {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  line-height: 1.6;
}

.n-explain-text--mini {
  margin-top: 0.45rem;
  font-size: 0.74rem;
}

.n-explain-note {
  padding-top: 0.7rem;
  border-top: 1px solid rgba(168, 85, 247, 0.14);
}

.n-term-detail {
  margin-top: 0.6rem;
  font-size: 0.78rem;
}

.n-term-detail summary {
  cursor: pointer;
  color: #a78bfa;
  font-weight: 600;
}

.theme-light .n-term-detail summary {
  color: #6d28d9;
}

.n-term-detail p {
  margin: 0.45rem 0 0;
  line-height: 1.55;
  color: var(--text-muted, #64748b);
}

.n-term-detail a {
  color: #60a5fa;
}

@media (max-width: 900px) {
  .n-explain-list--inline {
    grid-template-columns: 1fr;
  }
}

/* ── TOGGLE LABEL ───────────────────────────────────────────── */
.n-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border-radius: var(--n-radius-sm);
  border: 1px solid var(--n-border-subtle);
  background: var(--n-surface-raised);
  user-select: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.n-toggle-label:hover {
  color: var(--text-primary, #e2e8f0);
  border-color: rgba(255, 255, 255, 0.12);
}

.theme-light .n-toggle-label:hover {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

.n-toggle-label input {
  accent-color: #22c55e;
  width: 0.95rem;
  height: 0.95rem;
}

/* ── DRIVERS ROW ────────────────────────────────────────────── */
.n-drivers-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Rain row (legacy — kept for backward compat): rain event + scatter side
   by side, wind rose full-width below. */
.n-drivers-row--rain-pair {
  grid-template-columns: 1fr 1fr;
}

/* NEW split layout: Rain column (rain-event + rain-scatter stacked) on the
   left, Wind column (wind-rose) on the right. Combined insight spans full
   width at the bottom. This surfaces Rain vs Wind as two coequal "drivers"
   rather than burying the wind rose below the rain pair. */
.n-drivers-row--split {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-auto-rows: min-content;
  align-items: start;
}

.n-drivers-row--split #panel-rain-event-n   { grid-column: 1; grid-row: 1; }
.n-drivers-row--split #panel-rain-scatter-n { grid-column: 1; grid-row: 2; }
.n-drivers-row--split #panel-wind-rose-n    { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; }
.n-drivers-row--split #n-env-drivers-insight { grid-column: 1 / -1; grid-row: 3; }

/* Wind rose needs to fill the taller right column gracefully. */
.n-drivers-row--split #panel-wind-rose-n {
  display: flex;
  flex-direction: column;
}

.n-drivers-row--split #panel-wind-rose-n .n-rose-wrap {
  flex: 1 1 auto;
  min-height: 320px;
}

@media (max-width: 980px) {
  .n-drivers-row--split {
    grid-template-columns: 1fr;
  }
  .n-drivers-row--split #panel-rain-event-n,
  .n-drivers-row--split #panel-rain-scatter-n,
  .n-drivers-row--split #panel-wind-rose-n,
  .n-drivers-row--split #n-env-drivers-insight {
    grid-column: 1;
    grid-row: auto;
  }
}

/* Pandora row: total column full-width on top, diurnal + (future) side by side below */
.n-drivers-row--pandora {
  grid-template-columns: 1fr 1fr;
}

.n-panel--meta {
  padding-bottom: 0.75rem;
}

.n-pandora-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.65rem 1.25rem;
  margin: 0;
}

.n-pandora-meta-item dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin: 0 0 0.15rem;
}

.n-pandora-meta-item dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.n-pandora-scatter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
  cursor: pointer;
}

.n-chip-pandora-scatter::before {
  background: rgba(124, 58, 237, 0.45);
  height: 3px;
}

.n-chip-pm-range::before {
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.2), rgba(234, 88, 12, 0.5));
  height: 3px;
}

/* Full-width panel — spans all columns */
.n-panel--full-row {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .n-drivers-row,
  .n-drivers-row--rain-pair,
  .n-drivers-row--pandora { grid-template-columns: 1fr; }
  .n-panel--full-row { grid-column: 1; }
}

/* ── LOADING STATE ──────────────────────────────────────────── */
.n-loading-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 0;
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
}

.n-loading-pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border, rgba(255,255,255,0.1));
  border-top-color: #22c55e;
  animation: n-spin 0.8s linear infinite;
}

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

/* ── EMPTY STATE ────────────────────────────────────────────── */
.n-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  gap: 0.5rem;
}

.n-empty-icon { font-size: 2rem; }

.n-empty-state strong {
  font-size: 0.9rem;
  color: var(--text-primary, #e2e8f0);
}

.theme-light .n-empty-state strong { color: #1e293b; }

.n-empty-state p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  max-width: 340px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ── PANDORA PROFILE CURTAIN PLOT ───────────────────────────── */
.n-profile-curtain-wrap {
  min-height: 360px;
  background:
    linear-gradient(rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.08)),
    var(--n-well);
}

.n-profile-curtain {
  width: 100%;
  min-width: 760px;
  height: 360px;
}

.n-profile-curtain .modebar {
  display: none !important;
}

@media (max-width: 760px) {
  .n-profile-curtain-wrap {
    overflow-x: auto;
  }
}

/* ── EVENT BADGES ───────────────────────────────────────────── */
.n-rain-events-details {
  margin-top: 0.6rem;
  border-top: 1px solid rgba(79,195,247,0.15);
}

.n-rain-events-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4fc3f7;
  cursor: pointer;
  user-select: none;
  list-style: none;
  opacity: 0.8;
}
.n-rain-events-summary-toggle:hover { opacity: 1; }
.n-rain-events-summary-toggle::before {
  content: '▶';
  font-size: 0.55rem;
  transition: transform 0.15s ease;
}
.n-rain-events-details[open] .n-rain-events-summary-toggle::before {
  transform: rotate(90deg);
}

.n-event-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0.25rem;
}

.n-event-badge {
  background: rgba(79,195,247,0.08);
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
  color: #4fc3f7;
}

.n-event-badge-title { font-weight: 600; }
.n-event-badge-delta { font-size: 0.7rem; color: var(--text-muted, #64748b); }
.n-event-badge-delta.delta-down { color: #22c55e; }
.n-event-badge-delta.delta-up   { color: #ef4444; }

/* ── ENVIRONMENTAL DRIVERS INSIGHT BOX ─────────────────────── */
.n-insight-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-left: 3px solid #a855f7;
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  margin: 0.5rem 0 0.25rem;
  grid-column: 1 / -1;
}
.n-insight-box-icon {
  font-size: 1.1rem;
  line-height: 1.5;
  flex-shrink: 0;
}
.n-insight-box-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-primary, #e2e8f0);
  margin: 0;
}

/* ── WIND ROSE ──────────────────────────────────────────────── */
.n-rose-wrap {
  width: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;       /* N/S angular labels need space; Plotly margins keep plot inset */
  box-sizing: border-box;
}

.n-rose-scale {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.n-rose-scale-label {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  font-weight: 500;
}

.n-rose-chip {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
}

.n-rose-takeaway {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  font-style: italic;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  padding-top: 0.6rem;
}

.theme-light .n-rose-takeaway { color: #475569; border-top-color: #e2e8f0; }

/* ── MAP ────────────────────────────────────────────────────── */
