/* Link Light Rail Tracker — clean minimal CSS */

:root {
    --bg: #fff;
    --fg: #222;
    --fg-dim: #666;
    --border: #ddd;
    --link: #0366d6;
    --green: #22863a;
    --yellow: #b08800;
    --red: #cb2431;
    --green-bg: #e6ffed;
    --yellow-bg: #fff4c2;
    --red-bg: #ffe2e0;
    --gray-bg: #f6f8fa;
    --bg-alt: #f6f8fa;
    --bg-header: #24292e;
    --fg-header: #fff;
    --chart-west: #0366d6;
    --chart-east: #22863a;
    --west: #137f86;
    --west-bg: #e8f6f6;
    --west-border: #9fd2d4;
    --east: #7d5ac6;
    --east-bg: #f2eefb;
    --east-border: #d1c1ef;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--fg);
    background: var(--bg);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.mono { font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
    background: var(--bg-header);
    color: var(--fg-header);
    padding: 8px 16px;
    margin: 0 -16px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
}

header h1 {
    font-size: 16px;
    font-weight: 600;
}

header h1 a { color: var(--fg-header); }
header h1 a:hover { text-decoration: none; }

header nav a {
    color: var(--fg-header);
    opacity: 0.8;
    font-size: 13px;
}

header nav a:hover { opacity: 1; }
header nav a.active { opacity: 1; font-weight: 700; }
header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    max-width: 100%;
}

/* Page title */
h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 16px 0 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 12px 0 6px;
    color: var(--fg-dim);
}

/* Tables — wrapped for mobile overflow */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-wrap + .table-wrap { margin-top: 0; }

/* Standalone table (no wrapper) */
table:not(.table-wrap table) {
    margin: 8px 0 16px;
}

th, td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td.nowrap, th.nowrap { white-space: nowrap; }
td.time-col { white-space: nowrap; }

th {
    background: var(--bg-alt);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--fg-dim);
    white-space: nowrap;
}

tr:hover { background: var(--bg-alt); }

/* Status colors */
.on-time { color: var(--green); font-weight: 600; }
.late-minor { color: var(--yellow); font-weight: 600; }
.late-major { color: var(--red); font-weight: 600; }
.early-minor { color: #6f42c1; font-weight: 600; }
.early-major { color: var(--link); font-weight: 600; }

.status-ok { color: var(--green); }
.status-error { color: var(--red); }

/* Stat grid */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 8px 0 16px;
}

.stat {
    border: 1px solid var(--border);
    padding: 12px;
    background: var(--bg-alt);
}

.stat .label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--fg-dim);
    margin-bottom: 2px;
}

.stat .value {
    font-size: 20px;
    font-weight: 700;
}

.stat .value.small { font-size: 14px; }

/* Service strip */
.service-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    margin: 8px 0;
    font-size: 13px;
}

.service-strip .status-label {
    font-weight: 600;
}

/* Service alerts */
.alerts-stack {
    margin: 12px 0 16px;
}

.alerts-stack-compact {
    margin: 8px 0 12px;
}

.alert-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.alert-heading {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.alert-heading-link,
.alert-inline-link {
    font-size: 12px;
}

.alert-banner,
.alert-card {
    border: 2px solid var(--border);
    background: var(--gray-bg);
}

.alert-banner {
    padding: 12px 14px;
    margin-bottom: 8px;
    font-weight: 600;
}

.alert-banner-compact {
    padding: 8px 10px;
}

.alert-card {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.alert-cards {
    margin: 8px 0 16px;
}

.alert-card-header,
.alert-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.alert-summary {
    color: var(--fg);
    font-size: 14px;
    line-height: 1.4;
}

.alert-banner-compact .alert-summary {
    font-size: 13px;
}

.alert-card-subtitle,
.alert-meta-text {
    font-size: 12px;
    color: var(--fg-dim);
    margin-top: 2px;
}

.alert-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.alert-description {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    white-space: pre-wrap;
    color: var(--fg);
    font-size: 13px;
    line-height: 1.45;
}

.alert-details {
    margin-top: 10px;
}

.alert-details summary {
    cursor: pointer;
    color: var(--fg-dim);
}

.alert-detail-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 12px;
    margin-top: 10px;
    font-size: 12px;
}

.alert-detail-grid dt {
    color: var(--fg-dim);
    font-weight: 600;
}

.alert-detail-grid dd {
    margin: 0;
}

.alert-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.65);
}

