/* wizard.css — R-098 "Create Data View" wizard (Stream B).
   Namespaced .dvw-* ONLY. Consumes existing CSS variables (tokens.css); declares NO :root.
   Does NOT restyle the page-owned .dv-overlay / .dv-modal / .dv-close.
   In-flow content inside #dv-wizard (the page owns show/hide). No scrim, no position:fixed.
   Ink-mode. border-radius <= 2px everywhere. Fonts: Inter (UI), IBM Plex Mono (data), Source Serif 4 (titles). */

/* ── Root: in-flow block filling the modal; NOT hidden, NOT fixed, NO scrim ── */
.dvw-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 82vh;
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  font-size: 13px;
}

/* ── Header ── */
.dvw-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
}
.dvw-source-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  color: var(--accent2);
}

/* ── Disclosure banner (pinned from step 2) ── */
.dvw-disclosure {
  margin: 10px 18px 0;
  padding: 7px 10px;
  border: 1px solid var(--warn);
  border-radius: 2px;
  background: transparent;
  color: var(--warn);
  font-size: 11px;
  line-height: 1.4;
}

/* ── Step nav chips ── */
.dvw-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.dvw-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.dvw-chip.is-current {
  color: var(--accent2);
  border-left: 2px solid var(--accent2);
  background: rgba(90, 169, 222, 0.08);
}
.dvw-chip.is-done { color: var(--ok); border-color: var(--ok); }
.dvw-chip.is-done::before { content: '✓ '; }
.dvw-chip.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Body (scrolls) ── */
.dvw-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.dvw-step-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ── Fields ── */
.dvw-field { margin-bottom: 14px; }
.dvw-field-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.dvw-help {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 6px;
}
.dvw-input, .dvw-select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.dvw-input:focus, .dvw-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ── Option cards ── */
.dvw-options { display: flex; flex-direction: column; gap: 6px; }
.dvw-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.dvw-option:hover:not(.is-disabled) { border-color: var(--accent2); }
.dvw-option.is-selected { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.dvw-option.is-disabled { opacity: 0.45; cursor: not-allowed; }
.dvw-option-label { font-size: 13px; font-weight: 500; }
.dvw-option-desc { font-size: 11px; color: var(--muted); margin-top: 3px; }
.dvw-option-reason { font-size: 10px; color: var(--warn); margin-top: 3px; font-style: italic; }
.dvw-grain-head { margin-top: 6px; }

/* ── AOI ── */
.dvw-aoi-actions, .dvw-run-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dvw-bbox {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--accent2);
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ── Coverage chips (7 distinct states — NEVER conflated) ── */
.dvw-cov {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--muted);
  color: var(--text);
  white-space: nowrap;
}
.dvw-cov--observed      { border-color: var(--accent2); color: var(--accent2); background: rgba(90,169,222,0.10); }
.dvw-cov--observed-zero { border-color: var(--ok);      color: var(--ok);      background: rgba(70,160,107,0.10); }
.dvw-cov--partial       { border-color: var(--warn);    color: var(--warn);    background: rgba(212,160,23,0.10); }
.dvw-cov--no-acq        { border-color: var(--muted);   color: var(--muted);   background: transparent; }
.dvw-cov--outside       { border-color: var(--muted);   color: var(--muted);
  background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(138,134,126,0.18) 3px, rgba(138,134,126,0.18) 6px); }
.dvw-cov--not-eval      { border-style: dashed; border-color: var(--muted); color: var(--muted); background: transparent; }
.dvw-cov--error         { border-color: var(--danger);  color: var(--danger);  background: rgba(198,72,91,0.10); }

.dvw-cov-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.dvw-cov-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; cursor: pointer; border-radius: 2px; }
.dvw-cov-row:hover { background: var(--panel); }
.dvw-cov-meaning { font-size: 12px; color: var(--text); }

/* ── Review ── */
.dvw-summary {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.dvw-estimate { margin-bottom: 10px; }
.dvw-warn-line { font-size: 11px; color: var(--warn); margin-top: 3px; }

/* ── Preview: legend / distribution / table / envelope / json ── */
.dvw-preview { margin-top: 12px; }
.dvw-legend { margin: 10px 0; }
.dvw-legend-title, .dvw-envelope-title {
  font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em;
}
.dvw-legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dvw-legend-meaning { font-size: 12px; color: var(--text); }

.dvw-dist { margin: 12px 0; }
.dvw-dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.dvw-dist-track {
  flex: 1 1 auto; height: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 2px; overflow: hidden;
}
.dvw-dist-bar { height: 100%; }
.dvw-dist-bar.dvw-cov--observed      { background: var(--accent2); }
.dvw-dist-bar.dvw-cov--observed-zero { background: var(--ok); }
.dvw-dist-bar.dvw-cov--partial       { background: var(--warn); }
.dvw-dist-bar.dvw-cov--no-acq        { background: var(--muted); }
.dvw-dist-bar.dvw-cov--outside       { background: var(--muted); }
.dvw-dist-bar.dvw-cov--not-eval      { background: var(--muted); }
.dvw-dist-bar.dvw-cov--error         { background: var(--danger); }
.dvw-dist-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); min-width: 32px; text-align: right; }

.dvw-table {
  width: 100%; border-collapse: collapse; margin: 12px 0;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
}
.dvw-table th {
  text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-weight: 500;
}
.dvw-table td { padding: 4px 7px; border-bottom: 1px solid var(--border); }
.dvw-table tr:nth-child(odd) td { background: var(--panel); }
.dvw-table tr:nth-child(even) td { background: var(--bg); }

