/* ─── Course Correct viewer chrome ──────────────────────────────────────────
   Dark, quiet, precise instrument around the 3D capture. All values come from
   src/styles/tokens.css (imported first in globals.css) — no hardcoded colors
   here. Layout model: the Cesium canvas stays full-bleed; the workspace frame
   (top bar / tool rail / side panel / status bar) is opaque fixed chrome.

   z ladder: chrome 930–960 · dropdown menus 990 · modals 1000 · toasts 1100
             · loading splash 9999 */

:root {
  /* Workspace geometry. JS re-points --panel-w on collapse and --rail-w per
     portal so canvas-anchored UI (prompt bar, view controls) stays centered
     over the visible canvas. */
  --topbar-h: 44px;
  --statusbar-h: 26px;
  --rail-w: 0px;
  --panel-w: 0px;
}

html, body, #cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--surface-0);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--text-primary);
}

.icon { flex: none; display: inline-block; vertical-align: -3px; }

/* Focus rings on everything interactive (outline, so elevation shadows survive). */
:focus-visible {
  outline: 2px solid var(--accent-border);
  outline-offset: 1px;
}

/* ─── View root (DOM views layer above the canvas) ───────────────────── */
#view-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none; /* empty (hole view) → never blocks the canvas */
}

/* ─── Shared button styles ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 32px;
  padding: 0 var(--sp-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}
.btn-accent {
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { border-color: var(--border-default); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-ghost.is-active {
  background: var(--accent-muted);
  border-color: var(--accent-border);
  color: var(--accent);
}
.btn-block { width: 100%; }
.btn-icon {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }

/* ─── Segmented control (view modes, tabs, portal toggle, green-book) ── */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.segmented .seg {
  min-height: 26px;
  padding: 0 var(--sp-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.segmented .seg:hover { color: var(--text-primary); }
.segmented .seg.is-active {
  background: var(--surface-1);
  border-color: var(--border-default);
  color: var(--text-primary);
}
/* Selection-flavored segments (view mode): accent = selected. */
.segmented.seg-select .seg.is-active {
  background: var(--accent-muted);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ─── Section labels ─────────────────────────────────────────────────── */
.section-label,
.panel-section h4 {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ─── TopBar ─────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 950;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-3);
  box-sizing: border-box;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--elev-0);
  pointer-events: auto;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  flex: 1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}
.brand-back {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  flex: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.brand-back:hover { background: var(--surface-3); color: var(--text-primary); }
.topbar-logo {
  height: 26px;
  width: auto;
  background: var(--brand-logo-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex: none;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: var(--fs-ui);
  color: var(--text-tertiary);
}
.crumb { white-space: nowrap; }
.crumb-sep { color: var(--text-tertiary); flex: none; }
.crumb-btn {
  font: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 4px 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.crumb-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.crumb-current { color: var(--text-primary); }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sem-success);
  background: var(--sem-success-muted);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sem-success);
}

/* ─── Dropdown menus (capture selector, export) ──────────────────────── */
.menu {
  position: fixed;
  z-index: 990;
  min-width: 220px;
  padding: var(--sp-1);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  display: none;
}
.menu.is-open { display: block; }
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 32px;
  padding: 0 var(--sp-2);
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast) var(--ease);
}
.menu-item:hover { background: var(--surface-3); }
.menu-item .icon { color: var(--text-secondary); }
.menu-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.menu-chip {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-muted);
  border-radius: 999px;
  padding: 2px 8px;
  flex: none;
}
.menu-foot {
  margin: var(--sp-1) var(--sp-2) var(--sp-1);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* ─── Tool rail (management only) ────────────────────────────────────── */
.tool-rail {
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--statusbar-h);
  left: 0;
  width: 48px;
  z-index: 940;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--sp-2) 0;
  box-sizing: border-box;
  background: var(--surface-1);
  border-right: 1px solid var(--border-default);
  box-shadow: var(--elev-0);
  pointer-events: auto;
}
.rail-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rail-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.rail-btn.is-active { background: var(--accent-muted); color: var(--accent); }
.rail-divider {
  width: 24px;
  height: 1px;
  background: var(--border-default);
  margin: var(--sp-1) 0;
}

/* ─── View controls (canvas top-right cluster) ───────────────────────── */
.view-controls {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: calc(var(--panel-w) + 12px);
  z-index: 935;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  transition: right var(--dur-slow) var(--ease);
}
.vc-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--elev-1);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.vc-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.vc-btn.is-active { background: var(--accent-muted); border-color: var(--accent-border); color: var(--accent); }

/* ─── Tool prompt bar (canvas top-center, one per active mode) ───────── */
.tool-prompt {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  transform: translateX(-50%);
  z-index: 947;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-2) 6px var(--sp-3);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--elev-1);
  font-size: var(--fs-caption);
  pointer-events: auto;
  max-width: min(640px, calc(100vw - var(--rail-w) - var(--panel-w) - 24px));
  transition: left var(--dur-slow) var(--ease);
}
.tool-prompt.is-hidden { display: none; }
.tp-mode {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.tp-msg { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-prompt.is-success .tp-msg { color: var(--sem-success); font-weight: 600; }
.tp-esc {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.tp-actions { display: flex; align-items: center; gap: 4px; }
.tp-measure {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--fs-caption);
  color: var(--text-inverse);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--dur-fast) var(--ease);
}
.tp-measure:hover { background: var(--accent-hover); }
.tp-measure:disabled { opacity: 0.45; cursor: default; }
.tp-iconbtn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tp-iconbtn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.tp-exit {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--fs-caption);
  color: var(--text-inverse);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
}
.tp-exit:hover { background: var(--accent-hover); }