.alert-badge-prominent {
    white-space: nowrap;
}

.severity-1 {
    background: var(--green-bg);
    border-color: var(--green);
}

.severity-2 {
    background: var(--yellow-bg);
    border-color: var(--yellow);
}

.severity-3 {
    background: var(--red-bg);
    border-color: var(--red);
}

.severity-unclassified {
    background: var(--gray-bg);
    border-color: var(--border);
}

/* Today-so-far compact */
.today-compact {
    font-size: 13px;
    color: var(--fg-dim);
    margin: 8px 0;
}

.today-compact strong {
    color: var(--fg);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    align-items: end;
    margin: 8px 0;
    flex-wrap: wrap;
}

.filters label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--fg-dim);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filters select, .filters input {
    font-family: inherit;
    font-size: 13px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.filters button {
    font-family: inherit;
    font-size: 13px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    cursor: pointer;
}

.filters button:hover { background: var(--border); }

/* Pagination */
.pagination {
    margin: 12px 0;
    font-size: 13px;
    color: var(--fg-dim);
}

.pagination a { margin: 0 4px; }

/* Direction pills */
.direction-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.direction-pill-wb {
    color: var(--west);
    background: var(--west-bg);
    border-color: var(--west-border);
}

.direction-pill-eb {
    color: var(--east);
    background: var(--east-bg);
    border-color: var(--east-border);
}

/* Home timeline */
.timeline-board {
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 16px;
    margin: 12px 0 16px;
}

.timeline-board-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 12px 20px;
    margin-bottom: 12px;
}

.timeline-board-header h3 {
    margin: 0;
    font-size: 17px;
    color: var(--fg);
    text-align: center;
}

.timeline-direction {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timeline-direction-wb {
    color: var(--west);
    justify-self: start;
}

.timeline-direction-eb {
    color: var(--east);
    justify-self: end;
    text-align: right;
}

.timeline-desktop {
    position: relative;
    padding-top: 40px;
}

.timeline-desktop::before {
    content: "";
    position: absolute;
    top: 16px;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #77838e, #d0d8df);
}

.timeline-now-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.timeline-now-marker span {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.timeline-rows {
    position: relative;
    z-index: 1;
}

.timeline-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
    align-items: center;
}

.timeline-row-near {
    min-height: 108px;
}

.timeline-row-mid {
    min-height: 92px;
}

.timeline-row-far {
    min-height: 78px;
}

.timeline-lane {
    display: flex;
    min-width: 0;
}

.timeline-lane-left {
    justify-content: flex-end;
    padding-right: 18px;
}

.timeline-lane-right {
    justify-content: flex-start;
    padding-left: 18px;
}

.timeline-axis-cell {
    position: relative;
    align-self: stretch;
}

.timeline-axis-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--bg-header);
    border: 2px solid var(--bg);
    transform: translate(-50%, -50%);
}

.timeline-item {
    position: relative;
    width: min(100%, 360px);
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.timeline-item::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px;
    border-top: 1px solid #c8d0d8;
    transform: translateY(-50%);
}

.timeline-item-left {
    text-align: right;
}

.timeline-item-left::after {
    right: -19px;
}

.timeline-item-right {
    text-align: left;
}

.timeline-item-right::after {
    left: -19px;
}

.timeline-item-wb {
    border-right: 3px solid var(--west);
}

.timeline-item-eb {
    border-left: 3px solid var(--east);
}

