/* NLS Reports. Light, modern, print-friendly. Self-hosted font only. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #ffffff;
  --panel: #f6f7fb;
  --ink: #172033;
  --text: #2c374b;
  --muted: #5e6b7e;
  --faint: #8a95a6;
  --line: #e6e9ef;
  --line-strong: #d3d8e1;
  --accent: #0f766e;
  --accent-soft: #e7f4f2;
  --danger: #c93636;
  --danger-soft: #fdf1f1;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 15.5px/1.6 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { color: var(--ink); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.num, .stat-value, .summary-number, table td.num { font-variant-numeric: tabular-nums; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.brand-mark { display: inline-block; flex: none; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: conic-gradient(#2f5bea 0 40%, #7a4fd9 0 70%, #e07a2e 0); }
.who { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

main { max-width: 76rem; margin: 0 auto; padding: 2.25rem clamp(1rem, 4vw, 2.5rem) 5rem; }
.status, .muted, .note { color: var(--muted); }
.note { font-size: 0.88rem; max-width: 54rem; }

/* controls */
button, .button {
  font: inherit; font-size: 0.92rem; font-weight: 600; line-height: 1;
  padding: 0.7rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:hover, .button:hover { background: #26324a; }
.button.ghost-link { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover { border-color: var(--ink); background: transparent; }
button:disabled { opacity: 0.4; cursor: default; }
select {
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--ink);
  padding: 0.62rem 2.2rem 0.62rem 1rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--canvas); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 52%, calc(100% - 0.8rem) 52%;
  background-size: 0.3rem 0.3rem; background-repeat: no-repeat;
}

/* report header */
.report-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.25rem; margin-bottom: 2rem; }
.report-head h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.05; letter-spacing: -0.03em; font-weight: 750; }
.report-head .meta { margin: 0.5rem 0 0; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* sections */
.section { padding: 2.5rem 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: none; padding-top: 0; }
.section-head { margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.02em; font-weight: 700; }
.lede { margin: 0.35rem 0 0; color: var(--muted); max-width: 46rem; }

/* hero: pie and summary */
.hero-panel { background: var(--panel); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2.25rem); }
.stage { display: block; scroll-margin-top: 5.5rem; }
.overview, .category-view { display: flex; flex-direction: column; align-items: center; }
.pie-wrap { width: 100%; max-width: 860px; }
.pie { width: 100%; height: auto; display: block; }
.pie .slice { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.5; stroke-linejoin: round; transition: transform 0.18s ease, filter 0.18s ease; }
.pie .slice.selectable { cursor: pointer; }
.pie .slice.hover { filter: brightness(1.06) saturate(1.05); }
.pie .pie-side path, .pie .pie-side circle { stroke: none; }
.pie .pie-light { pointer-events: none; }
.pie .pie-empty { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-dasharray: 6 6; }
.pie .leader { fill: none; stroke: #9aa5b6; stroke-width: 1.25; }
.pie .leader-dot { fill: #9aa5b6; }
.pie .label { outline: none; }
.pie .label-hit { fill: transparent; pointer-events: all; }
.pie .label.selectable:focus-visible .label-hit { stroke: var(--accent); stroke-width: 1.5; }
.pie .label.selectable { cursor: pointer; }
.pie .label-name { fill: var(--ink); font-size: 14px; font-weight: 650; }
.pie .label-value { fill: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.pie .label.selectable:hover .label-name, .pie .label:focus-visible .label-name { fill: var(--accent); text-decoration: underline; }

.summary { text-align: center; margin-top: 0.75rem; max-width: 40rem; }
.summary-number { margin: 0; font-size: clamp(2.5rem, 6vw, 3.5rem); font-weight: 750; letter-spacing: -0.035em; color: var(--ink); line-height: 1; }
.summary-unit { font-size: 0.4em; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.summary-text { margin: 0.6rem 0 0; font-size: 1.05rem; color: var(--text); }
.summary-hint { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--faint); }

.crumbs { align-self: stretch; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.crumbs h3 { margin: 0; font-size: 1.15rem; display: inline-flex; align-items: center; gap: 0.55rem; }
.crumb-sep { color: var(--faint); }
.back::before { content: "\2190"; font-weight: 400; }

.split { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.1rem; }
.split-item {
  display: inline-flex; align-items: center; gap: 0.55rem; text-align: left;
  padding: 0.65rem 1rem; border-radius: 999px; background: var(--canvas); border: 1px solid var(--line);
  font-size: 0.92rem; font-weight: 500; color: var(--text); line-height: 1.3;
}
button.split-item.action { cursor: pointer; border-color: #f0c4c4; color: var(--text); }
button.split-item.action:hover { background: var(--danger-soft); border-color: var(--danger); }

.fix-panel {
  align-self: stretch; margin-top: 1.5rem; padding: 1.1rem 1.35rem;
  border-radius: 12px; background: var(--danger-soft); border: 1px solid #f3cccc;
}
.fix-panel h4 { margin: 0 0 0.4rem; color: var(--danger); }
.fix-panel h4:focus { outline: none; }
.fix-panel p { margin: 0.4rem 0 0; max-width: 54rem; }
.make-up { align-self: stretch; margin-top: 1.75rem; }
.make-up h4 { margin: 0 0 0.5rem; font-size: 1rem; }

.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none; }

/* category list */
.cat-list { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.cat-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 6rem minmax(9rem, 13rem); gap: 1rem; align-items: center;
  padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background-color 0.15s ease;
}
.cat-row:not(.cat-head):hover { background: #fafbfd; }
.cat-row.off .cat-title, .cat-row.off .strong { color: var(--faint); }
.cat-head { cursor: default; padding-top: 0.6rem; padding-bottom: 0.6rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cat-name { display: flex; align-items: flex-start; gap: 0.8rem; min-width: 0; }
.cat-name input { width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; flex: none; cursor: pointer; }
.cat-title { display: block; font-weight: 650; color: var(--ink); }
.cat-desc { display: block; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.num { text-align: right; white-space: nowrap; }
.strong { font-weight: 650; color: var(--ink); }
.share { display: flex; align-items: center; gap: 0.75rem; }
.share-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.share-bar.spacer { visibility: hidden; }
.share-fill { display: block; height: 100%; border-radius: 999px; width: 0; transition: width 0.25s ease; }
.share-text { width: 5.2rem; text-align: right; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row { margin-top: 1rem; }

.invalid-row { width: 100%; font: inherit; text-align: left; background: transparent; color: inherit; border: none;
  border-bottom: 1px solid var(--line); border-radius: 0; line-height: inherit; }
.invalid-row:hover { background: var(--danger-soft); }
.invalid-row .cat-name .dot { margin: 0.4rem 0.25rem 0 0.2rem; }
.invalid-row .cat-title { color: var(--danger); }

/* explainer */
.explainer { margin-top: 1.5rem; padding: 1.1rem 1.35rem; border-radius: 12px; background: var(--panel); max-width: 54rem; }
.explainer h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.explainer ul { margin: 0; padding-left: 1.1rem; }
.explainer li { margin: 0.3rem 0; font-size: 0.92rem; }

/* data to fix */
.fix-group { margin: 1.75rem 0 0.25rem; font-size: 1.1rem; }
.fix-list { list-style: none; padding: 0; margin: 0.75rem 0 0; border-top: 1px solid var(--line); }
.fix-item { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.25rem; padding: 1rem 0.25rem; border-bottom: 1px solid var(--line); break-inside: avoid; }
.fix-count { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1; text-align: right; font-variant-numeric: tabular-nums; }
.fix-body p { margin: 0; }
.fix-issue { font-weight: 650; color: var(--ink); }
.fix-detail { font-size: 0.88rem; color: var(--muted); margin-top: 0.15rem !important; }
.fix-effect { margin-top: 0.35rem !important; }
.fix-how { margin-top: 0.35rem !important; font-size: 0.92rem; }
#fix { scroll-margin-top: 5rem; }

/* charts */
.chart-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.25rem 0.75rem; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { stroke: var(--canvas); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 12px; }
.chart .value { fill: var(--ink); font-size: 12.5px; font-weight: 650; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; padding: 0; margin: 0.75rem 0 0.25rem; font-size: 0.86rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 0.45rem; }

/* stats */
.stats { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 1.5rem; }
.stat { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.25rem 2rem 0.25rem 0; margin-right: 2rem; border-right: 1px solid var(--line); min-width: 8rem; }
.stat:last-child { border-right: none; margin-right: 0; }
.stat-value { font-size: 2rem; font-weight: 750; letter-spacing: -0.03em; color: var(--ink); line-height: 1.1; }
.stat-label { font-size: 0.85rem; color: var(--muted); max-width: 12rem; line-height: 1.35; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.table-wrap.narrow { max-width: 44rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0.25rem; }
thead th { font-size: 0.8rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-strong); }
tbody th { font-weight: 600; color: var(--ink); }
tr.reported { background: var(--accent-soft); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.75rem; max-width: 40rem; }
.panel h2 { margin-top: 0; font-size: 1.25rem; }
.error h2, .error p { color: var(--danger); }
.notes { max-width: 54rem; padding-left: 1.2rem; color: var(--text); }
.notes li { margin: 0.35rem 0; }
.print-only { display: none; }
.section > .lede { margin: -0.75rem 0 1.25rem; }

@media (max-width: 720px) {
  .fix-item { grid-template-columns: 3.5rem 1fr; gap: 0.75rem; }
  .fix-count { font-size: 1.35rem; }
  .hide-sm { display: none; }
  .cat-row { grid-template-columns: minmax(0, 1fr) 4.5rem 7rem; gap: 0.75rem; }
  .share-bar { display: none; }
  .share-text { width: auto; }
  .pie-wrap { max-width: 320px; }
  .stat { min-width: 7rem; padding-right: 1.25rem; margin-right: 1.25rem; margin-bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { font-size: 10.5pt; }
  .topbar, .no-print, .status { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  .section { break-inside: auto; padding: 1.25rem 0; }
  .section-head, .hero-panel, .chart-card, .stats, .split { break-inside: avoid; }
  .section-head { break-after: avoid; }
  .lede { margin-top: -0.75rem; margin-bottom: 1rem; }
  .explainer, .hero-panel, .pie, .pie *, .chart, .dot, .share-fill, .share-bar, tr.reported, .fix-panel, .cat-name input {
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .table-wrap { overflow: visible; }
  thead { display: table-header-group; }
  tr, .cat-row { break-inside: avoid; }
}