.dvw-scrub { margin: 12px 0; }
.dvw-scrub input[type=range] { width: 100%; accent-color: var(--accent); }
.dvw-scrub-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--accent2); }

.dvw-envelope {
  margin: 12px 0; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 2px;
  font-family: 'IBM Plex Mono', monospace;
}
.dvw-envelope-line { font-size: 11px; line-height: 1.6; word-break: break-all; }
.dvw-envelope-key { color: var(--muted); }
.dvw-envelope-val { color: var(--text); }
.dvw-envelope-disc { font-size: 10px; color: var(--warn); margin-top: 4px; }

.dvw-json {
  margin-top: 12px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 2px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.4;
  max-height: 320px; overflow: auto; color: var(--text); white-space: pre;
}

/* ── Status line ── */
.dvw-status { padding: 8px 18px; font-size: 12px; min-height: 16px; }
.dvw-status.ok { color: var(--ok); }
.dvw-status.err { color: var(--danger); }
.dvw-status.loading { color: var(--accent2); }
.dvw-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent2); margin-right: 6px; vertical-align: middle;
  animation: dvw-pulse 1.1s ease-in-out infinite;
}
@keyframes dvw-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ── Footer ── */
.dvw-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.dvw-footer-spacer { flex: 1 1 auto; }
.dvw-btn {
  padding: 6px 14px; border-radius: 2px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 13px;
}
.dvw-btn:hover:not(:disabled) { filter: brightness(1.1); }
.dvw-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dvw-btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.dvw-btn--ghost:hover:not(:disabled) { border-color: var(--accent2); color: var(--accent2); }

/* ── Publish ── */
.dvw-publish { margin: 10px 18px; padding: 10px; border: 1px solid var(--ok); border-radius: 2px; }
.dvw-link { font-family: 'IBM Plex Mono', monospace; color: var(--accent2); text-decoration: none; }
.dvw-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   R-098 persistent map presentation — frame legend (dvFrameLayer) + monthly
   timeline (dvFrameTimeline). Overlays the explorer map, bottom-centered, so it
   never collides with the bottom-left rings-card / bottom-right map-legend.
   ═══════════════════════════════════════════════════════════════════════════ */
.dv-timeline-wrap {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  width: clamp(320px, 52vw, 660px); z-index: 1001;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
}
.dv-timeline-wrap.hidden { display: none; }

/* Frame legend — honest coverage key. Muted/dashed swatch = "not evaluated", never zero. */
.dv-frame-legend {
  align-self: center; max-width: 100%;
  background: rgba(12,15,19,0.92); border: 1px solid var(--border); border-radius: 2px;
  padding: 8px 12px; font-size: 11px; backdrop-filter: blur(4px);
}
.dv-frame-legend.hidden { display: none; }
.dv-fl-title { font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: 0.02em; }
.dv-fl-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.dv-fl-swatch { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; display: inline-block; border: 1px solid rgba(230,227,220,0.15); }
.dv-fl-ramp { background: linear-gradient(90deg, #CFE6F5, #5AA9DE, #1E6FA8, #123F63); border-color: rgba(230,227,220,0.25); }
.dv-fl-label { color: var(--text); }
.dv-fl-note { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; line-height: 1.35; }

/* Frame-layer popups (cell detail) — rendered on Leaflet's light popup surface */
.dv-fl-ptitle { font-weight: 600; color: var(--accent); margin-bottom: 5px; }
.dv-fl-prow { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.dv-fl-pk { color: #5a6472; }
.dv-fl-pv { color: #1b2531; font-family: 'IBM Plex Mono', monospace; }
.dv-fl-pwarn { color: #8a6d0f; margin-top: 5px; font-size: 11px; }

/* Timeline bar — scrubber + play + clear */
.dv-timeline-bar {
  display: flex; align-items: center; gap: 8px;
  background: rgba(12,15,19,0.94); border: 1px solid var(--border); border-radius: 2px;
  padding: 8px 10px; backdrop-filter: blur(4px);
}
.dv-timeline-host { flex: 1; min-width: 0; }
.dv-timeline-close {
  flex-shrink: 0; background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 2px; padding: 5px 9px;
  font-size: 11px; cursor: pointer; font-family: inherit;
}
.dv-timeline-close:hover { border-color: var(--danger); color: var(--danger); }

/* dvFrameTimeline component (class hooks reserved by frame-timeline.js) */
.dvft-root { display: flex; align-items: center; gap: 10px; width: 100%; outline: none; }
.dvft-root:focus-visible { box-shadow: 0 0 0 2px rgba(90,169,222,0.5); border-radius: 2px; }
.dvft-empty { color: var(--muted); font-size: 12px; padding: 2px 0; }
.dvft-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dvft-btn {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  border-radius: 2px; padding: 4px 8px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.dvft-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.dvft-play { min-width: 52px; }
.dvft-slider { flex: 1; min-width: 80px; accent-color: var(--accent); cursor: pointer; }
.dvft-counter { color: var(--muted); font-size: 11px; font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; }
.dvft-month { color: var(--text); font-size: 12px; font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; min-width: 66px; }
/* coverage badge — verbatim coverage_state, no count; color via inline var(--…) set by frame-timeline */
.dvft-badge { font-size: 10px; padding: 2px 7px; border-radius: 2px; border: 1px solid currentColor; flex-shrink: 0; white-space: nowrap; }
.dvft-badge[data-state="NOT_EVALUATED"], .dvft-badge[data-state="NO_ACQUISITION"], .dvft-badge[data-state="OUTSIDE_SOURCE_COVERAGE"] { border-style: dashed; }
