/* Scorecard: executive-facing, and prints on one landscape page. Builds on audit.css tokens. */
.sc-page {
  --ok: #1E8449; --watch: #B9770E; --off: #C0392B;
  --g-bg: #E3F4EA; --g-fg: #145A32;
  --a-bg: #FDF0D5; --a-fg: #7E5109;
  --r-bg: #FBE1DE; --r-fg: #922B21;
  max-width: 1240px; margin: 0 auto; padding: 26px 22px 70px; font-size: 15px;
}
[data-theme="dark"] .sc-page {
  --g-bg: #183A27; --g-fg: #A9DFBF;
  --a-bg: #3F3012; --a-fg: #F8D78A;
  --r-bg: #46201C; --r-fg: #F5B7B1;
}
.sc-top { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sc-top h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.sc-sub { margin: 5px 0 0; color: var(--muted); font-size: 15px; }
.sc-controls { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sc-seg, .sc-step { display: inline-flex; border: 1px solid var(--hairline); border-radius: 9px; overflow: hidden; background: var(--surface); }
.sc-seg button, .sc-step button { border: 0; background: transparent; padding: 8px 13px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.sc-step button { font-size: 18px; line-height: 1; padding: 6px 12px; }
.sc-step button:disabled { opacity: .35; cursor: default; }
.sc-seg button.on { background: var(--text); color: var(--bg-elev); }
.sc-export { border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-size: 14px; padding: 8px 13px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.sc-export:hover { background: var(--brand-int); }
.sc-export:disabled { opacity: .55; cursor: default; }
.sc-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.sc-switch i { width: 34px; height: 20px; border-radius: 999px; background: var(--faint); position: relative; }
.sc-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.sc-page.details #scDetails i { background: var(--brand); }
.sc-page.details #scDetails i::after { left: 17px; }
.sc-dt { display: none !important; }
.sc-page.details .kt-foot.sc-dt { display: flex !important; }
.sc-page.details .cell .dl.sc-dt { display: block !important; }
.sc-notice { background: var(--warning-soft); color: var(--warning); border-radius: 8px; padding: 9px 14px; font-size: 13.5px; margin-bottom: 16px; }

/* ---------- KPI tiles ---------- */
.sc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 36px; }
@media (max-width: 1000px) { .sc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sc-tiles { grid-template-columns: 1fr; } }
.kt { background: var(--bg-elev); border: 1px solid var(--hairline); border-radius: 14px; padding: 18px 20px 16px; display: grid;
  grid-template-columns: 1fr auto; grid-template-areas: "head head" "val spark" "bar bar" "tgt tgt" "foot foot"; column-gap: 16px; row-gap: 10px; }
.kt-head { grid-area: head; display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.kt-head .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kt-valwrap { grid-area: val; align-self: end; min-width: 0; }
.kt-val { font-size: 40px; line-height: 1; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kt-val small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kt-val.na { color: var(--faint); }
.kt-delta { display: block; font-size: 14px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kt-delta.good { color: var(--ok); } .kt-delta.bad { color: var(--off); } .kt-delta.none { color: var(--faint); font-weight: 500; }
.kt-delta span { color: var(--faint); font-weight: 500; margin-left: 4px; }
.kt-early { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kt-early::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--faint); margin-right: 6px; vertical-align: 1px; }
.kt-spark { grid-area: spark; width: 150px; height: 56px; align-self: end; cursor: crosshair; }
.kt-sparknote { grid-area: spark; align-self: end; width: 150px; height: 56px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: 12px; color: var(--faint); }
.kt-bar { grid-area: bar; position: relative; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--text) 9%, transparent); margin-top: 4px; }
.kt-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.kt-bar b { position: absolute; top: -4px; width: 2px; height: 12px; background: var(--muted); }
.kt-target { grid-area: tgt; font-size: 14px; color: var(--muted); }
.kt-target strong { color: var(--text); font-weight: 600; }
.kt-foot { grid-area: foot; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; border-top: 1px solid var(--hairline); padding-top: 10px; }

/* the (i): how the number is measured */
.info { margin-left: auto; position: relative; flex: none; }
.info > button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--hairline); background: transparent; color: var(--faint); font: italic 700 12px/1 Georgia, serif; cursor: help; padding: 0; }
.info > button:hover, .info:focus-within > button { border-color: var(--brand-int); color: var(--brand-int); }
.tip { position: absolute; right: -8px; top: 30px; z-index: 20; width: min(360px, 82vw); background: var(--text); color: var(--bg-elev);
  border-radius: 10px; padding: 14px 16px; box-shadow: 0 18px 50px rgba(10,25,55,.3); font-size: 13.5px; font-weight: 400; line-height: 1.5;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s; text-align: left; }
.tip::before { content: ""; position: absolute; right: 14px; top: -5px; width: 10px; height: 10px; background: var(--text); transform: rotate(45deg); }
.info:hover .tip, .info:focus-within .tip { opacity: 1; visibility: visible; transform: none; }
.tip h5 { margin: 0 0 5px; font-size: 14px; font-weight: 700; color: var(--bg-elev); }
.tip dl { margin: 10px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 12.5px; }
.tip dt { color: color-mix(in srgb, var(--bg-elev) 60%, transparent); font-weight: 600; }
.tip dd { margin: 0; }
.tip .yes { color: #8EE0AE; font-weight: 650; } .tip .part { color: #FFD98A; font-weight: 650; }

/* sparkline hover label */
.sc-sptip { position: absolute; z-index: 40; transform: translate(-50%, calc(-100% - 12px)); background: var(--text); color: var(--bg-elev);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; line-height: 1.35; white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 24px rgba(10,25,55,.25); opacity: 0; transition: opacity .08s; text-align: center; }
.sc-sptip.on { opacity: 1; }
.sc-sptip b { display: block; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-sptip span { color: color-mix(in srgb, var(--bg-elev) 70%, transparent); }

/* ---------- divisional heatmap ---------- */
.sc-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.sc-head h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.sc-head > span { color: var(--muted); font-size: 14px; }
.sc-legend { margin-left: auto; display: flex; gap: 16px; font-size: 13px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.sc-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sc-legend i.g { background: var(--g-bg); box-shadow: inset 0 0 0 1px var(--g-fg); }
.sc-legend i.a { background: var(--a-bg); box-shadow: inset 0 0 0 1px var(--a-fg); }
.sc-legend i.r { background: var(--r-bg); box-shadow: inset 0 0 0 1px var(--r-fg); }
.sc-wrap { overflow-x: auto; background: var(--bg-elev); border: 1px solid var(--hairline); border-radius: 14px; padding: 4px 8px 6px; }
table.sc-table { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 900px; }
.sc-table th { font-size: 13.5px; font-weight: 600; color: var(--text); text-align: center; padding: 12px 6px 6px; vertical-align: bottom; white-space: nowrap; }
.sc-table th small { display: block; font-size: 12px; font-weight: 500; color: var(--faint); margin-top: 2px; }
.sc-table th:first-child { text-align: left; padding-left: 10px; }
.sc-table td { padding: 0; text-align: center; }
.sc-table td.door { text-align: left; padding: 8px 10px; white-space: nowrap; }
.sc-table td.door b { font-size: 15.5px; font-weight: 650; }
.sc-table td.door span.sub { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.rowtag { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); vertical-align: 2px; }
.cell { border-radius: 6px; padding: 12px 8px; font-variant-numeric: tabular-nums; position: relative; }
.cell .v { font-size: 16.5px; font-weight: 600; }
.cell .dl { font-size: 12px; font-weight: 500; opacity: .85; margin-top: 2px; }
.cell.g { background: var(--g-bg); color: var(--g-fg); }
.cell.a { background: var(--a-bg); color: var(--a-fg); }
.cell.r { background: var(--r-bg); color: var(--r-fg); }
.cell.none { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.cell.empty { color: var(--faint); }
.cell.low::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1.5px dashed currentColor; opacity: .45; pointer-events: none; }
.newtag, .ntag { position: absolute; top: 4px; right: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; opacity: .7; }
.newtag { text-transform: uppercase; }
.sc-table tr.grp td { text-align: left; padding: 14px 10px 2px; }
.sc-table tr.grp td em { font-style: normal; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.sc-table tr.rule td { padding: 2px 0 0; } .sc-table tr.rule td div { height: 1px; background: var(--text); opacity: .7; }
.sc-table tr.total td.door b { font-size: 16px; font-weight: 700; }
.sc-table tr.total .cell .v { font-weight: 750; }
.sc-table tr.nl td { text-align: left; padding: 0; }
.nl-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 10px; background: transparent; border: 0; border-top: 1px solid var(--hairline);
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; text-align: left; }
.nl-toggle:hover { color: var(--text); }
.nl-toggle .chev { transition: transform .15s; display: inline-block; }
.nl-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nl-toggle b { color: var(--text); font-weight: 650; }
.nl-codes { color: var(--faint); font-size: 13px; }
.nl-list { display: none; padding: 2px 10px 12px 30px; }
.nl-list.on { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; }
.nl-grp h4 { margin: 8px 0 4px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.nl-grp div { font-size: 14px; padding: 2px 0; color: var(--muted); }
.nl-grp div b { color: var(--text); font-weight: 600; margin-right: 6px; }
.sc-note { font-size: 12.5px; color: var(--muted); margin: 8px 4px 0; }
.sc-print-foot { display: none; }
/* Loading: placeholders the size of what they stand in for, using audit.css's .sk shimmer. */
.sc-sk-tile { pointer-events: none; }
.sc-sk-tile .kt-spark { width: 150px; border-radius: 8px; }
.sc-table .cell.sk { padding: 0; }
.sc-page[aria-busy="true"] .sc-seg button:not(.on) { opacity: .75; }

/* ---------- PDF: one landscape page, controls gone, colours kept ---------- */
@page { size: letter landscape; margin: 10mm 12mm; }
@media print {
  body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  header.topbar, .sc-controls, .info, .nl-toggle .chev, .sc-notice, .sc-sptip, #gate { display: none !important; }
  .sc-page { max-width: none; padding: 0 0 22px; font-size: 13px; }
  .sc-top { margin-bottom: 8px; } .sc-top h1 { font-size: 20px; } .sc-sub { font-size: 11.5px; margin-top: 2px; }
  .sc-tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
  .kt { padding: 9px 12px 8px; row-gap: 3px; break-inside: avoid; box-shadow: none; border-radius: 10px; }
  .kt-val { font-size: 24px; } .kt-val small { font-size: 11px; } .kt-spark, .kt-sparknote { width: 100px; height: 30px; font-size: 10px; }
  .kt-head, .kt-target { font-size: 11px; } .kt-delta { font-size: 11px; margin-top: 3px; } .kt-early { font-size: 10.5px; } .kt-bar { margin-top: 2px; }
  .sc-head { margin-bottom: 4px; } .sc-head h2 { font-size: 14px; } .sc-head > span, .sc-legend { font-size: 11px; }
  .sc-wrap { border-radius: 10px; overflow: visible; break-inside: avoid; padding: 2px 6px 4px; }
  table.sc-table { min-width: 0; border-spacing: 3px; }
  .sc-table th { font-size: 11px; padding: 5px 4px 3px; } .sc-table th small { font-size: 10px; }
  .sc-table tr.grp td { padding: 6px 8px 0; } .sc-table tr.grp td em { font-size: 10px; }
  .cell { padding: 5px 4px; border-radius: 5px; } .cell .v { font-size: 12.5px; }
  .newtag, .ntag { font-size: 8px; top: 2px; }
  .sc-table td.door { padding: 2px 8px; } .sc-table td.door b { font-size: 12px; } .sc-table td.door span.sub { font-size: 10px; margin-top: 0; }
  .sc-table tr.total td.door b { font-size: 13px; }
  .nl-toggle { pointer-events: none; padding: 5px 8px; font-size: 11px; } .nl-codes { font-size: 10.5px; }
  .sc-note { font-size: 10px; margin-top: 4px; }
  .sc-print-foot { display: flex; justify-content: space-between; position: fixed; left: 0; right: 0; bottom: 0; font-size: 10px; color: #5B6472; }
}
