@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f0eddf;
  --paper-deep: #e4e0d1;
  --ink: #13231f;
  --muted: #647069;
  --line: #a9afa4;
  --signal: #ff4f2f;
  --acid: #d7ef43;
  --progress: #2462ff;
  --blocked: #f05a37;
  --done: #1e7a55;
  --white: #fffdf4;
  --focus: #2462ff;
  --display: "Space Grotesk", Arial, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(19,35,31,.06) 1px) 0 0 / 6.25vw 100%,
    var(--paper);
  color: var(--ink);
  font-family: var(--display);
  min-width: 320px;
}

button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }

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

.page-shell { min-height: 100vh; }

.topbar {
  height: 70px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--ink);
  padding: 0 clamp(20px, 3.2vw, 52px);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.04em;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 22px;
  display: inline-block;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark i {
  position: absolute;
  content: "";
  height: 2px;
  background: var(--ink);
  left: 0;
  transform-origin: left center;
}

.brand-mark::before { width: 28px; top: 10px; }
.brand-mark::after { width: 13px; top: 10px; transform: rotate(-42deg); }
.brand-mark i:nth-child(1) { width: 10px; top: 2px; left: 11px; transform: rotate(42deg); }
.brand-mark i:nth-child(2) { width: 10px; bottom: 2px; left: 11px; transform: rotate(-42deg); }
.brand-mark i:nth-child(3) { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); left: 24px; top: 7px; }