/* ─── Side panel ─────────────────────────────────────────────────────── */
.side-panel {
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--statusbar-h);
  right: 0;
  width: 280px;
  z-index: 945;
  background: var(--surface-1);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--elev-0);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  transition: width var(--dur-slow) var(--ease);
}
.side-panel.is-collapsed { width: 0; border-left: none; }
.panel-inner {
  width: 280px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: auto; /* content stays anchored as width animates */
}
.panel-collapse {
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.panel-collapse:hover { color: var(--text-primary); background: var(--surface-3); }
.panel-tabs { padding: var(--sp-3) var(--sp-3) 0; flex: none; }
.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--sp-3) var(--sp-3);
}
.tab-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}
.seg.is-active .tab-badge { color: var(--text-secondary); }
.panel-pane[hidden] { display: none; }
.panel-section { padding-top: var(--sp-4); }
.panel-section:first-child { padding-top: var(--sp-3); }
.panel-section + .panel-section { border-top: 1px solid var(--border-subtle); margin-top: var(--sp-4); }
.side-panel.is-dimmed .panel-inner { opacity: 0.25; pointer-events: none; }
.side-panel .panel-inner { transition: opacity var(--dur-slow) var(--ease); }
.panel-hint {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-caption);
  line-height: 1.45;
  color: var(--text-tertiary);
}
.panel-stack { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ─── Status bar ─────────────────────────────────────────────────────── */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--statusbar-h);
  z-index: 950;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-3);
  box-sizing: border-box;
  background: var(--surface-1);
  border-top: 1px solid var(--border-default);
  box-shadow: var(--elev-0);
  font-size: var(--fs-label);
  color: var(--text-tertiary);
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
}
.status-coords { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status-meta { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.status-meta a { color: var(--text-tertiary); text-decoration: none; }
.status-meta a:hover { color: var(--text-secondary); text-decoration: underline; }

/* Keep Cesium's required data attribution visible, tucked above the status bar. */
.cesium-viewer-toolbar { display: none; }
.cesium-viewer-bottom {
  font-size: 10px;
  opacity: 0.55;
  bottom: calc(var(--statusbar-h) + 2px) !important;
  left: calc(var(--rail-w) + 6px) !important;
}

/* ─── Switch rows (overlays / terrain) ───────────────────────────────── */
.switch-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 32px;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  font-size: var(--fs-ui);
}
.switch-row .switch-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.switch-meta {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}
.switch-row input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch {
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background var(--dur-fast) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform var(--dur-fast) var(--ease);
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); background: var(--surface-0); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent-border); outline-offset: 1px; }

/* Legends collapse behind their toggle. */
.legend-wrap {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--dur-base) var(--ease);
}
.legend-wrap.is-open { max-height: 140px; }
.overlay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 2px 0 var(--sp-2) 2px;
}
.overlay-swatch-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.overlay-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}
.overlay-group {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: var(--sp-3) 0 var(--sp-1);
}
.overlay-empty {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  margin: 0;
}

/* ─── Findings / POI lists ───────────────────────────────────────────── */
.findings {
  list-style: none;
  margin: 0;
  padding: 0;
}
.finding {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 32px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.finding:hover { background: var(--surface-2); }
.finding .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.finding-label {
  font-size: var(--fs-ui);
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.finding-age {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  flex: none;
}
.finding-delete {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.finding-delete:hover { background: var(--sem-danger-muted); color: var(--sem-danger); }
.finding-status {
  flex-shrink: 0;
  border: none;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--dur-fast) var(--ease);
}
.finding-status:hover { opacity: 0.8; }
.finding-status.status-open { color: var(--sem-danger); background: var(--sem-danger-muted); }
.finding-status.status-in-progress { color: var(--sem-warning); background: var(--sem-warning-muted); }
.finding-status.status-resolved { color: var(--sem-success); background: var(--sem-success-muted); }
.finding.is-resolved .finding-label {
  color: var(--text-tertiary);
  text-decoration: line-through;
}
.finding.is-resolved .dot { opacity: 0.45; }

/* ─── Compare placeholder + selects ──────────────────────────────────── */
.compare-placeholder {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: var(--sp-3);
}
.compare-ghost {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--sp-2);
}
.compare-ghost > div {
  background: var(--surface-3);
  display: flex;
  align-items: flex-end;
  padding: 6px 8px;
  font-size: var(--fs-label);
  color: var(--text-tertiary);
}
.compare-ghost .num { letter-spacing: 0; }
.compare-ghost-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--border-strong);
}
.compare-ghost-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  border: 2px solid var(--surface-2);
}
.compare-selects { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }
.compare-sel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-label);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.compare-sel select {
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.compare-sel select option { color: var(--text-inverse); }

/* ─── Timeline scrubber ──────────────────────────────────────────────── */
.timeline-row { display: flex; align-items: center; gap: var(--sp-2); }
.timeline-play {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: var(--fs-caption);
}
.timeline-play.is-active { color: var(--accent); border-color: var(--accent-border); }
.timeline-date {
  font-size: var(--fs-caption); color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.timeline-slider { width: 100%; margin: var(--sp-2) 0 4px; accent-color: var(--accent); cursor: pointer; }
.timeline-ends {
  display: flex; justify-content: space-between;
  font-size: var(--fs-label); color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.compare-overlay {
  position: fixed;
  inset: var(--topbar-h) 0 var(--statusbar-h);
  z-index: 932;
  pointer-events: none;
}
.compare-overlay.is-hidden { display: none; }
.compare-tag {
  position: absolute;
  top: 14px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  box-shadow: var(--elev-1);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.compare-tag-before { left: calc(var(--rail-w) + 16px); }
.compare-tag-after { right: calc(var(--panel-w) + 16px); }
.compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--text-primary);
  box-shadow: var(--elev-1);
  transform: translateX(-1px);
}
.compare-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: ew-resize;
  pointer-events: auto;
  box-shadow: var(--elev-1);
  touch-action: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

/* ─── Saved measurements (Report tab) ────────────────────────────────── */
.saved-vols { list-style: none; margin: 0; padding: 0; }
.saved-vol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-height: 32px;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-ui);
}
.saved-vol:hover { background: var(--surface-2); }
.saved-vol-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-vol-from {
  flex: none;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.saved-vol-net {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  flex: none;
}
.saved-vol-cmp {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: var(--fs-caption);
  cursor: pointer;
}
.saved-vol-cmp:hover { color: var(--text-primary); background: var(--surface-3); }
.saved-vol-delta {
  flex-basis: 100%;
  font-size: var(--fs-caption);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ─── POI card (opens when a finding is clicked) ─────────────────────── */
.poi-card {
  position: fixed;
  bottom: calc(var(--statusbar-h) + 16px);
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  transform: translateX(-50%);
  z-index: 960;
  width: min(440px, 92vw);
  padding: var(--sp-4) var(--sp-5);
  box-sizing: border-box;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  pointer-events: auto;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease),
    visibility var(--dur-base);
}
.poi-card.is-hidden {
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  visibility: hidden;
}
.poi-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.poi-card-close:hover { color: var(--text-primary); background: var(--surface-3); }
.poi-card-category {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  color: var(--text-inverse);
}
.poi-card-category.is-hidden { display: none; }
.poi-card h3 {
  margin: var(--sp-2) 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.poi-card.no-category h3 { margin-top: 0; }
.poi-card p {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-ui);
  color: var(--text-secondary);
  line-height: 1.5;
}
.poi-card-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}
.poi-card-actions .is-hidden { display: none; }

