/* ════════════════════════════════════════════════════════════════════════
   Analytics page — standalone dashboard on the shared base.css design tokens.
   Mirrors the owt.html / sites.html aesthetic (cool stone, teal accent).
   ════════════════════════════════════════════════════════════════════════ */

body { background: var(--bg); color: var(--ink); }

.an-wrap { max-width: 1140px; margin: 0 auto; padding: 28px 24px 64px; }

/* ── Header ─────────────────────────────────────────────────────────── */
/* Override the global chrome-rail `header` styling — analytics header blends
   into the page, no background band. */
.an-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin: 0 0 14px; padding: 4px 0 0;
  background: none; box-shadow: none; border: none;
}
.an-title {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 600; letter-spacing: -0.005em;
  color: var(--ink-strong);
}

/* ── Controls (tabs + range) ────────────────────────────────────────── */
.an-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
  padding: 10px 0 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  box-shadow: 0 10px 14px -12px rgba(30, 40, 60, 0.18);
}
.an-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.an-tab {
  font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500;
  color: var(--mid); cursor: pointer;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-md); padding: 6px 13px;
  transition: all var(--t-fast) var(--ease);
}
.an-tab:hover { background: var(--panel-alt); color: var(--ink); }
.an-tab.is-active {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: var(--accent); font-weight: 600;
}
.an-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Segmented preset control — one bordered track, buttons share it. */
.an-presets {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.an-presets button {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  color: var(--mid); background: transparent; border: none;
  border-radius: 3px; padding: 5px 12px; cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.an-presets button:hover { color: var(--ink); }
.an-presets button.is-active {
  background: var(--accent); color: #fff; box-shadow: var(--shadow-xs);
}

/* Date fields as chips: uppercase label + native input share one pill. */
.an-range label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 5px 11px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.an-range label:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.an-range input[type=date] {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500;
  color: var(--ink); background: transparent; border: none; padding: 0;
  color-scheme: light;
}
.an-range input[type=date]:focus { outline: none; }
.an-range input[type=date]::-webkit-calendar-picker-indicator {
  opacity: 0.45; cursor: pointer; transition: opacity var(--t-fast) var(--ease);
}
.an-range input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 0.85; }

/* Include-test toggle — chip matching the date pills; active = accent fill. */
.an-include-test {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px 11px; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
.an-include-test:hover { color: var(--ink); border-color: var(--mid); }
.an-include-test input { accent-color: var(--accent); cursor: pointer; margin: 0; }
.an-include-test:has(input:checked) {
  color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft);
}

/* ── States ─────────────────────────────────────────────────────────── */
.an-loading, .an-empty, .an-error {
  text-align: center; padding: 56px 20px; color: var(--dim); font-size: 0.86rem;
}
.an-error { color: var(--bad); }
.an-error .placeholder-retry { display: block; margin: 14px auto 0; }
.an-empty-title { font-size: 1rem; font-weight: 600; color: var(--mid); margin-bottom: 6px; }

/* Loading skeletons — layout-matched shells per lens, so a lens/range switch
   holds the page's shape instead of collapsing to a text line. Shimmer +
   panel styling come from base.css .skel-block. */
.an-skel-kpi   { height: 96px; }
.an-skel-chart { height: 320px; margin-bottom: 20px; }
.an-skel-table { height: 360px; margin-bottom: 20px; }
.an-skel-flag  { height: 62px; }
.an-skel-flags { display: flex; flex-direction: column; gap: 8px; }
.an-skel-head  { height: 16px; width: 180px; margin: 0 2px 10px; border-radius: var(--r-sm); }

/* ── KPI cards ──────────────────────────────────────────────────────── */
.an-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.an-kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-xs); padding: 16px 18px;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.an-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.an-kpi-label {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 8px;
}
.an-kpi-value {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
  color: var(--ink-strong); line-height: 1;
}
.an-kpi-sub { font-size: 0.72rem; color: var(--dim); margin-top: 6px; }

/* ── Block = external title + card body ─────────────────────────────────
   The section title lives ABOVE/OUTSIDE the card panel, so a card never
   stacks its own header on top of a table's column header. One header per
   card. */
