/* Ported from the ny-penn-departures artifact's theme.css (2026-10-01 inspection).
   Light editorial board: light gray page, near-black square track tiles,
   system monospace for all distinctive type, amber accent. */

:root {
  --bg: #edf2f4;
  --surface: #ffffff;
  --surface-strong: #07141f;
  --surface-muted: #dfe8eb;
  --text: #07141f;
  --inverse-text: #f7fafb;
  --dim: #526671;
  --border: #b8c8ce;
  --accent: #ffd43b;
  --very-likely-green: #00b85c;
  --green: #168b48;
  --orange: #c46b07;
  --red: #cb2e38;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071017;
    --surface: #0d1d28;
    --surface-strong: #02090e;
    --surface-muted: #142a38;
    --text: #edf4f6;
    --dim: #9db0b9;
    --border: #29414e;
    --very-likely-green: #72ffa7;
    --green: #37d67a;
    --orange: #ffad42;
    --red: #ff6670;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.app-shell {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
}

/* ---- utility bar header ---- */
.utility-bar {
  min-height: 52px; padding: 10px 0 9px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-weight: 700; font-size: 11px; line-height: 1.4;
  letter-spacing: .04em; text-transform: uppercase;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.live-dot.stale { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 18%, transparent); }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-time { font-weight: 500; color: var(--dim); text-transform: none; letter-spacing: 0; }
.refresh-button {
  border: 0; border-radius: 6px; background: var(--surface-strong);
  color: var(--inverse-text); padding: 9px 13px;
  font-family: var(--mono); font-weight: 800; font-size: 12px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em;
}
.refresh-button:disabled { opacity: .5; }

