/* E-Voting Registration desk.
 *
 * Built for people who do this for hours at a folding table: a quiet, flat workspace, large type, no decoration that is not
 * information. The one thing allowed to look special is the slip - it is drawn as the strip of thermal paper that comes out of the
 * printer (serrated edge, fed out once), and the same markup is what is printed.
 *
 * Type: Atkinson Hyperlegible, made by the Braille Institute so that look-alike characters (0 O, 1 l I) stay different - which is
 * exactly the problem of account codes read across a desk. Fonts are served from this site (see fonts/LICENSE-OFL.txt).
 * No inline styles anywhere: the Content-Security-Policy forbids them. */

/* ── fonts ──────────────────────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Atkinson Hyperlegible Next Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2') format('woff2-variations'), url('../fonts/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── tokens ─────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Forest green is the colour of this desk. --forest is the literal CSS colour "forestgreen" (#228B22): the top bar, the main
   * buttons, and every marker of "this one is chosen". White on it is 4.39:1 - enough for large bold type and for shapes
   * (WCAG asks 3:1 for those) but not for small type. So large bold type sits straight on it, and small type sits on a darker
   * green inset (--forest-inset, white on it is 7.7:1) or on white. */
  --forest: #228b22;
  --forest-dark: #1a6e1b;
  --forest-inset: #166016;
  --forest-inset-hover: #0f4a12;
  --forest-tint: #e3f1e3;

  --ink: #14211a;
  --ink-soft: #41524a;
  --ink-faint: #51625a;
  --desk: #e1eae1;
  --panel: #ffffff;
  --rule: #c2cfc3;
  --rule-strong: #7a8f7e;

  --brand: var(--forest);
  --brand-dark: var(--forest-dark);
  --brand-tint: var(--forest-tint);
  --focus: #f5b700;

  /* "for your information" is neutral on purpose: in a green desk, green must keep meaning "chosen" or "done". */
  --info-bar: #4b5e53;
  --info-tint: #e9efea;

  --ok: #17601b;
  --ok-tint: #dcefdc;
  --bad: #9b1c1c;
  --bad-tint: #fde3e3;
  --warn: #6f4300;
  --warn-tint: #fff0c7;
  --mark: #ffe58f;

  --font: 'Atkinson Hyperlegible Next Variable', 'Atkinson Hyperlegible Next', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Atkinson Hyperlegible Mono Variable', 'Atkinson Hyperlegible Mono', 'Cascadia Mono', Consolas, 'Courier New', monospace;

  --r-control: 6px;
  --r-panel: 8px;
  --r-dialog: 12px;
}

/* ── base ───────────────────────────────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  font-size: 106.25%; /* 17 px: the desk is read at arm's length */
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.4;
  font-variant-numeric: lining-nums;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin: 0;
}
ul {
  padding: 0;
  list-style: none;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.mono,
.detail-code,
.result-code,
.recent-code {
  font-family: var(--font-mono);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.boot {
  max-width: 34rem;
  margin: 4rem auto;
  padding: 0 1.5rem;
  color: var(--ink-soft);
}
#print-root {
  display: none;
}

/* The ring is two-tone (dark outside, amber inside) so it is visible on white, on tinted rows and on the green bar alike. */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus);
}
.topbar :focus-visible {
  outline-color: #ffffff;
}

/* ── buttons and fields ─────────────────────────────────────────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 650;
  min-height: 2.75rem;
  padding: 0.45rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: var(--r-control);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover:not(:disabled) {
  background: var(--brand-tint);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  cursor: not-allowed;
  color: var(--ink-faint);
  border-color: var(--rule-strong);
  border-style: dashed;
  background: transparent;
}
/* The main buttons are the literal forest green. White on it is 4.39:1, so the label is large and bold (14 pt bold = 18.67 px,
 * which WCAG measures against 3:1). A small primary button (in a table) is the darker green instead. */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  font-weight: 700;
  font-size: max(1.1rem, 18.67px);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}
