/* ==========================================================================
   THE EXCHANGE — Central 4-1200
   A team task inbox run as a 1920s manual telephone switchboard.
   ========================================================================== */

/* --- Faces (self-hosted, SIL OFL — see public/assets/*-OFL.txt) ----------- */
@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Oxblood-enamel console, aged brass, ivory enamel, document paper. */
  --bg: #150a09;
  --console: #2a1310;
  --console-hi: #391b16;
  --console-lo: #1d0d0c;
  --cavity: #1a0c0b;
  --plate-line: #542a20;
  --plate-edge: #6b3826;

  --brass: #bf8c3f;
  --brass-hi: #e8be72;
  --brass-lo: #7c5721;
  --brass-ink: #3a260b;

  --ivory: #f2e6cb;
  --ivory-2: #d9c7a2;
  --muted: #b39a72;
  --muted-2: #a08a63;

  --ink-on-paper: #2c1d12;
  --paper: #f3ead6;
  --paper-2: #e7dabf;
  --paper-line: #cbb894;

  --lamp-todo: #f5a93a;
  --lamp-in-progress: #64c47c;
  --lamp-blocked: #f2563f;
  --lamp-done: #a99b83;

  --focus: #ffd77a;
  --radius: 3px;
  --line-grid: 30px 58px minmax(0, 1fr) 58px;
  --shadow-ticket: 0 26px 60px -18px rgba(0, 0, 0, 0.85), 0 2px 0 rgba(255, 255, 255, 0.06) inset;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(191, 140, 63, 0.1), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(0, 0, 0, 0.6), transparent 70%);
  color: var(--ivory);
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-weight: 600;
  text-wrap: balance;
}

/* Themed scrollbars — a browser surface that should carry the design. */
* {
  scrollbar-color: var(--brass-lo) transparent;
}
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
*::-webkit-scrollbar-track {
  background: var(--cavity);
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--brass), var(--brass-lo));
  border: 3px solid var(--cavity);
  border-radius: 99px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  background: var(--brass-hi);
  color: var(--brass-ink);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms var(--ease);
}
.skip-link:focus {
  transform: translateY(0);
}

/* ==========================================================================
   Console / header
   ========================================================================== */
.exchange {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 0;
}

.console {
  position: relative;
  border-radius: 10px 10px 4px 4px;
  background:
    linear-gradient(180deg, var(--console-hi), var(--console) 30%, var(--console-lo));
  border: 1px solid var(--plate-line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 -18px 40px -20px rgba(0, 0, 0, 0.9) inset,
    0 22px 50px -30px rgba(0, 0, 0, 0.9);
  padding: clamp(16px, 2.4vw, 24px);
  overflow: hidden;
}

/* Enamel speckle + corner screws, drawn not fetched. */
.console::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.05) 0.8px, transparent 1.1px),
    radial-gradient(circle at 38px 26px, rgba(0, 0, 0, 0.14) 0.8px, transparent 1.2px);
  background-size: 46px 40px, 58px 54px;
  opacity: 0.5;
  mix-blend-mode: overlay;
}
.console::after {
  content: "";
  position: absolute;
  inset: 7px 7px auto 7px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 190, 114, 0.35), transparent);
}

.console__plate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.dial {
  width: 54px;
  height: 54px;
  flex: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}
