:root {
  color-scheme: light;
  font-family: Barlow, system-ui, sans-serif;
  color: #242f28;
  background: #f0f4f3;
  --surface: #fff;
  --rule: #d0dad5;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(1120px, calc(100% - 3rem)); margin-inline: auto; }
header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.brand { padding-block: 1.15rem; font: bold 1.45rem Georgia, serif; color: #384b3d; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar nav { display: flex; align-self: stretch; gap: 1rem; }
.topbar nav a { display: grid; align-content: center; border-bottom: 3px solid transparent; color: #425849; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; text-underline-offset: .25em; }
.topbar nav a[aria-current] { border-color: #344f3c; color: #233b2a; font-weight: 650; }
main { padding-block: clamp(2.2rem, 5vw, 4.2rem) 4rem; }
h1, h2 { font-family: Baskervville, Georgia, serif; font-weight: 500; margin: 0; }
h1 { font-size: clamp(2.7rem, 6vw, 4.3rem); line-height: 1; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1rem; margin: 0 0 .65rem; }
p { line-height: 1.55; }
.intro { max-width: 62ch; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin: 1rem 0; }
button { padding: .7rem 1rem; cursor: pointer; border: 1px solid #aeb9a9; border-radius: .35rem; background: var(--surface); color: #293d30; font: inherit; font-size: .95rem; line-height: 1.3; font-weight: 600; }
button:hover { background: #edf0e7; }
.file-field { position: relative; display: grid; justify-items: center; gap: .35rem; margin-block: 1.25rem 1rem; padding: 1.4rem 1rem; border: 2px dashed #7b9182; border-radius: .35rem; background: var(--surface); color: #293d30; text-align: center; font-weight: 600; cursor: pointer; }
.file-help { color: #47574c; font-size: .9rem; font-weight: 400; }
.file-field:hover, .file-field.dragging { border-color: #344f3c; background: #e4ede8; }
.file-field.dragging { border-style: solid; }
.file-field input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
:focus-visible, .file-field:focus-within { outline: 3px solid #9a5a32; outline-offset: 3px; }
.quiet { border-color: transparent; background: transparent; text-decoration: underline; font-weight: 500; }
button:disabled, .file-field:has(input:disabled) { opacity: .6; cursor: wait; }
details { color: #475547; font-size: .9rem; max-width: 70ch; }
summary { cursor: pointer; width: fit-content; }
a { color: #305d42; }
#notice { white-space: pre-line; font-weight: 550; }
.notice:not(:empty) { padding: .65rem .85rem; background: #e4ede8; }
#notice:not(:empty) { border-left: 3px solid #789278; padding: .5rem .85rem; background: #f0f3eb; }
section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.totals { display: grid; grid-template-columns: 1fr 1.35fr; gap: 2rem; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
th, td { padding: .6rem .7rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font-weight: 600; background: #edf0e7; }
td.number { text-align: right; font-variant-numeric: tabular-nums; }
.source { margin-top: 1.1rem; }
.source table { min-width: 670px; }
.review { color: #7a3d19; font-weight: 650; }
.subtotal { color: #596258; }
.week-controls { display: flex; align-items: end; flex-wrap: wrap; gap: .75rem 1rem; margin-block: 1.5rem; }
.week-controls label { display: grid; gap: .33rem; font-weight: 600; }
.week-controls input, .week-controls select { min-height: 2.75rem; padding: .5rem .75rem; border: 1px solid #aeb9a9; border-radius: .35rem; background: var(--surface); color: inherit; font: inherit; }
.quantities { display: flex; flex-wrap: wrap; gap: 1rem 3rem; margin: 1.4rem 0 .4rem; }
.quantities dt { color: #425849; }
.quantities dd { margin: .15rem 0 0; font-size: 1.65rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#week-source { margin-top: 1.8rem; overflow-wrap: anywhere; }
#week-rows table { min-width: 760px; }
.empty { color: #526057; }
[hidden] { display: none !important; }
.primary { color: white; background: #31503a; border-color: #31503a; }
.primary:hover { background: #243f2c; }
.row-action { padding: .3rem .6rem; font-size: .85rem; white-space: nowrap; }
.order-tools { margin-block: 1.15rem 1.7rem; }
.order-tools details { max-width: none; }
.order-tools summary { padding-block: .4rem; color: #31503a; font-weight: 650; }
.order-tools .scroll { margin-block: .6rem; }
.order-tools .notice:empty { display: none; }
dialog { width: min(32rem, calc(100% - 2rem)); max-height: 90dvh; padding: 1.6rem; border: 1px solid #819487; border-radius: .45rem; color: inherit; }
dialog::backdrop { background: rgb(25 38 29 / 45%); }
#mapping label { display: grid; gap: .3rem; margin-top: .75rem; font-weight: 600; }
#mapping input, #mapping select, #mapping textarea { width: 100%; padding: .55rem; font: inherit; color: inherit; border: 1px solid #88978b; border-radius: .25rem; }
#mapping input:read-only { background: #eef2ef; }
dialog details { margin-top: 1rem; }
.field-help { margin-top: .25rem; font-size: .85rem; color: #47574c; }
#order-change { width: min(52rem, calc(100% - 2rem)); }
#order-change .week-controls label { min-width: 0; max-width: 100%; }
#order-change .week-controls select { max-width: 100%; }
#change-preview table { min-width: 32rem; margin-block: .8rem; }
#change-file-name { overflow-wrap: anywhere; }
.order-tools .actions label { display: grid; gap: .35rem; min-width: 0; max-width: 100%; }
.order-tools .actions select { max-width: 100%; padding: .5rem; border: 1px solid #aeb9a9; border-radius: .35rem; background: var(--surface); color: inherit; font: inherit; }
.list-sheet { margin: 1rem 0 2rem; background: white; padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--rule); }
.list-sheet h2 { font-size: 1.65rem; }
.list-sheet .status-line { font-weight: 650; }
.list-sheet .sheet-total { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.list-sheet table { margin-block: .8rem; }
#archive-source details { max-width: none; }
#archive-source details h3 { margin-top: 1rem; }
#archive-review:not(:empty) { margin-top: 2rem; }
#archive-review table { min-width: 760px; }
#archive-review td { vertical-align: middle; }
#archive-review th:nth-child(4) { width: 31%; }
#archive-review th:nth-child(5) { width: 15%; }
#archive-review td.number { white-space: nowrap; }
#archive-review input { width: 100%; padding: .5rem; border: 1px solid #88978b; border-radius: .25rem; font: inherit; color: inherit; background: white; }
.review-common { align-items: end; }
.review-common label { display: grid; gap: .35rem; font-weight: 600; }
#print-links a + a { margin-left: .5rem; }
@page { size: A4; margin: 16mm; }
@media print {
  body { background: white; color: black; }
  body:has(#list-view:not([hidden])) > :not(#list-view), .screen-only, .print-skip { display: none !important; }
  #list-view { width: 100%; padding: 0; }
  .list-sheet { margin: 0; padding: 0; border: 0; break-after: page; color: black; }
  .list-sheet:last-child { break-after: auto; }
  .list-group + .list-group { break-before: page; }
  .list-group:not(:has(.list-sheet:not(.print-skip))) { display: none; }
  .list-sheet .scroll { overflow: visible; }
  .list-sheet tr { break-inside: avoid; }
  .list-sheet thead { display: table-header-group; }
  .list-sheet th, .list-sheet td { padding: 2mm; border-color: #aaa; }
}
@media (max-width: 700px) {
  .wrap { width: calc(100% - 2rem); }
  .totals { grid-template-columns: 1fr; gap: 1.2rem; }
  .topbar { flex-wrap: wrap; gap: 0 .75rem; }
  .topbar nav { flex-wrap: wrap; padding-block: .4rem; }
  th, td { padding: .5rem; }
}