.btn-danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background: #7a1414;
  border-color: #7a1414;
}
.btn-quiet {
  border-color: var(--rule-strong);
  background: transparent;
}
.btn-small {
  min-height: 2.25rem;
  padding: 0.2rem 0.8rem;
  font-size: 0.95rem;
}
.btn-small.btn-primary {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}
.btn-small.btn-primary:hover:not(:disabled) {
  background: var(--forest-inset);
  border-color: var(--forest-inset);
}
.btn-large {
  min-height: 4rem;
  padding: 0.7rem 1.6rem;
  font-size: 1.3rem;
}
.btn-wide {
  width: 100%;
}
.count {
  display: inline-block;
  min-width: 1.5rem;
  margin-left: 0.2rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--bad);
  color: #ffffff;
  font-size: 0.85rem;
  line-height: 1.5rem;
  text-align: center;
}

input[type='text'],
input[type='password'] {
  font: inherit;
  min-height: 2.9rem;
  width: 100%;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--ink-soft);
  border-radius: var(--r-control);
  background: #ffffff;
  color: var(--ink);
}
/* the focus ring (dark + amber) already says "you are here"; a green border inside it only muddies the amber */
input:focus-visible {
  border-color: var(--ink);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field label {
  font-weight: 650;
}
.password-row {
  display: flex;
  gap: 0.5rem;
}
.password-row .btn {
  flex: none;
  min-width: 4.5rem;
}
.form-error {
  min-height: 1.4em;
  color: var(--bad);
  font-weight: 650;
}

/* ── sign-in ────────────────────────────────────────────────────────────────────────────────────────── */
.login {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: auto;
}
.login-panel {
  width: min(26rem, 100%);
  padding: 1.75rem 1.75rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 8px solid var(--forest);
  border-radius: var(--r-panel);
}
.login-title {
  margin-bottom: 0.4rem;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.15;
}
.login-lead {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
}
.login-form {
  display: grid;
  gap: 0.9rem;
}
/* the tear-off stub of a ticket: what the page knows about the server sits below the perforation */
.login-server {
  margin: 1.4rem -1.75rem 0;
  padding: 0.9rem 1.75rem 0;
  border-top: 2px dashed var(--rule-strong);
}
.login-server-host {
  font-family: var(--font-mono);
  font-weight: 600;
}
.login-server-state {
  font-weight: 650;
}
.login-server-state[data-state='online'] {
  color: var(--ok);
}
.login-server-state[data-state='offline'] {
  color: var(--bad);
}
.login-note {
  margin-top: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ── top bar ────────────────────────────────────────────────────────────────────────────────────────── */
/* The bar is the literal forest green. The election title is large bold type and sits straight on it; every smaller piece of
 * type (brand tag, venue and dates, who is signed in, connection, buttons) sits on a darker inset so it stays readable. */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 0.6rem 1rem;
  background: var(--forest);
  color: #ffffff;
}
.topbar-brand {
  display: inline-block;
  padding: 0 0.55rem;
  border-radius: 4px;
  background: var(--forest-inset);
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}
.election-title {
  margin-top: 0.15rem;
  font-size: 1.4rem;
  font-weight: 750;
  line-height: 1.2;
}
.election-detail {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  margin-top: 0.2rem;
  padding: 0.05rem 0.75rem;
  border-radius: 6px;
  background: var(--forest-inset);
  color: #ffffff;
  font-size: 0.95rem;
}
.election-detail:empty {
  display: none;
}
.election-detail span + span::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 0.9em;
  margin: 0 0.7rem;
  background: currentColor;
  opacity: 0.55;
  vertical-align: -0.1em;
}
.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.topbar-user {
  padding: 0.15rem 0.8rem;
  border-radius: 999px;
  background: var(--forest-inset);
  color: #ffffff;
}
.topbar-user strong {
  color: #ffffff;
}
.topbar-buttons {
  display: flex;
  gap: 0.5rem;
}
.topbar .btn-quiet {
  background: var(--forest-inset);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
}
.topbar .btn-quiet:hover:not(:disabled) {
  background: var(--forest-inset-hover);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: var(--forest-inset);
  font-size: 0.95rem;
  font-weight: 650;
}
.pill-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #b8c9b8;
}
.pill[data-kind='online'] .pill-dot {
  background: #6ee7a0;
}
.pill[data-kind='offline'] .pill-dot {
  background: #ff9a9a;
}
.pill[data-kind='problem'] .pill-dot {
  background: #fbbf24;
}

