/* drop: cover sheets on a steel desk.
   Pre-printed form text is Archivo; everything filled in is typed in Courier Prime. */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  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: 'Archivo';
  src: url('/fonts/archivo-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  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: 'Courier Prime';
  src: url('/fonts/courier-prime-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('/fonts/courier-prime-bold-latin.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('/fonts/courier-prime-italic-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --desk: #23272a;
  --desk-raised: #2d3236;
  --desk-ink: #d3d7da;
  --desk-dim: #9aa2a8;

  --bond: #f4f5f2;
  --bond-shade: #e8eae5;
  --ink: #1b1d1f;
  --ink-2: #474d52;
  --ink-3: #62686d;
  --rule: #b9bdbd;

  --once: #e8622a;
  --limited: #c0282d;
  --open: #2c4f9e;
  --sealed: #3d4349;
  --void: #6d6f70;

  --stamp-red: #b8262b;
  --stamp-violet: #473c9c;
  --manila: #cdb57f;
  --manila-deep: #b89d62;

  --band: var(--open);
  --band-ink: #f4f5f2;
  --band-size: 28px;

  --form: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --typed: 'Courier Prime', 'Courier New', ui-monospace, monospace;

  --press: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

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

html {
  background: var(--desk);
  scrollbar-color: #4a5156 var(--desk);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--form);
  font-size: 16px;
  line-height: 1.5;
  color: var(--desk-ink);
  background:
    radial-gradient(120% 70% at 50% 0%, #2b3034 0%, transparent 70%),
    var(--desk);
  caret-color: var(--stamp-violet);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--manila); color: var(--ink); }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--stamp-violet);
  outline-offset: 2px;
}
.masthead :focus-visible, .desk-button:focus-visible { outline-color: var(--manila); }

/* Desk --------------------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 0;
}
.wordmark {
  font-weight: 850;
  font-stretch: 62%;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--bond);
  text-decoration: none;
}
.masthead-note {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--desk-dim);
}
.desk-button {
  margin-left: auto;
  font: 600 13px/1 var(--form);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--desk-ink);
  background: none;
  border: 1px solid #4a5156;
  border-radius: 2px;
  padding: 8px 12px;
  cursor: pointer;
}
.desk-button:hover { border-color: var(--desk-dim); color: var(--bond); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* Sheets ------------------------------------------------------------------- */

.sheet {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  padding: var(--band-size);
  background: var(--band);
  color: var(--ink);
  border-radius: 2px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 2px 3px rgba(0, 0, 0, 0.35),
    0 24px 48px -18px rgba(0, 0, 0, 0.6);
  transition: background-color 420ms var(--press);
}
.sheet[data-band='once'] { --band: var(--once); --band-ink: var(--ink); }
.sheet[data-band='limited'] { --band: var(--limited); --band-ink: var(--bond); }
.sheet[data-band='open'] { --band: var(--open); --band-ink: var(--bond); }
.sheet[data-band='sealed'] { --band: var(--sealed); --band-ink: var(--bond); }
.sheet[data-band='void'] { --band: var(--void); --band-ink: var(--bond); }
.sheet[data-band='none'] { --band: var(--bond); padding: 0; }

.band-legend {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  height: var(--band-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 800;
  font-stretch: 75%;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--band-ink);
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
.band-legend.top { top: 0; }
.band-legend.bottom { bottom: 0; }

.sheet-body {
  position: relative;
  background: var(--bond);
  padding: 34px 44px 30px;
  min-height: 200px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.sheet[data-band='none'] .sheet-body { box-shadow: none; }

.sheet-title,
.page-title {
  margin: 0;
  padding-right: 190px;
  font-size: clamp(34px, 5.4vw, 54px);
  line-height: 0.96;
  font-weight: 820;
  font-stretch: 62%;
  letter-spacing: 0.004em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.page-title { font-size: 30px; }

.typed {
  font-family: var(--typed);
  font-variant-numeric: tabular-nums;
}
.issued {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--ink-2);
}

.lede {
  margin: 0 0 16px;
  max-width: 60ch;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink);
}

/* Form cells --------------------------------------------------------------- */

.cells {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 26px 0 0;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.cells > .cell {
  margin: 0;
  padding: 9px 12px 11px;
  min-width: 0;
  border-right: 1px solid var(--rule);
}
.cells > .cell:first-child { padding-left: 0; }
.cells > .cell:last-child { border-right: 0; }
.cells dd { margin: 3px 0 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }

.cell-label {
  display: block;
  padding: 0;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 650;
  font-stretch: 88%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.cell-hint {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-3);
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset > legend.cell-label { float: left; width: 100%; margin-bottom: 8px; }
fieldset > legend.cell-label + * { clear: left; }

.field {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 0 5px;
  font: 17px/1.3 var(--typed);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}
.field::placeholder { color: var(--ink-3); opacity: 1; }
.field:focus { outline: none; border-bottom: 2px solid var(--stamp-violet); padding-bottom: 4px; }

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin-top: 26px;
}
.form-row .grow { flex: 1; }

/* Buttons ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  font: 700 13.5px/1 var(--form);
  font-stretch: 88%;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--bond);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  transition: background-color 140ms, color 140ms, box-shadow 140ms, transform 140ms var(--press);
  white-space: nowrap;
}
.button:hover { background: var(--bond-shade); }
.button:active { transform: translateY(1px); }
.button.primary { color: var(--bond); background: var(--ink); }
.button.primary:hover { background: #33373a; }
.button.big { min-height: 48px; padding: 12px 22px; font-size: 15px; }
.button.quiet { border-color: transparent; background: transparent; padding-left: 8px; padding-right: 8px; }
.button.quiet:hover { background: var(--bond-shade); }
.button.danger { color: var(--stamp-red); }
.button.primary.danger { color: var(--bond); background: var(--stamp-red); border-color: var(--stamp-red); }
.button.primary.danger:hover { background: #9e1f24; }
.button.icon-only { padding: 8px; min-width: 40px; }
.button[disabled], .button[aria-busy='true'] { opacity: 0.55; cursor: progress; }
.button[disabled] { cursor: not-allowed; }
.button:has(input:focus-visible) { outline: 2px solid var(--stamp-violet); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Stamps ------------------------------------------------------------------- */

.stamp-slot {
  position: absolute;
  top: 26px;
  right: 34px;
  z-index: 3;
  pointer-events: none;
}
.stamp {
  --r: -7deg;
  display: inline-block;
  padding: 7px 14px 6px;
  font-size: 22px;
  line-height: 1;
  font-weight: 850;
  font-stretch: 70%;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp-red);
  border: 3px solid currentColor;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--bond), inset 0 0 0 3.5px currentColor;
  transform: rotate(var(--r));
  mix-blend-mode: multiply;
  -webkit-mask-image: url('/img/ink.svg');
  mask-image: url('/img/ink.svg');
  -webkit-mask-size: 170px;
  mask-size: 170px;
  white-space: nowrap;
}
.stamp.violet { color: var(--stamp-violet); }
.stamp small { display: block; margin-top: 4px; font-size: 10.5px; letter-spacing: 0.16em; font-weight: 700; }
.stamp.pressed { animation: press 420ms var(--press) both; }
@keyframes press {
  0% { transform: rotate(var(--r)) scale(1.25); opacity: 0; filter: blur(3px); }
  55% { opacity: 1; filter: blur(0); }
  100% { transform: rotate(var(--r)) scale(1); opacity: 1; filter: none; }
}
.sheet.thud { animation: thud 320ms var(--press); }
@keyframes thud {
  0% { transform: none; }
  30% { transform: translateY(2px) scale(0.997); }
  100% { transform: none; }
}

/* Compose ------------------------------------------------------------------ */

.bench {
  display: grid;
  grid-template-columns: minmax(0, 780px) 330px;
  justify-content: center;
  align-items: start;
  gap: 28px;
}
.bench #compose { margin: 0; width: 100%; }
.bench:not(:has(#result:not([hidden]))) { grid-template-columns: minmax(0, 780px); }

.title-line { display: block; padding-right: 190px; }
.title-field {
  width: 100%;
  padding: 0 0 4px;
  font: 820 clamp(34px, 5.4vw, 54px)/1 var(--form);
  font-stretch: 62%;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
}
.title-field::placeholder { color: var(--ink-3); opacity: 1; }
.title-field:hover { border-bottom-color: var(--rule); }
.title-field:focus { outline: none; border-bottom: 1px solid var(--stamp-violet); }

.enclosures { margin-top: 26px; padding-top: 10px; border-top: 1.5px solid var(--ink); }

.switch {
  display: inline-flex;
  margin: 2px 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
}
.switch-option { position: relative; cursor: pointer; }
.switch-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-option span {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  font-stretch: 88%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.switch-option + .switch-option span { border-left: 1.5px solid var(--ink); }
.switch-option input:checked + span { background: var(--ink); color: var(--bond); }
.switch-option input:focus-visible + span { outline: 2px solid var(--stamp-violet); outline-offset: 2px; }

.drop-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 22px 20px;
  background: var(--bond-shade);
  border: 1px solid var(--rule);
}
.drop-lead {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  font-stretch: 88%;
  color: var(--ink);
}
.drop-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* A drag answers on the sheet itself: the band legend changes and a solid ink rule frames the form. */
#compose.dragging .sheet-body { box-shadow: inset 0 0 0 3px var(--ink); }

.manifest {
  list-style: none;
  margin: 0;
  padding: 0;
}
#picked { margin-top: 12px; max-height: 320px; overflow: auto; border-top: 1px solid var(--rule); }
.manifest-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.manifest-row .icon { color: var(--ink-2); }
.manifest-path {
  font-family: var(--typed);
  font-size: 15.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.manifest-path .dir { color: var(--ink-3); }
.manifest-size {
  font-family: var(--typed);
  font-size: 15px;
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
}
.manifest-row .button { min-height: 34px; padding: 6px 10px; }
.manifest-total { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-2); text-align: right; }

textarea.ruled {
  display: block;
  width: 100%;
  min-height: 190px;
  padding: 2px 4px 2px 22px;
  resize: vertical;
  font: 17px/30px var(--typed);
  color: var(--ink);
  background:
    linear-gradient(to right, transparent 10px, rgba(192, 40, 45, 0.5) 10px 11px, transparent 11px) 0 0 / 100% 100% no-repeat local,
    linear-gradient(to bottom, transparent 29px, #c5d1e3 29px, #c5d1e3 30px) 0 1px / 100% 30px local,
    var(--bond);
  border: 0;
  border-radius: 0;
}
textarea.ruled::placeholder { color: var(--ink-3); opacity: 1; }
textarea.ruled:focus { outline: none; box-shadow: 0 0 0 2px var(--stamp-violet); }

.compose-cells { grid-template-columns: 1fr 1fr 1.25fr; margin-top: 22px; }
.compose-cells > .cell { padding-top: 11px; padding-bottom: 14px; }

.boxes { display: grid; gap: 7px; }
.box { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; line-height: 1.25; }
.box input { position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.box span::before {
  content: '';
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  margin-right: 10px;
  vertical-align: -3px;
  border: 1.5px solid var(--ink);
  background: var(--bond);
}
.box input:checked + span::before {
  background:
    linear-gradient(45deg, transparent 44%, var(--ink) 44% 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--ink) 44% 56%, transparent 56%),
    var(--bond);
}
.box input:checked + span { font-weight: 650; }
.box input:focus-visible + span::before { outline: 2px solid var(--stamp-violet); outline-offset: 2px; }

.seal-row { display: flex; align-items: flex-end; gap: 8px; }
.seal-row .field { flex: 1; }

.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-top: 24px;
}
.foot-note {
  margin: 0;
  max-width: 44ch;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
}
.recv-note { margin-top: 26px; max-width: 64ch; }

.notice { margin: 14px 0 0; font-size: 15px; line-height: 1.45; }
.notice:empty { display: none; }
.notice.error { color: var(--stamp-red); font-weight: 600; }

/* Routing slip ------------------------------------------------------------- */

.slip.receipt {
  position: sticky;
  top: 20px;
  padding: 24px 22px 20px;
  color: var(--ink);
  background: var(--bond);
  border-radius: 2px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35), 0 18px 36px -16px rgba(0, 0, 0, 0.6);
  rotate: 0.6deg;
  animation: slip-in 520ms var(--press) both;
}
.slip.receipt::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 28px;
  width: 16px;
  height: 36px;
  border: 2.5px solid #8b9196;
  border-radius: 8px;
}
/* One animation for every layout, so crossing a breakpoint never replays it. */
@keyframes slip-in {
  from { translate: -40px 0; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}
.receipt .stamp-slot { top: 14px; right: 14px; }
.receipt .stamp { font-size: 17px; padding: 5px 10px 4px; }
.slip-title {
  margin: 0;
  font-size: 22px;
  font-weight: 820;
  font-stretch: 62%;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.receipt-name { margin: 4px 0 14px; padding-right: 96px; font-size: 14.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.receipt > .cell { padding: 10px 0 12px; border-top: 1px solid var(--ink); }
.link {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
}
.receipt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.receipt-actions .button { flex: 1 1 auto; }
#up-status { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
#up-status[data-state='done'] { color: var(--ink); font-weight: 700; }
#up-status[data-state='failed'] { color: var(--stamp-red); font-weight: 700; }
#abort { margin-top: 6px; }

/* Gauges: exact byte proportion. Hatched = arrived at the server, solid = here. */
.gauge {
  position: relative;
  height: 10px;
  margin-top: 6px;
  background: var(--bond-shade);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.gauge-fill,
.gauge-arrived {
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 260ms linear;
}
.gauge-fill { background: var(--ink); }
.gauge-arrived {
  background: repeating-linear-gradient(-45deg, var(--ink-3) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px var(--ink-3);
}

/* Register ----------------------------------------------------------------- */

.register { max-width: 1138px; margin: 56px auto 0; }
.folder-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-left: 22px;
  padding: 10px 22px 8px;
  color: var(--ink);
  background: var(--manila);
  border-radius: 8px 8px 0 0;
}
.folder-tab h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 820;
  font-stretch: 62%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.folder-tab .typed { font-size: 13.5px; color: #4b412a; }
.folder {
  padding: 16px;
  background: var(--manila);
  border-radius: 2px 6px 6px 6px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35), 0 24px 48px -20px rgba(0, 0, 0, 0.6);
}
.register-empty {
  margin: 0;
  padding: 28px 24px;
  font-size: 16px;
  color: var(--ink);
  background: var(--bond);
}
.register-foot { margin: 12px 4px 0; font-size: 13.5px; color: #4b412a; }
.register-foot:empty { display: none; }
.folder .notice.error { margin: 10px 4px 0; }

.ledger {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  background: var(--bond);
  font-size: 15px;
}
.ledger th {
  padding: 10px 12px 8px;
  font-size: 11px;
  font-weight: 650;
  font-stretch: 88%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-2);
  border-bottom: 1.5px solid var(--ink);
}
.ledger td {
  padding: 12px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--rule);
}
.ledger tbody tr { transition: background-color 160ms, opacity 160ms; }
.ledger tbody:hover tr:not(:hover):not(:focus-within) { opacity: 0.72; }
.ledger tbody tr:hover, .ledger tbody tr:focus-within { background: #fbfbf9; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger .typed { font-size: 14.5px; }
.ledger-file { min-width: 180px; max-width: 320px; }
.ledger-file strong { display: block; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.ledger-file span { display: block; margin-top: 2px; font-family: var(--typed); font-size: 13.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.ledger-actions { white-space: nowrap; text-align: right; }
.ledger-actions .button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.ledger-actions .button + .button { margin-left: 4px; }
.ledger-state .gauge { width: 110px; height: 7px; }
.ledger-state .typed { display: block; font-size: 13.5px; }

.handling {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
  font-stretch: 80%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.handling::before {
  content: '';
  width: 14px;
  height: 18px;
  background: var(--band);
  box-shadow: inset 0 0 0 3px var(--band), inset 0 0 0 5px var(--bond);
}
.handling[data-band='once'] { --band: var(--once); }
.handling[data-band='limited'] { --band: var(--limited); }
.handling[data-band='open'] { --band: var(--open); }

.tag {
  display: inline-block;
  padding: 3px 7px 2px;
  font-size: 11.5px;
  font-weight: 800;
  font-stretch: 75%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}
.tag.red { color: var(--stamp-red); }
.tag.violet { color: var(--stamp-violet); }
.tag.ink { color: var(--ink-2); }

/* Recipient ---------------------------------------------------------------- */

.stack { position: relative; max-width: 780px; margin: 0 auto; }
.stack > .sheet { margin: 0; }

.remarks {
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.remarks:empty { display: none; }
.remarks[data-uploading='true'] { color: var(--ink); }

#files { margin-top: 18px; border-top: 1px solid var(--rule); }
#files .manifest-row { grid-template-columns: 20px minmax(0, 1fr) auto auto; padding: 11px 0; }
.row-meter { grid-column: 2 / 4; display: flex; align-items: center; gap: 10px; min-height: 0; }
.row-meter .gauge { margin: 0; height: 6px; flex: none; min-width: 6px; }
.row-meter .typed { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.row-meter .typed.done { color: var(--ink); font-weight: 700; }
.row-meter .typed.failed { color: var(--stamp-red); font-weight: 700; }

.gate {
  margin-top: 22px;
  padding: 20px 22px;
  background: var(--bond-shade);
  border: 1px solid var(--rule);
}
.gate.warn { border: 1.5px solid var(--stamp-red); }
.gate.warn .lede strong { color: var(--stamp-red); }
.gate .lede { margin-bottom: 18px; }

.confirm {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1.5px solid var(--stamp-red);
  background: #fbf1ef;
}
.confirm p { margin: 0 0 14px; max-width: 58ch; font-size: 15.5px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.unlock { margin-top: 26px; padding-top: 18px; border-top: 1.5px solid var(--ink); }
.unlock .form-row { margin-top: 6px; }
.unlock.shake { animation: shake 380ms var(--press); }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-8px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-3px); }
}

/* The message sits under the cover sheet, which lifts away on reveal. */
.page { box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35), 0 24px 48px -18px rgba(0, 0, 0, 0.6); }
.page .sheet-body { padding-top: 38px; }
.page-title { padding-right: 170px; }
.message {
  margin: 20px 0 0;
  padding: 2px 4px 0;
  min-height: 150px;
  font: 18px/30px var(--typed);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding-left: 22px;
  background:
    linear-gradient(to right, transparent 10px, rgba(192, 40, 45, 0.5) 10px 11px, transparent 11px) 0 0 / 100% 100% no-repeat,
    linear-gradient(to bottom, transparent 29px, #c5d1e3 29px, #c5d1e3 30px) 0 1px / 100% 30px;
}
.stack.lifting #cover {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 4;
  transform-origin: 20% 0%;
  animation: lift 820ms cubic-bezier(0.55, 0, 0.3, 1) forwards;
}
@keyframes lift {
  0% { transform: none; }
  25% { transform: translateY(-14px) rotate(-0.8deg); box-shadow: 0 40px 70px -20px rgba(0, 0, 0, 0.7); }
  100% { transform: translateY(-115vh) rotate(-7deg); opacity: 0.9; }
}

/* Certificates: no record, spent, destroyed, damaged ----------------------- */

#cover.certificate .sheet-title { padding-right: 230px; }
#cover.certificate .stamp { font-size: 30px; padding: 9px 16px 8px; }
#cover.certificate .unlock, #cover.certificate #contents { display: none; }

/* Owner sign-in slip ------------------------------------------------------- */

.slip { max-width: 560px; }
#login .sheet-title { padding-right: 0; font-size: clamp(34px, 5vw, 46px); }

/* Responsive --------------------------------------------------------------- */

@media (max-width: 1180px) {
  .bench { grid-template-columns: minmax(0, 780px); }
  .slip.receipt { position: relative; top: 0; rotate: none; }
  .bench #result { order: -1; }
}

@media (max-width: 900px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { position: relative; padding: 14px 14px 12px; border-bottom: 1px solid var(--rule); }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger td { padding: 3px 0; border: 0; }
  .ledger-file { max-width: none; }
  .ledger td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 7.5em;
    font: 650 11px/1 var(--form);
    font-stretch: 88%;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .ledger-state .gauge { display: inline-block; vertical-align: middle; }
  .ledger-actions { text-align: left; padding-top: 10px !important; white-space: normal; }
  .ledger tbody:hover tr:not(:hover):not(:focus-within) { opacity: 1; }
}

@media (max-width: 640px) {
  :root { --band-size: 20px; }
  .masthead { padding: 16px 16px 0; }
  .masthead-note { display: none; }
  main { padding: 18px 10px 56px; }
  .band-legend { font-size: 9.5px; letter-spacing: 0.16em; }
  .sheet-body { padding: 24px 18px 22px; }
  .sheet-title, .title-line, .page-title { padding-right: 0; }
  .stamp-slot { position: static; margin: 0 0 14px; }
  #cover.certificate .sheet-title { padding-right: 0; }
  .cells { grid-template-columns: 1fr 1fr; }
  .cells > .cell:nth-child(2n) { border-right: 0; }
  .cells > .cell:nth-child(2n + 1) { padding-left: 0; }
  .cells > .cell:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
  .compose-cells { grid-template-columns: 1fr 1fr; }
  .compose-cells > .seal-cell { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-left: 0; }
  .compose-cells > .cell:nth-child(-n + 2) { border-bottom: 0; }
  .form-row { flex-direction: column; align-items: stretch; }
  .drop-zone { padding: 16px 14px; }
  .drop-actions, .drop-actions .button { width: 100%; }
  .sheet-foot { flex-direction: column-reverse; align-items: stretch; }
  .sheet-foot .button { width: 100%; }
  #files .manifest-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  #files .manifest-row .manifest-size { grid-column: 3; grid-row: 1; }
  #files .manifest-row .button { grid-column: 2 / 4; justify-self: start; }
  .row-meter { grid-column: 2 / 4; }
  .register { margin-top: 40px; }
  .folder { padding: 8px; }
  .folder-tab { margin-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

#cover.certificate #error {
  margin-top: 22px;
  padding-top: 16px;
  max-width: 60ch;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  border-top: 1.5px solid var(--ink);
}

/* Fixes from the first inspection round ------------------------------------ */

.bench, .bench:not(:has(#result:not([hidden]))) { grid-template-columns: minmax(0, 780px) 330px; }

.compose-cells { grid-template-columns: 0.9fr 0.9fr 1.35fr; }
#pw { font-size: 16px; }
.cells dd small { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.sheet-title.is-name { text-transform: none; letter-spacing: 0; }
.ledger td.typed, .ledger .tag { white-space: nowrap; }

@media (max-width: 1180px) {
  .bench, .bench:not(:has(#result:not([hidden]))) { grid-template-columns: minmax(0, 780px); }
  #tray { display: none; }
}
@media (max-width: 900px) {
  .ledger td[data-label]::before { min-width: 9.5em; margin-right: 6px; }
  .ledger td.typed { white-space: normal; }
}
@media (max-width: 640px) {
  #files .manifest-row .row-meter { grid-row: 2; }
  #files .manifest-row .button { grid-row: 3; margin-top: 4px; }
}

/* Finish review fixes --------------------------------------------------------- */

.printed { font-family: var(--form); }
.issued.printed { font-size: 15.5px; }

/* The empty right column holds a blank routing slip rather than a note. */
.slip.receipt.blank { animation: none; rotate: -0.4deg; background: #e3e5e0; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); }
.slip.receipt.blank::before { display: none; }
.slip.receipt.blank .slip-title { color: var(--ink-3); }
.slip.receipt.blank .receipt-name { padding-right: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.blank-line { height: 22px; margin: 0; border-bottom: 1px solid var(--rule); }
.slip.receipt.blank .gauge { background: transparent; }

/* The read-once warning is a printed handling clause, not an alert box. */
.gate { background: transparent; border: 0; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 12px 0 20px; }
.gate .cell-label { margin-bottom: 8px; }
.gate.warn { border: 0; border-top: 1.5px solid var(--stamp-red); border-bottom: 1px solid var(--stamp-red); }
.gate.warn .cell-label { color: var(--stamp-red); }

/* Recipient rows: every track is the full row, labelled in every state. */
.row-meter { min-width: 0; }
.row-meter .gauge { flex: 1 1 auto; min-width: 40px; max-width: 360px; }
.row-meter .typed { flex: none; }

/* Register state stamps, in the same ink as the sheet stamps. */
.mini-stamp {
  display: inline-block;
  padding: 4px 8px 3px;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  font-stretch: 70%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--stamp-violet);
  border: 2px solid currentColor;
  border-radius: 3px;
  rotate: -3deg;
  mix-blend-mode: multiply;
  -webkit-mask-image: url('/img/ink.svg');
  mask-image: url('/img/ink.svg');
  -webkit-mask-size: 120px;
  mask-size: 120px;
}
.mini-stamp.red { color: var(--stamp-red); }
.mini-stamp.faint { color: var(--ink-2); }
.handling[data-band='void'] { --band: var(--void); color: var(--ink-2); }
.handling[data-band='void']::before {
  background: linear-gradient(to top right, transparent 45%, var(--void) 45% 55%, transparent 55%), var(--bond);
  box-shadow: inset 0 0 0 2px var(--void);
}
.register-foot .typed { color: var(--ink); }

@media (max-width: 520px) {
  .compose-cells { grid-template-columns: 1fr; }
  .compose-cells > .cell { border-right: 0; padding-left: 0; border-bottom: 1px solid var(--rule); }
  .compose-cells > .cell:last-child { border-bottom: 0; }
  .compose-cells > .seal-cell { border-top: 0; }
  .compose-cells .boxes { grid-template-columns: 1fr 1fr; }
}
/* Small stamps keep a base coat of ink under the wear so the words stay legible. */
.mini-stamp {
  -webkit-mask-image: url('/img/ink.svg'), linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.62));
  mask-image: url('/img/ink.svg'), linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.62));
  -webkit-mask-size: 160px, 100% 100%;
  mask-size: 160px, 100% 100%;
  -webkit-mask-composite: source-over;
  mask-composite: add;
}
/* Handling clauses (read-once warning, destroy order) are printed between rules, labels in the usual ink. */
.gate.warn .cell-label { color: var(--ink-2); }
.confirm { background: transparent; border: 0; border-top: 1.5px solid var(--stamp-red); border-bottom: 1px solid var(--stamp-red); padding: 14px 0 16px; }

/* Copy may carry a deliberate line break between two short sentences. */
.notice, .lede, .remarks, .foot-note, .cell-hint, .register-empty, #up-status, .confirm p { white-space: pre-line; }
.issued:empty { display: none; }

/* Site footer on the desk, linking back to nocfa.net. */
main { padding-bottom: 40px; }
.site-foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 36px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.site-foot a {
  color: var(--desk-dim);
  text-decoration: underline;
  text-decoration-color: #4a5156;
  text-underline-offset: 3px;
}
.site-foot a:hover { color: var(--bond); text-decoration-color: var(--desk-dim); }
.site-foot a:focus-visible { outline-color: var(--manila); }
