/* overview.css — Longitudinal Overview v2 compass.
   Sparse, directional layout. Reuses the WebTUI theme tokens/classes from
   evidence-daily.css (.ov-note, .st-rail, .kpi, .mut, .ops-*, tui-menubar …);
   only the compass-specific pieces (summary tiles, contribution calendar, inline
   SVG charts) live here. No hardcoded colours — theme tokens only. */

/* ── Summary tiles ─────────────────────────────────────────────────────────── */
.ov-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 2px;
}
.ov-tile {
  background: var(--sp-panel-bg-raised, var(--sp-panel-bg));
  border: 1px solid var(--sp-border, var(--border));
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ov-tile .lbl { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.ov-tile .val { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.05; }
.ov-tile .val .u { font-size: 12px; font-weight: 500; color: var(--text-mut); margin-left: 2px; }
.ov-tile .sub { font-size: 10.5px; color: var(--text-mut); }
.ov-tile .sub.good { color: var(--ok); } .ov-tile .sub.warn { color: var(--warn); }
.ov-tile.is-hero { border-color: color-mix(in srgb, var(--accent) 55%, var(--sp-border)); }

.ov-dir { font-weight: 700; }
.ov-dir.improving { color: var(--ok); }
.ov-dir.declining { color: var(--crit); }
.ov-dir.steady    { color: var(--accent); }
.ov-dir.insufficient_data { color: var(--text-dim); }

/* ── Contribution calendar ─────────────────────────────────────────────────── */
.ov-cal-rail { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ov-modes { display: inline-flex; gap: 4px; }
.ov-mode {
  font: inherit; font-size: 11px; cursor: pointer;
  background: var(--sp-panel-bg); color: var(--text-mut);
  border: 1px solid var(--sp-border, var(--border)); border-radius: 4px;
  padding: 3px 9px;
}
.ov-mode:hover { color: var(--text); }
.ov-mode.active { background: var(--accent); color: var(--sp-page-bg, #150f23); border-color: var(--accent); font-weight: 600; }

.ov-cal-scroll { overflow-x: auto; padding-bottom: 4px; }
.ov-cal {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  gap: 3px;
  width: max-content;
}
.ov-cal .cell {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--sp-graph-lane-bg, #1b1330);
  border: 1px solid transparent;
  cursor: pointer;
}
.ov-cal .cell.empty { background: transparent; cursor: default; opacity: .35; }
.ov-cal .cell.nap { border-radius: 6px; }
.ov-cal .cell.change { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.ov-cal .cell:hover { border-color: var(--text); }
.ov-cal-legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 10.5px; color: var(--text-dim); }
.ov-cal-legend .sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* Tooltip */
.ov-tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--sp-inspector-bg, #0f0a1c); color: var(--text);
  border: 1px solid var(--sp-border-strong, var(--border)); border-radius: 5px;
  padding: 7px 9px; font-size: 11px; max-width: 240px; box-shadow: 0 6px 22px rgba(0,0,0,.45);
  opacity: 0; transition: opacity .08s;
}
.ov-tip.show { opacity: 1; }
.ov-tip .t-date { font-weight: 700; margin-bottom: 3px; }
.ov-tip .t-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-mut); }
.ov-tip .t-row b { color: var(--text); font-weight: 600; }
.ov-tip .t-chg { margin-top: 4px; color: var(--accent); }
.ov-tip .t-hint { margin-top: 4px; color: var(--text-dim); font-size: 10px; }

/* ── Panels + charts ───────────────────────────────────────────────────────── */
.ov-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.ov-panel { background: var(--sp-panel-bg); border: 1px solid var(--sp-border, var(--border)); border-radius: 6px; padding: 12px 14px; min-width: 0; }
.ov-panel h3 { margin: 0 0 2px; font-size: 12.5px; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.ov-panel .sub { font-size: 10.5px; color: var(--text-dim); margin-bottom: 8px; }
.ov-chart { width: 100%; display: block; }
/* crisp hairlines: grid/axis/threshold/change strokes snap to the pixel grid (S1 de-blur).
   Rolling trend lines (.roll7/.roll30/.adbline) and dots are intentionally left anti-aliased. */
.ov-chart .axis, .ov-chart .grid, .ov-chart .thr, .ov-chart .chg { shape-rendering: crispEdges; }
.ov-chart .axis { stroke: var(--sp-border, var(--border)); stroke-width: 1; }
.ov-chart .grid { stroke: color-mix(in srgb, var(--sp-border) 55%, transparent); stroke-width: 1; stroke-dasharray: 2 3; }
.ov-chart .thr  { stroke: color-mix(in srgb, var(--ok) 60%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
.ov-chart .dot  { fill: var(--text-dim); }
.ov-chart .dot.nap { fill: color-mix(in srgb, var(--text-dim) 55%, transparent); }
.ov-chart .roll7 { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.ov-chart .roll30 { fill: none; stroke: var(--flow-color, #79c0ff); stroke-width: 1.4; opacity: .8; }
.ov-chart .adbline { fill: none; stroke: var(--sp-airway-burden, var(--warn)); stroke-width: 1.6; }
.ov-chart text { fill: var(--text-dim); font-size: 9px; font-family: Monaco, monospace; }
.ov-chart .chg { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 2; opacity: .7; }
.ov-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10px; color: var(--text-dim); margin-top: 6px; }
.ov-legend i { display: inline-block; width: 14px; height: 0; border-top-width: 2px; border-top-style: solid; vertical-align: middle; margin-right: 4px; }

/* Relationship quintile tables (replaced the scatter plots — 2026-07-11 spike) */
.ov-rel { margin-bottom: 12px; }
.ov-rel-stat { font-size: 11px; color: var(--text-mut); margin-bottom: 5px; }
.ov-rel-stat b { color: var(--text); }
.ov-rel-stat .none, .ov-rel-note .none { color: var(--text-dim); }
.ov-rel-tbl { font-family: Monaco, monospace; }
.ov-rel-row {
  display: grid;
  grid-template-columns: minmax(78px, 96px) 34px 58px minmax(120px, 1fr);
  align-items: center; gap: 8px;
  font-size: 11px; color: var(--text); padding: 1.5px 0;
}
.ov-rel-row.hd { color: var(--text-dim); font-size: 9.5px; text-transform: uppercase; letter-spacing: .03em; padding-bottom: 3px; }
.ov-rel-row .c-n, .ov-rel-row .c-med { text-align: right; color: var(--text-mut); }
.ov-rel-row .c-med { color: var(--text); }
.ov-rel-row.hd .c-n, .ov-rel-row.hd .c-med { color: var(--text-dim); }
.ov-band { display: block; overflow: visible; }
.ov-band .trk { stroke: color-mix(in srgb, var(--sp-border) 70%, transparent); stroke-width: 1; shape-rendering: crispEdges; }
.ov-band .iqr { fill: color-mix(in srgb, var(--sp-airway-burden, var(--warn)) 45%, transparent); }
.ov-band .med { stroke: var(--sp-airway-burden, var(--warn)); stroke-width: 1.5; shape-rendering: crispEdges; }
.ov-rel-note { font-size: 11px; color: var(--text-mut); margin-top: 4px; line-height: 1.4; }
.ov-rel-note b { color: var(--text); }

/* ── Change timeline + weekly cards ────────────────────────────────────────── */
.ov-changes { display: flex; flex-direction: column; gap: 4px; }
.ov-change { display: flex; gap: 10px; align-items: baseline; font-size: 11.5px; padding: 3px 0; border-bottom: 1px solid color-mix(in srgb, var(--sp-border) 40%, transparent); }
.ov-change .d { color: var(--text-dim); font-family: Monaco, monospace; font-size: 10.5px; min-width: 74px; }
.ov-change .k { color: var(--accent); text-transform: uppercase; font-size: 9.5px; letter-spacing: .05em; min-width: 62px; }
.ov-change .s { color: var(--text); }

.ov-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.ov-card { border: 1px solid var(--sp-border, var(--border)); border-left-width: 3px; border-radius: 5px; padding: 9px 11px; background: var(--sp-panel-bg); }
.ov-card.good { border-left-color: var(--ok); }
.ov-card.warn { border-left-color: var(--warn); }
.ov-card.muted { border-left-color: var(--text-dim); }
.ov-card .title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.ov-card .body { font-size: 11px; color: var(--text-mut); line-height: 1.35; }

/* ── Error / loading ───────────────────────────────────────────────────────── */
.ov-error { color: var(--crit); }

@media (max-width: 860px) {
  .ov-tiles { grid-template-columns: repeat(2, 1fr); }
  .ov-grid2 { grid-template-columns: 1fr; }
}