.dial__rim {
  fill: none;
  stroke: var(--brass);
  stroke-width: 2;
}
.dial__face {
  fill: var(--cavity);
  stroke: var(--brass-lo);
  stroke-width: 1.4;
}
.dial__hub {
  fill: var(--brass-lo);
  stroke: var(--brass-hi);
  stroke-width: 1;
}
.dial__holes circle {
  fill: var(--console-hi);
  stroke: var(--brass);
  stroke-width: 0.8;
}
.dial__stop {
  stroke: var(--brass-hi);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.brand__name {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ivory);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
.brand__sub {
  margin: 2px 0 0;
  font-family: "Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Tally lamps */
.tally {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tally__item {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 9px;
  border: 1px solid var(--plate-line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--console-lo), var(--cavity));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 120ms var(--ease);
}
.tally__item:hover {
  border-color: var(--plate-edge);
}
.tally__item:active {
  transform: translateY(1px);
}
.tally__item[aria-pressed="true"] {
  border-color: var(--brass);
  background: linear-gradient(180deg, rgba(191, 140, 63, 0.24), rgba(191, 140, 63, 0.05));
  box-shadow: 0 0 0 3px rgba(191, 140, 63, 0.16), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
.tally__item .lamp {
  grid-row: 1;
}
.tally__label {
  font-family: "Oswald", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tally__count {
  grid-column: 2;
  font-family: "Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ivory-2);
  font-variant-numeric: tabular-nums;
}

/* Shift clock */
.shift {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border: 1px solid var(--plate-line);
  border-radius: var(--radius);
  background: var(--cavity);
}
.shift__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lamp-in-progress);
  box-shadow: 0 0 10px 1px rgba(100, 196, 124, 0.7);
  animation: pulse 2.4s var(--ease) infinite;
}
.shift__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.shift__label {
  font-family: "Oswald", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.shift__clock {
  font-family: "Plex Mono", monospace;
  font-size: 0.86rem;
  color: var(--ivory-2);
  font-variant-numeric: tabular-nums;
}

/* --- Controls strip ------------------------------------------------------ */
.console__controls {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--plate-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px auto;
  align-items: end;
  gap: 16px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.field__label,
.patch__lead {
  font-family: "Oswald", sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field__icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--brass-lo);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
  transition: stroke 160ms var(--ease);
}
.field__wrap:focus-within .field__icon {
  stroke: var(--brass-hi);
}

input[type="search"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius);
  border: 1px solid var(--plate-line);
  background: var(--cavity);
  color: var(--ivory);
  font: inherit;
  font-size: 1rem;
  box-shadow: 0 2px 10px -6px rgba(0, 0, 0, 0.9) inset;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input[type="search"]::placeholder {
  color: var(--muted-2);
}
input[type="search"]:hover {
  border-color: var(--plate-edge);
}
input[type="search"]:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(191, 140, 63, 0.22), 0 2px 10px -6px rgba(0, 0, 0, 0.9) inset;
}

/* Native select, dressed as a brass selector. */
.select-shell {
  position: relative;
  display: flex;
  align-items: center;
}
.select-shell--patch {
  flex: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 50px;
  padding: 12px 44px 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--plate-line);
  background: var(--cavity);
  color: var(--ivory);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 10px -6px rgba(0, 0, 0, 0.9) inset;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
select:hover {
  border-color: var(--plate-edge);
}
select:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(191, 140, 63, 0.22), 0 2px 10px -6px rgba(0, 0, 0, 0.9) inset;
}
select option {
  background: var(--console);
  color: var(--ivory);
}
.select-shell__chevron {
  position: absolute;
  right: 15px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.results {
  margin: 0;
  align-self: center;
  font-family: "Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}

/* ==========================================================================
   The line bank
   ========================================================================== */
.board {
  position: relative;
  flex: 1;
  margin-top: 20px;
  border-radius: 6px 6px 3px 3px;
  border: 1px solid var(--plate-line);
  background:
    linear-gradient(180deg, var(--console-lo), var(--bg) 22%, var(--bg));
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.95) inset;
  padding: 0 0 26px;
  overflow: hidden;
}

.board__head {
  display: grid;
  grid-template-columns: var(--line-grid);
  gap: 0 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--plate-line);
  background: linear-gradient(180deg, rgba(191, 140, 63, 0.06), transparent);
  font-family: "Oswald", sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.board__head span:first-child {
  grid-column: 2 / 3;
}
.board__head span:last-child {
  grid-column: 3 / 4;
}

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Each task is a jack strip on the board. */
.line {
  position: relative;
  display: grid;
  grid-template-columns: var(--line-grid);
  align-items: center;
  gap: 0 14px;
  padding: 15px 18px 15px 18px;
  border-bottom: 1px solid rgba(84, 42, 32, 0.55);
  cursor: pointer;
  transition: background 180ms var(--ease);
}
/* Brass busbar the lamps tap into. */
.line::before {
  content: "";
  position: absolute;
  left: 33px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--brass-lo), rgba(191, 140, 63, 0.25));
  opacity: 0.5;
  pointer-events: none;
}
.line:first-child::before {
  top: 50%;
}
.line:last-child::before {
  bottom: 50%;
}
.line:hover {
  background: linear-gradient(90deg, rgba(191, 140, 63, 0.09), rgba(191, 140, 63, 0.02) 60%, transparent);
}
.line[data-open="true"] {
  background: linear-gradient(90deg, rgba(191, 140, 63, 0.16), rgba(191, 140, 63, 0.03) 60%, transparent);
  box-shadow: inset 0 0 0 1px rgba(232, 190, 114, 0.4);
}