.timeline-item-countdown {
    font-size: 30px;
    line-height: 1;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

.timeline-item-destination {
    margin-top: 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
}

.timeline-item-status {
    margin-top: 3px;
    font-size: 13px;
    color: var(--fg-dim);
}

.timeline-item-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 12px;
    color: var(--fg-dim);
}

.timeline-item-left .timeline-item-meta {
    justify-content: flex-end;
}

.timeline-item-right .timeline-item-meta {
    justify-content: flex-start;
}

.timeline-item-meta .delay-late,
.timeline-history-deviation.delay-late,
.timeline-mobile-meta .delay-late {
    color: var(--red);
    font-weight: 600;
}

.timeline-item-meta .delay-early,
.timeline-history-deviation.delay-early,
.timeline-mobile-meta .delay-early {
    color: var(--east);
    font-weight: 600;
}

.timeline-empty {
    padding: 28px 16px 12px;
    text-align: center;
    color: var(--fg-dim);
    font-style: italic;
}

.timeline-mobile {
    display: none;
}

.timeline-mobile-section + .timeline-mobile-section {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.timeline-mobile-heading {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timeline-mobile-heading-wb {
    color: var(--west);
}

.timeline-mobile-heading-eb {
    color: var(--east);
    text-align: right;
}

.timeline-mobile-list {
    list-style: none;
}

.timeline-mobile-item {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.timeline-mobile-item:last-child {
    border-bottom: 0;
}

.timeline-mobile-time {
    font-size: 24px;
    line-height: 1.05;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timeline-mobile-body {
    min-width: 0;
}

.timeline-mobile-destination {
    font-size: 14px;
    font-weight: 600;
}

.timeline-mobile-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--fg-dim);
}

.timeline-mobile-empty {
    padding: 4px 0;
    font-size: 13px;
    color: var(--fg-dim);
}

.timeline-history {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.timeline-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.timeline-history-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--fg-dim);
}

.timeline-history-toggle {
    font-family: inherit;
    font-size: 12px;
    color: var(--fg-dim);
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
}

.timeline-history-toggle:hover {
    color: var(--fg);
    background: var(--gray-bg);
}

.timeline-history-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px dashed var(--border);
    background: #fafbfd;
}

.timeline-history-summary-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--fg-dim);
}

.timeline-history-inline,
.timeline-history-item {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
}

.timeline-history-list {
    list-style: none;
    margin-top: 10px;
}

.timeline-history-item {
    padding: 8px 10px;
    border: 1px dashed var(--border);
    background: #fafbfd;
}

.timeline-history-item + .timeline-history-item {
    margin-top: 8px;
}

.timeline-history-arrow {
    font-weight: 700;
}

.timeline-history-arrow-wb {
    color: var(--west);
}

.timeline-history-arrow-eb {
    color: var(--east);
}

.timeline-history-time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--fg);
}

.timeline-history-copy {
    color: var(--fg-dim);
}

.timeline-history-empty {
    margin-top: 8px;
    font-size: 13px;
    color: var(--fg-dim);
}

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

@media (max-width: 768px) {
    .timeline-board {
        padding: 12px;
    }

    .timeline-board-header {
        display: block;
    }

    .timeline-board-header h3 {
        text-align: left;
    }

    .timeline-direction,
    .timeline-desktop {
        display: none;
    }

    .timeline-mobile {
        display: block;
    }

    .timeline-mobile-time {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .timeline-mobile-item {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 10px;
    }

    .timeline-mobile-time {
        font-size: 20px;
    }

    .timeline-history-summary,
    .timeline-history-item {
        font-size: 12px;
    }
}

/* Live map */
.live-shell {
    margin: 12px 0 20px;
}

.live-mode-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin: 10px 0 8px;
}

.live-panels {
    position: relative;
}

.live-view-panel {
    display: none;
}

.live-view-panel.is-active {
    display: block;
}

.live-geographic-shell {
    position: relative;
    border: 1px solid var(--border);
    background: var(--bg-alt);
}