/* ─── Note-input modal (annotation flow) ─────────────────────────────── */
.note-modal {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: grid;
  place-items: center;
  z-index: 1000;
  pointer-events: auto;
}
.note-modal.is-hidden { display: none; }
.modal-card-anim { animation: modal-in var(--dur-slow) var(--ease); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.note-modal-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--elev-2);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-sizing: border-box;
}
.note-modal-title { margin: 0; font-size: 16px; font-weight: 600; }
.note-modal-sub { margin: 0; font-size: var(--fs-caption); color: var(--text-secondary); }
.note-modal-input {
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  padding: 9px var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.note-modal-input::-moz-placeholder { color: var(--text-tertiary); }
.note-modal-input::placeholder { color: var(--text-tertiary); }
.note-modal-input:focus {
  border-color: var(--accent-border);
  background: var(--surface-3);
}
.note-modal-severity {
  display: flex;
  gap: var(--sp-2);
  border: none;
  margin: 0;
  padding: 0;
}
.note-modal-severity.is-hidden { display: none; }
.note-modal-severity label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--fs-ui);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  min-height: 32px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.note-modal-severity label:has(input:checked).sev-choice-issue {
  border-color: var(--sem-danger);
  background: var(--sem-danger-muted);
  color: var(--sem-danger);
}
.note-modal-severity label:has(input:checked).sev-choice-watch {
  border-color: var(--sem-warning);
  background: var(--sem-warning-muted);
  color: var(--sem-warning);
}
.note-modal-severity input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.note-modal-severity .sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.note-modal-severity .sev-issue { background: var(--sem-danger); }
.note-modal-severity .sev-watch { background: var(--sem-warning); }
.note-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}

/* ─── Green book modal (2D "paper" read, three modes) ───────────────── */
.gb-modal {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: grid;
  place-items: center;
  z-index: 1000;
  pointer-events: auto;
}
.gb-modal.is-hidden { display: none; }
.gb-card {
  width: min(440px, calc(100vw - 32px));
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--elev-2);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-sizing: border-box;
}
.gb-head { display: flex; align-items: center; justify-content: space-between; }
.gb-title { font-size: 15px; font-weight: 600; }
.gb-head-actions { display: flex; align-items: center; gap: 2px; }
.gb-close, .gb-print {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.gb-close:hover, .gb-print:hover { color: var(--text-primary); background: var(--surface-3); }
/* The stage stays "paper" — it renders the printed-book artifact, not chrome. */
.gb-stage {
  background: var(--brand-logo-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-default);
}
.gb-svg { display: block; width: 100%; height: auto; }
.gb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.gb-leg-item { display: inline-flex; align-items: center; gap: 4px; }
.gb-leg-item i { width: 12px; height: 10px; border-radius: 2px; display: inline-block; }
.gb-leg-unit { font-style: italic; }
.gb-leg-mark { font-weight: 600; }
.gb-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.gb-stats b {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-ui);
}
@media (max-width: 600px) {
  .gb-card { width: calc(100vw - 20px); padding: var(--sp-3); }
}
body.snapshot-clean .gb-modal { display: none !important; }

