:root {
  color-scheme: light;
  --page: #f4f6fa;
  --surface: #ffffff;
  --ink: #202b3c;
  --muted: #687588;
  --quiet: #8a95a6;
  --line: #e4e9f0;
  --line-strong: #d6deea;
  --blue: #3369c8;
  --blue-soft: #edf3ff;
  --teal: #148b7a;
  --amber: #be7727;
  --red: #b84d50;
  --shadow: 0 2px 9px rgba(27, 45, 72, 0.035);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
[hidden], .is-hidden { display: none !important; }

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 28px 28px;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 2px;
}

.brand, .source-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #cfdaec;
  border-radius: 11px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: .01em;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.source-actions { gap: 10px; }
.status-chip, .source-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
  font-size: 12px;
}

.status-chip {
  border: 1px solid #d8e5f7;
  background: #f5f8fd;
  color: #536881;
}

.source-link {
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
}
.source-link:hover { border-color: #b8c9e1; background: #fbfcfe; }

.filter-bar {
  position: relative;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.filter-summary-copy { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; column-gap: 9px; row-gap: 3px; min-width: 0; }
.filter-summary-label { grid-row: 1 / span 2; color: var(--quiet); font-size: 10px; white-space: nowrap; }
.filter-summary-primary { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.filter-summary-secondary { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.filter-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; min-height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 0 10px; color: var(--ink); font-size: 11px; }
.filter-toggle:hover { border-color: #b8c9e1; background: #fbfcfe; }
.filter-toggle .chevron { color: var(--quiet); font-size: 11px; transition: transform .16s ease; }
.filter-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.filter-content { position: relative; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-top: 11px; border-top: 1px solid var(--line); padding-top: 12px; }
.filter-content[hidden] { display: none; }

.filter-field, .compact-select {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 128px;
  color: var(--muted);
  font-size: 11px;
}

.filter-field select, .compact-select select {
  min-width: 128px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 30px 0 10px;
  color: var(--ink);
  font-size: 13px;
}

.dimension-filter { min-width: 112px; }
.dimension-filter select { min-width: 112px; }
.dimension-filter select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.media-filter { min-width: 210px; }
.media-field { position: relative; min-width: 0; }
.media-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  min-width: 180px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}
.media-trigger:hover { border-color: #b8c9e1; background: #fbfcfe; }
.media-trigger:disabled { color: var(--muted); cursor: not-allowed; }
.media-trigger-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-trigger .chevron { flex: 0 0 auto; color: var(--quiet); font-size: 11px; transition: transform .16s ease; }
.media-trigger[aria-expanded=\"true\"] .chevron { transform: rotate(180deg); }
.media-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  left: 0;
  width: min(390px, calc(100vw - 42px));
  max-height: min(420px, calc(100vh - 190px));
  overflow: auto;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.media-menu-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 8px; }
.media-menu-heading strong { color: var(--ink); font-size: 12px; font-weight: 600; }
.media-menu-heading span, .check-copy small { color: var(--quiet); font-size: 11px; }
.all-row { padding: 6px 7px; }
.all-row input, .media-groups input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 32px; border-radius: 7px; padding: 4px 6px; color: var(--ink); cursor: pointer; }
.check-row:hover { background: #f7f9fc; }
.check-copy { display: flex; align-items: center; justify-content: space-between; flex: 1; min-width: 0; gap: 10px; }
.check-copy strong { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.check-copy small { flex: 0 0 auto; }
.menu-divider { height: 1px; margin: 7px 2px; background: var(--line); }
.media-group { padding: 2px 0; }
.group-row { display: flex; align-items: center; gap: 4px; border-radius: 7px; background: #f8faff; padding-right: 4px; }
.group-select-row { flex: 1; min-width: 0; background: transparent; }
.group-toggle { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border: 0; border-radius: 6px; background: transparent; color: var(--quiet); }
.group-toggle:hover { background: #edf2fa; color: var(--ink); }
.group-toggle .chevron { display: block; font-size: 14px; line-height: 1; transition: transform .16s ease; }
.group-toggle[aria-expanded=\"false\"] .chevron { transform: rotate(-90deg); }
.media-children { margin: 2px 0 1px 22px; border-left: 1px solid var(--line); padding-left: 8px; }
.media-child .check-copy strong { font-weight: 450; }
.menu-footnote, .media-empty { margin: 7px 3px 1px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.filter-field-hint { max-width: 205px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.filter-notice { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.filter-notice.is-warning { color: #90611e; }
.quality-scope-note { margin: 15px 2px 0; color: var(--muted); font-size: 12px; }
.grain-pills { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.range-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.range-pills, .date-inputs, .metric-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}
.grain-pills { border-right: 1px solid var(--line); padding-right: 9px; }

.range-pill, .metric-pill {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.range-pill:hover, .metric-pill:hover { background: #f4f7fb; color: var(--ink); }
.range-pill.is-active, .metric-pill.is-active {
  border-color: #d8e4f6;
  background: var(--blue-soft);
  color: #2858a5;
  font-weight: 600;
}

.date-field { position: relative; flex: 0 0 150px; min-width: 0; }
.date-inputs .date-input-text {
  display: block;
  width: 150px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  padding: 0 36px 0 9px;
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .015em;
}
.date-inputs .date-input-text::placeholder { color: #929eae; opacity: 1; }
.date-picker-icon { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: var(--muted); font-size: 14px; line-height: 1; pointer-events: none; }
.date-inputs .date-picker-native { position: absolute; top: 0; right: 0; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 0 7px 7px 0; padding: 0; opacity: 0; cursor: pointer; }
.date-field:focus-within .date-input-text { border-color: #8ba9dc; outline: 2px solid rgba(51, 105, 200, .18); outline-offset: 1px; }

.date-separator { color: var(--quiet); font-size: 12px; }
.button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  white-space: nowrap;
}
.button-quiet { border-color: var(--line); background: #fff; color: #4d5b70; }
.button-quiet:hover, .button-secondary:hover { border-color: #bdcde2; background: #f9fbfd; }
.button-secondary { border-color: var(--line); background: #fff; color: #40526d; }

.date-error {
  flex-basis: 100%;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.view-tabs {
  display: flex;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin: 17px 0 15px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
}

.view-tabs button {
  position: relative;
  min-height: 42px;
  border: 0;
  background: transparent;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.view-tabs button[aria-selected="true"] { color: #2858a5; font-weight: 650; }
.view-tabs button[aria-selected="true"]::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--blue);
  content: "";
}

.view-panel { display: block; }
.section-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 12px;
  padding: 0 2px;
}
.section-toolbar h2 { margin: 0; font-size: 15px; font-weight: 650; }
.metric-config { position: relative; flex: 0 0 auto; }
.metric-config summary {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--surface);
  color: #40526d;
  font-size: 12px;
  cursor: pointer;
}
.metric-config-options {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
  width: 310px;
  max-width: calc(100vw - 26px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(25, 43, 70, .14);
}
.config-choice { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; cursor: pointer; }
.cohort-toolbar { align-items: center; }
.kpi-grid, .quality-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card, .quality-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
.kpi-card { position: relative; }
.kpi-card:hover, .kpi-card:focus-within { z-index: 8; }

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}
.kpi-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title-with-tooltip { position: relative; display: flex; align-items: center; gap: 7px; }
.section-title-with-tooltip > .tooltip-wrap { position: static; }
.section-title-with-tooltip > .tooltip-wrap > .tooltip-popup {
  right: auto;
  left: 0;
  width: min(280px, calc(100vw - 32px));
}
.tooltip-wrap { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; }
.tooltip-trigger { display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid #cbd5e2; border-radius: 50%; background: #fff; padding: 0; color: #6b7a8f; font-size: 10px; font-weight: 650; line-height: 1; cursor: help; }
.tooltip-trigger:hover, .tooltip-trigger:focus-visible { border-color: #89a7d9; background: #f2f6fc; color: #2858a5; }
.tooltip-popup { position: absolute; top: calc(100% + 7px); right: 0; z-index: 20; width: 280px; max-width: min(320px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; padding: 9px 11px; color: var(--ink); font-size: 11px; font-weight: 400; line-height: 1.5; white-space: normal; box-shadow: 0 8px 22px rgba(25, 43, 70, .14); opacity: 0; visibility: hidden; transform: translateY(-3px); transition: opacity .14s ease, transform .14s ease, visibility .14s ease; }
.tooltip-wrap:hover .tooltip-popup, .tooltip-wrap:focus-within .tooltip-popup { opacity: 1; visibility: visible; transform: translateY(0); }
.kpi-label .tooltip-wrap { position: static; margin-left: auto; }
.kpi-label .tooltip-popup { top: 38px; right: auto; left: 0; width: min(320px, calc(100vw - 32px)); }
.kpi-card:nth-child(even) .kpi-label .tooltip-popup { right: 0; left: auto; }
.kpi-value {
  overflow: hidden;
  margin-top: 9px;
  color: #1f2d42;
  font-size: clamp(20px, 2vw, 26px);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-context { margin-top: 5px; color: var(--quiet); font-size: 11px; line-height: 1.45; }
.kpi-context:empty { display: none; }
.kpi-change { margin-top: 5px; color: #66758a; font-size: 11px; }

.panel {
  min-width: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.trend-heading { align-items: center; }
.panel-heading h2 {
  margin: 0;
  color: #26344a;
  font-size: 15px;
  font-weight: 650;
}
.panel-heading h3 { margin: 0; }
.eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
}
.panel-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.period-label { color: var(--quiet); font-size: 12px; white-space: nowrap; }
.metric-pills { justify-content: flex-end; flex-wrap: wrap; }
.metric-pill { min-height: 30px; padding: 5px 9px; }
.chart { width: 100%; min-width: 0; }
.chart-large { height: 350px; }
.chart-medium { height: 310px; }
/* Trend Heading Actions & View Mode Toggle */
.trend-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.trend-heading-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: #edf2f7;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.view-mode-pill {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}
.view-mode-pill:hover {
  color: #1e293b;
}
.view-mode-pill.is-active {
  background: #ffffff;
  color: #2563eb;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Parallel Inspection Status Bar (Focus) */
.parallel-focus {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  color: #334155;
  font-size: 12px;
  margin-top: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.parallel-focus-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.parallel-focus-date {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.parallel-focus-metric-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 5px;
}
.parallel-focus-method {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}
.parallel-focus-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  width: 100%;
}
.parallel-focus-item {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 6px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--focus-color, #2563eb);
  border-radius: 5px;
  padding: 4px 10px;
  color: #334155;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  line-height: 1.4;
}
.parallel-focus-series {
  color: var(--focus-color, #1e293b);
  font-size: 11.5px;
  font-weight: 700;
}
.parallel-focus-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.parallel-focus-key {
  color: #64748b;
  font-size: 11px;
}
.parallel-focus-stat-value {
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 600;
}
.parallel-focus-sep {
  color: #cbd5e1;
  font-weight: 700;
}
.parallel-focus-coverage {
  color: #64748b;
  font-size: 11px;
}
/* Keep selected-media summaries compact on one row; narrow screens scroll inside this strip. */
#compare-focus .parallel-focus-items {
  flex-wrap: nowrap;
  gap: 6px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
#compare-focus .parallel-focus-item {
  flex: 0 0 auto;
  gap: 4px 7px;
  padding: 3px 8px;
  font-size: 10px;
}
#compare-focus .parallel-focus-series,
#compare-focus .parallel-focus-stat-value {
  font-size: 10px;
}
#compare-focus .parallel-focus-key,
#compare-focus .parallel-focus-coverage {
  font-size: 9.5px;
}
.parallel-focus-status {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}
.parallel-focus-status.is-missing {
  color: #b91c1c;
  background: #fee2e2;
}
.parallel-focus-status.is-partial {
  color: #b45309;
  background: #fef3c7;
}

/* Compare Multi-line View Styles */
.compare-view-switch {
  display: inline-flex;
  align-items: center;
  background: #edf2f7;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.compare-metric-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.compare-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}
.compare-reference-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #b6cced;
  border-radius: 7px;
  background: var(--blue-soft);
  color: #285cae;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.compare-reference-toggle::before {
  content: "";
  width: 16px;
  border-top: 2px dashed currentColor;
}
.compare-reference-toggle::after {
  content: "关";
  padding: 1px 6px;
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
}
.compare-reference-toggle:hover {
  border-color: var(--blue);
  background: #e3edfc;
}
.compare-reference-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.compare-reference-toggle[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}
.compare-reference-toggle[aria-pressed="true"]::after {
  content: "开";
  color: #285cae;
}
.compare-reference-note {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.compare-daily-details {
  margin-top: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #fbfcfe;
}
.compare-daily-details summary {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.compare-daily-scroll {
  position: relative;
  max-height: 320px;
  margin-top: 10px;
  overflow: auto;
  overscroll-behavior: contain;
}
.compare-daily-table {
  border-collapse: separate;
  border-spacing: 0;
}
.compare-daily-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8f9fc;
  vertical-align: middle;
}
.compare-daily-table thead th:first-child { z-index: 4; }
.compare-daily-details .compare-daily-table th,
.compare-daily-details .compare-daily-table td { text-align: center; }
.compare-daily-media-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
}
.compare-daily-media-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}
.compare-daily-media-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--media-color, #7d8ba0);
}
.compare-daily-sparkline {
  display: block;
  width: 104px;
  max-width: 100%;
  height: 28px;
  overflow: visible;
}
.compare-daily-sparkline-empty {
  min-height: 28px;
  color: #a0a9b7;
  font-size: 12px;
  line-height: 28px;
}
.parallel-focus-diff.is-up {
  color: #15803d;
  background: #f0fdf4;
}
.parallel-focus-diff.is-down {
  color: #b91c1c;
  background: #fef2f2;
}
.parallel-focus-ref {
  color: #64748b;
  font-size: 11px;
}
.parallel-focus-status {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}
.parallel-focus-status.is-missing {
  color: #b91c1c;
  background: #fee2e2;
}
.parallel-focus-status.is-partial {
  color: #b45309;
  background: #fef3c7;
}

/* Parallel Scroll Container */
.parallel-scroll {
  position: relative;
  width: 100%;
  overflow: visible;
  max-height: none;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* Header Clip & Grids */
.parallel-header-clip {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(30, 49, 76, 0.045);
}
.parallel-head-grid, .parallel-body-grid {
  display: grid;
  grid-template-columns: var(--parallel-date-width, 76px) repeat(var(--parallel-columns, 10), minmax(0, 1fr));
  width: 100%;
}
.parallel-header-legend {
  min-height: 28px;
  padding: 5px 10px 4px;
  justify-content: flex-end;
  border-bottom: 1px solid #eef2f6;
  background: #ffffff;
}
.parallel-header-legend[hidden] { display: none; }

/* Header Cells */
.parallel-date-head {
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 25;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.03);
  min-height: 88px;
  padding: 8px 6px;
}
.parallel-metric-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  min-height: 88px;
  border-right: 1px solid #eef2f6;
  padding: 8px 0 0;
  background: #fbfcfe;
  transition: background-color 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.parallel-metric-head:last-child {
  border-right: 0;
}
.parallel-metric-head:hover,
.parallel-metric-head.is-focused {
  background: #f0f5ff;
}
.parallel-metric-head:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.parallel-metric-top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0 5px 6px;
}
.parallel-metric-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 100%;
  gap: 3px;
  color: #0f172a;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}
.parallel-metric-title > span:not(.parallel-swatch) { min-width: 0; }
.parallel-swatch {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.parallel-unit {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.2;
}

.parallel-metric-range {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.parallel-range-val {
  color: #64748b;
}

.parallel-metric-baseline {
  display: flex;
  align-items: center;
  min-height: 22px;
}
.parallel-baseline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #334155;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.parallel-baseline-dash {
  display: inline-block;
  width: 10px;
  border-top: 1.5px dashed #94a3b8;
}

.parallel-media-refs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}
.parallel-media-ref-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: #475569;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.parallel-media-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 6px;
}
.parallel-value-axis {
  position: relative;
  flex: 0 0 30px;
  width: 100%;
  height: 30px;
  margin-top: auto;
  border-top: 1px solid #dfe5ed;
  font-variant-numeric: tabular-nums;
}
.parallel-value-axis::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-bottom: 1px solid #e7ebf1;
  content: "";
}
.parallel-axis-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 1;
}
.parallel-axis-label {
  position: absolute;
  top: 5px;
  left: 0;
  color: #66758a;
  font-size: 8.5px;
  line-height: 1.15;
  white-space: nowrap;
  transform: translateX(-50%);
}
.parallel-axis-mark {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 5px;
  border-left: 1px solid #9aa8b9;
}
.parallel-axis-tick.is-first .parallel-axis-label {
  transform: none;
}
.parallel-axis-tick.is-last .parallel-axis-label {
  transform: translateX(-100%);
}
.parallel-axis-empty {
  position: absolute;
  top: 5px;
  left: 50%;
  color: #97a2b1;
  font-size: 9px;
  transform: translateX(-50%);
}

/* Legend */
.parallel-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.parallel-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}
.parallel-legend-item::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--series-color, #7d8ba0);
}
.parallel-legend-item[data-kind="solid"]::before {
  flex-basis: 16px;
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 1.6px solid #7d8ba0;
  background: transparent;
}
.parallel-legend-item[data-kind="dashed"]::before {
  flex-basis: 16px;
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 1px dashed #7d8ba0;
  background: transparent;
}
.parallel-legend-item[data-kind="partial"]::before {
  flex-basis: 16px;
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 1.25px dashed #66758a;
  background: transparent;
}
.parallel-legend-item[data-kind="metric-colors"]::before {
  flex-basis: 18px;
  width: 18px;
  height: 7px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3369c8 0 10%, #cc852f 10% 20%, #148b7a 20% 30%, #8468b5 30% 40%, #c15f68 40% 50%, #63798f 50% 60%, #4d8b4b 60% 70%, #b05a98 70% 80%, #3d839c 80% 90%, #9d8627 90% 100%);
}

/* Body Grid, Bands & Columns */
.parallel-body-grid {
  position: relative;
  min-height: 0;
}
.parallel-bands {
  position: absolute;
  z-index: 0;
  inset: 0;
}
.parallel-band {
  height: var(--parallel-row-height);
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.12s ease;
}
.parallel-band.is-alt {
  background: #fcfdfe;
}
.parallel-band.is-active {
  background: #eff6ff;
}
.parallel-date-column, .parallel-metric-column {
  position: relative;
  z-index: 1;
  min-width: 0;
  border-right: 1px solid #f1f5f9;
  transition: background-color 0.12s ease;
}
.parallel-date-column {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.03);
}
.parallel-metric-column:last-child {
  border-right: 0;
}
.parallel-metric-column.is-focused {
  background: rgba(37, 99, 235, 0.02);
}
.parallel-date-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--parallel-row-height);
  border: 0;
  background: transparent;
  padding: 0 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
  border-left: 3px solid transparent;
  transition: all 0.12s ease;
  cursor: pointer;
}
.parallel-date-row:hover {
  background: #f8fafc;
  color: #0f172a;
}
.parallel-date-row:nth-child(even) {
  background: #fbfcfe;
}
.parallel-date-row.is-active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  border-left: 3px solid #2563eb;
}
.parallel-plot {
  position: absolute;
  inset: 0;
}
@media (max-width: 1000px) {
  .parallel-head-grid, .parallel-body-grid { --parallel-date-width: 72px; }
  .parallel-date-head { min-height: 88px; padding: 7px 4px; }
  .parallel-metric-head { min-height: 88px; padding-top: 7px; }
  .parallel-header-legend { justify-content: flex-start; max-width: 100%; }
}
.parallel-scroll[data-grain="week"] .parallel-head-grid,
.parallel-scroll[data-grain="week"] .parallel-body-grid {
  --parallel-date-width: 100px;
}
.parallel-scroll[data-grain="week"] .parallel-date-row { font-size: 11px; }
@media (max-width: 760px) {
  .parallel-header-legend { justify-content: flex-start; gap: 5px 9px; padding-right: 6px; padding-left: 6px; }
  .parallel-legend-item { font-size: 10px; }
  .parallel-date-head { font-size: 10px; }
  .parallel-metric-title { font-size: 10.5px; }
  .parallel-axis-label { font-size: 8px; }
  .parallel-scroll[data-grain="week"] .parallel-head-grid,
  .parallel-scroll[data-grain="week"] .parallel-body-grid { --parallel-date-width: 72px; }
}
.tooltip-note { margin-left: 20px; color: #8b6327; font-size: 11px; }
.check-control {
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  margin: 0 0 3px auto;
  color: var(--muted);
  font-size: 12px;
}
.check-control input { accent-color: var(--blue); }

.table-scroll { width: 100%; overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}
thead { background: #f8f9fc; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #627087;
  font-size: 11px;
  font-weight: 600;
}
th, td {
  min-width: 92px;
  border-bottom: 1px solid #edf0f4;
  padding: 10px 11px;
  vertical-align: top;
}
th:first-child, td:first-child { min-width: 105px; }
tbody tr:hover { background: #fafbfd; }
td { color: #36445a; font-variant-numeric: tabular-nums; }
td.numeric { text-align: right; white-space: nowrap; }
td.muted-cell { color: var(--quiet); }
td.source-cell { color: var(--muted); font-size: 11px; white-space: nowrap; }

.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid #e1e6ee;
  border-radius: 999px;
  background: #f7f8fa;
  padding: 2px 8px;
  color: #687588;
  font-size: 10px;
  white-space: nowrap;
}
.state-badge.is-partial { border-color: #f0dfbd; background: #fff9ed; color: #8b6327; }
.state-badge.is-observing { border-color: #d9e5f6; background: #f4f8ff; color: #4e6f9f; }
.state-badge.is-missing { border-color: #f0d8d8; background: #fff5f5; color: #995256; }

.quality-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quality-card .kpi-value { font-size: 22px; }
.quality-card .kpi-context { min-height: 0; }
.quality-detail h3 {
  margin: 0 0 8px;
  color: #36445a;
  font-size: 12px;
}
.quality-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 20px;
}
.quality-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px 12px;
  color: #526176;
  font-size: 12px;
}
.quality-note strong { color: #33445c; font-weight: 600; }
.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.definition-grid ul { margin: 0; padding-left: 18px; color: #58667a; }
.definition-grid li { margin: 0 0 7px; font-size: 12px; }
.source-evidence {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
  color: var(--muted);
  font-size: 11px;
}
.source-evidence code {
  overflow: hidden;
  color: #536176;
  text-overflow: ellipsis;
}
.empty-state {
  display: grid;
  min-height: 140px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 3px 2px;
  color: var(--quiet);
  font-size: 11px;
}
.page-footer span:last-child { text-align: right; }
.compact-select { min-width: 104px; }
.compact-select select { min-width: 104px; height: 33px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(51, 105, 200, .25);
  outline-offset: 2px;
}

@media (max-width: 1160px) {
  .app-shell { padding-right: 20px; padding-left: 20px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .range-controls { margin-left: 0; }
  .filter-content { align-items: flex-start; }
}

@media (max-width: 760px) {
  .app-shell { padding: 0 12px 18px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 13px 2px; }
  .source-actions { align-self: stretch; justify-content: space-between; }
  .filter-bar { padding: 9px 10px; }
  .filter-summary-row { gap: 8px; }
  .filter-summary-copy { column-gap: 6px; }
  .filter-summary-primary { font-size: 11px; }
  .filter-summary-secondary { font-size: 9px; }
  .filter-toggle { min-height: 30px; padding: 0 8px; font-size: 10px; }
  .filter-content { gap: 9px; padding-top: 10px; }
  .filter-field { flex: 1 1 135px; min-width: 0; }
  .filter-field select { width: 100%; min-width: 0; }
  .media-filter { flex: 1 1 100%; }
  .media-menu { position: static; width: 100%; max-height: min(340px, calc(100vh - 210px)); margin-top: 7px; box-shadow: none; }
  .section-toolbar { flex-wrap: wrap; }
  .cohort-toolbar .metric-pills { width: auto; }
  .range-controls { width: 100%; margin: 3px 0 0; }
  .range-pills { flex-wrap: wrap; }
  .date-inputs { width: 100%; }
  .date-inputs .date-field { flex: 1 1 0; width: auto; min-width: 0; }
  .date-inputs .date-input-text { width: 100%; }
  .kpi-card:nth-child(even) .kpi-label .tooltip-popup { right: 0; left: auto; }
  .filter-content > .button-secondary { width: 100%; }
  .view-tabs { width: 100%; margin-top: 12px; }
  .view-tabs button { padding: 0 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 21px; }
  .panel { padding: 14px 12px; }
  .panel-heading, .trend-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .metric-pills { justify-content: flex-start; width: 100%; }
  .metric-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .chart-large { height: 310px; }
  .chart-medium { height: 280px; }
  .quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quality-notes, .definition-grid { grid-template-columns: 1fr; }
  .source-evidence { grid-template-columns: 1fr; gap: 4px; }
  .source-evidence code { overflow-wrap: anywhere; }
  .page-footer { flex-direction: column; }
  .page-footer span:last-child { text-align: left; }
  table { min-width: 700px; }
}

@media (max-width: 390px) {
  .app-shell { padding-right: 9px; padding-left: 9px; }
  .brand h1 { font-size: 17px; }
  .source-link, .status-chip { padding-right: 8px; padding-left: 8px; font-size: 11px; }
  .kpi-card { padding: 10px; }
  .kpi-value { font-size: 19px; }
  .range-pill { padding-right: 8px; padding-left: 8px; }
}
