/* Said Enough. A photocopied department form: cream, ink, thin rules, square corners. */

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }

html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

.page { max-width: 40rem; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
@media (min-width: 40rem) { .page { padding: 4.5rem 1.5rem 6rem; } }

p { margin: 0 0 1rem; }
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: 2rem;
  line-height: 1.1;
  color: var(--c-earth);
}
.sub { margin: .375rem 0 0; color: var(--ink-soft); }

/* the small capital label used for every field and row name */
.label, dt, th {
  font-size: .75rem;
  font-weight: var(--fw-medium);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ---------- the form ---------- */

.mark { display: block; width: 105px; height: auto; margin-bottom: 2.25rem; }
#form > .sub { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--ink); }

.consent { margin: 1.5rem 0; border-top: 1px solid var(--ink); }
.consent > div { padding: .625rem 0 .75rem; border-bottom: 1px solid var(--ink); }
.consent dt { margin-bottom: .125rem; }
.consent dd { margin: 0; }

#notes { color: var(--ink-soft); }

#begin-form { display: flex; flex-direction: column; align-items: stretch; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--ink); }
#begin-form .label { margin: 0 0 .375rem; }
#begin-form .label ~ .label { margin-top: 1.25rem; }
#novoice { margin: 0 0 .625rem; }

input, select, button { font: inherit; font-size: 1rem; color: var(--ink); }
input, select {
  width: 100%;
  min-width: 0;
  padding: .5rem .625rem;
  background: transparent;
  border: 1px solid var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
.select { position: relative; display: block; }
.select select { padding-right: 2.5rem; text-overflow: ellipsis; }
.select::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: .5rem;
  height: .5rem;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

button {
  padding: .5625rem 1.125rem;
  background: var(--bg);
  border: 1px solid var(--ink);
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent); color: var(--accent-fg); }
button:disabled { color: var(--ink-soft); border-color: var(--ink-soft); cursor: default; }
#begin { align-self: flex-start; margin-top: 2rem; }

a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { background: var(--accent); color: var(--accent-fg); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- the run ---------- */

.count {
  margin: 0;
  font-weight: var(--fw-thin);
  font-size: clamp(6rem, 30vw, 11rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.unit { margin: .5rem 0 3rem; color: var(--ink-soft); }
.entry { margin: 0; }
#entry-label { display: block; margin-bottom: .375rem; }
#entry-label.due { font-weight: var(--fw-bold); }
.entry .row { display: flex; gap: .5rem; }
.entry .row input { flex: 1; }
#stop { margin-top: 3rem; }

/* ---------- the sheet ---------- */

.sheet { padding: 2rem 2rem 2.25rem; border: 1px solid var(--ink); }
@media (max-width: 30rem) { .sheet { padding: 1.25rem 1rem 1.5rem; } }
.sheet > * { margin: 0; }
.sheet > * + * { margin-top: 1rem; }
.sheet header { padding-bottom: 1rem; border-bottom: 1px solid var(--ink); }
.letterhead { display: block; width: 140px; height: auto; margin-bottom: 1.25rem; }
.sheet h1 { font-size: 1.75rem; }

.facts > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: .375rem 0;
  border-bottom: 1px solid var(--ink);
}
.facts dt { padding-top: .2rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.sheet h2 { margin-top: 1.75rem; font-size: 1rem; font-weight: var(--fw-bold); }

.entries { width: 100%; border-collapse: collapse; border-top: 1px solid var(--ink); font-variant-numeric: tabular-nums; }
.entries th, .entries td { padding: .375rem .75rem .375rem 0; border-bottom: 1px solid var(--ink); vertical-align: top; }
.entries th { color: var(--c-earth); text-align: left; vertical-align: bottom; }
.entries th:nth-child(-n+3), .entries td:nth-child(-n+3) { text-align: right; padding-right: 1rem; }
.entries th:nth-child(1) { width: 2.75rem; }
.entries th:nth-child(2) { width: 5rem; }
.entries th:nth-child(3) { width: 6.5rem; }
.entries .typed { overflow-wrap: anywhere; }
.entries tr { break-inside: avoid; }

.sheet > .signatures { margin-top: 1.75rem; break-inside: avoid; }
.sign + .sign { margin-top: 1rem; }
.sign .label { margin: 0; }
.sign .line { height: 2.5rem; border-bottom: 1px solid var(--ink); }
@media (min-width: 30rem) {
  .entries th:nth-child(3) { width: 8rem; }
  .signatures { display: grid; grid-template-columns: 3fr 2fr; gap: 2rem; }
  .sign + .sign { margin-top: 0; }
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; margin: 1.5rem 0 0; }

/* ---------- print: the sheet only, black on white ---------- */

@page { size: A4; margin: 18mm; }
@media print {
  * { color: #000 !important; background: transparent !important; border-color: #000 !important; box-shadow: none !important; }
  html, body { background: #fff !important; }
  html { font-size: 9pt; }
  body { line-height: 1.35; }
  #form, #run, .actions, button, form, input, select, a { display: none !important; }
  .page { max-width: none; margin: 0; padding: 0; }
  .sheet { padding: 0; border: 0; }
  .sheet > * + * { margin-top: .75rem; }
  .sheet header { padding-bottom: .7rem; }
  .letterhead { width: 30mm; margin-bottom: 2.5mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet h1 { font-size: 15pt; }
  .sheet h2 { margin-top: 1.1rem; }
  .facts { columns: 2; column-gap: 8mm; }
  .facts > div { padding: .2rem 0; break-inside: avoid; }
  .facts dt { padding-top: .1rem; }
  .entries th, .entries td { padding-top: .12rem; padding-bottom: .12rem; }
  .entries th:nth-child(3) { width: 8rem; }
  /* more than twenty entries: the table runs in two columns so forty fit one A4 page */
  .entries-wrap:has(tbody tr:nth-child(21)) { columns: 2; column-gap: 8mm; }
  .signatures { display: grid; grid-template-columns: 3fr 2fr; gap: 8mm; }
  .sign + .sign { margin-top: 0; }
}
