/* Annual Return: one ruled sheet. Radius 0 everywhere, no gradients, no shadows. */

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --on-fill: #1A1A1A;
  --band-text: #FCF0DD;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 2rem 16px 3rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.sheet { max-width: 54rem; margin: 0 auto; border: 1px solid var(--ink); }

.band {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: .85rem 1.5rem .8rem;
  background: var(--c-moss); color: var(--band-text);
  border-bottom: 2px solid var(--c-brick);
}
.band h1, .band .title { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.band .code { font-size: 1.5rem; font-weight: 200; line-height: 1.2; white-space: nowrap; }

.banner { margin: 0; padding: .6rem 1.5rem; border-bottom: 1px solid var(--ink); font-size: .9rem; }

main { display: block; padding: 1.5rem 1.5rem 2rem; }

h2 { margin: 0 0 .25rem; font-size: 1.35rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
p { margin: 0 0 .75rem; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: .15em; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.label, .box-label, dt, .ledger th, .cmp thead th, .cmp tbody th, .word, .official-label {
  font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; line-height: 1.4;
}

.soft, .hint, .meta { color: var(--ink-soft); }
.flash { border-left: 3px solid var(--ink); padding: .2rem .75rem; margin-bottom: 1.25rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* numbered ruled boxes */
.boxes { border: 1px solid var(--ink); margin: 1.25rem 0 0; }
.box { padding: .5rem .75rem .75rem; }
.box + .box, .boxes > .rule { border-top: 1px solid var(--ink); }
.box-label { display: flex; gap: .6rem; margin: 0 0 .3rem; }
.num { min-width: 1rem; font-weight: 700; }
.hint { margin: 0 0 .35rem; font-size: .82rem; }
.box:focus-within { outline: 2px solid var(--ink); outline-offset: -2px; }
.box.invalid { border-left: 4px solid var(--ink); }
.error { margin: .45rem 0 0; font-size: .88rem; font-weight: 700; }
.summary { margin: 1rem 0 0; font-weight: 700; }
.summary:empty { display: none; }
.rule { margin: 0; padding: .6rem .75rem; font-size: .88rem; }

input[type="text"], input[type="date"], textarea {
  display: block; width: 100%; margin: 0; padding: .3rem 0;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px dotted var(--ink-soft);
}
textarea { min-height: 6.5rem; resize: vertical; line-height: 1.5; border: 1px dotted var(--ink-soft); padding: .35rem .45rem; }
input[type="date"] { max-width: 14rem; }
input:focus, textarea:focus { outline: none; border-color: var(--ink); }
.check { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: .15rem 0 0; flex: none; accent-color: var(--ink); }

/* filed values */
.value { overflow-wrap: anywhere; }
.lines { margin: 0; padding: 0; list-style: none; }
.confirmed { display: flex; gap: .65rem; margin: 0; }
.tick {
  flex: none; width: 1.15rem; height: 1.15rem; margin-top: .15rem;
  border: 1px solid var(--ink); font-size: .8rem; font-weight: 700; line-height: 1.05rem; text-align: center;
}

/* the unnumbered box at the foot */
.official { width: min(100%, 20rem); min-height: 5.5rem; margin: 1rem 0 0 auto; padding: .35rem .6rem; border: 1px solid var(--ink); }
.official-label { margin: 0; color: var(--ink-soft); }

/* return header block */
.head .cells { display: grid; grid-template-columns: 8rem 1fr 1fr; margin: 0 0 .9rem; border: 1px solid var(--ink); }
.cell { padding: .4rem .75rem .5rem; }
.cell + .cell { border-left: 1px solid var(--ink); }
dt { margin: 0 0 .1rem; }
dd { margin: 0; }
.window { margin-bottom: .3rem; }
.status-line { margin-bottom: 0; }

.lead { font-weight: 700; }
.note { margin: 1.25rem 0 0; }

/* actions */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.25rem; }
button {
  font: inherit; font-size: .95rem; line-height: 1.3; color: var(--ink); background: transparent;
  border: 1px solid var(--ink); padding: .55rem 1.1rem; cursor: pointer;
}
button.primary { background: var(--ink); color: var(--bg); }
button.link { border: 0; padding: 0; font-size: inherit; text-decoration: underline; text-underline-offset: .15em; }

/* the register */
.meta { margin-bottom: 1rem; }
.state { margin-bottom: 1rem; }
.ledger { width: 100%; border-collapse: collapse; font-size: .93rem; }
.ledger th { text-align: left; padding: .45rem .5rem; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.ledger td { padding: .55rem .5rem; border-bottom: 1px solid var(--ink); vertical-align: top; }
.ledger td:first-child, .ledger th:first-child { width: 3.2rem; }
.ledger td:last-child { text-align: right; }
.ledger tr.open, .ledger tr.open td { background: var(--c-mustard); color: var(--on-fill); }
.ledger tr.open a { color: var(--on-fill); }

/* receipt */
.receipt { margin: 0 0 1.5rem; padding: 1rem 1.25rem; background: var(--c-sky); color: var(--on-fill); border: 1px solid var(--on-fill); }
.receipt p { margin: 0; font-weight: 700; }
.receipt .actions { margin-top: .75rem; }
.receipt a, .receipt button { color: var(--on-fill); border-color: var(--on-fill); }

/* year on year */
.cmp { margin-top: 2rem; }
.cmp-head { margin: 0 0 .5rem; font-size: 1.05rem; font-weight: 700; }
.cmp table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.c-field { width: 25%; }
.c-word { width: 6.5rem; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: .35rem .5rem; overflow-wrap: anywhere; }
.cmp thead th { border-bottom: 1px solid var(--ink); }
.cmp tbody { border-bottom: 1px solid var(--ink); }
.cmp tbody th { padding-top: .5rem; }
.cmp td.added { background: var(--c-mustard); color: var(--on-fill); }
.cmp td.removed { background: var(--c-peach); color: var(--on-fill); }
.cmp ins { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.cmp del { text-decoration: line-through; }
.cmp .unchanged { font-size: .8rem; color: var(--ink-soft); }
.cmp .word { padding-top: .5rem; white-space: nowrap; }

/* footer */
.foot {
  max-width: 54rem; margin: 1rem auto 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem;
  font-size: .88rem;
}
.foot-note { margin: 0; }
.foot-actions { order: -1; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.mark { display: inline-block; line-height: 0; }
.wordmark { height: 1.5rem; width: auto; }
.noscript { max-width: 54rem; margin: 1rem auto; }

.record, .printed { display: none; }

/* the wordmark is plum ink: on the dark ground it sits on a cream label */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark { background: var(--c-cream); padding: .3rem .5rem; }
}
[data-theme="dark"] .mark { background: var(--c-cream); padding: .3rem .5rem; }

@media (max-width: 40rem) {
  body { padding: 1rem 16px 2rem; }
  .band { padding: .7rem 1rem; }
  .band h1, .band .title, .band .code { font-size: 1.2rem; }
  .banner { padding: .6rem 1rem; }
  main { padding: 1rem 1rem 1.5rem; }

  .head .cells { grid-template-columns: 1fr; }
  .cell + .cell { border-left: 0; border-top: 1px solid var(--ink); }

  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .ledger, .ledger tbody, .ledger tr { display: block; }
  .ledger tr { padding: .45rem .5rem; border-bottom: 1px solid var(--ink); }
  .ledger tr:first-child { border-top: 1px solid var(--ink); }
  .ledger td { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; padding: .1rem 0; border: 0; text-align: left; }
  .ledger td:first-child, .ledger td:last-child { width: auto; text-align: left; }
  .ledger td::before { content: attr(data-label); font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; align-self: center; }
  .ledger td:empty { display: none; }

  .cmp thead, .cmp colgroup { display: none; }
  .cmp table, .cmp tbody, .cmp th, .cmp td { display: block; }
  .cmp tbody { padding: .35rem 0; }
  .cmp tbody:first-of-type { border-top: 1px solid var(--ink); }
  .cmp tr { display: flex; flex-wrap: wrap; align-items: baseline; }
  .cmp tbody th { flex-basis: 100%; padding: .25rem .5rem; order: -2; }
  .cmp td { flex: 1 1 0; padding: .25rem .5rem; }
  .cmp td.word { flex: none; padding-top: .25rem; }
  .cmp td:empty, .cmp tr.same td.prev { display: none; }
  .cmp tr.single td.prev, .cmp tr.single td.now { flex-basis: 100%; }
  .cmp tr.single td.prev::before, .cmp tr.single td.now::before {
    display: block; font-size: .7rem; font-weight: 500; text-transform: uppercase; letter-spacing: .09em;
  }
  .cmp tr.single td.prev::before { content: "Previously"; }
  .cmp tr.single td.now::before { content: "Now"; }
  .cmp tr.single td.word { order: -1; flex-basis: 100%; }

  .official { width: 100%; }
}

@media print {
  @page { margin: 1.5cm; }
  *, *::before, *::after { color: #000 !important; background: transparent !important; border-color: #000 !important; }
  html, body { background: #fff !important; }
  body { padding: 0; font-size: 9.5pt; line-height: 1.3; }
  .sheet { max-width: none; border: 0; }
  .band { padding: 0 0 3pt; border-bottom-width: 1.5pt; }
  .band h1, .band .title, .band .code { font-size: 13pt; }
  main { padding: 8pt 0 1.2cm; }
  .actions, .foot, .banner, .flash, .receipt, button, .summary, .ledger td:last-child, .ledger th:last-child { display: none !important; }
  .label, .box-label, dt, .ledger th, .cmp thead th, .cmp tbody th, .word, .official-label { font-size: 6.5pt; letter-spacing: .06em; }
  .head .cells { margin-bottom: 5pt; }
  .cell { padding: 2pt 6pt 3pt; }
  .window, .status-line { margin-bottom: 2pt; }
  .boxes { margin-top: 6pt; }
  .box { padding: 2pt 6pt 3pt; }
  .box-label { margin-bottom: 1pt; }
  .tick { width: 10pt; height: 10pt; font-size: 7pt; line-height: 9pt; margin-top: 1pt; }
  .official { min-height: 1.6cm; margin-top: 6pt; }
  .cmp { margin-top: 8pt; }
  .cmp-head { font-size: 10pt; margin-bottom: 3pt; }
  .cmp th, .cmp td { padding: 1.5pt 4pt; }
  .cmp tbody th, .cmp .word { padding-top: 3pt; }
  .c-word { width: 1.8cm; }
  .cmp .unchanged { font-size: 7.5pt; }
  .boxes, .cmp tbody, .head { break-inside: avoid; }
  .printed {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; margin: 0;
    padding-top: 3pt; border-top: .5pt solid #000; font-size: 8.5pt;
  }
  body.print-all .sheet { display: none; }
  body.print-all .record { display: block; }
  .record-page { padding-bottom: 1.4cm; break-after: page; }
  .record-page:last-child { break-after: auto; }
}