.topbar-note,
.system-live {
  margin: 0;
  font: 11px/1.2 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar-note span { margin: 0 8px; color: var(--line); }
.system-live { justify-self: end; display: flex; gap: 9px; align-items: center; }
.system-live span { width: 8px; height: 8px; border-radius: 50%; background: var(--done); box-shadow: 0 0 0 4px rgba(30,122,85,.14); }

.hero {
  min-height: 385px;
  display: grid;
  grid-template-columns: minmax(470px, .85fr) minmax(560px, 1.15fr);
  border-bottom: 1px solid var(--ink);
}

.hero-copy {
  padding: 48px clamp(24px, 4.4vw, 68px) 44px;
  border-right: 1px solid var(--ink);
}

.eyebrow {
  margin: 0 0 20px;
  font: 11px/1.3 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(64px, 6.6vw, 104px);
  line-height: .78;
  letter-spacing: -.075em;
  font-weight: 650;
}

h1 em { color: var(--signal); font-style: normal; font-weight: 400; }

.hero-intro {
  max-width: 470px;
  margin: 28px 0 0 23%;
  font-size: 16px;
  line-height: 1.55;
}

.route-map {
  overflow: hidden;
  isolation: isolate;
  position: relative;
  min-height: 385px;
  padding: 46px clamp(30px, 4.3vw, 66px);
  background: var(--ink);
  color: var(--white);
}

.route-map::before {
  content: "JCT";
  position: absolute;
  z-index: -1;
  right: -18px;
  bottom: -52px;
  font-size: 210px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.11em;
  color: rgba(255,255,255,.035);
}

.route-title {
  display: flex;
  justify-content: space-between;
  font: 11px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.route-line {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 51%;
  border-top: 1px solid rgba(255,255,255,.5);
}

.stations {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 102px;
}

.station-button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  padding: 0 10px 0 0;
  position: relative;
}

.station-button::before {
  content: "";
  display: block;
  width: 17px;
  height: 17px;
  margin-bottom: 19px;
  border: 5px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 1px var(--acid);
  transition: transform .18s ease;
}

.station-button:hover::before { transform: scale(1.35); }
.station-button[aria-pressed="true"] .station-name { color: var(--white); text-decoration: underline; text-underline-offset: 5px; }
.station-button[aria-pressed="true"]::before { transform: scale(1.35); }
.station-button[data-status="in-progress"]::before { background: #6d98ff; box-shadow: 0 0 0 1px #6d98ff; }
.station-button[data-status="blocked"]::before { background: #ff7053; box-shadow: 0 0 0 1px #ff7053; }
.station-button[data-status="done"]::before { background: #57c997; box-shadow: 0 0 0 1px #57c997; }
.station-number { display: block; font-size: 38px; line-height: 1; letter-spacing: -.05em; }
.station-name { display: block; margin-top: 8px; font: 10px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: #b7c0b8; }

.route-curve {
  position: absolute;
  z-index: -1;
  left: 7%;
  right: 5%;
  bottom: 14px;
  width: 88%;
  height: 145px;
  fill: none;
  stroke: rgba(215,239,67,.16);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}

.board { padding: 46px clamp(20px, 3.2vw, 52px) 70px; }

.board-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 38px;
}

.board-head .eyebrow { margin-bottom: 8px; color: var(--muted); }
h2 { margin: 0; font-size: clamp(34px, 3.4vw, 52px); line-height: 1; letter-spacing: -.055em; }
h2 sup { font: 12px var(--mono); color: var(--signal); vertical-align: top; margin-left: 10px; letter-spacing: 0; }

.controls { display: grid; grid-template-columns: minmax(245px, 1.4fr) minmax(175px, 1fr); gap: 10px; width: min(560px, 52vw); }
.controls label > span:first-child { display: block; margin: 0 0 7px 2px; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.input-wrap { position: relative; display: block; }
.input-wrap svg { position: absolute; left: 14px; top: 50%; width: 18px; transform: translateY(-50%); fill: none; stroke: currentColor; stroke-width: 1.7; }
.input-wrap kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 2px; padding: 2px 6px; color: var(--muted); font: 10px var(--mono); }

input, select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background-color: rgba(255,253,244,.55);
  font-size: 14px;
}

input { padding: 0 42px; }
select { padding: 0 38px 0 14px; }
input::placeholder { color: #7e867f; }

.manifest-labels,
.task-card {
  display: grid;
  grid-template-columns: minmax(370px, 2fr) minmax(185px, .8fr) minmax(180px, .8fr) 110px 48px;
  column-gap: 20px;
  align-items: center;
}

.manifest-labels {
  min-height: 34px;
  padding: 0 14px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font: 9px/1.2 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

.task-card {
  position: relative;
  min-height: 83px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  transition: background-color .16s ease, transform .16s ease;
}

.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 4px;
  background: var(--status-color);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .16s ease;
}

.task-card:hover,
.task-card:focus-within { background: var(--white); }
.task-card:hover::before,
.task-card:focus-within::before { transform: scaleY(1); }

.task-primary { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 15px; }
.task-ref { font: 10px var(--mono); color: var(--muted); }
.task-title { margin: 0 0 7px; font-size: 17px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; }
.mini-route { display: flex; align-items: center; width: min(160px, 90%); }
.mini-route i { width: 7px; height: 7px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); }
.mini-route i.passed { border-color: var(--status-color); background: var(--status-color); }
.mini-route b { height: 1px; flex: 1; background: var(--line); }
.mini-route b.passed { background: var(--status-color); }
.assignment strong { display: block; font-size: 13px; font-weight: 550; }
.assignment span, .due span { display: block; color: var(--muted); font: 10px/1.4 var(--mono); margin-top: 5px; }
.status-chip { width: max-content; padding: 5px 8px; border: 1px solid currentColor; color: var(--status-color); font: 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.due strong { display: block; font: 12px var(--mono); font-weight: 500; }

.open-item {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--ink);
  background: transparent;
  font-size: 22px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.open-item:hover { color: var(--white); background: var(--ink); transform: translateX(3px); }

.empty-state { text-align: center; padding: 64px 20px; border-bottom: 1px solid var(--ink); }
.empty-state .eyebrow { margin: 20px 0 10px; color: var(--muted); }
.empty-state h3 { font-size: 32px; letter-spacing: -.04em; margin: 0 0 8px; }
.empty-state p:not(.eyebrow) { color: var(--muted); margin: 0 0 22px; }
.empty-state button { min-height: 44px; border: 1px solid var(--ink); background: var(--acid); padding: 0 18px; font-weight: 600; }
.empty-signal { width: 74px; height: 40px; margin: auto; border-bottom: 1px dashed var(--line); position: relative; }
.empty-signal span { position: absolute; width: 14px; height: 14px; border: 3px solid var(--paper); border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 1px var(--signal); left: 30px; bottom: -7px; }

footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(20px, 3.2vw, 52px);
  border-top: 1px solid var(--ink);
  background: var(--ink);
  color: #adb7ae;
  font: 9px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.detail-dialog {
  width: min(650px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  box-shadow: 16px 16px 0 rgba(19,35,31,.28);
}

.detail-dialog::backdrop { background: rgba(19,35,31,.74); backdrop-filter: blur(3px); }
.detail-dialog[open] { animation: ticket-in .24s cubic-bezier(.2,.7,.2,1); }
@keyframes ticket-in { from { opacity: 0; transform: translateY(18px) rotate(.5deg); } }

.detail-top {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 22px;
  border-bottom: 1px solid var(--ink);
  background: var(--acid);
}

.detail-brand { display: flex; align-items: center; gap: 10px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.mini-mark { width: 19px; height: 9px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: skewX(-35deg); }
.close-detail { align-self: stretch; min-width: 112px; border: 0; border-left: 1px solid var(--ink); background: transparent; display: flex; align-items: center; justify-content: space-around; font: 11px var(--mono); text-transform: uppercase; }
.close-detail span:last-child { font: 25px/1 var(--display); }
.close-detail:hover { background: var(--ink); color: white; }

.detail-scroll { overflow: auto; max-height: calc(100vh - 86px); }
.detail-hero { padding: 30px 34px 28px; border-bottom: 1px solid var(--ink); }
.detail-meta-line { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.detail-hero h2 { font-size: clamp(36px, 5vw, 56px); margin: 42px 0 24px; max-width: 550px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-tags span { padding: 5px 8px; border: 1px solid var(--line); font: 9px var(--mono); text-transform: uppercase; }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; }
.detail-copy, .detail-order { padding: 30px 34px 36px; }
.detail-copy { border-right: 1px solid var(--ink); }
.detail-section-label { margin: 0 0 16px; font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.detail-copy p:not(.detail-section-label) { margin: 0 0 16px; font-size: 15px; line-height: 1.55; }
.detail-copy p:last-child { margin-bottom: 0; }
.person-card { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.person-initials { width: 42px; height: 42px; display: grid; place-items: center; background: var(--ink); color: var(--white); border-radius: 50%; font: 11px var(--mono); }
.person-card strong { display: block; font-size: 13px; }
.person-card span:last-child { color: var(--muted); font: 10px var(--mono); }
.status-select-label span { display: block; margin-bottom: 8px; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.status-select-label select { background-color: var(--paper); }
.status-feedback { min-height: 32px; margin: 10px 0 0; font: 10px/1.4 var(--mono); color: var(--done); }
.ticket-route { margin-top: 28px; }
.ticket-stop { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 12px; min-height: 48px; font: 10px var(--mono); text-transform: uppercase; color: var(--muted); }
.ticket-stop:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 15px; bottom: -1px; border-left: 1px solid var(--line); }
.ticket-stop i { position: relative; z-index: 1; width: 13px; height: 13px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); }
.ticket-stop.passed i, .ticket-stop.current i { border-color: var(--route-color); background: var(--route-color); }
.ticket-stop.current { color: var(--ink); font-weight: 600; }
.ticket-stop.current i { box-shadow: 0 0 0 4px var(--white), 0 0 0 5px var(--route-color); }

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  padding: 13px 18px;
  background: var(--ink);
  color: var(--white);
  border-left: 5px solid var(--acid);
  font: 11px/1.4 var(--mono);
  transform: translateY(150%);
  transition: transform .25s ease;
}
.toast.show { transform: translateY(0); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { border-right: 0; }
  .route-map { min-height: 305px; }
  .hero-intro { margin-left: 35%; }
  .route-line { top: 53%; }
  .stations { margin-top: 78px; }
  .manifest-labels { display: none; }
  .task-card { grid-template-columns: minmax(320px, 1.8fr) minmax(160px, .8fr) 140px 42px; }
  .task-card .due { display: none; }
}

@media (max-width: 700px) {
  body { background: var(--paper); }
  .topbar { height: 58px; grid-template-columns: 1fr auto; padding: 0 20px; }
  .topbar-note { display: none; }
  .brand { font-size: 17px; }
  .system-live { font-size: 9px; }
  .hero { min-height: auto; }
  .hero-copy { padding: 34px 20px 32px; }
  h1 { font-size: clamp(62px, 19vw, 78px); line-height: .82; }
  .hero-intro { margin: 24px 0 0 19%; font-size: 15px; }
  .route-map { min-height: 238px; padding: 28px 20px; }
  .route-map::before { font-size: 130px; bottom: -26px; }
  .route-line { left: 7%; right: 7%; top: 48%; }
  .stations { margin-top: 56px; }
  .station-button { padding-right: 4px; }
  .station-button::before { width: 14px; height: 14px; border-width: 4px; margin-bottom: 14px; }
  .station-number { font-size: 28px; }
  .station-name { max-width: 70px; font-size: 8px; }
  .route-curve { opacity: .7; }
  .board { padding: 34px 14px 50px; }
  .board-head { display: block; margin-bottom: 24px; }
  .controls { width: 100%; margin-top: 28px; grid-template-columns: 1.35fr 1fr; }
  .controls label > span:first-child { font-size: 9px; }
  input, select { height: 45px; font-size: 13px; }
  .input-wrap kbd { display: none; }
  input { padding-right: 12px; }
  .task-list { border-top: 1px solid var(--ink); }
  .task-card { grid-template-columns: 1fr 42px; gap: 10px 12px; padding: 14px 8px; min-height: 123px; }
  .task-primary { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; }
  .task-title { font-size: 15px; margin-bottom: 10px; }
  .assignment { grid-column: 1; padding-left: 48px; margin-top: -5px; }
  .assignment strong, .assignment span { display: inline; font-size: 10px; }
  .assignment span::before { content: " · "; }
  .status-chip { grid-column: 1; margin-left: 48px; font-size: 8px; padding: 4px 5px; background: var(--paper); }
  .open-item { grid-column: 2; grid-row: 1 / span 3; }
  footer { min-height: 74px; padding: 16px 20px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 7px; }
  .detail-dialog { width: 100vw; max-width: none; max-height: 100dvh; height: 100dvh; border: 0; margin: 0; box-shadow: none; }
  .detail-scroll { max-height: calc(100dvh - 56px); }
  .detail-top { padding-left: 18px; position: sticky; top: 0; z-index: 3; }
  .close-detail { min-width: 104px; }
  .detail-hero { padding: 26px 22px; }
  .detail-hero h2 { margin: 34px 0 22px; font-size: 39px; }
  .detail-body { grid-template-columns: 1fr; }
  .detail-copy, .detail-order { padding: 26px 22px 30px; }
  .detail-copy { border-right: 0; border-bottom: 1px solid var(--ink); }
  .toast { left: 14px; right: 14px; bottom: 14px; }
}

@media (max-width: 380px) {
  .controls { grid-template-columns: 1fr; }
  .status-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
}