.an-block { margin-bottom: 20px; }
.an-grid2 > .an-block { margin-bottom: 0; }
.an-block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 2px 10px;
}
.an-block-title {
  font-family: var(--font-display); font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid);
}
.an-block-note {
  font-size: 0.72rem; color: var(--dim); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.an-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-xs);
  padding: 16px 18px; margin: 0;
}
.an-chart { width: 100%; min-height: 60px; }
.an-cap { font-size: 0.7rem; color: var(--dim); margin-top: 8px; }
/* Status: a donut "mix" card on the left, a warnings/errors bar on the right. */
.an-status-row {
  display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin-bottom: 20px;
}
.an-status-row > .an-block { margin-bottom: 0; min-width: 0; }
.an-pie-legend {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  height: 28px; font-size: 0.72rem; color: var(--mid);
}
.an-pie-legend span { display: inline-flex; align-items: center; gap: 6px; }
.an-pie-legend i { width: 9px; height: 9px; border-radius: 2px; }

/* Status-donut centre overlay: the self-animated logo sits in the hole (HTML,
   so its embedded CSS animates — Plotly layout images would rasterize it). The
   chart div is positioned so the overlay can centre on it. */
#anStatusPie { position: relative; }
.an-pie-overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  pointer-events: none; z-index: 1;
}
/* Sized to nearly hug the donut's inner wall (hole = 0.64 of a ~214px donut),
   matching the old static mark. */
.an-pie-logo { width: 132px; height: 132px; display: block; }
@media (max-width: 760px) { .an-status-row { grid-template-columns: 1fr; } }

