:root { --purple: #80276C; --purple-dark: #5e1c4f; --ink: #1d1d22; --panel: #ffffff; --line: #e3e0e6; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); }
body { display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--purple); color: #fff; flex-wrap: wrap; }
.t-logo { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; font-weight: 800; font-size: 17px; vertical-align: -7px; }
.brand .dim { opacity: .75; }
.status { font-size: 13px; opacity: .92; }
.status .dot { color: #7dff8a; }
.status .stale { color: #ffd97d; }
.header-actions { margin-left: auto; display: flex; gap: 6px; }
header button, header select { font: inherit; font-size: 13px; border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.12); color: #fff; border-radius: 6px; padding: 4px 9px; cursor: pointer; }
header select option { color: #000; }
.alerts-bar { background: #fff4d6; border-bottom: 1px solid #e6cf8a; font-size: 13px; }
.alerts-bar > button { width: 100%; text-align: left; background: none; border: 0; font: inherit; padding: 6px 12px; cursor: pointer; }
#alerts-list { padding: 0 12px 8px; max-height: 180px; overflow: auto; }
#alerts-list .alert { margin: 6px 0; }
#alerts-list .alert p { margin: 3px 0 0; color: #444; white-space: pre-wrap; }
.hidden { display: none !important; }
main { flex: 1; display: flex; min-height: 0; }
#panel { width: 322px; max-width: 86vw; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 10px 12px; }
#panel h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 6px; color: var(--purple-dark); }
#panel h2:first-child { margin-top: 0; }
#panel footer { margin-top: 18px; font-size: 12px; color: #666; line-height: 1.45; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.row-actions button { font-size: 12px; border: 1px solid var(--line); background: #f6f4f7; border-radius: 5px; padding: 2px 8px; cursor: pointer; }
.recent-label { font-size: 12px; color: #555; margin-left: auto; }
#line-list label { display: flex; align-items: center; gap: 7px; font-size: 13.5px; padding: 3px 2px; cursor: pointer; border-radius: 4px; }
#line-list label:hover { background: #f6f0f5; }
#line-list .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--purple); flex: none; }
#line-list .count { margin-left: auto; color: #777; font-size: 12px; }
#train-search { width: 100%; font: inherit; font-size: 13.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; }
#train-list .train { padding: 6px 7px; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 5px; cursor: pointer; font-size: 13px; }
#train-list .train:hover { border-color: var(--purple); }
#train-list .train.following { border-color: #e07b00; background: #fff7ea; }
#train-list .train .top { display: flex; gap: 6px; align-items: baseline; }
#train-list .train .no { font-weight: 700; color: var(--purple-dark); }
#train-list .train .dest { font-weight: 600; }
#train-list .train .sub { color: #666; font-size: 12px; margin-top: 2px; }
.follow-chip { background: #fff1d6; border: 1px solid #e6c98a; padding: 5px 8px; border-radius: 6px; font-size: 13px; margin-bottom: 6px; }
.follow-chip button { float: right; border: 0; background: none; cursor: pointer; font-size: 14px; }
#board .row { display: flex; gap: 8px; font-size: 13px; padding: 5px 2px; border-bottom: 1px solid var(--line); align-items: baseline; }
#board .row .time { font-weight: 700; min-width: 62px; }
#board .row .meta { margin-left: auto; text-align: right; color: #666; font-size: 12px; white-space: nowrap; }
#board .delay { color: #b35400; font-weight: 600; }
#board .ontime { color: #2c7a2c; }
#board .empty { color: #777; font-size: 13px; }
#map { flex: 1; min-width: 0; }
.train-marker { display: flex; align-items: center; gap: 1px; background: var(--purple); color: #fff; border: 1.5px solid #fff; border-radius: 999px; padding: 2px 7px 2px 5px; font-size: 11px; font-weight: 700; box-shadow: 0 1px 5px rgba(0,0,0,.45); white-space: nowrap; }
.train-marker .arrow { display: inline-block; font-size: 10px; line-height: 1; }
.train-marker.following { background: #e07b00; }
.train-marker.stopped { background: #55505c; }
.station-marker { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2.5px solid #2b2b30; box-shadow: 0 0 3px rgba(0,0,0,.4); }
.leaflet-popup-content { font-size: 13.5px; line-height: 1.5; }
.leaflet-popup-content .pop-title { font-weight: 700; color: var(--purple-dark); }
@media (max-width: 760px) {
  main { flex-direction: column-reverse; }
  #panel { width: 100%; max-width: none; max-height: 42%; border-right: 0; border-top: 1px solid var(--line); }
  #map { min-height: 0; }
}