.live-geographic-map {
    width: 100%;
    min-height: 60vh;
    height: min(68vh, 760px);
    background: var(--bg-alt);
}

.live-geographic-empty {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
    color: var(--fg-dim);
    font-size: 12px;
}

.live-geographic-shell .maplibregl-ctrl-group {
    border-radius: 0;
    border: 1px solid var(--border);
    box-shadow: none;
}

.live-geographic-shell .maplibregl-ctrl button {
    background: var(--bg);
}

.live-geographic-shell .maplibregl-ctrl-attrib {
    font: inherit;
    font-size: 11px;
    color: var(--fg-dim);
    background: rgba(255, 255, 255, 0.92);
}

.live-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin: 10px 0 12px;
}

.live-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.live-chip,
.live-drawer-close {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    padding: 6px 10px;
    cursor: pointer;
}

.live-chip.is-active {
    background: var(--bg-header);
    color: var(--fg-header);
    border-color: var(--bg-header);
}

.live-toolbar-status {
    font-size: 12px;
    color: var(--fg-dim);
}

.live-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--fg-dim);
}

.live-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.live-legend-line {
    display: inline-block;
    width: 18px;
    height: 0;
    border-top: 4px solid var(--border);
}

.live-legend-line-1 { border-color: #28813F; }
.live-legend-line-2 { border-color: #007CAD; }

.live-legend-marker,
.live-legend-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #007CAD;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.live-legend-outline {
    border: 2px solid #fff;
    background: #007CAD;
}

.live-legend-outline-late {
    border-color: var(--red);
}

.live-legend-outline-stale {
    background: var(--bg-alt);
    border-color: var(--fg-dim);
    color: var(--fg-dim);
    opacity: 0.78;
}

.live-legend-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    background: #007CAD;
    color: #fff;
    font-weight: 700;
}

.live-legend-pill-stale {
    background: var(--bg-alt);
    color: var(--fg-dim);
    border: 1px dashed var(--fg-dim);
}

.live-map-wrap {
    position: relative;
}

.live-map-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 12px;
}

.live-map-svg {
    display: block;
    width: min(100%, 860px);
    min-width: 680px;
    height: auto;
    margin: 0 auto;
    background: var(--bg);
}

.live-route-halo {
    fill: none;
    stroke: #e3e7eb;
    stroke-width: 16;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.live-route-line {
    fill: none;
    stroke-width: 9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.live-route-line.route-1 {
    stroke: #28813F;
}

.live-route-line.route-2 {
    stroke: #007CAD;
}

.live-station {
    cursor: pointer;
    outline: none;
}

.live-station-hit {
    fill: transparent;
    stroke: transparent;
    pointer-events: all;
}

.live-station-home-ring {
    fill: none;
    stroke: rgba(0, 124, 173, 0.25);
    stroke-width: 6;
}

.live-station-dot {
    stroke: #fff;
    stroke-width: 2.5;
}

.live-station-dot.route-1 {
    fill: #28813F;
}

.live-station-dot.route-2 {
    fill: #007CAD;
}

.live-station.is-mercer .live-station-dot.route-2 {
    stroke: var(--bg-header);
    stroke-width: 2.75;
}

.live-station:focus .live-station-home-ring,
.live-station:hover .live-station-home-ring {
    stroke: rgba(3, 102, 214, 0.35);
}

.live-station:focus .live-station-dot,
.live-station:hover .live-station-dot {
    stroke: var(--link);
    stroke-width: 3;
}

.live-station-label {
    font-size: 12px;
    fill: var(--fg-dim);
    font-weight: 500;
    pointer-events: none;
}

.live-station.is-mercer .live-station-label {
    fill: var(--fg);
    font-weight: 700;
}

.live-map-empty {
    display: none;
    font-size: 13px;
    fill: var(--fg-dim);
}

.live-map-empty.is-visible {
    display: block;
}

.live-map-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--fg-dim);
}