/* ── notices across the top ─────────────────────────────────────────────────────────────────────────── */
.banners:empty {
  display: none;
}
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  border-left: 8px solid;
  border-bottom: 1px solid var(--rule);
}
.banner-title {
  font-weight: 750;
}
.banner-detail {
  max-width: 75ch;
}
.banner-actions {
  display: flex;
  gap: 0.5rem;
}
.banner-critical {
  background: var(--bad-tint);
  border-left-color: var(--bad);
}
.banner-warning {
  background: var(--warn-tint);
  border-left-color: #b7791f;
}
.banner-info {
  background: var(--info-tint);
  border-left-color: var(--info-bar);
}

/* ── the desk ───────────────────────────────────────────────────────────────────────────────────────── */
.desk {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}
.desk-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(19rem, 30rem) minmax(0, 1fr);
  gap: 1rem;
}

/* search */
.search {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
  overflow: hidden;
}
.search > :not(.results) {
  margin-inline: 1rem;
}
.search-label {
  font-size: 1.15rem;
  font-weight: 750;
}
.search-row {
  display: flex;
  gap: 0.5rem;
}
.search-input {
  flex: 1;
  min-width: 0;
  min-height: 3.4rem;
  font-size: 1.4rem;
}
.search-hint {
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.search-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.6rem;
}
.search-status {
  color: var(--ink-soft);
}
.search-status.is-error {
  color: var(--bad);
  font-weight: 650;
}
.results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--rule);
}
.results.is-pending {
  opacity: 0.8;
}
.result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem 0.65rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  border-left: 5px solid transparent;
  cursor: pointer;
}
.result:hover {
  background: #f0f5f0;
}
.result.is-selected {
  background: var(--brand-tint);
  border-left-color: var(--brand);
}
.result-main {
  min-width: 0;
}
.result-name {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.result-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  text-align: right;
}
.result-qr {
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.badge {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0 0.5rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge[data-kind='eligible'] {
  background: var(--ok-tint);
  color: var(--ok);
}
.badge[data-kind='notEligible'] {
  background: var(--bad-tint);
  color: var(--bad);
}
.badge[data-kind='inactive'],
.badge[data-kind='branchNotInElection'] {
  background: var(--warn-tint);
  color: var(--warn);
}

/* selected member */
.detail {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
}
.detail.has-slip {
  grid-template-columns: minmax(0, 1fr) auto;
}
.detail > * {
  grid-column: 1;
}
.detail > .slip-area {
  grid-column: 2;
  grid-row: 1 / span 4;
}
.detail-empty {
  padding: 2rem 1rem;
  border: 2px dashed var(--rule);
  border-radius: var(--r-control);
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.detail-member {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
}
.detail-name {
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.detail-ids {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0;
  font-size: 1.2rem;
}
.detail-code {
  font-weight: 700;
  letter-spacing: 0.03em;
}
.detail-branch {
  color: var(--ink-soft);
}
.detail-branch::before {
  content: '';
  display: inline-block;
  width: 1px;
  height: 1em;
  margin: 0 0.8rem;
  background: var(--rule-strong);
  vertical-align: -0.12em;
}
.eligibility {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1rem;
  border-left: 6px solid;
  border-radius: var(--r-control);
  font-size: 1.25rem;
}
.eligibility-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.eligibility[data-kind='eligible'] {
  background: var(--ok-tint);
  color: var(--ok);
}
.eligibility[data-kind='notEligible'] {
  background: var(--bad-tint);
  color: var(--bad);
}
.eligibility[data-kind='inactive'],
.eligibility[data-kind='branchNotInElection'] {
  background: var(--warn-tint);
  color: var(--warn);
}
.eligibility-reason {
  max-width: 60ch;
}
.detail-qr {
  color: var(--ink-soft);
}
.issue {
  display: grid;
  justify-items: start;
  gap: 0.6rem;
}
.issue .btn-large {
  min-width: min(100%, 22rem);
}
.issue-hint {
  max-width: 52ch;
  color: var(--ink-soft);
}
.more summary {
  cursor: pointer;
  font-weight: 650;
}
.more-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 1.25rem;
  margin-top: 0.6rem;
}
.more-list dt {
  color: var(--ink-soft);
}
.more-list dd {
  overflow-wrap: anywhere;
}
.notice {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-left: 6px solid;
  border-radius: var(--r-control);
  font-size: 1.05rem;
}
.notice[data-kind='success'] {
  background: var(--ok-tint);
  border-left-color: var(--ok);
}
.notice[data-kind='error'] {
  background: var(--bad-tint);
  border-left-color: var(--bad);
}
.notice[data-kind='info'] {
  background: var(--info-tint);
  border-left-color: var(--info-bar);
}
.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* recently issued */
.recent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem 1.25rem;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
}
.recent-head {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.recent-title {
  font-size: 1rem;
  font-weight: 700;
}
.recent-empty,
.recent-list {
  grid-column: 2;
  grid-row: 1;
}
.recent-empty {
  color: var(--ink-soft);
}
.recent-list {
  display: flex;
  gap: 0.5rem;
  padding: 0.2rem;
  overflow-x: auto;
}
.recent-item {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--ok);
  border-radius: var(--r-control);
  font-size: 0.95rem;
  white-space: nowrap;
}
.recent-item[data-state='failed'],
.recent-item[data-state='unknown'],
.recent-item[data-state='rejected'] {
  border-left-color: var(--bad);
  background: var(--bad-tint);
}
.recent-item[data-state='sending'] {
  border-left-color: var(--info-bar);
}
.recent-name {
  font-weight: 700;
}
.recent-time,
.recent-state {
  color: var(--ink-soft);
}

/* ── dialogs ────────────────────────────────────────────────────────────────────────────────────────── */
.dialog {
  max-width: min(34rem, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--r-dialog);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(10, 36, 16, 0.45);
}
.dialog::backdrop {
  background: rgba(12, 30, 16, 0.62);
}
.dialog-records {
  width: min(66rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
}
.dialog-form {
  display: grid;
  gap: 0.9rem;
  padding: 1.25rem 1.5rem;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.dialog-title {
  font-size: 1.5rem;
  font-weight: 750;
}
.dialog-lead {
  color: var(--ink-soft);
  max-width: 70ch;
}
.dialog-body {
  display: grid;
  gap: 0.7rem;
  white-space: pre-line;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}
.lock-user {
  color: var(--ink-soft);
}
.review-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.choice input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
}
.review-summary {
  font-weight: 650;
}
.review-notice {
  min-height: 1.4em;
  color: var(--brand-dark);
  font-weight: 650;
}
.table-wrap {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
.records-table {
  width: 100%;
  border-collapse: collapse;
}
.records-table th {
  position: sticky;
  top: 0;
  padding: 0.5rem 0.75rem;
  background: #e9f0e9;
  border-bottom: 2px solid var(--rule-strong);
  text-align: left;
}
.records-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.records-table tr.is-problem td:first-child {
  border-left: 5px solid var(--bad);
}
/* a table cell must stay a table cell (a flex <td> stops stretching to the row and breaks the row's lines): the buttons wrap like words */
.cell-actions .btn {
  margin: 0 0.4rem 0.4rem 0;
  vertical-align: top;
}
.state-title {
  display: block;
  font-weight: 700;
}
.state-title[data-state='confirmed'] {
  color: var(--ok);
}
.state-title[data-state='failed'],
.state-title[data-state='unknown'],
.state-title[data-state='rejected'] {
  color: var(--bad);
}
.state-detail,
.state-seen {
  display: block;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ── the slip: what is shown on screen and what is printed ──────────────────────────────────────────── */
/* the tray the paper comes out into */
.slip-area {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  width: calc(80mm + 2rem);
  padding: 0.75rem 1rem 1rem;
  background: #e4ece4;
  border-radius: var(--r-panel);
}
.slip-area-title {
  font-size: 1.15rem;
  font-weight: 750;
}
.slip-message {
  color: var(--bad);
  font-weight: 650;
}
.slip-actions {
  display: flex;
  gap: 0.5rem;
}
.slip-paper {
  display: flex;
  justify-content: center;
  padding-bottom: 0.5rem;
  filter: drop-shadow(0 1px 1px rgba(10, 36, 16, 0.45)) drop-shadow(0 6px 8px rgba(10, 36, 16, 0.18));
}
.slip {
  width: 80mm;
  padding: 4mm 4mm 8mm;
  background: #ffffff;
  color: #000000;
  font-family: var(--font);
  font-size: 10pt;
  line-height: 1.25;
  text-align: center;
}
/* the serrated tear edge of thermal paper (screen only) */
.slip-paper .slip {
  width: min(80mm, 100%); /* the paper is 80 mm wide on the roll, but on the screen never wider than the screen */
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%;
}
.slip-feed {
  animation: slip-feed 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes slip-feed {
  from {
    clip-path: inset(0 0 100% 0);
    transform: translateY(-1rem);
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: none;
  }
}
.slip-title {
  font-size: 11pt;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.slip-reprint {
  display: inline-block;
  margin-top: 1mm;
  padding: 0.3mm 3mm;
  border: 0.4mm solid #000000;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.slip-rule {
  height: 0;
  margin: 2.5mm 0;
  border: 0;
  border-top: 0.3mm dashed #000000;
}
.slip-rule-strong {
  border-top: 0.6mm solid #000000;
}
.slip-fields {
  text-align: left;
}
.slip-label {
  margin-top: 1.5mm;
  font-size: 8pt;
  font-weight: 650;
}
.slip-value {
  font-size: 11pt;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.slip-name {
  font-size: 13pt;
  font-weight: 800;
}
.slip-code-field {
  font-family: var(--font-mono);
  font-size: 12pt;
}
.slip-scan {
  margin: 2mm 0 1.5mm;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.slip-qr {
  display: flex;
  justify-content: center;
}
.slip-qr svg {
  display: block;
  width: 50mm;
  height: 50mm;
}
.slip-code {
  margin-top: 1mm;
  font-family: var(--font-mono);
  font-size: 12pt;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.slip-issued,
.slip-keep {
  font-size: 8.5pt;
}

/* ── smaller screens ────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 62rem) {
  #app {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .desk,
  .desk-grid,
  .search,
  .detail {
    min-height: auto;
    overflow: visible;
  }
  .desk-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .results {
    max-height: 22rem;
  }
  .detail.has-slip {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail > .slip-area {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
  .recent {
    grid-template-columns: minmax(0, 1fr);
  }
  .recent-head,
  .recent-empty,
  .recent-list {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 36rem) {
  html {
    font-size: 100%;
  }
  .desk {
    padding: 0.5rem;
  }
  .detail {
    padding: 1rem;
  }
  .detail-name {
    font-size: 1.6rem;
  }
  .slip-area {
    width: 100%;
  }
  .dialog-form {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slip-feed {
    animation: none;
  }
  .btn:active:not(:disabled) {
    transform: none;
  }
}

/* ── printing: only the slip ───────────────────────────────────────────────────────────────────────── */
/* The PAPER SIZE belongs to the printer: choose the 80 mm roll in the printer's own settings (README, "Printing the slip").
 * Do not declare one here: "@page { size: 80mm auto }" is not valid CSS and Chrome / Edge silently ignore it (measured), and
 * a fixed height would feed blank paper or split a long slip. What this file does fix is that there is no margin (so no
 * header or footer with the address of this page can be printed) and that the slip is as wide as the paper, up to 80 mm: a
 * printer whose printable width is narrower than 80 mm then does not shrink the whole slip - and with it the QR. */
@page {
  margin: 0;
}
@media print {
  html,
  body {
    height: auto;
    margin: 0;
    padding: 0;
    background: #ffffff;
  }
  #app {
    display: none !important;
  }
  #print-root {
    display: block !important;
  }
  #print-root .slip {
    width: 100%;
    max-width: 80mm;
    padding: 3mm 4mm 6mm;
    margin: 0;
    animation: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  #print-root .slip-qr svg {
    width: min(50mm, 100%);
    height: auto;
    aspect-ratio: 1;
  }
}