/* ─── Cross-section profile chart (bottom-center, docked) ───────────── */
.profile-chart {
  position: fixed;
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  bottom: calc(var(--statusbar-h) + 16px);
  transform: translateX(-50%);
  width: min(640px, calc(100vw - var(--rail-w) - var(--panel-w) - 48px));
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  box-sizing: border-box;
  z-index: 940;
  box-shadow: var(--elev-1);
  color: var(--text-primary);
  pointer-events: auto;
}
.profile-chart.is-hidden { display: none; }
.profile-chart-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.profile-chart-title {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.profile-chart-stats {
  flex: 1;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: var(--fs-ui);
  font-weight: 500;
  color: var(--text-primary);
}
.profile-chart-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.profile-chart-close:hover { color: var(--text-primary); background: var(--surface-3); }
.profile-chart-svg {
  width: 100%;
  height: 140px;
  display: block;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.profile-chart-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-label);
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ─── Measurement display pattern (reports) ──────────────────────────── */
.meas { display: flex; flex-direction: column; gap: 1px; }
.meas-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: var(--fs-data);
  font-weight: 600;
  color: var(--text-primary);
}
.meas-num-lg { font-size: var(--fs-data-lg); }
.meas-unit { font-size: var(--fs-caption); color: var(--text-secondary); font-weight: 400; }
.meas-lbl {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* ─── Earthwork volume report ────────────────────────────────────────── */
.vol-report {
  position: fixed;
  left: calc(var(--rail-w) + 16px);
  bottom: calc(var(--statusbar-h) + 16px);
  z-index: 946;
  width: 272px;
  padding: var(--sp-4);
  box-sizing: border-box;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
  color: var(--text-primary);
  pointer-events: auto;
}
.vol-report.is-hidden { display: none; }
.vol-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.vol-report-title {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.vol-report-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.vol-report-close:hover { color: var(--text-primary); background: var(--surface-3); }
.vol-report-net {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.vol-net-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: var(--fs-data-lg);
  font-weight: 600;
}
.vol-net-lbl { font-size: var(--fs-caption); color: var(--text-secondary); }
.vol-report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: var(--sp-2);
}
.vol-report-grid > div { display: flex; flex-direction: column; gap: 1px; }
.vol-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: var(--fs-data);
  font-weight: 600;
}
.vol-cut { color: var(--sem-danger); }
.vol-fill { color: var(--sem-success); }
.vol-lbl {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.vol-report-tonnage { font-size: var(--fs-caption); color: var(--text-secondary); margin-bottom: var(--sp-3); }
.vol-report-base { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.vol-report-base label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}
.vol-report-base select,
.vol-report-base input {
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.vol-report-base input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.vol-report-base select option { color: var(--text-inverse); }
.vol-grade-wrap.is-hidden { display: none; }
.vol-report-cover {
  font-size: var(--fs-caption);
  color: var(--sem-warning);
  margin: 0 0 var(--sp-2);
}
.vol-report-cover.is-hidden { display: none; }
.vol-title {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: var(--sp-2);
}
.vol-title::-moz-placeholder { color: var(--text-tertiary); }
.vol-title::placeholder { color: var(--text-tertiary); }
.vol-report-actions { display: flex; gap: var(--sp-2); }
.vol-report-actions .btn { flex: 1; }

/* ─── Green slope report (bottom-left) ───────────────────────────────── */
.green-report {
  position: fixed;
  left: calc(var(--rail-w) + 16px);
  bottom: calc(var(--statusbar-h) + 16px);
  z-index: 945;
  width: 248px;
  padding: var(--sp-4);
  box-sizing: border-box;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
  color: var(--text-primary);
  pointer-events: auto;
}
.green-report.is-hidden { display: none; }
.green-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.green-report-title {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.green-report-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.green-report-close:hover { color: var(--text-primary); background: var(--surface-3); }
.green-report-stats {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.green-report-stats > div { display: flex; flex-direction: column; gap: 2px; }
.green-stat-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: var(--fs-data-lg);
  font-weight: 600;
}
.green-stat-lbl { font-size: var(--fs-label); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
.green-report-legend {
  display: flex;
  gap: var(--sp-3);
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.green-report-legend span { display: inline-flex; align-items: center; gap: 5px; }
.green-report-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.green-report-hint { margin: 0; font-size: var(--fs-caption); line-height: 1.4; color: var(--text-tertiary); }
body.snapshot-clean .green-report { display: none !important; }

/* ─── Putt card (Relive the putt) ────────────────────────────────────── */
.putt-card {
  position: fixed;
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  bottom: calc(var(--statusbar-h) + 16px);
  transform: translateX(-50%);
  z-index: 960;
  width: min(300px, 92vw);
  padding: var(--sp-4) var(--sp-5);
  box-sizing: border-box;
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  pointer-events: auto;
}
.putt-card.is-hidden { display: none; }
.putt-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.putt-card-close:hover { color: var(--text-primary); background: var(--surface-3); }
.putt-card-label {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.putt-card-dist {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  font-size: 32px;
  font-weight: 600;
  margin: 2px 0 var(--sp-3);
}
.putt-card-hint { margin: var(--sp-2) 0 0; font-size: var(--fs-caption); line-height: 1.4; color: var(--text-tertiary); }
body.snapshot-clean .putt-card { display: none !important; }

/* ─── Yardage card ────────────────────────────────────────────────────── */
.yard-card {
  position: fixed;
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  bottom: calc(var(--statusbar-h) + 16px);
  transform: translateX(-50%);
  z-index: 960;
  width: min(320px, 92vw);
  padding: var(--sp-4) var(--sp-5);
  box-sizing: border-box;
  text-align: center;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  pointer-events: auto;
}
.yard-card.is-hidden { display: none; }
.yard-card-close {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  display: grid; place-items: center; background: transparent; border: none;
  color: var(--text-tertiary); cursor: pointer; border-radius: var(--radius-sm);
}
.yard-card-close:hover { color: var(--text-primary); background: var(--surface-3); }
.yard-card-label {
  font-size: var(--fs-label); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: var(--sp-3);
}
.yard-fcb { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); }
.yard-cell { display: flex; flex-direction: column; align-items: center; flex: 1; }
.yard-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 22px; }
.yard-center-cell .yard-num { font-size: 30px; color: var(--accent); }
.yard-cap { font-size: var(--fs-caption); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }
.yard-playslike {
  display: flex; align-items: baseline; justify-content: center; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border-subtle, var(--border-default));
}
.yard-pl-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 20px; }
.yard-pl-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.yard-pl-lbl { font-size: var(--fs-caption); color: var(--text-tertiary); }
.yard-elev { font-size: var(--fs-caption); color: var(--text-secondary); }
.yard-card-hint { margin: var(--sp-2) 0 0; font-size: var(--fs-caption); line-height: 1.4; color: var(--text-tertiary); }
body.snapshot-clean .yard-card { display: none !important; }

/* ─── Hole guide (player) ─────────────────────────────────────────────── */
.guide-stats { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.guide-stat { display: flex; flex-direction: column; }
.guide-stat .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 22px; }
.guide-stat-lbl { font-size: var(--fs-label); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }
.flyover-btn.is-active { background: var(--accent-muted); color: var(--accent); }
.guide-tips { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.guide-tips li { font-size: var(--fs-caption); line-height: 1.45; color: var(--text-secondary); }
.guide-tip-title { display: block; font-weight: 600; color: var(--text-primary); }

/* ─── Round card (player shot tracking) ───────────────────────────────── */
.round-card {
  position: fixed;
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  bottom: calc(var(--statusbar-h) + 16px);
  transform: translateX(-50%);
  z-index: 960;
  width: min(300px, 92vw);
  padding: var(--sp-4) var(--sp-5);
  box-sizing: border-box;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  pointer-events: auto;
}
.round-card.is-hidden { display: none; }
.round-card-close {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  display: grid; place-items: center; background: transparent; border: none;
  color: var(--text-tertiary); cursor: pointer; border-radius: var(--radius-sm);
}
.round-card-close:hover { color: var(--text-primary); background: var(--surface-3); }
.round-card-label {
  font-size: var(--fs-label); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: var(--sp-3);
}
.round-shots { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; }
.round-shots li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 0; font-size: var(--fs-ui);
}
.round-shot-n {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface-3); color: var(--text-secondary);
  font-size: var(--fs-label); font-weight: 600;
}
.round-shot-d { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.round-empty { margin: var(--sp-2) 0 0; font-size: var(--fs-caption); color: var(--text-tertiary); }
.round-summary {
  display: flex; justify-content: space-between; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--border-default); font-size: var(--fs-caption); color: var(--text-secondary);
}
.round-summary .num { color: var(--text-primary); font-weight: 600; font-family: var(--font-mono); }
.round-topin.is-hidden { display: none; }
.round-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.round-actions .btn { flex: 1; justify-content: center; }
body.snapshot-clean .round-card { display: none !important; }

/* ─── Tour caption overlay (bottom-center) ───────────────────────────── */
.caption-overlay {
  position: fixed;
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  bottom: calc(var(--statusbar-h) + 20px);
  transform: translateX(-50%);
  z-index: 940;
  width: min(680px, 92vw);
  padding: var(--sp-4) var(--sp-5);
  box-sizing: border-box;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  pointer-events: auto;
  transition: opacity var(--dur-base) var(--ease), visibility var(--dur-base);
}
.caption-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.caption-body { flex: 1; }
.caption-title { margin: 0 0 4px; font-size: var(--fs-body); font-weight: 600; }
.caption-text { margin: 0; font-size: var(--fs-ui); color: var(--text-secondary); line-height: 1.5; }

/* ─── Toasts (bottom-center, above the status bar) ───────────────────── */
.toast-host {
  position: fixed;
  bottom: calc(var(--statusbar-h) + 12px);
  left: calc(var(--rail-w) + (100vw - var(--rail-w) - var(--panel-w)) / 2);
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-4);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  font-size: var(--fs-ui);
  color: var(--text-primary);
  animation: toast-in var(--dur-base) var(--ease);
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease); }
.toast .icon { color: var(--sem-success); }
.toast.is-danger .icon { color: var(--sem-danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
body.snapshot-clean .toast-host { display: none !important; }

/* ─── Loading splash ─────────────────────────────────────────────────── */
#loading-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--surface-0);
  display: grid;
  place-items: center;
  transition: opacity var(--dur-slow) var(--ease);
  opacity: 1;
}
#loading-splash.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.splash-card { text-align: center; color: var(--text-primary); }
.splash-mark {
  height: 56px;
  width: auto;
  display: inline-block;
  background: var(--brand-logo-bg);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
}
.splash-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.splash-sub {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  margin: 0 0 var(--sp-5);
}
.splash-spinner { display: none; }
.splash-message {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin: 0 auto;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  min-height: 18px;
}
.splash-message::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 12px;
  margin-left: 6px;
  vertical-align: -2px;
  background: var(--accent);
  animation: splash-caret 1s steps(1) infinite;
}
@keyframes splash-caret { 50% { opacity: 0; } }

