:root {
  --ink: #1a1a1a;
  --paper: #ffffff;
  --line: #c4c4c0;
  --line-strong: #8d8d88;
  /* #595959 on white = 7.0:1, on --header-bg = 6.5:1. Passes AA at every size
     we render it, which the old #5f5f5f did not at 0.75rem. */
  --muted: #595959;
  --accent: #8a1c1c;
  --late-bg: #fdecec;
  --late-ink: #7d1919;
  --ok-bg: #eef6ee;
  --ok-ink: #285628;
  --header-bg: #f2f2ef;
  --focus: #0b57a4;

  /* Type scale, 1.25 ratio off a 16px base. Sizes are picked from this scale,
     never invented ad hoc - the printed record and the phone form share it. */
  --t-xs:   0.75rem;   /* 12px - legal, captions */
  --t-sm:   0.875rem;  /* 14px - helper text, table meta */
  --t-base: 1rem;      /* 16px - body, inputs (never smaller: iOS zooms below 16) */
  --t-md:   1.125rem;  /* 18px - lead paragraph, large controls */
  --t-lg:   1.375rem;  /* 22px - section headings */
  --t-xl:   1.75rem;   /* 28px - page title */
  --t-2xl:  2.25rem;   /* 36px - contract id */

  /* Spacing rhythm - multiples of 4, so vertical margins stay on one grid. */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Minimum comfortable touch target. Room lighting is bad and people are
     queueing behind the bidder. */
  --touch: 48px;

  font-size: 16px;
}

/* Visible keyboard focus everywhere. There was none before, which made the
   forms unusable by keyboard and failed WCAG 2.4.7. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* System stack by necessity, not laziness: the venue has no internet, so a
     web font would silently fail to load and reflow the printed record. */
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: #eeeeec;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* Staff screens - contract encoding and the live logbook - are used on a desk
   monitor and are dense with columns, so they take the full width. The bidder
   forms stay narrow: those are read on a phone. */
.page.wide {
  max-width: min(1680px, 100%);
}

