/* Statement of Hours. The page is paper: light only, every corner square. */
:root { color-scheme: light; }
[hidden] { display: none !important; }
* { box-sizing: border-box; border-radius: 0; }

html, body { background: var(--c-cream); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

.sheet, .controls, .register { max-width: calc(160mm + 32px); margin: 0 auto; padding: 0 16px; }
.sheet { padding-top: 40px; }
.paper, .refusal { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

input, select, button { font: inherit; color: inherit; border-radius: 0; }
input::placeholder { color: var(--ink-soft); opacity: 1; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

/* Letterhead */
.letterhead { border-bottom: 3px solid var(--c-earth); padding-bottom: 14px; }
.wordmark { display: block; height: 7mm; width: auto; }
h1 { margin: 22px 0 2px; color: var(--c-earth); font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.entity { margin: 0; }
#entity {
  width: 100%; max-width: 24em; border: 0; background: transparent; padding: 2px 0;
  font-size: 17px; font-weight: 500;
}
.intro { margin: 8px 0 0; font-size: 14px; }
.closing { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); }
.closing input { margin-left: 6px; border: 1px solid var(--ink); background: transparent; padding: 2px 4px; color: var(--ink); }
.specimen { margin: 12px 0 0; font-weight: 500; }

/* Ledger */
.ledger { width: 100%; border-collapse: collapse; margin-top: 20px; }
.ledger th, .ledger td { padding: 7px 0 6px; vertical-align: baseline; text-align: left; font-weight: 400; }
.ledger thead th { font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--ink); padding-bottom: 5px; vertical-align: bottom; }
.ledger .note { width: 3em; text-align: center; color: var(--ink-soft); font-size: 13px; }
.ledger thead .note { color: var(--ink); font-size: 12px; }
.ledger .fig { width: 6.5em; text-align: right; font-weight: 500; white-space: nowrap; padding-left: 10px; }
.ledger thead .fig { white-space: normal; }
.prev { display: none; }
body.has-prev .prev { display: table-cell; }
.prev-time { display: block; font-size: 11px; font-weight: 400; color: var(--ink-soft); line-height: 1.3; }

.passed td { font-size: 13px; padding-top: 0; }
.group th { padding-top: 14px; font-weight: 500; }

.line th { padding-left: 1em; }
.fields { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; }
.heading {
  flex: 1 1 11em; min-width: 0; border: 0; border-bottom: 1px solid var(--ink);
  background: transparent; padding: 3px 0;
}
/* the select drops under the number when a narrow screen also carries the Previous column */
.amount { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; min-width: 0; }
.number { width: 4.2em; border: 1px solid var(--ink); background: transparent; padding: 2px 5px; text-align: right; }
.basis { border: 1px solid var(--ink); background: var(--c-cream); padding: 2px 2px; font-size: 13px; }
.line .fig { vertical-align: bottom; padding-bottom: 8px; }
.prev-only th { padding-left: 1em; }

.add td { padding: 6px 0 4px 1em; }
button {
  border: 1px solid var(--ink); background: transparent; padding: 6px 12px; cursor: pointer;
  font-weight: 500;
}
button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
button:disabled { color: var(--ink-soft); border-color: var(--ink-soft); cursor: not-allowed; }
#add { font-size: 13px; padding: 3px 10px; }

.subtotal th, .subtotal .fig, .total th, .total .fig { font-weight: 700; }
.subtotal .fig { border-top: 1px solid var(--ink); }
.subtotal th { padding-top: 10px; }
.total .fig { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
body.overdrawn #total { border-bottom: 1px solid var(--ink); }
body.overdrawn #unalloc, .overdrawn-msg, .refusal .fig { color: var(--error); }

.reconcile .gap td { padding: 8px 0; }
.reconcile th { font-size: 14px; }
/* the rule under a subtraction; with no elapsed figure there is nothing to subtract */
.reconcile .rec-now .fig { border-top: 1px solid var(--ink); }
.reconcile.no-elapsed .rec-now .fig { border-top: 0; }

.overdrawn-msg { margin: 16px 0 0; font-weight: 500; }

/* Notes and approval */
.notes { margin-top: 26px; font-size: 12.5px; color: var(--ink-soft); }
.notes p { margin: 0 0 6px; }
.approval { margin-top: 22px; border-top: 1px solid var(--ink); padding-top: 10px; }
.approval p { margin: 0; }
.approval .stamp { margin-top: 2px; font-size: 12.5px; color: var(--ink-soft); }

/* Controls and register: screen only */
.controls { margin-top: 28px; }
#issue { font-size: 15px; padding: 9px 18px; }
.register { margin-top: 44px; margin-bottom: 56px; }
.register h2 { margin: 0 0 8px; padding-top: 12px; border-top: 1px solid var(--ink); font-size: 15px; font-weight: 700; }
.register-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.register-list td { padding: 3px 0; }
.register-list .fig { text-align: right; padding-left: 12px; white-space: nowrap; }
.register-list .refused td { color: var(--ink-soft); }
.register-empty, .register-note { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }

/* check.html */
.result { font-weight: 700; margin: 16px 0 8px; }
.checks { border-collapse: collapse; font-size: 13px; }
.checks td { padding: 2px 14px 2px 0; vertical-align: baseline; }
.checks .fail td { color: var(--error); }

@media (max-width: 480px) {
  .sheet { padding-top: 28px; }
  h1 { font-size: 24px; }
  .ledger .fig { width: 4.6em; padding-left: 6px; }
  /* a percentage width lets the heading field give up its intrinsic width when the figures need it */
  .heading { flex-basis: 100%; width: 100%; }
  /* room for the number and its basis on one row beside two columns of figures */
  .line th, .prev-only th, .add td { padding-left: 0.5em; }
  .ledger .note { width: 1.8em; }
  .register-list td { display: block; padding: 0; text-align: left; }
  .register-list .fig { text-align: left; padding-left: 0; }
  .register-list tr { display: block; padding: 4px 0; }
}

@page { size: auto; margin: 18mm; }
@media print {
  /* the sheet itself is the paper */
  html, body { background: none; }
  body { font-size: 9.5pt; line-height: 1.3; }
  .screen, .fields, #entity, .register, .controls { display: none !important; }
  .sheet { max-width: none; padding: 0; margin: 0; }
  .paper { display: block; }
  .letterhead { padding-bottom: 3mm; }
  .entity:has(#entity-text:empty) { display: none; }
  #entity-text { font-size: 11pt; font-weight: 500; }
  h1 { font-size: 17pt; margin: 5mm 0 1mm; }
  .intro { font-size: 9pt; margin-top: 1.5mm; }
  .specimen { font-size: 9.5pt; margin-top: 2mm; }
  .ledger { margin-top: 3mm; }
  .ledger th, .ledger td { padding: 0.9mm 0 0.7mm; }
  .ledger thead th, .ledger thead .note { font-size: 8pt; padding-bottom: 1mm; }
  .ledger .fig { width: 22mm; }
  .ledger .note { width: 12mm; font-size: 8pt; }
  .line th, .prev-only th { padding-left: 4mm; }
  .prev-time { font-size: 7pt; }
  .passed td { font-size: 9pt; }
  .group th { padding-top: 2mm; }
  .line.empty { display: none; }
  .line .fig { vertical-align: baseline; padding-bottom: 0.7mm; }
  .basis-text { font-size: 7pt; line-height: 1.15; color: var(--ink-soft); }
  .basis-text:empty { display: none; }
  .subtotal th { padding-top: 1.5mm; }
  .reconcile .gap td { padding: 1mm 0; }
  .reconcile th { font-size: 9pt; }
  .overdrawn-msg { margin-top: 3mm; }
  .notes { font-size: 8pt; margin-top: 4mm; }
  .notes p { margin-bottom: 1mm; }
  .approval { margin-top: 4mm; padding-top: 2mm; }
  .approval .stamp { font-size: 8pt; }
  tr, .notes p, .approval, .refusal { break-inside: avoid; }

  body.overdrawn .ledger, body.overdrawn .notes, body.overdrawn .intro, body.overdrawn .entity { display: none; }
  body.overdrawn .refusal { display: flex; justify-content: space-between; margin-top: 8mm; padding-bottom: 1.4mm; border-bottom: 1px solid var(--ink); font-weight: 700; }
}