/* ---- filters ---- */
.filters { padding: 14px 0 4px; }
.eyebrow {
  font-family: var(--mono); font-weight: 800; font-size: 11px;
  letter-spacing: .08em; color: var(--dim); text-transform: uppercase;
  margin: 10px 0 6px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button {
  min-height: 35px; border: 1px solid var(--border); border-radius: 5px;
  padding: 7px 11px; background: var(--surface); color: var(--text);
  font-family: var(--mono); font-weight: 750; font-size: 12px; line-height: 1;
  cursor: pointer;
}
.chip-row button.active { background: var(--accent); color: #161200; border-color: #c9a400; }
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px;
  background: var(--surface-muted); border-radius: 7px; gap: 3px;
}
.segmented button {
  border: 0; border-radius: 5px; background: transparent; color: var(--text);
  font-family: var(--mono); font-weight: 750; font-size: 12px; padding: 8px 4px;
  cursor: pointer;
}
.segmented button.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

/* ---- hero: next departure ---- */
.hero-departure {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 13px;
  padding: 20px 0 18px; margin-top: 12px;
  border-top: 4px solid var(--text); border-bottom: 1px solid var(--border);
  align-items: start;
}
.hero-eyebrow {
  font-family: var(--mono); font-weight: 800; font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
  margin-bottom: 8px;
}
.hero-time {
  font-family: var(--mono); font-weight: 750; font-size: clamp(24px, 8vw, 38px);
  line-height: 1; letter-spacing: -.05em; margin-bottom: 6px;
}
.hero-dest {
  font-size: clamp(28px, 8.5vw, 48px); line-height: .98;
  letter-spacing: -.055em; font-weight: 700; margin: 0 0 8px;
}
.hero-route {
  font-family: var(--mono); font-weight: 650; font-size: 13px; line-height: 1.4;
  color: var(--dim);
}
.hero-route .sep { color: var(--accent); }
.service-status {
  display: inline-block; margin: 12px 0 0; padding: 4px 7px; border-radius: 4px;
  background: var(--accent); color: #161200;
  font-family: var(--mono); font-weight: 850; font-size: 11px; line-height: 1;
  letter-spacing: .06em; text-transform: uppercase;
}

/* ---- track tiles ---- */
.track-tile {
  align-self: start; width: 72px; min-height: 72px; justify-self: end;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  border-radius: 6px; background: var(--surface-strong); color: var(--inverse-text);
  border: 2px solid transparent; padding: 6px 2px;
}
.track-number {
  font-family: var(--mono); font-weight: 850; font-size: 34px; line-height: .95;
  letter-spacing: -.07em;
}
.track-number sup { color: var(--accent); font-size: .36em; vertical-align: top; margin-left: 2px; }
.track-kind {
  margin-top: 8px; font-family: var(--mono); font-weight: 800; font-size: 8px;
  line-height: 1.3; letter-spacing: .06em; text-align: center; text-transform: uppercase;
}
.track-tile-large { width: 96px; min-height: 112px; }
.track-tile-large .track-number { font-size: 56px; }

.track-tile.official { background: #05090c; color: #fff; border-color: #05090c; }
.track-tile.predicted.tier-high { border-color: var(--green); }
.track-tile.predicted.tier-medium { border-color: var(--orange); }
.track-tile.predicted.tier-low { border-color: var(--red); }
.track-tile.predicted.very-likely { border-color: var(--very-likely-green); }
.track-tile.predicted.very-likely .track-kind { color: var(--very-likely-green); }

.track-tile.signaled {
  min-height: 104px; border-color: var(--accent); border-style: dashed; padding: 7px 3px;
}
.track-tile.signaled .track-kind { color: var(--accent); }
.track-tile.signaled.tier-high { border-color: var(--green); }
.track-tile.signaled.tier-medium { border-color: var(--orange); }
.track-tile.signaled.tier-low { border-color: var(--red); }
.track-tile.signaled.very-likely { border-color: var(--very-likely-green); }
.track-tile.signaled.very-likely .track-kind,
.track-tile.signaled.very-likely .signal-confidence { color: var(--very-likely-green); }
.signal-confidence {
  margin-top: 6px; color: var(--inverse-text);
  font-family: var(--mono); font-weight: 800; font-size: 7px; line-height: 1.2;
  letter-spacing: .06em; text-align: center; text-transform: uppercase;
}
.track-tile.waiting { background: transparent; color: var(--dim); border-color: var(--border); }

/* ---- departure list ---- */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 22px 0 0;
}
.section-head h2 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.section-head .count { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.column-labels { display: none; }
.departure-list { border-top: 1px solid var(--text); margin-top: 8px; }
.departure-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 72px; gap: 9px;
  padding: 15px 0; border-bottom: 1px solid var(--border); align-items: start;
}
.row-time { font-family: var(--mono); font-weight: 800; font-size: 15px; line-height: 1.1; }
.row-rel { font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 4px; }
.row-dest { font-size: 17px; line-height: 1.12; letter-spacing: -.025em; font-weight: 700; margin: 0; }
.row-meta {
  font-family: var(--mono); font-weight: 650; font-size: 11px; line-height: 1.4;
  color: var(--dim); margin-top: 4px;
}
.row-meta .sep { color: var(--accent); }
.connection-tags { margin-top: 5px; display: flex; gap: 10px; }
.connection-tags span {
  border-bottom: 2px solid var(--accent); padding-bottom: 1px;
  color: var(--dim); font-size: 11px; font-weight: 750;
  font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase;
}
.signal-note { margin-top: 8px; font-size: 13px; line-height: 1.45; }
.signal-note strong { display: block; }
.signal-note .dim { color: var(--dim); }
.conflict-note { margin-top: 8px; font-size: 13px; color: var(--orange); font-weight: 600; }

details.why { margin-top: 8px; }
details.why summary {
  font-family: var(--mono); font-weight: 750; font-size: 12px; color: var(--dim);
  cursor: pointer;
}
.prediction-body {
  margin-top: 10px; padding: 12px; background: var(--surface-muted);
  border-radius: 6px; font-size: 13px; line-height: 1.45;
}
.prediction-body .cand { margin: 8px 0; }
.prediction-body .cand .bar {
  height: 4px; background: var(--border); border-radius: 2px; margin-top: 3px;
}
.prediction-body .cand .bar i {
  display: block; height: 100%; background: var(--text); border-radius: 2px;
}
.prediction-body ul { margin: 8px 0 0; padding-left: 18px; }
.prediction-body li { margin: 4px 0; }

/* ---- RailData panel ---- */
.signal-settings {
  margin-top: 28px; padding: 15px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.signal-settings > summary {
  font-family: var(--mono); font-weight: 750; font-size: 12px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .06em;
}
.rd-status { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; }
.rd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }
.rd-dot.on {
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.signal-form { display: grid; gap: 8px; margin: 8px 0; }
.signal-form .row2 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.signal-form input {
  min-height: 42px; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-family: var(--mono); font-size: 16px;
  background: var(--surface); color: var(--text); width: 100%;
}
.signal-form button {
  min-height: 42px; border: 0; border-radius: 6px; padding: 8px 18px;
  background: var(--surface-strong); color: var(--inverse-text);
  font-family: var(--mono); font-weight: 800; font-size: 13px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em;
}
.rd-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.privacy-note { font-size: 11px; color: var(--dim); max-width: 68ch; line-height: 1.5; }
.rd-msg { font-size: 13px; margin-top: 8px; }
.rd-vault { font-size: 13px; margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.rd-vault button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 5px; padding: 6px 10px; font-size: 12px; cursor: pointer;
  font-family: var(--mono);
}

/* ---- forecast key legend ---- */
.legend {
  margin-top: 28px; padding: 18px 0;
  border-top: 3px solid var(--text); border-bottom: 1px solid var(--border);
}
.legend h2 { font-size: 19px; margin: 0 0 10px; letter-spacing: -.01em; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; gap: 10px; align-items: baseline; margin: 10px 0; font-size: 14px; line-height: 1.45; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; transform: translateY(1px); }
.legend .signal-swatch {
  width: 18px; height: 12px; border: 2px dashed var(--dim); border-radius: 3px; flex: none;
  transform: translateY(2px);
}
.legend .fine { color: var(--dim); font-size: 12px; margin-top: 10px; }

/* ---- scorecard ---- */
.scorecard { margin-top: 28px; padding-bottom: 20px; }
.scorecard h2 { font-size: 19px; margin: 0 0 6px; letter-spacing: -.01em; }
.scorecard .explainer { font-size: 13px; color: var(--dim); margin: 0 0 4px; }
.score-overall {
  display: grid; grid-template-columns: repeat(2, 1fr);
  margin-top: 16px; border-top: 1px solid var(--text); border-bottom: 1px solid var(--text);
}
.score-overall > div { padding: 12px 4px; }
.score-overall .label {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em;
}
.score-overall .value { font-family: var(--mono); font-weight: 850; font-size: 28px; margin-top: 4px; }
.score-overall .value.cal { color: var(--orange); font-size: 15px; }
.score-rows { margin-top: 12px; border-top: 1px solid var(--border); }
.score-row {
  display: grid; grid-template-columns: minmax(76px, 1fr) 34px minmax(72px, .8fr) minmax(72px, .8fr);
  gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-weight: 700; font-size: 11px; line-height: 1.4;
  align-items: baseline;
}
.score-row .cal { color: var(--orange); }
.score-row .dim { color: var(--dim); font-weight: 500; }

.alert {
  background: var(--accent); color: #161200; border-radius: 6px;
  padding: 10px 12px; margin: 10px 0; font-size: 14px; font-weight: 600;
}
.board-empty { padding: 30px 0; color: var(--dim); font-size: 14px; }

/* ---- desktop ---- */
@media (min-width: 760px) {
  .app-shell { width: min(100%, 980px); margin: 0 auto; padding-inline: 28px; }
  .filters-panel { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; align-items: end; }
  .hero-departure { grid-template-columns: minmax(0, 1fr) 150px; padding-block: 30px; }
  .track-tile-large { width: 150px; min-height: 150px; }
  .track-tile-large .track-number { font-size: 76px; }
  .column-labels {
    display: grid; grid-template-columns: 100px minmax(0, 1fr) 90px; gap: 18px;
    font-family: var(--mono); font-weight: 750; font-size: 10px;
    letter-spacing: .08em; text-transform: uppercase; color: var(--dim);
    padding: 10px 0 6px;
  }
  .departure-row { grid-template-columns: 100px minmax(0, 1fr) 90px; gap: 18px; padding-block: 17px; }
  .legend ul { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
}

/* ---- admin page ---- */
.admin-shell { max-width: 560px; margin: 0 auto; }
.admin-title { font-size: 22px; margin: 22px 0 12px; letter-spacing: -.01em; }
.admin-back { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text); text-decoration: none; }
.admin-back:hover { text-decoration: underline; }
.admin-shell .signal-form { margin-top: 14px; }