.live-train-marker {
    cursor: pointer;
    transition: opacity 0.25s ease;
}

.live-train-marker.is-hidden {
    display: none;
}

.live-train-marker.is-missing {
    opacity: 0.28;
}

.live-train-selection {
    fill: none;
    stroke: var(--link);
    stroke-width: 2;
    opacity: 0;
}

.live-train-marker.is-selected .live-train-selection {
    opacity: 1;
}

.live-train-body {
    stroke-width: 2;
}

.live-train-marker.route-1 .live-train-body {
    fill: #28813F;
    stroke: var(--west);
}

.live-train-marker.route-2 .live-train-body {
    fill: #007CAD;
    stroke: var(--east);
}

.live-train-arrow-text,
.live-train-delay-text {
    fill: #fff;
    font-weight: 700;
}

.live-train-arrow-text {
    font-size: 14px;
}

.live-train-delay-text {
    font-size: 11px;
}

.live-train-delay-box {
    stroke-width: 1;
}

.live-train-marker.delay-on-time .live-train-delay-box {
    fill: rgba(255, 255, 255, 0.18);
    stroke: rgba(255, 255, 255, 0.45);
}

.live-train-marker.delay-late .live-train-delay-box {
    fill: var(--red-bg);
    stroke: var(--red);
}

.live-train-marker.delay-late .live-train-delay-text {
    fill: var(--red);
}

.live-train-marker.delay-early .live-train-delay-box {
    fill: var(--east-bg);
    stroke: var(--east);
}

.live-train-marker.delay-early .live-train-delay-text {
    fill: var(--east);
}

.live-train-marker.is-stale .live-train-body,
.live-train-marker.is-missing .live-train-body {
    stroke-dasharray: 4 3;
    opacity: 0.82;
}

.live-train-marker.is-stale .live-train-delay-box,
.live-train-marker.is-missing .live-train-delay-box {
    stroke-dasharray: 4 3;
}

.live-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(36, 41, 46, 0.18);
    z-index: 20;
}

.live-drawer {
    position: fixed;
    top: 86px;
    right: 16px;
    bottom: 16px;
    width: min(380px, calc(100vw - 32px));
    border: 1px solid var(--border);
    background: var(--bg);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    transform: translateX(110%);
    transition: transform 0.22s ease;
    z-index: 21;
    display: flex;
    flex-direction: column;
}

.live-drawer.is-open {
    transform: translateX(0);
}

.live-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
}

.live-drawer-header h3 {
    margin: 2px 0 0;
    color: var(--fg);
    font-size: 16px;
}

.live-drawer-kicker {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--fg-dim);
    font-weight: 700;
}

.live-drawer-body {
    padding: 14px 16px 18px;
    overflow: auto;
}

.live-drawer-section + .live-drawer-section {
    margin-top: 18px;
}

.live-drawer-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--fg-dim);
    margin: 0 0 8px;
}

.live-detail-note {
    font-size: 13px;
    color: var(--fg-dim);
}

.live-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.live-detail-card {
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 10px 12px;
}

.live-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--fg-dim);
}

.live-detail-value {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

.live-detail-list,
.live-alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.live-detail-list-item,
.live-alert-item {
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
}

.live-detail-list-item:last-child,
.live-alert-item:last-child {
    border-bottom: 0;
}

.live-detail-list-main,
.live-alert-title {
    font-size: 13px;
    color: var(--fg);
}

.live-detail-list-meta,
.live-alert-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--fg-dim);
}

.live-direction-group + .live-direction-group {
    margin-top: 10px;
}

.live-direction-heading {
    font-size: 12px;
    font-weight: 700;
    color: var(--fg-dim);
    margin-bottom: 4px;
}

.live-inline-badge {
    display: inline-block;
    padding: 1px 5px;
    margin-right: 6px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Footer */
footer {
    margin: 24px 0 16px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--fg-dim);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 16px;
    flex-wrap: wrap;
}