#loading-splash.is-error .splash-message { display: none; }
.splash-error {
  margin: 4px auto 0;
  max-width: 380px;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--sem-danger-muted);
  border: 1px solid var(--sem-danger);
  color: var(--text-primary);
  font-size: var(--fs-ui);
  line-height: 1.45;
  text-align: left;
}
.splash-error-title { font-weight: 600; color: var(--sem-danger); margin: 0 0 6px; font-size: var(--fs-ui); }
.splash-error-detail { margin: 0; font-size: var(--fs-caption); color: var(--text-secondary); }
.splash-error-hint { margin: var(--sp-2) 0 0; font-size: var(--fs-caption); color: var(--text-tertiary); }

/* ─── Snapshot-clean mode (hide every piece of chrome) ───────────────── */
body.snapshot-clean .topbar,
body.snapshot-clean .tool-rail,
body.snapshot-clean .side-panel,
body.snapshot-clean .status-bar,
body.snapshot-clean .view-controls,
body.snapshot-clean .tool-prompt,
body.snapshot-clean .menu,
body.snapshot-clean .poi-card,
body.snapshot-clean .caption-overlay,
body.snapshot-clean .profile-chart,
body.snapshot-clean .note-modal {
  display: none !important;
}

/* ─── Course home (landing) ──────────────────────────────────────────── */
.home {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  pointer-events: auto;
  background: var(--surface-0);
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) clamp(20px, 5vw, 64px) 0;
  flex-wrap: wrap;
}
.home-links { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-ui);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-default);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.home-link .icon { color: var(--text-secondary); }
.home-link:hover { background: var(--surface-3); border-color: var(--border-strong); }
.portal-switch { display: flex; }
.portal-switch .segmented { min-width: 280px; }
.home-hero {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) clamp(20px, 5vw, 64px) var(--sp-4);
  flex-wrap: wrap;
}
.home-logo {
  height: 52px;
  width: auto;
  background: var(--brand-logo-bg);
  padding: 8px 14px;
  border-radius: var(--radius-md);
}
.home-hero-text { flex: 1; min-width: 200px; }
.home-title { margin: 0; font-size: clamp(22px, 3vw, 28px); font-weight: 600; letter-spacing: -0.02em; }
.home-tagline { margin: 5px 0 0; color: var(--text-secondary); font-size: var(--fs-body); }
.home-stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-2) clamp(20px, 5vw, 64px) var(--sp-4);
  align-content: start;
}
.hole-card {
  text-align: left;
  font-family: var(--font-ui);
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}
.hole-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--elev-1);
}
.hole-card-thumb {
  height: 130px;
  position: relative;
  background:
    radial-gradient(ellipse 70% 90% at 35% 45%, var(--accent-muted) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 70% 60%, var(--sem-success-muted) 0%, transparent 75%),
    var(--surface-2);
}
.hole-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}
.hole-card-thumb .icon {
  position: absolute;
  left: 14px;
  bottom: 12px;
  color: var(--text-secondary);
}
.hole-card-body {
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hole-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.hole-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.hole-card-meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}
.soon-strip {
  margin: 0 clamp(20px, 5vw, 64px) var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--fs-ui);
  color: var(--text-tertiary);
}
.home-foot {
  margin-top: auto;
  padding: var(--sp-4) clamp(20px, 5vw, 64px) var(--sp-5);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
}