.lineno {
  grid-column: 2;
  font-family: "Plex Mono", monospace;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}

.line-main {
  grid-column: 3;
  min-width: 0;
}
.line-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ivory);
  overflow-wrap: anywhere;
}
.meta {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.8rem;
  color: var(--muted);
}
.meta .dot {
  color: var(--muted-2);
}
.meta .assignee {
  color: var(--ivory-2);
  font-weight: 500;
}
.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  font-family: "Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--plate-line);
  border-radius: 2px;
  padding: 1px 6px;
  background: rgba(0, 0, 0, 0.25);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Oswald", sans-serif;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--lamp-done);
}
.status-chip[data-status="todo"] {
  color: var(--lamp-todo);
}
.status-chip[data-status="in-progress"] {
  color: var(--lamp-in-progress);
}
.status-chip[data-status="blocked"] {
  color: var(--lamp-blocked);
}
.status-chip[data-status="done"] {
  color: var(--lamp-done);
}

/* The plug — the accessible open control. */
.plug {
  grid-column: 4;
  justify-self: end;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 56px;
  min-height: 56px;
  padding: 6px;
  border: 1px solid var(--plate-edge);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--console-hi), var(--cavity));
  color: var(--brass);
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}
.plug svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plug__text {
  font-family: "Oswald", sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.plug:hover {
  color: var(--brass-hi);
  border-color: var(--brass);
}
.plug:hover .plug__text {
  color: var(--ivory-2);
}
.plug:active {
  transform: translateY(1px);
}
.line[data-open="true"] .plug {
  color: var(--brass-hi);
  border-color: var(--brass-hi);
  box-shadow: 0 0 0 3px rgba(232, 190, 114, 0.18);
}

/* Lamps */
.lamp {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  justify-self: center;
  background: var(--lamp-done);
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 1px 2px rgba(0, 0, 0, 0.7);
  position: relative;
}
.lamp--lg {
  width: 11px;
  height: 11px;
}
.lamp[data-status="todo"] {
  background: radial-gradient(circle at 35% 30%, #ffd98e, var(--lamp-todo) 60%);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 0 9px 1px rgba(245, 169, 58, 0.6);
}
.lamp[data-status="in-progress"] {
  background: radial-gradient(circle at 35% 30%, #c8f2cf, var(--lamp-in-progress) 60%);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 0 9px 1px rgba(100, 196, 124, 0.6);
}
.lamp[data-status="blocked"] {
  background: radial-gradient(circle at 35% 30%, #ffc0ac, var(--lamp-blocked) 60%);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 0 11px 1px rgba(242, 86, 63, 0.7);
  animation: lamp-pulse 1.5s ease-in-out infinite;
}
.lamp[data-status="done"] {
  background: radial-gradient(circle at 35% 30%, #b6a88f, var(--lamp-done) 65%);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 0 4px rgba(169, 155, 131, 0.35) inset;
}

@keyframes lamp-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px var(--brass-lo), 0 0 11px 1px rgba(242, 86, 63, 0.75);
  }
  50% {
    box-shadow: 0 0 0 1px var(--brass-lo), 0 0 4px 1px rgba(242, 86, 63, 0.4);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* Patch flash on the strip when a status updates. */
@keyframes patch-flash {
  0% {
    background: rgba(232, 190, 114, 0.34);
  }
  100% {
    background: transparent;
  }
}
.line--patched {
  animation: patch-flash 900ms var(--ease);
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: clamp(40px, 8vw, 84px) 24px;
}
.empty[hidden] {
  display: none;
}
.empty__jack {
  width: 64px;
  height: 64px;
  fill: none;
  stroke: var(--brass-lo);
  stroke-width: 1.6;
  opacity: 0.8;
}
.empty__jack circle:last-of-type {
  fill: var(--cavity);
}
.empty__title {
  margin: 0;
  font-family: "Oswald", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ivory);
}
.empty__copy {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
}
.empty__hint {
  color: var(--ivory-2);
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 12px 20px;
  min-height: 48px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 120ms var(--ease), filter 160ms var(--ease), box-shadow 160ms var(--ease);
}
.btn--brass {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: var(--brass-ink);
  border-color: var(--brass-lo);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 8px 18px -12px rgba(0, 0, 0, 0.9);
}
.btn--brass:hover {
  filter: brightness(1.06);
}
.btn--brass:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Call ticket (detail dialog)
   ========================================================================== */
.ticket-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vw, 34px);
}
.ticket-layer[hidden] {
  display: none;
}
.ticket-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 3, 0.68);
  backdrop-filter: blur(3px) saturate(0.8);
  animation: scrim-in 220ms var(--ease);
}