.footer-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 12px;
    flex-wrap: wrap;
}

.footer-note,
.footer-meta a {
    color: var(--fg-dim);
    font-size: 11px;
}

/* Date presets */
.date-presets {
    font-size: 13px;
    color: var(--fg-dim);
    margin: 4px 0 8px;
}

/* Empty state */
.empty {
    padding: 24px;
    text-align: center;
    color: var(--fg-dim);
    font-style: italic;
}

/* Error inline */
.error-inline {
    color: var(--red);
    font-size: 13px;
    margin: 8px 0;
}

/* Scope labels */
.scope-label {
    font-size: 12px;
    font-weight: 400;
    color: var(--fg-dim);
    margin-left: 8px;
}

/* Section notes */
.section-note {
    font-size: 12px;
    color: var(--fg-dim);
    margin: 2px 0 8px;
    font-style: italic;
}

.stat-note {
    margin-top: 4px;
    font-size: 12px;
    color: var(--fg-dim);
}

.adherence-stat-primary {
    border-color: var(--west-border);
}

.adherence-direction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 8px 0 16px;
}

.adherence-direction-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.adherence-direction-header,
.adherence-direction-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.adherence-direction-total,
.adherence-direction-submetrics {
    font-size: 12px;
    color: var(--fg-dim);
}

.adherence-direction-metric .label {
    margin-bottom: 0;
}

/* Direction sub-headers */
.direction-header {
    margin: 12px 0 4px;
    color: var(--fg-dim);
    font-size: 13px;
    font-weight: 600;
}

/* Charts */
.chart-grid {
    display: grid;
    gap: 16px;
    margin: 12px 0 16px;
}

.chart-grid-halves {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.chart-card {
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 12px;
}

.chart-card h4 {
    font-size: 13px;
    margin: 0 0 4px;
    color: var(--fg);
}

.chart-frame {
    width: 100%;
    height: 280px;
}

.chart-frame-tall {
    height: 420px;
}

.analytics-details {
    margin-top: 8px;
}

.analytics-details summary {
    font-size: 13px;
}

/* Low sample rows */
.low-sample {
    opacity: 0.6;
}

.badge-limited {
    font-size: 10px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 1px 4px;
    border-radius: 3px;
    color: var(--fg-dim);
    font-weight: 400;
    vertical-align: middle;
    margin-left: 4px;
}

/* Advanced section toggle */
.advanced-section {
    margin: 16px 0;
    border: 1px solid var(--border);
    padding: 8px 12px;
}

.advanced-section summary {
    cursor: pointer;
    font-size: 14px;
    color: var(--fg-dim);
}

.advanced-section summary:hover {
    color: var(--fg);
}

.advanced-section[open] summary {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    table { font-size: 12px; }
    th, td { padding: 3px 4px; }
    header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .chart-grid-halves { grid-template-columns: 1fr; }
    .chart-frame { height: 240px; }
    .chart-frame-tall { height: 340px; }
    .alert-heading-row,
    .alert-card-header,
    .alert-summary-row { flex-direction: column; }
    .alert-detail-grid { grid-template-columns: 1fr; }
    .live-mode-row { align-items: flex-start; }
    .live-chip,
    .live-drawer-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 14px;
    }
    .live-toolbar { align-items: flex-start; }
    .live-toolbar-status { margin-left: 0; width: 100%; }
    .live-geographic-map { height: 60vh; min-height: 60vh; }
    .live-geographic-empty {
        left: 8px;
        right: 8px;
        top: 8px;
    }
    .live-map-scroll {
        padding: 8px;
        touch-action: pan-y;
    }
    .live-map-svg { min-width: 100%; }
    .live-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: min(70vh, 540px);
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        transform: translateY(110%);
    }
    .live-drawer.is-open { transform: translateY(0); }
    .live-detail-grid { grid-template-columns: 1fr; }
    footer { flex-direction: column; gap: 4px; }
    .footer-meta { justify-content: flex-start; }
}