/* ─── Embed/kiosk branding chip (chrome-less surface) ────────────────── */
.brand-header {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  pointer-events: none;
}
.brand-mark {
  height: 38px;
  width: auto;
  display: block;
  background: var(--brand-logo-bg);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
}
.brand-meta { line-height: 1.25; }
.brand-title { font-size: var(--fs-body); font-weight: 600; }
.brand-sub { font-size: var(--fs-caption); color: var(--text-secondary); }
body.snapshot-clean .brand-header { display: none !important; }

/* ─── Mobile fallback hole surface (2D map) ──────────────────────────── */
.mobile-hole {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
}
.mobile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--sp-3);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
}
.mobile-logo {
  height: 34px;
  width: auto;
  background: var(--brand-logo-bg);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
}
.mobile-bar-text { flex: 1; min-width: 0; line-height: 1.25; }
.mobile-bar-title { font-size: 15px; font-weight: 600; }
.mobile-bar-sub { font-size: var(--fs-caption); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-controls {
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
}
.mobile-map { flex: 1; position: relative; min-height: 0; }
.mobile-note {
  padding: 9px var(--sp-3);
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--text-secondary);
  background: var(--surface-1);
  border-top: 1px solid var(--border-default);
  text-align: center;
}
.map-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--surface-0);
  box-shadow: var(--elev-1);
  cursor: pointer;
}
.map-popup { font: var(--fs-ui)/1.4 var(--font-ui); color: var(--text-inverse); max-width: 220px; }
.map-popup strong { display: block; margin-bottom: 4px; font-size: var(--fs-body); }
.map-popup p { margin: 0; font-size: var(--fs-caption); }
.mobile-gb-open {
  margin-top: 8px;
  width: 100%;
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: 600 var(--fs-caption)/1 var(--font-ui);
  cursor: pointer;
}

/* Mobile green book modal — same "paper" treatment as the desktop gb modal. */
.mobile-gb {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 12px;
}
.mobile-gb.is-hidden { display: none; }
.mobile-gb-card {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  box-shadow: var(--elev-2);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-sizing: border-box;
}
.mobile-gb-head { display: flex; align-items: center; justify-content: space-between; }
.mobile-gb-title { font-size: 15px; font-weight: 600; }
.mobile-gb-close {
  border: none; background: none; color: var(--text-tertiary);
  cursor: pointer; width: 30px; height: 30px; font-size: 16px;
  border-radius: var(--radius-sm);
}
.mobile-gb-tabs { display: flex; gap: 4px; }
.mobile-gb-tab {
  flex: 1; border: 1px solid var(--border-default); background: var(--surface-0);
  color: var(--text-secondary); padding: 7px 4px; border-radius: var(--radius-sm);
  font: 600 var(--fs-caption)/1 var(--font-ui); cursor: pointer;
}
.mobile-gb-tab.is-active { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); }
.mobile-gb-stage {
  background: var(--brand-logo-bg); border-radius: var(--radius-md);
  overflow: hidden; border: 1px solid var(--border-default);
}
.mobile-gb-stage .gb-svg { display: block; width: 100%; height: auto; }
.mobile-gb-legend, .mobile-gb-stats {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center;
  font-size: var(--fs-caption); color: var(--text-secondary);
}
.mobile-gb-stats b { color: var(--text-primary); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* The mobile brand-back lives outside the topbar — give it a visible border. */
.mobile-bar .brand-back { border: 1px solid var(--border-default); width: 34px; height: 34px; }
.capture-select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  box-sizing: border-box;
}
.capture-select option { color: var(--text-inverse); }

/* ─── Narrow-viewport adjustments ────────────────────────────────────── */
@media (max-width: 900px) {
  .side-panel, .panel-inner { width: 260px; }
  .side-panel.is-collapsed { width: 0; }
}

/* Third-party + existing-app styles, centralized here so client components
   don't each import global CSS. Order matters: @import must precede other
   rules, and the design tokens load first so everything can read them. */

/* Tailwind (preflight disabled in tailwind.config.ts to protect ui.css). */
*, ::before, ::after{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
  --tw-contain-size:  ;
  --tw-contain-layout:  ;
  --tw-contain-paint:  ;
  --tw-contain-style:  ;
}
::backdrop{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
  --tw-contain-size:  ;
  --tw-contain-layout:  ;
  --tw-contain-paint:  ;
  --tw-contain-style:  ;
}
.container{
  width: 100%;
}
@media (min-width: 640px){
  .container{
    max-width: 640px;
  }
}
@media (min-width: 768px){
  .container{
    max-width: 768px;
  }
}
@media (min-width: 1024px){
  .container{
    max-width: 1024px;
  }
}
@media (min-width: 1280px){
  .container{
    max-width: 1280px;
  }
}
@media (min-width: 1536px){
  .container{
    max-width: 1536px;
  }
}
.\!visible{
  visibility: visible !important;
}
.visible{
  visibility: visible;
}
.static{
  position: static;
}
.absolute{
  position: absolute;
}
.relative{
  position: relative;
}
.inline{
  display: inline;
}
.flex{
  display: flex;
}
.table{
  display: table;
}
.grid{
  display: grid;
}
.contents{
  display: contents;
}
.hidden{
  display: none;
}
.border{
  border-width: 1px;
}
.lowercase{
  text-transform: lowercase;
}
.outline{
  outline-style: solid;
}
.ring{
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
.filter{
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--surface-0);
}