header.topbar {
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header.topbar a { color: #fff; text-decoration: none; font-weight: 600; }
header.topbar .brand { font-size: 1.05rem; letter-spacing: 0.02em; }

h1, h2, h3 { font-weight: 700; margin: 0 0 var(--s-2); line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--t-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-md); }
p.muted, .muted { color: var(--muted); }
.lead { font-size: var(--t-md); color: var(--muted); margin-top: 0; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th, td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
th { background: var(--header-bg); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge.late { background: var(--late-bg); color: var(--late-ink); border: 1px solid var(--late-ink); }
.badge.ontime { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid var(--ok-ink); }
.badge.noshow { background: #f2f2f2; color: var(--muted); border: 1px solid var(--line); }
.badge.unlisted { background: #fff6e0; color: #7a5b00; border: 1px solid #7a5b00; }

tr.late-row td { background: var(--late-bg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  background: var(--ink);
  color: #fff;
  padding: var(--s-3) var(--s-5);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-size: var(--t-base);
  font-family: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  /* A primary action must never wrap to two lines. */
  white-space: nowrap;
}
.btn:hover { opacity: 0.9; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.big {
  font-size: var(--t-md);
  min-height: 60px;
  padding: var(--s-4) var(--s-5);
  width: 100%;
  border-radius: 6px;
  letter-spacing: 0.01em;
}
.btn.danger { background: var(--accent); }

.field { margin-bottom: var(--s-5); }
.field label {
  display: block;
  font-weight: 700;
  font-size: var(--t-base);
  margin-bottom: var(--s-1);
}
.field .hint {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  margin: 0 0 var(--s-2);
}
.field input[type=text],
.field input[type=email],
.field input[type=file],
.field input[type=password],
.field input[type=datetime-local],
.field select,
.field textarea {
  width: 100%;
  min-height: var(--touch);
  padding: var(--s-3);
  /* 16px minimum: anything smaller makes iOS Safari zoom on focus, which throws
     the bidder out of the form mid-transaction. */
  font-size: var(--t-base);
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-radius: 4px;
}
.field input::placeholder { color: #6b6b6b; opacity: 1; }
.field input[aria-invalid="true"] { border-color: var(--late-ink); background: var(--late-bg); }

.required-mark { color: var(--accent); font-weight: 700; }

.bidder-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; align-items: center; }
.bidder-row input { flex: 1 1 180px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 4px; }
.bidder-row .remove-row { background: none; border: none; color: var(--accent); font-size: 1.2rem; cursor: pointer; }

.qr-block { text-align: center; }
.qr-block img { border: 1px solid var(--line); padding: 8px; background: #fff; }
.qr-url { font-family: Consolas, monospace; font-size: 0.9rem; word-break: break-all; background: #f4f4f2; padding: 8px; border-radius: 4px; }

.error-box {
  background: var(--late-bg);
  border: 1px solid var(--late-ink);
  color: var(--late-ink);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-weight: 600;
}

.deadline-banner {
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.deadline-banner.open { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid var(--ok-ink); }
.deadline-banner.closed { background: var(--late-bg); color: var(--late-ink); border: 1px solid var(--late-ink); }

.success-check {
  text-align: center;
  padding: 40px 20px;
}
.success-check .mark {
  font-size: 4rem;
  color: var(--ok-ink);
}
.success-check .time {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.contract-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.contract-list-item:last-child { border-bottom: none; }
.contract-list-item .title { font-weight: 600; }
.contract-list-item .meta { font-size: 0.85rem; color: var(--muted); }

.countdown {
  display: block;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: center;
  border: 2px solid var(--line);
  background: #fff;
}
.countdown-value, .countdown [data-countdown-value] {
  display: block;
  font-family: Consolas, "SF Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.countdown-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 6px;
}
.countdown.open { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.countdown.closed { background: var(--late-bg); border-color: var(--late-ink); color: var(--late-ink); }

/* Inline variant used beside each contract in the bidder-facing list. */
.countdown.inline {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 0 0 6px;
  border-width: 1px;
  font-size: 0.8rem;
  vertical-align: baseline;
}
.countdown.inline [data-countdown-value] {
  display: inline;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Lateness in words, so it reads the same on a colourless printout. */
.delta {
  font-family: Consolas, "SF Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--late-ink);
  white-space: nowrap;
}

.contract-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.contract-option { position: relative; min-height: var(--touch); }
.contract-option input {
  width: 26px;
  height: 26px;
  margin-top: 2px;
  accent-color: var(--ink);
}
.contract-option:has(input:checked) {
  border-width: 3px;
  border-color: var(--ink);
  background: #f7f7f4;
}
.contract-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* A closed contract cannot be selected. Greyed out AND struck through AND
   labelled, so it does not depend on colour perception to read as unavailable. */
.contract-option.is-closed {
  background: #f4f4f2;
  border-style: dashed;
  color: var(--muted);
  cursor: not-allowed;
}
.contract-option.is-closed strong { text-decoration: line-through; }
.contract-option.is-closed input { cursor: not-allowed; }

/* Addresses are long and must not force the table wider than the page. */
td.email {
  font-family: Consolas, "SF Mono", monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* Money is a figure: tabular so columns of amounts align, and never broken
   across a line mid-number. */
.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

/* Wet-signature block. Names sit ON the rule, so the signer writes above their
   own printed name the way the paper form works. */
.sign-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  margin-top: 28px;
}
.sign-block { flex: 1 1 260px; max-width: 380px; }
.sign-line {
  border-bottom: 1px solid var(--ink);
  padding: 24px 4px 4px;
  font-weight: 700;
  min-height: 1.4em;
}
/* Date sits inline directly beneath the printed-name row, so it reads as part
   of that signature rather than as a second, detached field. */
.sign-date {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}
.sign-line.date-line {
  flex: 1;
  padding: 0 4px 2px;
  min-height: 1.1em;
}
.sign-role { font-weight: 700; font-size: 0.9rem; margin-top: 6px; }
.sign-sub {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.verify-form { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.verify-prompt {
  flex: 1 0 100%;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.verify-form input {
  padding: 5px 6px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  width: 110px;
}

.signatory-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.signatory-edit .field { margin-bottom: 0; flex: 1 1 240px; }

.print-controls { display: flex; align-items: center; gap: 8px; }
.print-controls label { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.print-controls select, .print-controls input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.9rem;
}
.print-controls input { width: 80px; }

/* The declaration must read as a deliberate legal step, not fine print the
   bidder scrolls past. */
.declaration {
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 16px 18px;
  margin-top: 20px;
  background: #fbfbf9;
}
.declaration h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.declaration ul { margin: 10px 0; padding-left: 20px; }
.declaration li { margin-bottom: 8px; font-size: 0.92rem; }
.declaration-warning {
  background: var(--late-bg);
  border: 1px solid var(--late-ink);
  color: var(--late-ink);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}
.attest {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.attest input { width: 24px; height: 24px; flex: 0 0 auto; margin-top: 2px; }

/* ---- Bidder form (phone-first) ---- */
.form-page { max-width: 620px; }
.form-page .card { padding: var(--s-5); }

.step h2 {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-1);
}
/* A numbered step tells the bidder how much is left. Three cards with no
   numbering read as one endless column on a phone. */
.step-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: var(--t-base);
  font-variant-numeric: tabular-nums;
}
.step-hint { color: var(--muted); font-size: var(--t-sm); margin: 0 0 var(--s-5); }

/* Contract rows: id and deadline are what the bidder scans for, so they lead. */
.contract-body { display: block; }
.contract-id {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  font-size: var(--t-md);
}
.contract-title {
  display: block;
  margin: var(--s-1) 0 var(--s-2);
  font-size: var(--t-sm);
  color: var(--muted);
}
.contract-meta { display: block; font-size: var(--t-sm); }
.meta-row { display: block; }
.meta-key {
  display: inline-block;
  min-width: 76px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
}
.contract-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  margin-top: var(--s-2);
}
.is-closed .contract-title, .is-closed .contract-meta { text-decoration: none; }

/* Submit stays in reach at the bottom of a long form. */
.submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: var(--s-4);
  margin-bottom: var(--s-5);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
}
.selection-count {
  margin: 0 0 var(--s-3);
  font-weight: 700;
  font-size: var(--t-sm);
  text-align: center;
  color: var(--muted);
}
.selection-count.has-selection { color: var(--ink); }
.submit-note {
  margin: var(--s-3) 0 0;
  text-align: center;
  font-size: var(--t-xs);
  color: var(--muted);
}
.privacy-notice { font-size: var(--t-xs); color: var(--muted); }
.opt { font-weight: inherit; }

@media (max-width: 480px) {
  .form-page .card { padding: var(--s-4); }
  .meta-key { min-width: 0; margin-right: var(--s-2); }
}

.print-masthead, .print-running-head, .print-provenance { display: none; }

/* ---- Bidder confirmation ---- */
.receipt-head { text-align: center; }
.receipt-eyebrow {
  margin: 0;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.receipt-head h1 { margin: var(--s-1) 0 var(--s-3); }
.receipt-company { font-weight: 700; font-size: var(--t-md); margin: 0 0 var(--s-4); }
.receipt-time {
  margin: 0;
  font-size: var(--t-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.reference-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  margin: var(--s-5) 0 var(--s-2);
  padding: var(--s-3);
  border: 2px dashed var(--line-strong);
  border-radius: 6px;
}
.reference-label {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.reference-value {
  font-family: Consolas, "SF Mono", monospace;
  font-size: var(--t-lg);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Says plainly that the transaction is not finished yet. A bare green tick
   would tell the bidder they are done when the receipt is still unverified. */
.pending-notice {
  background: #fff8e6;
  border: 2px solid #8a6d00;
  border-radius: 6px;
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
}
.pending-notice h2 {
  margin: 0 0 var(--s-2);
  color: #6b5400;
  font-size: var(--t-md);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pending-notice p { margin: 0 0 var(--s-2); font-size: var(--t-sm); }
.pending-notice p:last-child { margin-bottom: 0; }

/* ---- Single vs joint venture ---- */
.bid-type {
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  padding: var(--s-4);
  margin: 0 0 var(--s-5);
}
.bid-type legend {
  font-weight: 700;
  padding: 0 var(--s-2);
}
.choice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3);
  border: 2px solid var(--line);
  border-radius: 4px;
  margin-top: var(--s-2);
  cursor: pointer;
  min-height: var(--touch);
}
.choice input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--ink); flex: 0 0 auto; }
.choice:has(input:checked) { border-width: 3px; border-color: var(--ink); background: #f7f7f4; }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }

.jv-block {
  border-left: 4px solid var(--ink);
  padding-left: var(--s-4);
  margin: 0 0 var(--s-5);
}
.jv-partners-label { font-weight: 700; margin: 0 0 var(--s-2); }
.jv-partner-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
.jv-partner-row input {
  flex: 1 1 180px;
  min-width: 0;
  min-height: var(--touch);
  padding: var(--s-3);
  font-size: var(--t-base);
  font-family: inherit;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
}

/* A completed step is marked with a tick, an outstanding one is flagged only
   after the bidder tries to submit - nagging before that is noise. */
.step.is-complete .step-num { background: var(--ok-ink); }
.step.is-incomplete { border-color: var(--late-ink); border-width: 2px; }
.step.is-incomplete .step-num { background: var(--late-ink); }

.missing-summary {
  border: 2px solid var(--late-ink);
  background: var(--late-bg);
  color: var(--late-ink);
  border-radius: 6px;
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
}
.missing-summary h2 { margin: 0 0 var(--s-2); font-size: var(--t-md); color: var(--late-ink); }
.missing-summary ul { margin: 0; padding-left: 20px; }
.missing-summary li { font-weight: 700; margin-bottom: var(--s-1); }

/* ---- Review-before-commit ---- */
.review-list { margin: 0; }
.review-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}
.review-list > div:last-child { border-bottom: none; }
.review-list dt {
  flex: 0 0 170px;
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.review-list dd { margin: 0; flex: 1 1 200px; font-weight: 600; }
.mono { font-family: Consolas, "SF Mono", monospace; font-variant-numeric: tabular-nums; }

.review-contract {
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}
.review-contract:last-child { border-bottom: none; }

/* The last thing before an irreversible commit gets the heaviest weight. */
.final-affirm {
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: var(--s-4);
  margin-bottom: var(--s-4);
  background: #fbfbf9;
}
.final-affirm .attest { border-top: none; padding-top: 0; margin-top: 0; }
.confirm-form { margin-bottom: var(--s-4); }

.picker select { width: 100%; min-height: var(--touch); }
.picker { padding-bottom: var(--s-4); border-bottom: 1px dashed var(--line); }

/* A contract this bidder has already dropped for cannot be selected again. */
.contract-option.is-duplicate {
  background: var(--late-bg);
  border-color: var(--late-ink);
  border-style: dashed;
  cursor: not-allowed;
}
.dup-flag {
  display: block;
  flex: 1 0 100%;
  margin-top: var(--s-1);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--late-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Section headings are set in caps.
   Done with text-transform rather than typing the words in capitals, so screen
   readers still announce them as words. Uppercase loses the word-shape cues
   readers rely on, so it gets tracking and a slightly smaller size to stay
   legible - caps at body size and normal tracking read as shouting. */
.step h2,
.review h2,
.missing-summary h2,
.receipt-head h1,
.page:not(.wide) .card > h2,
.page.wide .card > h2 {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: var(--t-md);
}

/* The step number sits beside the heading and must not shrink with it. */
.step h2 .step-num { font-size: var(--t-base); letter-spacing: 0; }

/* Page titles stay in sentence case: a whole line of caps at display size is
   hard to read and is the first thing on the screen. */
.form-page > .card > h1 { text-transform: none; }

/* ---- Printable QR poster (bulletin board) ---- */
.poster-sheet { text-align: center; max-width: 620px; margin: 0 auto; }
.poster-office {
  margin: 0;
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.poster-title {
  margin: var(--s-2) 0 var(--s-3);
  font-size: var(--t-2xl);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.poster-sub { margin: 0 0 var(--s-5); font-size: var(--t-md); }
.poster-qr {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto var(--s-4);
  border: 2px solid var(--ink);
  padding: var(--s-3);
  background: #fff;
  /* Never resample a QR: blurred modules stop scanning. */
  image-rendering: pixelated;
}
.poster-url {
  font-family: Consolas, "SF Mono", monospace;
  font-size: var(--t-md);
  font-weight: 700;
  word-break: break-all;
  margin: 0 0 var(--s-1);
}
.poster-url-note { margin: 0 0 var(--s-5); font-size: var(--t-sm); color: var(--muted); }
.poster-steps {
  text-align: left;
  max-width: 460px;
  margin: 0 auto var(--s-5);
  padding-left: 24px;
  font-size: var(--t-base);
}
.poster-steps li { margin-bottom: var(--s-2); }
.poster-foot {
  font-size: var(--t-sm);
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: var(--s-3);
  margin: 0;
}

@media print {
  /* Fill the sheet: the code has to be scannable pinned to a board. */
  .poster .card, .poster-sheet { max-width: 100%; }
  .poster-title { font-size: 30pt; }
  .poster-office { font-size: 11pt; }
  .poster-sub { font-size: 13pt; }
  .poster-qr { max-width: 115mm; border-width: 1pt; }
  .poster-url { font-size: 13pt; }
  .poster-steps { font-size: 11pt; max-width: 130mm; }
  .poster-foot { font-size: 9pt; color: #333 !important; }
}

/* The single commonest reason a scan fails, so it is stated before the code
   rather than in the small print underneath it. */
.poster-wifi {
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: var(--s-3) var(--s-4);
  margin: 0 auto var(--s-5);
  max-width: 460px;
}
.poster-wifi-head {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--t-sm);
}
.poster-wifi-name {
  margin: var(--s-1) 0;
  font-family: Consolas, "SF Mono", monospace;
  font-size: var(--t-lg);
  font-weight: 700;
}
.poster-wifi-note { margin: 0; font-size: var(--t-xs); color: var(--muted); }

@media print {
  .poster-wifi { border-width: 1.5pt; }
  .poster-wifi-head { font-size: 11pt; }
  .poster-wifi-name { font-size: 15pt; }
  .poster-wifi-note { font-size: 8.5pt; color: #333 !important; }
}

/* An access code is copied from an email under time pressure, so it is set
   large and monospaced with generous tracking. */
.code-input {
  font-family: Consolas, "SF Mono", monospace;
  font-size: var(--t-lg) !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.no-print { }

@page { margin: 20mm; }

@media print {
  body {
    background: #fff;
    /* Ink on paper is not a screen: full black, and a serif for the body of a
       formal record reads better in small sizes than the UI sans. */
    color: #000;
    font-size: 10pt;
    line-height: 1.35;
  }
  header.topbar, .no-print { display: none !important; }

  /* .page.wide outranks a bare .page selector, so it must be named here too,
     or the on-screen desk width would follow the sheet into the printer. */
  .page, .page.wide { max-width: 100%; padding: 0; margin: 0; }
  .card { border: none; padding: 0; margin-bottom: 10pt; }

  /* --- Document identity ------------------------------------------------ */
  .print-masthead {
    display: block;
    text-align: center;
    border-bottom: 1.5pt solid #000;
    padding-bottom: 6pt;
    margin-bottom: 12pt;
  }
  .masthead-office {
    margin: 0;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.16em;
  }
  .masthead-title {
    margin: 2pt 0 0;
    font-size: 16pt;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  /* Repeats on every sheet in Chrome, so a detached page stays identifiable. */
  .print-running-head {
    display: flex;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    font-size: 7.5pt;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #333;
  }

  .print-provenance {
    display: block;
    margin-top: 10pt;
    padding-top: 5pt;
    border-top: 0.5pt solid #999;
    font-size: 7.5pt;
    color: #333;
  }

  /* --- Headings ---------------------------------------------------------- */
  h1 { font-size: 15pt; }
  h2 {
    font-size: 10.5pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 0.5pt solid #000;
    padding-bottom: 2pt;
    margin-bottom: 5pt;
    break-after: avoid;
    page-break-after: avoid;
  }

  /* --- Tables ------------------------------------------------------------ */
  table {
    font-size: 8.5pt;
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    /* IDs, licence numbers, money and times must align down the column. */
    font-variant-numeric: tabular-nums;
  }
  th, td {
    padding: 3.5pt 4pt;
    border: 0.5pt solid #666;
    word-wrap: break-word;
    /* Only break inside a word where the content genuinely has no spaces (long
       email addresses). Headings must never split as "REPRESENTATI VE". */
    overflow-wrap: break-word;
    hyphens: none;
    vertical-align: top;
  }
  th { overflow-wrap: normal; white-space: normal; }
  td.email { overflow-wrap: anywhere; }

  /* Proportions, since table-layout:fixed otherwise splits every column evenly. */
  .t-purchased .c-num { width: 4%; }
  .t-purchased .c-company { width: 30%; }
  .t-purchased .c-lic { width: 13%; }
  .t-purchased .c-when { width: 19%; }
  .t-purchased .c-receipt { width: 20%; }
  .t-purchased .c-status { width: 14%; }

  .t-submitted .c-bidder { width: 19%; }
  .t-submitted .c-lic { width: 9%; }
  /* Wide enough that the word REPRESENTATIVE does not sit flush against the
     next column's rule. */
  .t-submitted .c-rep { width: 15%; }
  .t-submitted .c-email { width: 19%; }
  .t-submitted .c-date { width: 11%; }
  .t-submitted .c-time { width: 8%; }
  .t-submitted .c-status { width: 9%; }
  .t-submitted .c-approval { width: 9%; }
  th {
    font-size: 7pt;
    text-transform: uppercase;
    /* Tracking on an already-wide word like REPRESENTATIVE pushes it flush
       against the next column rule. Keep it tight and give it breathing room. */
    letter-spacing: 0.01em;
    padding-right: 6pt;
    background: #e8e8e4 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* A table spanning pages must reprint its header, and no row may be sliced
     in half across a page break - a split row is unreadable as evidence. */
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  td.email { font-size: 7.5pt; }

  tr.late-row td {
    background: #f7dede !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* --- Status marks: readable with no colour at all ---------------------- */
  .badge {
    display: inline-block;
    max-width: 100%;
    border: 0.5pt solid #000 !important;
    color: #000 !important;
    background: transparent !important;
    font-size: 7pt;
    padding: 0.5pt 3pt;
    /* Was spilling outside the cell border: a pill must wrap like any text. */
    white-space: normal;
    overflow-wrap: break-word;
    border-radius: 2pt;
  }
  .badge.late { border-width: 1pt !important; font-weight: 700; }
  .delta { color: #000 !important; font-weight: 700; }

  a[href]:after { content: ""; }
  .countdown { display: none !important; }

  .signatories { break-inside: avoid; page-break-inside: avoid; margin-top: 18pt; }
  .sign-sub { color: #333 !important; }
  .sign-line { border-bottom: 0.75pt solid #000; }
  .amount { font-variant-numeric: tabular-nums; }

  /* Orphans and widows in the certification wording read as sloppy on a
     document somebody signs. */
  p { orphans: 3; widows: 3; }
}