.ticket {
  position: relative;
  width: min(680px, 100%);
  max-height: min(88dvh, 900px);
  overflow: auto;
  border-radius: 4px;
  background:
    linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink-on-paper);
  box-shadow: var(--shadow-ticket);
  padding: clamp(20px, 3.4vw, 38px);
  animation: ticket-in 320ms var(--ease);
  outline: none;
}
.ticket::before {
  /* punch holes down the left margin */
  content: "";
  position: absolute;
  left: 14px;
  top: 42px;
  bottom: 42px;
  width: 10px;
  background-image: radial-gradient(circle, var(--console) 0 3px, transparent 3.4px);
  background-size: 10px 26px;
  background-repeat: repeat-y;
  opacity: 0.35;
  pointer-events: none;
}
.ticket__perf {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background-image: linear-gradient(90deg, transparent 50%, rgba(44, 29, 18, 0.18) 50%);
  background-size: 8px 8px;
  opacity: 0.4;
}
.ticket--patched {
  animation: ticket-patch 620ms var(--ease);
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}
@keyframes ticket-in {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(-0.4deg) scale(0.985);
  }
}
@keyframes ticket-patch {
  0% {
    transform: translateX(0) rotate(0);
  }
  25% {
    transform: translateX(-3px) rotate(-0.35deg);
  }
  55% {
    transform: translateX(2px) rotate(0.2deg);
  }
  100% {
    transform: translateX(0) rotate(0);
  }
}

.ticket__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--paper-line);
}
.ticket__id {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: "Oswald", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6f5433;
}
.ticket__id strong {
  font-family: "Plex Mono", monospace;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--ink-on-paper);
}
.ticket__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid #b9a075;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink-on-paper);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.ticket__close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.ticket__close:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--ink-on-paper);
}

.ticket__stamp {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding: 6px 14px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-family: "Oswald", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
  color: #6f5433;
}
.ticket__stamp[data-status="todo"] {
  color: #8f5714;
}
.ticket__stamp[data-status="in-progress"] {
  color: #2a6e3d;
}
.ticket__stamp[data-status="blocked"] {
  color: #b2301c;
}
.ticket__stamp[data-status="done"] {
  color: #6f6353;
}
.ticket__stamp .lamp--lg {
  width: 11px;
  height: 11px;
}

.ticket__title {
  margin: 16px 0 0;
  font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #241609;
  overflow-wrap: anywhere;
}

