@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;
}

:root {
  --bg: #16191b;
  --bg-deep: #101214;
  --steel: #202529;
  --steel-2: #2a3135;
  --text: #f0ebe0;
  --muted: #aaa99f;
  --line: rgba(240, 235, 224, 0.14);
  --line-strong: rgba(240, 235, 224, 0.28);
  --paper: #f3eee1;
  --paper-2: #e7dfcf;
  --ink: #181a19;
  --ink-soft: #5b5d55;
  --red: #f05a42;
  --red-deep: #b8321f;
  --yellow: #f0b92e;
  --green: #8ca98f;
  --blue: #a9c4cb;
  --rail: #aab8be;
  --page: 1360px;
  --gutter: max(16px, calc((100vw - var(--page)) / 2));
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --mono: "Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Work Sans", "Helvetica Neue", Helvetica, sans-serif;
  --display: "Oswald", "Arial Narrow", sans-serif;
}

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

#board:focus {
  outline: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1100px 560px at 74% -12%, rgba(92, 111, 118, 0.2), transparent 66%),
    radial-gradient(820px 500px at 2% 18%, rgba(240, 90, 66, 0.055), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-dialog {
  overflow: hidden;
}

::selection {
  background: var(--red);
  color: #fff8ee;
}

:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

input,
select {
  caret-color: var(--red-deep);
}

button {
  color: inherit;
}

* {
  scrollbar-color: #4b5458 transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: #4b5458;
  border: 3px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

.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: 10px;
  left: 10px;
  z-index: 500;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  font: 600 12px var(--sans);
  transform: translateY(-160%);
  transition: transform 0.18s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.skip-link:focus-visible {
  outline-color: var(--red-deep);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.topbar,
main {
  position: relative;
  z-index: 1;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px var(--gutter);
  background: linear-gradient(180deg, #1d2225 0%, #171a1c 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 24px;
  flex: none;
  color: var(--red);
}

.brand-word {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-sub {
  margin-left: 4px;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font: 400 9px/1.4 var(--mono);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  white-space: nowrap;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font: 400 9px/1.3 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
}

.service-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(240, 90, 66, 0.5);
  animation: livePulse 2.8s infinite;
}

@keyframes livePulse {
  0%, 60%, 100% { box-shadow: 0 0 0 0 rgba(240, 90, 66, 0.45); }
  12% { box-shadow: 0 0 0 5px rgba(240, 90, 66, 0); }
  30% { box-shadow: 0 0 0 0 rgba(240, 90, 66, 0.45); }
}

.meta-divider {
  color: rgba(240, 235, 224, 0.26);
}

.clock {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

/* ---------- masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 372px);
  gap: clamp(30px, 5vw, 86px);
  align-items: end;
  padding: clamp(34px, 5vw, 66px) var(--gutter) clamp(26px, 4vw, 46px);
}

.masthead-main {
  min-width: 0;
}

.masthead h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(54px, 6.7vw, 104px);
  font-weight: 500;
  line-height: 0.89;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  text-wrap: balance;
}

.pass-red {
  color: var(--red);
}

.lede {
  max-width: 56ch;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.62;
}

.shift-brief {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  padding: 20px 22px 17px;
  transform: rotate(-0.55deg);
  box-shadow:
    0 20px 34px -22px rgba(0, 0, 0, 0.9),
    0 2px 4px rgba(0, 0, 0, 0.28);
}

.shift-brief::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  background-size: 150px 150px;
}

.shift-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 23px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: rgba(240, 185, 46, 0.72);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  opacity: 0.9;
}

.shift-label {
  position: relative;
  margin: 0 0 8px;
  color: #626258;
  font: 500 9px/1.4 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.shift-copy {
  position: relative;
  margin: 0;
  max-width: 38ch;
  color: #2c2e29;
  font-size: 13.5px;
  line-height: 1.5;
}

.shift-copy strong {
  font-weight: 700;
  color: var(--red-deep);
}

.line-map {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 18px 0 14px;
  padding-top: 5px;
}

.line-map-track {
  position: absolute;
  top: 9px;
  left: 5px;
  right: 5px;
  height: 2px;
  background: rgba(24, 26, 25, 0.19);
}

.line-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.line-stop i {
  display: block;
  width: 9px;
  height: 9px;
  margin-bottom: 9px;
  border: 2px solid var(--paper);
  outline: 1px solid rgba(24, 26, 25, 0.45);
  background: var(--station-color);
}

.line-stop b {
  font: 500 11px/1 var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.line-stop small {
  color: #626358;
  font: 400 8.5px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.line-stop--rail { --station-color: var(--rail); }
.line-stop--line { --station-color: var(--red); }
.line-stop--held { --station-color: var(--yellow); }
.line-stop--served { --station-color: var(--green); }

.shift-foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(24, 26, 25, 0.24);
  color: #616257;
  font: 400 8px/1.35 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stamp-mini {
  flex: none;
  padding: 3px 5px 2px;
  border: 1.5px solid var(--red-deep);
  color: var(--red-deep);
  font: 600 8px/1 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

/* ---------- controls ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(212px, 292px) minmax(170px, auto);
  gap: 14px;
  align-items: end;
  padding: 13px var(--gutter) 14px;
  background: #171a1c;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px -24px #000;
}

.control {
  min-width: 0;
}

.control > label,
.status-row > label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.paper-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 50px;
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 18px -16px #000;
}

.paper-field:focus-within {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

.search-icon {
  position: absolute;
  left: 15px;
  width: 19px;
  height: 19px;
  color: #3f413b;
  pointer-events: none;
}

#search {
  width: 100%;
  height: 100%;
  padding: 0 46px 0 45px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 500 15px var(--sans);
  letter-spacing: -0.005em;
}

#search::placeholder {
  color: #64645a;
  opacity: 1;
}

#search::-webkit-search-cancel-button,
#search::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.clear-search {
  position: absolute;
  right: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.clear-search svg {
  width: 13px;
  height: 13px;
}

.clear-search:hover {
  background: rgba(24, 26, 25, 0.08);
}

.paper-field button:focus-visible {
  outline: 2px solid var(--red-deep);
  outline-offset: 1px;
}

.clear-search[hidden] {
  display: none;
}

.select-field {
  overflow: hidden;
}

#filter {
  width: 100%;
  height: 100%;
  padding: 0 40px 0 14px;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

#filter option {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  text-transform: none;
}

.select-arrow {
  position: absolute;
  right: 15px;
  width: 12px;
  height: 8px;
  color: var(--ink);
  pointer-events: none;
}

.results-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
  min-height: 50px;
  padding-bottom: 1px;
}

.results {
  margin: 0;
  color: var(--muted);
  font: 400 9px/1.4 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.reset-pass {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  font: 600 8.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.reset-pass:hover {
  color: var(--text);
  border-color: var(--text);
}

.reset-pass[hidden] {
  display: none;
}

/* ---------- board ---------- */

.board {
  padding: 8px var(--gutter) 64px;
}

.station {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: clamp(20px, 3.4vw, 48px);
  padding: 24px 0 30px;
  border-top: 1px solid var(--line);
}

.station:first-child {
  border-top: 0;
}

.station-head {
  position: relative;
  padding-top: 8px;
}

.station-swatch {
  display: block;
  width: 38px;
  height: 7px;
  margin-bottom: 13px;
  background: var(--station-color);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.station h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(26px, 2.35vw, 34px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.station-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--muted);
  font: 400 9px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.station-status {
  color: var(--station-color);
}

.station-dot {
  color: rgba(240, 235, 224, 0.3);
}

.station-count {
  display: inline-block;
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid var(--station-color);
  color: var(--station-color);
  font: 500 8px/1.2 var(--mono);
  letter-spacing: 0.06em;
  text-align: center;
}

.station-note {
  max-width: 19ch;
  margin: 13px 0 0;
  color: #8e8e84;
  font-size: 11.5px;
  line-height: 1.45;
}

.station--todo { --station-color: var(--rail); --station-ink: #4d5a5e; }
.station--in-progress { --station-color: var(--red); --station-ink: var(--red-deep); }
.station--blocked { --station-color: var(--yellow); --station-ink: #7f5b00; }
.station--done { --station-color: var(--green); --station-ink: #41624b; }

.station-rail {
  position: relative;
  min-width: 0;
  padding-top: 30px;
}

.tickets {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 40px 18px;
}

.ticket {
  --tilt: 0deg;
  position: relative;
  flex: 1 1 208px;
  max-width: 286px;
  min-height: 174px;
  padding: 14px 15px 11px;
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    0 18px 30px -20px rgba(0, 0, 0, 0.92),
    0 2px 4px rgba(0, 0, 0, 0.28);
  transform: rotate(var(--tilt));
  transition: transform 0.32s var(--ease), box-shadow 0.32s var(--ease);
  isolation: isolate;
}

.ticket::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

.ticket::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -9px;
  left: -9px;
  z-index: 2;
  height: 8px;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, transparent 0 27px, rgba(255, 255, 255, 0.055) 27px 28px),
    linear-gradient(180deg, #566166 0%, #31383c 32%, #1a1e20 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 3px 7px rgba(0, 0, 0, 0.55);
}

.ticket:nth-child(3n + 1) { --tilt: -0.45deg; }
.ticket:nth-child(3n + 2) { --tilt: 0.38deg; }
.ticket:nth-child(3n) { --tilt: -0.18deg; }

.ticket:hover,
.ticket:focus-within {
  transform: rotate(0deg) translateY(-2px);
  box-shadow:
    0 26px 38px -20px rgba(0, 0, 0, 0.95),
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.ticket > * {
  position: relative;
  z-index: 1;
}

.clip {
  position: absolute;
  top: -24px;
  left: 50%;
  z-index: 6;
  width: 18px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, #919a9f 0%, #4a5358 42%, #23282b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 3px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.clip::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 6px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #15181a;
  box-shadow: inset 0 1px 2px #000;
}

.ticket-stamp {
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 0;
  color: var(--station-color);
  font: 600 42px/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.085;
  transform: rotate(-11deg);
  pointer-events: none;
  white-space: nowrap;
}

.ticket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(24, 26, 25, 0.24);
  color: #626258;
  font: 400 9px/1.2 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ticket-status {
  color: var(--station-ink);
  font-weight: 600;
}

.priority {
  flex: none;
  padding: 2px 4px 1px;
  border: 1px solid currentColor;
  font: 600 8px/1.2 var(--mono);
  letter-spacing: 0.1em;
}

.priority--high {
  border-color: var(--red-deep);
  background: var(--red-deep);
  color: #fff8ee;
}

.priority--medium { color: #4e5049; }
.priority--low { color: #69695f; }

.ticket-title {
  max-width: 25ch;
  margin: 10px 0 0;
  color: var(--ink);
  font-size: clamp(16px, 1.25vw, 18.5px);
  font-weight: 620;
  line-height: 1.22;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}

.ticket-meta {
  display: grid;
  gap: 3px;
  margin: 11px 0 0;
}

.ticket-meta div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.ticket-meta dt {
  flex: none;
  width: 42px;
  color: #64655b;
  font: 400 8.5px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ticket-meta dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #373933;
  font: 400 11px/1.3 var(--mono);
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  padding-top: 8px;
  border-top: 1px dashed rgba(24, 26, 25, 0.24);
}

.ticket-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.tag {
  padding: 1px 4px;
  border: 1px solid rgba(24, 26, 25, 0.22);
  color: #56584f;
  font: 400 8px/1.35 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pull {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  color: var(--red-deep);
  font: 600 8.5px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pull svg {
  width: 8px;
  height: 8px;
}

.ticket-open {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  scroll-margin-top: 112px;
}

.ticket-open:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

/* ---------- empty + loading ---------- */

.empty-wrap {
  display: grid;
  place-items: center;
  padding: 44px 0 58px;
}

.empty-card {
  position: relative;
  width: min(560px, 100%);
  padding: 34px 32px 30px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  transform: rotate(-0.35deg);
  box-shadow:
    0 26px 44px -26px rgba(0, 0, 0, 0.95),
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.empty-card::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 96px;
  height: 23px;
  transform: translateX(-50%) rotate(1.6deg);
  background: rgba(240, 185, 46, 0.7);
}

.empty-code {
  margin: 0;
  color: var(--red-deep);
  font: 600 108px/0.78 var(--display);
  letter-spacing: 0.01em;
}

.empty-card h2 {
  margin: 12px 0 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.empty-card > p {
  max-width: 44ch;
  margin: 10px auto 0;
  color: #55574e;
  font-size: 13.5px;
  line-height: 1.55;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 11px/1.2 var(--sans);
  cursor: pointer;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn--red {
  border-color: var(--red-deep);
  background: var(--red-deep);
  color: #fff8ee;
}

.btn--red:hover {
  background: var(--ink);
  border-color: var(--ink);
}

.empty-card .btn:focus-visible {
  outline-color: var(--red-deep);
}

.loading-card,
.error-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  padding: 26px 24px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 400 9px/1.5 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.loading-card p,
.error-card p {
  margin: 0;
}

.loading-rule {
  display: block;
  width: 58px;
  height: 2px;
  background: var(--red);
  animation: loadPulse 1.2s var(--ease) infinite alternate;
}

@keyframes loadPulse {
  from { transform: scaleX(0.2); transform-origin: left; opacity: 0.4; }
  to { transform: scaleX(1); transform-origin: left; opacity: 1; }
}

.error-card {
  display: block;
}

.error-card p + p {
  margin-top: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.error-card .btn {
  margin-top: 14px;
  border-color: var(--paper);
  color: var(--paper);
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px var(--gutter) 34px;
  border-top: 1px solid var(--line);
  color: #8c8c82;
  font: 400 8px/1.5 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--text);
  font-weight: 500;
}

/* ---------- detail dialog ---------- */

.detail {
  width: min(858px, calc(100vw - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
  scrollbar-color: #79776d transparent;
}

.detail:not([open]) {
  display: none;
}

.detail::backdrop {
  background: rgba(5, 7, 8, 0.8);
}

.detail[open] {
  animation: dialogIn 0.3s var(--ease);
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.docket {
  position: relative;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: clamp(24px, 3.4vw, 40px);
  background: var(--paper);
  box-shadow: 0 34px 80px -30px rgba(0, 0, 0, 0.95);
  scrollbar-color: #79776d transparent;
}

.docket::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  background-size: 150px 150px;
}

.docket > * {
  position: relative;
  z-index: 1;
}

.docket-top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0 13px;
  background: var(--paper);
  border-bottom: 1px solid rgba(24, 26, 25, 0.2);
}

.docket-code {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  color: #626258;
  font: 400 9px/1.4 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.docket-slash {
  color: rgba(24, 26, 25, 0.3);
}

.close-detail {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(24, 26, 25, 0.45);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.close-detail svg {
  width: 15px;
  height: 15px;
}

.close-detail:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
  color: #fff8ee;
}

.docket :focus-visible {
  outline-color: var(--red-deep);
}

.docket-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
}

.docket-title {
  max-width: 20ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4.3vw, 49px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.detail-stamp {
  flex: none;
  max-width: 160px;
  margin-top: 4px;
  padding: 7px 9px 6px;
  border: 2px solid var(--red-deep);
  color: var(--red-deep);
  font: 500 11px/1.1 var(--display);
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.detail-stamp.is-blocked {
  border-color: #a47400;
  color: #8a6200;
}

.detail-stamp.is-done {
  border-color: #4c7057;
  color: #41624b;
}

.detail-stamp.is-stamped {
  animation: stampIn 0.4s var(--ease);
}

@keyframes stampIn {
  0% { opacity: 0; transform: rotate(-4deg) scale(1.45); filter: blur(2px); }
  62% { opacity: 1; transform: rotate(-4deg) scale(0.96); filter: blur(0); }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); filter: blur(0); }
}

.docket-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 20px 0 0;
  padding: 14px 0;
  border-top: 1px solid rgba(24, 26, 25, 0.2);
  border-bottom: 1px solid rgba(24, 26, 25, 0.2);
}

.docket-meta dt {
  margin: 0 0 3px;
  color: #64655b;
  font: 400 8.5px/1.3 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.docket-meta dd {
  margin: 0;
  color: #2b2d28;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.route-panel {
  margin: 22px 0 0;
  padding: 17px 18px 18px;
  border-top: 4px solid var(--red-deep);
  background: #e9e2d3;
}

.route-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 18px;
}

.route-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font: 500 9px/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.route-panel-head p {
  margin: 0;
  color: #53554a;
  font-size: 11.5px;
  line-height: 1.4;
}

.route-map {
  --progress: 0%;
  position: relative;
  margin: 18px 0 18px;
  padding: 0 26px;
}

.route-track {
  position: relative;
  height: 2px;
  margin: 0 4px;
  background: rgba(24, 26, 25, 0.25);
}

.route-fill {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: var(--progress);
  height: 2px;
  background: var(--red-deep);
  transition: width 0.45s var(--ease);
}

.route-marker {
  position: absolute;
  top: -7px;
  left: calc(var(--progress) - 6px);
  display: block;
  width: 12px;
  height: 16px;
  border: 1px solid #7b1c10;
  background: var(--red-deep);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: left 0.45s var(--ease);
}

.route-marker::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 3px;
  width: 4px;
  height: 6px;
  border: 1px solid rgba(255, 248, 238, 0.65);
}

.route-stops {
  display: flex;
  justify-content: space-between;
  margin: 9px -26px 0;
}

.route-stops span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #56584e;
  font: 500 9px/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s var(--ease);
}

.route-stops i {
  display: none;
}

.route-stops span.is-active {
  color: var(--red-deep);
  font-weight: 600;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-row > label {
  flex: none;
  margin: 0;
  color: #55574e;
}

.status-select-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

#status-control {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 13px;
  border: 1px solid rgba(24, 26, 25, 0.5);
  border-radius: 0;
  outline: 0;
  appearance: none;
  background: #fbf6e9;
  color: var(--ink);
  font: 600 13px var(--sans);
  cursor: pointer;
}

#status-control:focus-visible {
  outline: 2px solid var(--red-deep);
  outline-offset: 3px;
}

#status-control option {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

.status-select-wrap svg {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 12px;
  height: 8px;
  transform: translateY(-50%);
  color: var(--ink);
  pointer-events: none;
}

.docket-copy {
  margin-top: 26px;
}

.docket-copy h3,
.service-log h3 {
  margin: 0 0 9px;
  color: #5f6056;
  font: 500 9px/1.4 var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.body {
  max-width: 66ch;
  color: #2c2e29;
  font-size: 16px;
  line-height: 1.68;
  white-space: pre-line;
}

.service-log {
  margin-top: 26px;
  padding-top: 15px;
  border-top: 1px dashed rgba(24, 26, 25, 0.26);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.log-live {
  color: var(--red-deep);
  font: 600 8.5px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#detail-log {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 400 9.5px/1.5 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#detail-log li {
  display: flex;
  gap: 9px;
  color: #5d5e55;
}

#detail-log time {
  flex: none;
  color: var(--red-deep);
  font-variant-numeric: tabular-nums;
}

.docket-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 24px;
  padding-top: 15px;
  border-top: 1px solid rgba(24, 26, 25, 0.2);
  color: #5f6056;
  font: 400 8px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.close-detail-text {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--red-deep);
  background: transparent;
  color: var(--red-deep);
  font: 600 8.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.close-detail-text:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  right: var(--gutter);
  bottom: 22px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    0 18px 40px -16px rgba(0, 0, 0, 0.85),
    0 2px 5px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.3s var(--ease);
}

.toast[hidden] {
  display: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-stamp {
  flex: none;
  padding: 5px 6px 4px;
  background: var(--red-deep);
  color: #fff8ee;
  font: 500 9px/1 var(--display);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transform: rotate(-2deg);
}

.toast-text {
  margin: 0;
  color: #34362f;
  font: 500 9px/1.45 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toast-undo {
  flex: none;
  padding: 4px 6px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 8px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.toast-undo:hover {
  background: var(--ink);
  color: var(--paper);
}

.toast-undo[hidden] {
  display: none;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.toast-close svg {
  width: 10px;
  height: 10px;
}

.toast-close:hover {
  background: rgba(24, 26, 25, 0.1);
}

.toast :focus-visible {
  outline-color: var(--red-deep);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .masthead {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
    gap: 32px;
  }

  .station {
    grid-template-columns: 156px minmax(0, 1fr);
    gap: 24px;
  }

  .controls {
    grid-template-columns: minmax(220px, 1fr) minmax(190px, 250px);
  }

  .results-wrap {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 880px) {
  .masthead {
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
  }

  .shift-brief {
    width: min(100%, 560px);
    transform: none;
  }

  .station {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 18px;
  }

  .station-note {
    font-size: 11px;
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .brand-sub {
    display: none;
  }

  .service-meta {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 7px;
    line-height: 1.5;
  }

  .service-meta .meta-divider {
    display: none;
  }

  .service-live {
    width: 100%;
    justify-content: flex-end;
  }

  .masthead {
    gap: 20px;
    padding-top: 30px;
    padding-bottom: 28px;
  }

  .masthead h1 {
    font-size: clamp(46px, 13.5vw, 72px);
  }

  .lede {
    margin-top: 18px;
    font-size: 15px;
  }

  .shift-brief {
    display: none;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 11px;
  }

  .control > label {
    margin-bottom: 4px;
  }

  .paper-field {
    height: 46px;
  }

  .results-wrap {
    grid-column: auto;
    gap: 6px;
    min-height: 0;
  }

  .board {
    padding-top: 2px;
  }

  .station {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0 26px;
  }

  .station-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 4px 12px;
    padding-top: 0;
  }

  .station-swatch {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }

  .station h2 {
    font-size: 26px;
  }

  .station-sub {
    margin-top: 5px;
  }

  .station-note {
    max-width: 22ch;
    margin: 0;
    text-align: right;
    font-size: 10.5px;
  }

  .station-rail {
    padding-top: 30px;
  }

  .tickets {
    gap: 40px 14px;
  }

  .ticket {
    flex: 1 1 100%;
    max-width: none;
    min-height: 0;
    transform: none;
  }

  .ticket:hover,
  .ticket:focus-within {
    transform: translateY(-2px);
  }

  .ticket-open {
    scroll-margin-top: 196px;
  }

  .ticket-title {
    max-width: none;
    font-size: 19px;
  }

  .detail {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
  }

  .docket {
    min-height: 100%;
    max-height: 100dvh;
    height: 100dvh;
    padding: 20px 18px 36px;
  }

  .docket-heading {
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
  }

  .docket-title {
    max-width: none;
    font-size: clamp(29px, 9vw, 38px);
  }

  .detail-stamp {
    margin-top: 0;
    align-self: flex-start;
  }

  .docket-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
  }

  .route-panel {
    padding: 15px 14px 16px;
  }

  .route-panel-head {
    display: block;
  }

  .route-panel-head p {
    margin-top: 4px;
  }

  .status-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .status-row > label {
    margin-bottom: 0;
  }

  .body {
    font-size: 15.5px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
    flex-wrap: wrap;
  }

  .toast-text {
    flex: 1;
    min-width: 170px;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 430px) {
  .brand-word {
    font-size: 24px;
  }

  .brand-mark {
    width: 29px;
    height: 21px;
  }

  .service-meta {
    font-size: 8px;
  }

  .service-live {
    display: none;
  }

  .masthead h1 {
    font-size: clamp(42px, 13vw, 56px);
  }

  .station-head {
    grid-template-columns: 1fr;
  }

  .station-note {
    text-align: left;
    max-width: none;
  }

  .ticket-meta dd {
    white-space: normal;
  }

  .empty-card {
    padding: 30px 20px 26px;
  }

  .toast-stamp {
    display: none;
  }

  .toast-text {
    min-width: 120px;
  }

  .empty-code {
    font-size: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .ticket,
  .ticket:hover,
  .ticket:focus-within {
    transform: none !important;
  }

  .live-dot {
    animation: none;
  }

  .detail[open] {
    animation: none;
  }
}