/* Forel-Ule water-colour legend strip (OWT / FUI cards). */
.fu-legend {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim);
}
.fu-bar {
  flex: 1; height: 8px; border-radius: 4px; border: 1px solid var(--line-soft);
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.an-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.an-table th {
  text-align: left; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--dim);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.an-table td {
  padding: 9px 10px; border-bottom: 1px solid var(--line-soft); color: var(--ink);
  vertical-align: middle;
}
.an-table tr:last-child td { border-bottom: none; }
.an-table tbody tr { transition: background var(--t-fast) var(--ease); }
.an-table tbody tr:hover td { background: var(--accent-fade); }
.an-table tr.is-clickable { cursor: pointer; }
.an-table tr.is-clickable:hover td { background: var(--accent-soft); }
.an-mono { font-family: var(--font-mono); font-size: 0.76rem; }

/* ── Quality bar (inline) ───────────────────────────────────────────── */
.qbar { display: flex; height: 14px; border-radius: 3px; overflow: hidden;
        width: 120px; border: 1px solid var(--line-soft); }
.qbar > span { display: block; height: 100%; }
.qbar .q-good { background: var(--good); }
.qbar .q-warn { background: var(--warn); }
.qbar .q-bad  { background: var(--bad); }

/* ── Pills ──────────────────────────────────────────────────────────── */
.an-pill {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; line-height: 1.5;
}
.an-pill.ok    { background: var(--good-bg); color: var(--good); }
.an-pill.warn  { background: var(--warn-bg); color: var(--warn); }
.an-pill.bad   { background: var(--bad-bg);  color: var(--bad); }
.an-pill.muted { background: var(--panel-sunken); color: var(--mid); }
.an-pill.test  { background: #e7eaee; color: #5b6470; }
.an-pill.mhr   { background: var(--imu-bg); color: var(--imu); }
.an-pill.mfl   { background: var(--accent-soft); color: var(--accent-strong); }

/* ── Missing flags ──────────────────────────────────────────────────── */
.flag-list { display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: var(--r-md); padding: 11px 15px;
}
.flag.sev-bad { border-left-color: var(--bad); }
.flag.sev-info { border-left-color: var(--accent); }
.flag-count {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 600;
  color: var(--ink-strong); min-width: 36px; text-align: center;
}
.flag-body { flex: 1; }
.flag-msg { font-size: 0.84rem; color: var(--ink); }
.flag-action { font-size: 0.72rem; color: var(--dim); margin-top: 2px; }
.flag-type {
  font-family: var(--font-mono); font-size: 0.64rem; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Device picker ──────────────────────────────────────────────────── */
.an-devpicker { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.an-devpicker button {
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--mid);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px 12px; cursor: pointer;
}
.an-devpicker button.is-active {
  background: var(--accent); color: #fff; border-color: var(--accent-strong);
}

/* ── Two-column grid for charts ─────────────────────────────────────── */
.an-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 760px) {
  .an-grid2 { grid-template-columns: 1fr; }
  .an-controls { flex-direction: column; align-items: stretch; }
}

/* ── Entrance motion — restrained staggered reveal ──────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes anRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .an-kpi { animation: anRise 240ms var(--ease) both; }
  .an-kpis .an-kpi:nth-child(2) { animation-delay: 40ms; }
  .an-kpis .an-kpi:nth-child(3) { animation-delay: 80ms; }
  .an-kpis .an-kpi:nth-child(4) { animation-delay: 120ms; }
  .an-kpis .an-kpi:nth-child(5) { animation-delay: 160ms; }
  /* No delay on cards — avoids a blank flash when switching lenses. */
  .an-card { animation: anRise 220ms var(--ease) both; }
}

/* ── Errors lens: per-device operability timeline ───────────────────── */
.op-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 0.78rem; color: var(--ink);
}
.op-leg { display: inline-flex; align-items: center; gap: 6px; }
.op-swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.op-legend-note { color: #8a909a; font-style: italic; margin-left: auto; }

/* Errors-lens header — the entry point to the live console (the viewer's
   main-page console button was removed; this gated lens replaces it). */
.op-lens-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 0.78rem;
}
.op-lens-sub { color: #8a909a; }
.op-console-link {
  border: 1px solid var(--line); background: var(--panel); color: var(--accent);
  border-radius: 6px; padding: 3px 9px; font-size: 0.74rem; text-decoration: none;
}
.op-console-link:hover { background: var(--accent-fade); border-color: var(--accent); }

/* Status fills — shared by swatches and day cells. */
.op-working  { background: var(--good); }
.op-degraded { background: var(--warn); }
.op-down     { background: var(--bad); }
.op-silent   { background: var(--line); }

.op-row { margin-bottom: 14px; }
.op-rowhead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px; font-size: 0.82rem;
}
.op-dev { font-weight: 700; letter-spacing: 0.2px; }
.op-span { color: #8a909a; font-size: 0.74rem; }
.op-counts { margin-left: auto; color: #6b7280; font-size: 0.74rem; }
.op-counts b { font-weight: 700; }
.op-c-working  { color: var(--good); }
.op-c-degraded { color: var(--warn); }
.op-c-down     { color: var(--bad); }
.op-c-silent   { color: #8a909a; }

/* One shared grid axis — columns set inline per render as repeat(N, minmax(0,1fr))
   where N = days in the selected range — so every device's cells line up by date and
   no row wraps. Cells flex to fill the panel width; gaps stay visible as real cells. */
.op-strip { display: grid; gap: 2px; }
.op-cell {
  position: relative;
  min-width: 0; height: 16px; border-radius: 2px; cursor: pointer;
  box-sizing: border-box; transition: transform 80ms var(--ease);
}
.op-cell:hover { transform: scale(1.2); outline: 1px solid var(--ink); z-index: 1; }

/* Not-deployed day — holds its column for alignment but is not a status. A faint
   centred rail, recessive so the deployed (coloured) span reads as the signal and the
   crop to the deployment window is obvious. Inert: no hover, no click. */
.op-notdeployed { background: none; cursor: default; box-shadow: none; }
.op-notdeployed:hover { transform: none; outline: none; }
.op-notdeployed::before, .op-ndmark::before {
  content: ""; position: absolute; left: 1px; right: 1px; top: 50%;
  height: 2px; margin-top: -1px; border-radius: 1px;
  background: var(--line); opacity: 0.7;
}
.op-ndmark { position: relative; background: none; box-shadow: none; }
.op-ndmark::before { left: 0; right: 0; opacity: 1; }
/* A hand-input note rings the cell in the accent colour. A note may also force
   the status (op-override) — that recolours the fill; the ring just flags "noted". */
.op-noted { box-shadow: inset 0 0 0 2px var(--accent); }
/* Manual status override — the fill colour is human-asserted, not the cross-check's
   call. A central ink-ringed dot marks it, distinct from the accent note-ring and
   the top-right sync-gap wedge. */
.op-override::before, .op-manualmark::before {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%;
  background: var(--panel); box-shadow: 0 0 0 1px var(--ink);
}
.op-manualmark { position: relative; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
/* Sync gap (data on one side only) — orthogonal to status, shown as an ink corner
   wedge so it overlays any status fill (and the accent ring) without conflict. */
.op-gap::after {
  content: ""; position: absolute; top: 0; right: 0;
  border-style: solid; border-width: 0 6px 6px 0;
  border-color: transparent var(--ink) transparent transparent;
  border-top-right-radius: 3px;
}
.op-gapmark { position: relative; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.op-gapmark::after {
  content: ""; position: absolute; top: 0; right: 0;
  border-style: solid; border-width: 0 7px 7px 0;
  border-color: transparent var(--ink) transparent transparent;
}
.op-c-gap { color: var(--ink); }
/* Healed-late (point-in-time): the live status was upgraded by a later backfill, so
   the fill colour is no longer the real-time truth. Marked with a diagonal hatch
   overlaid on the status fill — non-pseudo so it never collides with the sync-gap
   wedge (::after), the override dot (::before), or the note ring (box-shadow). */
.op-healed {
  background-image: repeating-linear-gradient(
    45deg, transparent 0 3px, rgba(15, 18, 22, 0.30) 3px 5px);
}
.op-healedmark {
  position: relative; background: var(--panel);
  background-image: repeating-linear-gradient(
    45deg, transparent 0 3px, rgba(15, 18, 22, 0.30) 3px 5px);
  box-shadow: inset 0 0 0 1px var(--line);
}
.op-c-healed { color: var(--accent); }

/* Note editor panel */
.op-editor {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius, 8px); padding: 12px 14px; margin-bottom: 16px;
}
.op-ed-head { display: flex; align-items: center; font-size: 0.85rem; margin-bottom: 10px; }
.op-ed-head b { margin-left: 4px; }
.op-ed-x {
  margin-left: auto; border: none; background: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: #8a909a; padding: 0 4px;
}
.op-ed-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.op-ed-grid label, .op-ed-reason {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.72rem; color: #6b7280;
}
.op-ed-reason { margin-bottom: 10px; }
.op-editor input, .op-editor textarea, .op-editor select {
  font: inherit; font-size: 0.82rem; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.op-ed-grid label:nth-child(3) { flex: 1; min-width: 160px; }
.op-ed-actions { display: flex; gap: 8px; justify-content: flex-end; }
.op-ed-save {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.op-ed-del {
  background: none; color: var(--bad); border: 1px solid var(--bad);
  border-radius: 6px; padding: 6px 12px; font-size: 0.8rem; cursor: pointer; margin-right: auto;
}
.op-ed-hint { margin-top: 8px; font-size: 0.72rem; color: #8a909a; font-style: italic; }

/* ── Legend glossary (team context) ─────────────────────────────────────── */
.op-gloss-toggle {
  border: 1px solid var(--line); background: var(--panel); color: var(--accent);
  border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 0.74rem;
  cursor: pointer;
}
.op-gloss-toggle:hover { background: var(--accent-fade); border-color: var(--accent); }
.op-glossary {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 16px; max-width: 780px;
  display: grid; gap: 8px; font-size: 0.8rem;
}
.op-gloss-row { display: grid; grid-template-columns: 16px 98px 1fr; align-items: start; gap: 8px; }
.op-gloss-row .op-swatch { margin-top: 2px; }
.op-gloss-row b { color: var(--ink); }
.op-gloss-row > span:last-child { color: #6b7280; }
.op-gloss-foot {
  color: #6b7280; border-top: 1px solid var(--line-soft);
  padding-top: 8px; font-size: 0.76rem;
}

/* ── Day detail modal ───────────────────────────────────────────────────── */
.op-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 13, 18, 0.42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
/* `display:` above (and on .op-glossary) overrides the UA [hidden] rule, so the
   JS `el.hidden = true` toggle wouldn't hide them — restore it explicitly. */
.op-modal-backdrop[hidden], .op-glossary[hidden] { display: none; }
.opm-dialog {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  width: 100%; max-width: 560px; margin: auto;
  box-shadow: 0 18px 50px rgba(8, 9, 12, 0.28);
  padding: 18px 20px 20px;
}
.opm-loading { padding: 30px 0; text-align: center; color: #6b7280; }
.opm-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.opm-headl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.opm-dev { font-weight: 700; font-size: 1rem; }
.opm-date { color: #6b7280; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.opm-site { color: #6b7280; font-size: 0.78rem; }
.opm-x {
  margin-left: auto; border: none; background: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: #8a909a; padding: 0 4px;
}
.opm-x:hover { color: var(--ink); }

.opm-statusrow { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.opm-badge {
  text-transform: capitalize; font-weight: 700; font-size: 0.8rem;
  padding: 3px 12px; border-radius: 999px; letter-spacing: 0.2px;
}
.opm-badge.op-working  { background: var(--good-bg); color: var(--good); }
.opm-badge.op-degraded { background: var(--warn-bg); color: var(--warn); }
.opm-badge.op-down     { background: var(--bad-bg);  color: var(--bad); }
.opm-badge.op-silent   { background: var(--panel-sunken); color: #5b6270; }
.opm-manual { font-size: 0.72rem; color: #8a909a; }
.opm-def { margin: 0 0 8px; font-size: 0.84rem; color: var(--ink); line-height: 1.45; }
.opm-hint { margin: 0 0 12px; font-size: 0.8rem; color: #6b7280; }
.opm-reason { color: var(--ink); font-style: italic; }
.opm-by { font-style: normal; color: #8a909a; }

.opm-stats { display: flex; gap: 10px; margin-bottom: 2px; }
.opm-stat {
  flex: 1; background: var(--panel-alt); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 8px 10px; text-align: center;
}
.opm-stat b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.opm-stat span { font-size: 0.7rem; color: #6b7280; }

.opm-sec { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-top: 12px; }
.opm-sec h4 { margin: 0 0 8px; font-size: 0.82rem; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.opm-count { background: var(--panel-sunken); color: #5b6270; border-radius: 999px; padding: 0 7px; font-size: 0.7rem; font-weight: 600; }
.opm-note-sub { margin: 8px 0 0; font-size: 0.72rem; color: #8a909a; font-style: italic; }

.opm-gap ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.opm-gap li { font-size: 0.8rem; color: var(--ink); }
.opm-gap em { color: #8a909a; font-style: normal; font-size: 0.74rem; }

/* Point-in-time callout — accent-railed so the "first observed worse" state stands out. */
.opm-firstseen { border-left: 3px solid var(--accent); padding-left: 12px; }
.opm-firstseen p { margin: 0 0 6px; font-size: 0.82rem; color: var(--ink); line-height: 1.45; }
.opm-firstseen p:last-child { margin-bottom: 0; }

.opm-errlist { display: grid; gap: 4px; }
.opm-err {
  position: relative; display: grid;
  grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; overflow: hidden;
  background: var(--panel-alt); font-size: 0.78rem;
}
.opm-err-bar { position: absolute; inset: 0 auto 0 0; opacity: 0.16; }
.opm-err-operational .opm-err-bar { background: var(--bad); }
.opm-err-measurement .opm-err-bar { background: var(--good); }
.opm-err-msg { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opm-err-n { position: relative; z-index: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.opm-err-kind {
  position: relative; z-index: 1; font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 1px 6px; border-radius: 999px;
}
.opm-err-operational .opm-err-kind { background: var(--bad-bg); color: var(--bad); }
.opm-err-measurement .opm-err-kind { background: var(--good-bg); color: var(--good); }

.opm-tablewrap { overflow-x: auto; }
.opm-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.opm-table th { text-align: left; color: #8a909a; font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.opm-table td { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.opm-mono { font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; color: var(--bad); }
.opm-cat { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: var(--panel-sunken); color: #5b6270; }
.opm-cat-missing_in_netcdf, .opm-cat-missing_in_s3 { background: var(--warn-bg); color: var(--warn); }
.opm-cat-error_disagree, .opm-cat-good_mismatch, .opm-cat-size_mismatch { background: var(--bad-bg); color: var(--bad); }

/* Discrepancy drill-down — both pipelines side by side + a plain-English read. */
.opm-disclist { display: flex; flex-direction: column; gap: 8px; }
.opm-disc { padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--panel); }
.opm-disc-head { display: flex; align-items: center; gap: 8px; }
.opm-disc-t { font-family: 'IBM Plex Mono', monospace; font-size: 0.74rem; font-weight: 600; color: var(--ink); }
.opm-disc-link { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem;
  color: var(--accent); text-decoration: none; white-space: nowrap; }
.opm-disc-link:hover { text-decoration: underline; }
.opm-disc-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 7px 0 6px; }
.opm-disc-side { display: flex; align-items: baseline; gap: 7px; min-width: 0;
  padding: 4px 7px; background: var(--panel-alt); border-radius: var(--r-sm); }
.opm-disc-lbl { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.03em; color: #8a909a; white-space: nowrap; }
.opm-disc-cnt { font-family: 'IBM Plex Mono', monospace; font-size: 0.74rem; color: var(--ink-strong); }
.opm-cmp-ok { font-size: 0.7rem; color: var(--good); }
.opm-cmp-err { font-size: 0.7rem; color: var(--bad); font-family: 'IBM Plex Mono', monospace;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opm-cmp-absent { font-size: 0.7rem; color: #9aa0aa; font-style: italic; }
.opm-cmp-diff { color: var(--bad); font-weight: 600; }
.opm-disc-read { font-size: 0.74rem; line-height: 1.4; color: #6a7180; }

.opm-edit .op-ed-grid { margin-top: 4px; }
.opm-dialog input, .opm-dialog textarea, .opm-dialog select {
  font: inherit; font-size: 0.82rem; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