/* The dashboard + water-map surfaces were built on a light "Geist" palette
   (--g-*). They now bridge onto the dark design tokens so every surface shares
   one theme — `--g-bg` is a raised card, `--g-bg-subtle` an in-card fill.
   --g-sans/--g-mono alias the design-system font vars. */
:root {
  --g-bg: var(--surface-1);
  --g-bg-subtle: var(--surface-2);
  --g-border: var(--border-default);
  --g-border-strong: var(--border-strong);
  --g-fg: var(--text-primary);
  --g-muted: var(--text-secondary);
  --g-muted-2: var(--text-tertiary);
  --g-accent: var(--accent);
  --g-sans: var(--font-ui);
  --g-mono: var(--font-mono);
  /* Legacy dark aliases (pre-redesign home); kept mapped, harmless. */
  --gd-bg: var(--surface-0);
  --gd-bg-elev: var(--surface-1);
  --gd-bg-hover: var(--surface-3);
  --gd-border: var(--border-default);
  --gd-border-strong: var(--border-strong);
  --gd-fg: var(--text-primary);
  --gd-muted: var(--text-secondary);
}

/* ─── Hydrology "water map" surface ─────────────────────────────────────── */
.hydro-root {
  position: fixed;
  inset: 0;
}
.hydro-map {
  position: absolute;
  inset: 0;
}
.hydro-card {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--surface-1);
  color: var(--g-fg);
  border: 1px solid var(--g-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--elev-2);
  z-index: 5;
  font-family: var(--g-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hydro-head {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.hydro-title {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.hydro-sub {
  font-size: 12px;
  color: var(--g-muted);
}
.hydro-note {
  font-size: 12px;
  background: var(--sem-warning-muted);
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
}
.hydro-toggles {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 14px;
}
.hydro-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  cursor: pointer;
}
.hydro-toggle.is-disabled {
  opacity: 0.5;
  cursor: default;
}
.hydro-opacity {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.hydro-opacity label {
  font-size: 12px;
  color: var(--text-secondary);
}
.hydro-opacity input {
  width: 100%;
}
.hydro-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hydro-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.hydro-swatch i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.hydro-empty h2 {
  margin: 0 0 6px;
  font-size: 16px;
}
.zone-popup strong {
  font-size: 14px;
  color: var(--text-primary);
}
.zone-popup p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.zone-popup img {
  margin-top: 8px;
  width: 100%;
  border-radius: 6px;
  display: block;
}
.zone-popup-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.zone-popup-del {
  background: var(--sem-danger-muted);
  color: var(--sem-danger);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.zone-popup-3d {
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.zone-popup-3d:hover {
  background: var(--accent-border);
  color: var(--text-inverse);
}
.zone-popup-status {
  background: var(--surface-3);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.zone-popup-status:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.zone-status {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.zone-status-open {
  background: var(--sem-danger-muted);
  color: var(--sem-danger);
}
.zone-status-monitoring {
  background: var(--sem-warning-muted);
  color: var(--sem-warning);
}
.zone-status-resolved {
  background: var(--sem-success-muted);
  color: var(--sem-success);
}
.hydro-zone-summary {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Change detection (capture comparison) */
.hydro-compare {
  margin-top: 14px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hydro-compare strong {
  font-size: 13px;
}
.hydro-compare-row {
  display: flex;
  gap: 8px;
}
.hydro-compare-row label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-secondary);
}
.hydro-compare-row select {
  font-family: var(--g-sans);
  font-size: 13px;
  padding: 7px 8px;
  border: 1px solid var(--g-border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
}
.hydro-detect-btn {
  background: var(--accent);
  color: var(--text-inverse);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-family: var(--g-sans);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.hydro-detect-btn:not(:disabled):hover {
  background: var(--accent-hover);
}
.hydro-detect-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.hydro-diff-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.hydro-diff-result .diff-none {
  color: var(--sem-success);
  font-weight: 600;
}
.hydro-diff-sentence {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.hydro-diff-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hydro-diff-legend {
  list-style: none;
  margin: 0;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.hydro-diff-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hydro-diff-legend b {
  margin-left: auto;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.hydro-diff-legend .swatch {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}

/* Admin: author priority zones on the map */
.hydro-admin {
  margin-top: 14px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}
.hydro-add-btn {
  width: 100%;
  background: var(--surface-2);
  color: var(--g-fg);
  border: 1px dashed var(--g-border-strong);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-family: var(--g-sans);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.hydro-add-btn:hover {
  background: var(--surface-3);
}
.hydro-adding {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hydro-adding-hint {
  margin: 0;
}
.hydro-add-mode {
  display: flex;
  gap: 6px;
}
.hydro-add-mode button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  cursor: pointer;
  padding: 7px 8px;
  border: 1px solid var(--g-border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
}
.hydro-add-mode .sn-ico { display: inline-flex; }
.hydro-add-mode button.is-active {
  border-color: var(--accent-border);
  background: var(--accent-muted);
  color: var(--accent);
}
.linklike {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}
.hydro-zone-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hydro-zone-form strong {
  font-size: 13px;
}
.hydro-zone-form input,
.hydro-zone-form textarea,
.hydro-zone-form select {
  font-family: var(--g-sans);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--g-border-strong);
  border-radius: var(--radius-sm);
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  background: var(--surface-2);
  color: var(--text-primary);
}
.hydro-zone-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.hydro-zone-actions .primary {
  background: var(--accent);
  color: var(--text-inverse);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--g-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.hydro-zone-actions .primary:hover { background: var(--accent-hover); }
.hydro-zone-actions .primary:disabled {
  opacity: 0.5;
  cursor: default;
}
.hydro-zone-actions .ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.hydro-zone-actions .ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
@media (max-width: 640px) {
  .hydro-card {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    border-radius: 14px 14px 0 0;
  }
}

/* Native controls inside the dark water-map card pick up the accent. */
.hydro-toggle input[type='checkbox'],
.hydro-opacity input[type='range'],
.hydro-add-mode input { accent-color: var(--accent); }

/* MapLibre popups default to a white bubble — dark-theme the container, tip,
   and close button so zone popups match the surface. */
.maplibregl-popup-content {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  padding: 12px 14px;
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface-1); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface-1); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface-1); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface-1); }
.maplibregl-popup-close-button { color: var(--text-tertiary); font-size: 18px; }
.maplibregl-popup-close-button:hover { background: var(--surface-3); color: var(--text-primary); }
/* MapLibre ctrl buttons (zoom/compass) on the dark map. */
.maplibregl-ctrl-group {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  box-shadow: var(--elev-1);
}
.maplibregl-ctrl-group button + button { border-top-color: var(--border-default); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85); }

/* ─── Sibling-surface nav (3D tour · Water map · Dashboard) ──────────────────
   Two spatial surfaces share a segmented control; the Dashboard (a data
   surface, not a spatial view) sits past a divider as a distinct icon+label
   link. Floating, management-only. Tokens throughout. */
.surface-nav {
  position: fixed;
  z-index: 935;
  /* Clear the viewer's status bar + tool rail when the workspace chrome is up
     (the vars are 0 outside the hole view, so other surfaces sit near the edge). */
  bottom: 34px;
  left: calc(var(--rail-w, 0px) + 12px);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
}
.surface-nav-seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.surface-seg {
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}
.surface-seg:hover { color: var(--text-primary); }
.surface-seg.is-active {
  background: var(--accent-muted);
  border-color: var(--accent-border);
  color: var(--accent);
}
.surface-nav-div {
  width: 1px;
  align-self: stretch;
  margin: 4px 0;
  background: var(--border-default);
}
.surface-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px 6px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.surface-nav-link .sn-ico { display: inline-flex; color: var(--text-tertiary); }
.surface-nav-link:hover { background: var(--surface-3); color: var(--text-primary); }
.surface-nav-link:hover .sn-ico { color: var(--text-secondary); }
.surface-nav-link.is-active { color: var(--accent); }
.surface-nav-link.is-active .sn-ico { color: var(--accent); }
/* The SPA's nav belongs to an open hole, not the course home — hidden until
   main.js sets body.hole-open. (The /water and /dashboard navs aren't .spa.) */
.surface-nav-spa { display: none; }
body.hole-open .surface-nav-spa { display: flex; }
@media (max-width: 640px) {
  .surface-nav {
    bottom: auto;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ─── Notes & feedback dashboard (/dashboard) ───────────────────────────────
   Dark data surface; --g-* bridge to the design tokens (see :root). */
.dash-page {
  background: var(--surface-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.dash {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 40px) 120px;
  color: var(--g-fg);
  font-family: var(--g-sans);
  font-size: 14px;
  line-height: 1.5;
}
.dash-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--g-border);
}
.dash-logo {
  height: 36px;
  width: auto;
  background: var(--brand-logo-bg);
  border: 1px solid var(--g-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.dash-head-text { flex: 1; }
.dash-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dash-sub { margin: 4px 0 0; color: var(--g-muted); font-size: 13px; }
.dash-counts { display: flex; gap: 8px; }
.dash-chip {
  border: 1px solid var(--g-border);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 13px;
  color: var(--g-muted);
  white-space: nowrap;
  background: var(--g-bg);
}
.dash-chip b { font-weight: 600; color: var(--g-fg); font-family: var(--g-mono); }
.dash-filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 24px 0 20px;
}
.dash-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--g-muted);
}
.dash-filters select {
  font-family: var(--g-sans);
  font-size: 13px;
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--g-border-strong);
  border-radius: 8px;
  background: var(--g-bg);
  color: var(--g-fg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* Native select popups render light — keep option text dark so it's legible. */
.dash-filters select option,
.hydro-compare-row select option,
.hydro-zone-form select option { color: var(--text-inverse); }
.dash-filters select:hover { border-color: var(--border-strong); }
.dash-filters select:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-border);
}
.dash-apply {
  font-family: var(--g-sans);
  font-weight: 600;
  font-size: 13px;
  height: 36px;
  color: var(--text-inverse);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.dash-apply:hover { background: var(--accent-hover); }
.dash-clear {
  font-size: 13px;
  color: var(--g-muted);
  text-decoration: none;
  align-self: center;
  padding: 0 4px;
}
.dash-clear:hover { color: var(--g-fg); }
.dash-empty {
  text-align: center;
  color: var(--g-muted);
  padding: 64px 20px;
  border: 1px solid var(--g-border);
  border-radius: 12px;
  background: var(--g-bg);
  margin-top: 8px;
  font-size: 13px;
}
/* Each hole = a bordered card with a header strip + table. */
.dash-group {
  margin-top: 16px;
  background: var(--g-bg);
  border: 1px solid var(--g-border);
  border-radius: 12px;
  overflow: hidden;
}
.dash-group h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 13px 16px;
  background: var(--g-bg-subtle);
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-group-count {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--g-mono);
  color: var(--g-muted);
  background: var(--g-bg);
  border: 1px solid var(--g-border);
  border-radius: 6px;
  padding: 1px 7px;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-table th,
.dash-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--g-border);
  vertical-align: top;
}
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr { transition: background 0.1s; }
.dash-table tbody tr:hover { background: var(--g-bg-subtle); }
.dash-table th {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 500;
  color: var(--g-muted-2);
}
.dash-title { font-weight: 500; color: var(--g-fg); }
.dash-muted { color: var(--g-muted); }
.dash-coords { font-family: var(--g-mono); font-size: 12px; color: var(--g-muted); white-space: nowrap; }
.dash-caption { font-size: 11px; color: var(--g-muted-2); margin-top: 2px; }
.dash-prov { font-size: 11px; color: var(--g-muted-2); }
.dash-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
}
.dash-kind.k-note { background: var(--accent-muted); color: var(--accent); border-color: var(--accent-border); }
.dash-kind.k-issue { background: var(--sem-danger-muted); color: var(--sem-danger); border-color: var(--sem-danger); }
.dash-open {
  color: var(--g-muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s;
}
.dash-open:hover { color: var(--g-fg); }

