@font-face {
  font-family: Archivo;
  src: url("../assets/fonts/archivo-variable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin.woff2") format("woff2");
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f6f5ee;
  --ink: #182d27;
  --green: #115c43;
  --muted: #4d5c52;
  --line: #bdc3b7;
  --wash: #e4eadd;
  --dark: #203e35;
  font: 100%/1.48 "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p, fieldset { margin: 0; }
button, input, select { font: inherit; }
button, select, summary, input[type=checkbox], input[type=range] { cursor: pointer; }
a { color: var(--green); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #b36d23; outline-offset: 3px; }
:target, [tabindex="-1"] { scroll-margin-block: 1rem; }
.skip-link { position: absolute; z-index: 2; padding: .6rem 1rem; top: .4rem; left: 1rem; transform: translateY(-160%); background: white; }
.skip-link:focus { transform: none; }
main, .masthead { max-width: 1300px; margin-inline: auto; padding-inline: clamp(1rem, 5vw, 4.5rem); }
.masthead, .case-bar, .result-lead, .dialog-head, footer, .queue-head { display: flex; justify-content: space-between; align-items: center; gap: .7rem 1.2rem; }
.masthead { min-height: 63px; }
.masthead a { text-decoration: none; color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 720 1.25rem/1 Archivo, sans-serif; letter-spacing: -.05em; }
.masthead nav { font-size: .93rem; }
.masthead nav a:hover, .brand:hover, footer a:hover { text-decoration: underline; }
.intro { border-top: 1px solid var(--ink); padding-block: clamp(1.15rem, 3.3vw, 2.7rem) 1.3rem; }
.eyebrow, legend, .field-title { font-size: .72rem; font-weight: 650; line-height: 1.4; letter-spacing: .085em; text-transform: uppercase; }
.eyebrow { color: var(--green); }
.eyebrow span { margin-inline: .3rem; }
h1, h2, .budget b, #result-summary { font-family: Archivo, system-ui, sans-serif; }
h1 { margin: .27rem 0 .6rem; font-size: clamp(2.45rem, 5.3vw, 4.5rem); font-weight: 650; line-height: 1.02; letter-spacing: -.064em; }
h2 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); line-height: 1.09; letter-spacing: -.047em; font-weight: 625; }
.intro > p:last-child { max-width: 48rem; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.12rem); }
.muted, .table-note, #case-help { font-size: .91rem; color: var(--muted); }
.case-bar { border-block: 1px solid var(--line); padding-block: .45rem; margin-bottom: 1.45rem; }
.case-bar form, .filter { display: flex; align-items: center; gap: .55rem; }
.case-bar label, .filter label { font-weight: 620; }
#case-help { text-align: right; }
button { color: var(--ink); }
input[type=number], select { background: var(--paper); color: var(--ink); border: 1px solid #89998b; border-radius: 2px; padding: .38rem .55rem; min-height: 38px; max-width: 100%; }
input[type=number] { width: 5rem; }
.link-button, .inspect { border: 0; background: transparent; color: var(--green); text-underline-offset: .17em; }
.link-button { padding: .4rem .2rem; text-align: left; font-weight: 600; }
.link-button:hover, .inspect:hover { text-decoration: underline; }
.setup { display: grid; grid-template-columns: minmax(230px, .76fr) minmax(0, 1.65fr); column-gap: clamp(1rem, 3vw, 2.7rem); }
.editor { align-self: start; }
.editor h2 { margin-bottom: 1.25rem; }
.field-title { display: block; margin-bottom: .35rem; }
#preset { width: 100%; }
fieldset { min-width: 0; border: 0; padding: 0; margin-block: 1.25rem 1.05rem; }
legend { padding: 0; }
.weight-help { margin-block: .25rem .4rem; }
.factor { padding-block: .65rem; border-bottom: 1px solid var(--line); }
.factor-head, .range-ends { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.factor label { font-weight: 620; }
.factor output { color: var(--green); font: 650 .98rem Archivo, sans-serif; font-variant-numeric: tabular-nums; }
.factor input { accent-color: var(--green); width: 100%; margin: .1rem 0; height: 24px; }
.range-ends { font-size: .77rem; color: var(--muted); }
.primary, .outline { min-height: 43px; border-radius: 2px; padding: .52rem .9rem; font-weight: 620; transition: background-color 120ms ease; }
.primary { background: var(--green); color: white; border: 1px solid var(--green); }
.primary:hover { background: var(--dark); }
.outline { border: 1px solid var(--green); color: var(--green); background: transparent; }
.outline:hover { background: var(--wash); }
.kit-link, .adjust { display: inline-block; margin-top: .75rem; font-size: .9rem; }
#action-status:not(:empty) { margin-top: .55rem; }
.queue { min-width: 0; }
.queue-head { background: var(--dark); color: var(--paper); padding: .85rem clamp(.7rem, 2vw, 1.3rem); }
.queue-head .eyebrow { color: #cad9cc; margin-bottom: .18rem; }
.queue-head h2 { font-size: clamp(1.4rem, 2.3vw, 1.8rem); }
.budget { padding-left: .9rem; border-left: 1px solid #789184; display: flex; gap: .4rem; align-items: baseline; }
.budget b { font-size: 1.45rem; line-height: 1.14; }
.budget span { color: #e1e9e1; font-size: .79rem; }
#queue-note { margin-block: .6rem; }
.scroll-table { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; line-height: 1.35; font-variant-numeric: tabular-nums; font-size: .91rem; }
td, th { padding: .56rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
thead th { color: var(--muted); font-size: .76rem; vertical-align: bottom; }
tbody th { font-weight: 550; }
th:first-child, td:first-child { padding-left: .45rem; text-align: left; }
.rank-table td:nth-child(2), .rank-table th:nth-child(2) { text-align: left; padding-left: 0; }
.rank-table th[scope=row] { color: var(--muted); font-weight: 500; }
.rank-table td:nth-child(2) { font-size: .91rem; font-weight: 620; }
.rank-table .cutoff th, .rank-table .cutoff td { border-bottom: 2px solid var(--green); }
.check { display: flex; align-items: center; gap: .5rem; min-height: 40px; color: var(--green); font-size: .9rem; }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--green); }
#results { border-top: 1px solid var(--ink); margin-top: 1.6rem; padding-top: 1.45rem; }
.result-lead { align-items: flex-end; flex-wrap: wrap; }
#result-summary { font-weight: 550; font-size: clamp(1.1rem, 2vw, 1.4rem); margin-top: .9rem; }
#truth-note { margin: .3rem 0 .9rem; }
.results-table tr[data-policy=custom], #batch-rows tr[data-policy=custom] { background: var(--wash); }
.audit, .batch { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.25rem; }
.audit > .muted, .batch > p, #batch-result > .muted { margin: .55rem 0 .8rem; max-width: 53rem; }
.swap { margin-top: .65rem; padding: .6rem .8rem; background: var(--wash); border-left: 3px solid var(--green); }
.filter { margin-block: .8rem .35rem; }
.audit-scroll { max-height: 27rem; overflow: auto; }
.audit-scroll thead { position: sticky; top: 0; background: var(--paper); }
.inspect { padding: .2rem 0; font-weight: 620; text-align: left; text-decoration: underline; }
.adjust { font-weight: 650; }
#batch-summary { margin: .8rem 0 .55rem; }
.method { margin-top: 1.5rem; padding-block: .8rem; border-block: 1px solid var(--line); }
.method summary { font-weight: 650; cursor: pointer; }
.method p { color: var(--muted); max-width: 58rem; margin-top: .6rem; font-size: .93rem; }
footer { font-size: .9rem; padding-block: .9rem 2rem; }
footer a { color: var(--ink); }
dialog { width: min(37rem, calc(100% - 1.8rem)); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); padding: 1.3rem; }
dialog::backdrop { background: #172c23aa; }
dialog h2 { font-size: 1.55rem; }
dialog p { margin-block: .75rem; }
@media (max-width: 890px) {
  .setup { grid-template-columns: minmax(200px, .8fr) minmax(0, 1.4fr); column-gap: 1.25rem; }
  td, th { padding-inline: .4rem; }
  .queue-head { align-items: center; }
  .budget { flex-direction: column; gap: .04rem; }
}
@media (max-width: 700px) {
  .setup { grid-template-columns: 1fr; row-gap: 1.35rem; }
  .masthead { min-height: 52px; }
  .case-bar { align-items: flex-start; flex-direction: column; gap: .12rem; margin-bottom: 1.2rem; }
  #case-help { text-align: left; font-size: .8rem; }
  .editor h2 { margin-bottom: .85rem; }
  fieldset { margin-top: 1rem; }
  .factor { padding-block: .4rem; }
  .budget { flex-direction: row; gap: .3rem; align-items: baseline; }
  .queue-head { padding: .75rem; }
  .result-lead, .dialog-head { align-items: start; }
  table { font-size: .85rem; }
  .audit-scroll { max-height: 24rem; }
  .queue .scroll-table { max-height: 25rem; }
  .queue thead { position: sticky; top: 0; background: var(--paper); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.reference-mark { display: block; font-size: .7rem; line-height: 1.2; color: var(--muted); font-weight: 400; }
.run-actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.run-actions a { display: none; font-size: .92rem; }
@media (max-width: 700px) {
  .run-actions a { display: inline-block; }
  .results-table { display: block; }
  .results-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .results-table tbody { display: block; }
  .results-table tbody tr { padding: .6rem .7rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .34rem .6rem; border-bottom: 1px solid var(--line); }
  .results-table tbody th { grid-column: 1/-1; font-weight: 650; }
  .results-table tbody :is(th, td) { padding: 0; border: 0; text-align: left; }
  .results-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .72rem; }
  .results-table td:nth-child(2) { grid-column: 1/-1; }
  .results-table td:nth-child(2)::before { display: inline; margin-right: .4rem; }
}
