/* ---------- report / print ---------- */
.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.report-toolbar p {
  margin: 0;
  flex: 1 1 300px;
}
.report section,
.report header,
.report footer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.report-charts {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 760px) {
  .report-charts {
    grid-template-columns: 1fr;
  }
}
.report-foot ol {
  font-size: 0.8rem;
  padding-left: 18px;
}
.report-foot a,
.biblio li,
.claim-text {
  overflow-wrap: anywhere;
}

.print-only {
  display: none;
}
@media print {
  .print-only {
    display: block;
  }
  /* Always print light, even in dark mode: these selectors match the dark-theme ones'
     specificity and come later, so they win. */
  :root,
  :root[data-theme],
  :root:not([data-theme='light']) {
    color-scheme: light;
    --bg: #fbf8fa;
    --surface: #ffffff;
    --surface-2: #f5f0f4;
    --surface-3: #ebe3ea;
    --text: #1d1724;
    --text-2: #4f4659;
    --muted: #6c6276;
    --border: rgba(29, 23, 36, 0.13);
    --border-strong: rgba(29, 23, 36, 0.26);
    /* The trans flag, color-blocked: solid blue, pink and white areas, never blended.
       Text on blue and pink is a dark shade of the same color (7:1 or better). */
    --flag-blue: #5bcefa;
    --flag-pink: #f5a9b8;
    --on-blue: #02263a;
    --on-pink: #2e0716;
    /* "White" blocks: a white fill with a dark outline in light mode; in dark mode
       white becomes the outline and the text, over the page (no bright fill). */
    --white-fill: #ffffff;
    --on-white: #1d1724;
    --line: #1d1724;
    --accent: #b8326b;
    --accent-hover: #a02a5d;
    --accent-soft: #fde3ea;
    --accent-ink: #2e0716;
    --btn-primary: #f5a9b8;
    --btn-primary-hover: #f29aab;
    --btn-primary-ink: #2e0716;
    --focus: #1d1724;
    --ok: #0b7a2b;
    --ok-soft: #e6f4ea;
    --warn: #9a4b00;
    --warn-soft: #fdf0e1;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --info: #0a6f9c;
    --info-soft: #e3f5fd;
    --pre: #8a5a00;
    --pre-soft: #fbf1dc;
    --shadow: none;
    --shadow-lg: 0 12px 40px rgba(29, 23, 36, 0.2);
    /* charts: the flag first (blue, pink, white with a dark edge so it shows on white),
       then distinct colors for any further series */
    --surface-1: #ffffff;
    --series-1: #1597cf;
    --series-2: #dd6a84;
    --series-3: #ffffff;
    --series-3-edge: #1d1724;
    --series-4: #eda100;
    --series-5: #1baf7a;
    --series-6: #eb6834;
    --series-7: #6250d6;
    --series-8: #e34948;
    --kind-surgery: #0f8a94;
    --grid: #eee6ec;
    --axis: #cfc4cd;
    --band: rgba(27, 175, 122, 0.12);
    --band-edge: rgba(27, 175, 122, 0.45);
    --threshold: #1baf7a;
    --bg: #fff;
    --surface: #fff;
    --surface-1: #fff;
    --text: #000;
    --text-2: #222;
    --muted: #555;
    --border: #ccc;
    --shadow: none;
  }
  body {
    background: #fff;
    font-size: 11pt;
  }
  .topbar,
  .rail,
  .section-tabs,
  .no-print,
  .toasts,
  .skip-link,
  .chart-head .btn {
    display: none !important;
  }
  .main {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none;
  }
  @page {
    margin: 12mm;
  }
  /* Sections may span pages (a section longer than a page that can't break gets clipped);
     keep headings with what follows and individual charts and rows whole. */
  .report section,
  .report header,
  .report footer {
    border: 0;
    padding: 0 0 10pt;
    break-inside: auto;
  }
  .report h2 {
    break-after: avoid;
  }
  .report tr,
  .report li {
    break-inside: avoid;
  }
  /* Block + inline-block instead of grid: grid items don't split cleanly across pages. */
  .report-charts {
    display: block;
  }
  .report-chart {
    display: inline-block;
    width: 49%;
    vertical-align: top;
    margin: 0 0 10pt;
    break-inside: avoid;
  }
  .report-chart:nth-child(odd) {
    margin-right: 2%;
  }
  /* Charts are drawn at screen width; scale them to the page instead of cutting them off. */
  .chart-plot {
    height: auto !important;
  }
  .chart-svg {
    width: 100%;
    height: auto;
  }
  .chart-tip {
    display: none !important;
  }
  .table-scroll {
    overflow: visible;
    margin: 0;
  }
  .table-report {
    font-size: 7.5pt;
  }
  .table-report th,
  .table-report td {
    padding: 3px 4px;
  }
  .table-report td.num {
    white-space: normal;
  }
  .report-foot a {
    overflow-wrap: anywhere;
  }
  a {
    color: #000;
  }
}