.ticket__body {
  margin-top: 18px;
  max-width: 68ch;
  font-size: 1.02rem;
  line-height: 1.62;
  color: #3a2817;
  white-space: pre-line;
}

.ticket__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 0 0;
  border: 1px solid var(--paper-line);
  background: var(--paper-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ticket__meta > div {
  background: rgba(255, 255, 255, 0.42);
  padding: 11px 14px;
}
.ticket__meta dt {
  font-family: "Oswald", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a5c33;
}
.ticket__meta dd {
  margin: 3px 0 0;
  font-size: 0.94rem;
  font-weight: 500;
  color: #2f1f10;
  overflow-wrap: anywhere;
}

.patch {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--paper-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  align-items: center;
  gap: 12px 20px;
}
.patch__label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.patch__lead {
  color: #6f5433;
}
.patch__hint {
  font-size: 0.86rem;
  color: #7a6243;
}
.select-shell--patch select {
  background: rgba(255, 255, 255, 0.5);
  border-color: #b9a075;
  color: var(--ink-on-paper);
  box-shadow: none;
}
.select-shell--patch select option {
  background: var(--paper);
  color: var(--ink-on-paper);
}
.select-shell--patch .select-shell__chevron {
  stroke: #6f5433;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: min(520px, calc(100vw - 24px));
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--plate-edge);
  background: linear-gradient(180deg, var(--console-hi), var(--console-lo));
  color: var(--ivory);
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.07) inset;
  animation: toast-in 300ms var(--ease);
}
.toast[hidden] {
  display: none;
}
.toast__text {
  font-size: 0.92rem;
}
.toast__text strong {
  color: var(--brass-hi);
  font-weight: 600;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

/* ==========================================================================
   Floor note
   ========================================================================== */
.floor {
  padding: 16px 4px 28px;
  text-align: center;
}
.floor p {
  margin: 0;
  font-family: "Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--muted-2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .console__plate {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .tally {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
  }
  .console__controls {
    grid-template-columns: minmax(0, 1fr) 210px;
  }
  .results {
    grid-column: 1 / -1;
    text-align: left;
  }
}

@media (max-width: 640px) {
  :root {
    --line-grid: 24px 42px minmax(0, 1fr) 56px;
  }
  .exchange {
    padding: 10px 10px 0;
  }
  .console {
    border-radius: 8px 8px 3px 3px;
    padding: 16px 14px;
  }
  .console__plate {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .shift {
    justify-self: start;
  }
  .tally {
    order: 0;
  }
  .dial {
    width: 46px;
    height: 46px;
  }
  .brand__name {
    font-size: 1.28rem;
  }
  .console__controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .results {
    text-align: left;
  }
  .board__head {
    grid-template-columns: var(--line-grid);
    gap: 0 10px;
    padding: 10px 12px;
  }
  .line {
    grid-template-columns: var(--line-grid);
    gap: 0 10px;
    padding: 13px 12px;
  }
  .line::before {
    left: 23px;
  }
  .line-title {
    font-size: 0.98rem;
  }
  .plug {
    width: 52px;
    min-height: 52px;
  }

  .ticket-layer {
    padding: 0;
    align-items: stretch;
  }
  .ticket {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    animation: ticket-in-mobile 280ms var(--ease);
  }
  .ticket::before {
    display: none;
  }
  .ticket__meta {
    grid-template-columns: minmax(0, 1fr);
  }
  .patch {
    grid-template-columns: minmax(0, 1fr);
  }
  .ticket__close-text {
    display: none;
  }
  .ticket__close {
    padding: 10px;
    width: 44px;
    justify-content: center;
  }
}

@keyframes ticket-in-mobile {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* ==========================================================================
   Reduced motion — keep the state change, drop the choreography.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 120ms !important;
  }
  .shift__pulse,
  .lamp[data-status="blocked"] {
    animation: none !important;
  }
  .ticket,
  .toast,
  .ticket-scrim {
    animation: none !important;
  }
}
