:root {
  color-scheme: light dark;
  --brand: #a66f40;
  --paper: light-dark(#fff, #202428);
  --background: light-dark(#f7f5ef, #151719);
  --ink: light-dark(#202428, #f3f1eb);
  --muted: light-dark(#667078, #aab1b7);
  --border: light-dark(#d8d4ca, #41474c);
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
nav { min-height: 4rem; padding: .75rem max(1rem, calc((100% - 70rem)/2)); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--brand); color: white; }
nav > div, nav form { display: flex; align-items: center; gap: .75rem; margin: 0; }
.brand { color: white; text-decoration: none; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
main { width: min(70rem, calc(100% - 2rem)); margin: 2rem auto; }
article { padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: .75rem; background: var(--paper); box-shadow: 0 .15rem .5rem #0001; }
article > header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.5rem; }
article > header > div { width: 100%; }
article > footer { display: flex; gap: .75rem; margin-top: 1.5rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); }
a { color: var(--brand); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.field { grid-column: span 12; }
.half { grid-column: span 6; }
.third { grid-column: span 4; }
label, legend { font-weight: 700; }
input, select, button, .button { width: 100%; min-height: 2.8rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: .4rem; font: inherit; color: inherit; background: var(--paper); }
label input, label select { display: block; margin-top: .25rem; }
.date-weekday { display: block; margin-top: .2rem; color: var(--muted); font-weight: 400; }
button, .button { display: inline-flex; width: auto; align-items: center; justify-content: center; border-color: var(--brand); color: white; background: var(--brand); font-weight: 700; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { filter: brightness(.92); }
.secondary { color: var(--ink); border-color: var(--border); background: transparent; }
.danger { border-color: #a4261d; background: #a4261d; color: white; }
.link { min-height: auto; padding: 0; border: 0; text-decoration: underline; background: transparent; }
.action, .card { display: block; width: 100%; padding: 1rem; border: 1px solid var(--border); border-radius: .55rem; color: inherit; background: var(--paper); text-align: left; text-decoration: none; }
.action { border-color: var(--brand); }
.action strong, .card strong { display: block; font-size: 1.08rem; }
.action small, .card small, .muted { color: var(--muted); }
.list { display: grid; gap: .75rem; }
.search { margin-top: .75rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.meta { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-top: .4rem; color: var(--muted); }
.notice { padding: .8rem 1rem; border-left: .3rem solid var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.notice.warning, .shift-missing, .shift-next { border-color: #c78a00; background: light-dark(#fff4c7, #3f3314); }
.notice.danger-notice, .shift-boundary, .shift-overdue { border-color: #b42318; background: light-dark(#fde7e5, #451d1a); }
.warning-label { display: inline-block; margin-top: .35rem; padding: .1rem .45rem; border-radius: 1rem; color: light-dark(#684900, #ffe8a1); background: light-dark(#ffe49a, #68500d); font-size: .85rem; font-weight: 700; }
.error { color: #b42318; }
fieldset { grid-column: span 12; padding: 1rem; border: 1px solid var(--border); border-radius: .4rem; }
fieldset label { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1rem; }
fieldset input { width: auto; margin: 0; }
.snapshots { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.snapshot, video { width: min(300px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: .5rem; background: #000; }
.countdown { font-size: 3rem; font-weight: 800; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem; border-bottom: 1px solid var(--border); text-align: left; }
.right { text-align: right; }
.period-heading { margin-bottom: .5rem; }
.period-nav { display: flex; gap: .75rem; margin-bottom: 1rem; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 1rem 0; }
.button-row form { margin: 0; }
.status { display: inline-block; padding: .1rem .45rem; border-radius: 1rem; font-weight: 700; text-transform: capitalize; }
.status.prepared { background: #fff0b3; color: #5c4500; }
.status.printed { background: #ccebd7; color: #164f2b; }
.status.void { background: #f5cccc; color: #721c17; }
.print-workspace { overflow: auto; padding: 1rem; background: #777; }
.check-sheet { --print-offset-x: 0mm; --print-offset-y: 0mm; position: relative; width: 215.9mm; height: 279.4mm; overflow: hidden; color: #000; background: #fff; font-family: Arial, sans-serif; transform: translate(var(--print-offset-x), var(--print-offset-y)); transform-origin: top left; }
.check-face { position: absolute; inset: 0 0 auto; height: 90mm; }
.check-field { position: absolute; display: block; line-height: 1; white-space: nowrap; transform: translateY(-100%); font-size: 10pt; }
.check-date { left: 178mm; top: 27mm; width: 30mm; font-size: 8.5pt; }
.check-payee { left: 28mm; top: 39mm; width: 140mm; font-size: 11pt; }
.check-amount { left: 178mm; top: 39mm; width: 29mm; font-size: 11pt; }
.check-words { left: 9mm; top: 48mm; width: 196mm; overflow: hidden; font-size: 9pt; }
.check-memo { left: 9mm; top: 80mm; width: 90mm; font-size: 9pt; }
.check-stub { position: absolute; left: 0; width: 215.9mm; height: 90mm; padding: 10mm 8mm 4mm; overflow: hidden; }
.payee-stub { top: 90mm; }
.business-stub { top: 180mm; height: 99.4mm; }
.check-stub h2 { margin: 0 0 1.5mm; font-size: 10pt; }
.stub-summary { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr; gap: 1mm 4mm; margin-bottom: 1mm; font-size: 7.5pt; }
.check-stub table { font-size: 7pt; line-height: 1.05; }
.check-stub th, .check-stub td { padding: .55mm 1mm; border-bottom: .2mm solid #bbb; }
.stub-totals { display: flex; justify-content: flex-end; gap: 8mm; margin-top: 1.5mm; font-size: 8pt; }
.detail-note { margin: 5mm 0; font-size: 9pt; }
.watermark { position: absolute; z-index: 5; top: 35mm; left: 20mm; width: 176mm; transform: rotate(-18deg); border: 2mm solid #999; color: #999; font-size: 25pt; font-weight: 900; text-align: center; opacity: .55; pointer-events: none; }
.is-copy .watermark::after { content: ""; }
.calibration .check-sheet { outline: .3mm solid #000; }
.calibration .check-face, .calibration .payee-stub { border-bottom: .3mm dashed #000; }
.calibration .check-field { outline: .2mm solid #777; }
.payment-detail { color: #000; background: #fff; }
[hidden] { display: none !important; }
@media (max-width: 42rem) { .half, .third { grid-column: span 12; } nav { align-items: start; } nav > div { align-items: end; flex-direction: column; gap: .2rem; } }
@page { size: Letter; margin: 0; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; }
  nav, article > footer, .no-print, .print-controls { display: none !important; }
  main { width: 100%; margin: 0; }
  article { border: 0; box-shadow: none; }
  .print-workspace { overflow: visible; padding: 0; background: none; }
  .payment-detail { padding: 12mm !important; }
}