/* Milestone confetti: flag-colored pieces that fall once and are removed. */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  pointer-events: none;
}
.confetti > i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  animation: confetti-fall var(--dur, 2.4s) cubic-bezier(0.25, 0.6, 0.4, 1) var(--delay, 0s) forwards;
}
@keyframes confetti-fall {
  to {
    transform: translate(var(--drift, 0), 110vh) rotate(var(--spin, 540deg));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media (forced-colors: active) {
  .chart-svg .line {
    stroke: CanvasText !important;
  }
  .chart-svg .band {
    fill: Highlight;
    opacity: 0.2;
  }
}

/* ---------- spreadsheet import ---------- */
.import > * + * {
  margin-top: 14px;
}
.import-options {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.import-columns summary {
  cursor: pointer;
  font-weight: 600;
}
.import-columns[open] summary {
  margin-bottom: 8px;
}
.import-map th {
  width: 45%;
  font-weight: 550;
  color: var(--text);
  font-size: 0.88rem;
}
.import-map td > * + * {
  margin-top: 6px;
}
.col-header {
  white-space: pre-line;
}
.col-sample {
  font-weight: 400;
  overflow-wrap: anywhere;
}
.col-ignored th {
  color: var(--muted);
}
.import-preview td,
.import-preview th {
  white-space: nowrap;
}
.import-preview td.small {
  white-space: normal;
  min-width: 160px;
}
.import-preview tr.st-skip td,
.import-preview tr.st-duplicate td,
.import-preview tr.st-same td {
  color: var(--muted);
}
.import-msg {
  white-space: normal;
  font-size: 0.78rem;
  color: var(--warn);
  max-width: 240px;
}
.import-changes {
  margin: 4px 0 0;
  padding-left: 1.1em;
  white-space: normal;
  font-size: 0.78rem;
  color: var(--info);
  max-width: 260px;
}
.pill-info {
  background: var(--info-soft);
  color: var(--info);
}
.pill-muted {
  background: var(--surface-2);
  color: var(--muted);
}
/* Tappable status pills (open an explanation). */
.pill-btn {
  position: relative;
  border: 0;
  font-family: var(--font);
  cursor: pointer;
}
/* A taller invisible hit area, so the small pill is easy to tap without looking bigger. */
.pill-btn::after {
  content: '';
  position: absolute;
  inset: -10px 0;
}
.pill-btn:hover {
  filter: brightness(0.96);
}
.pill-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.pill-explain > * + * {
  margin-top: 12px;
}
.pill-explain p {
  margin: 0;
}
/* Pills wrap inside a value box instead of spilling out of it. */
.lab-value .pill {
  max-width: 100%;
  white-space: normal;
  border-radius: 10px;
}
/* Inside a value box (already surface-2), outline the muted pill so it still reads as one. */
.lab-value .pill-muted {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.more-exports summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 10px;
}
.more-exports[open] summary {
  margin-bottom: 8px;
}

