:root {
    --ink: #17252d;
    --muted: #60737d;
    --paper: #f8f6ef;
    --panel: #fffdf7;
    --teal: #176b87;
    --teal-dark: #0f526a;
    --rust: #c45a38;
    --line: #dfe4df;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #app { height: 100%; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

#app { display: grid; grid-template-columns: 330px minmax(0, 1fr); }
#sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    color: #f7faf8;
    z-index: 4;
    box-shadow: 8px 0 30px rgba(15, 35, 45, .12);
}
#sidebar header { padding: 20px 18px 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-bottom: 20px; }
.brand-mark {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
    background: var(--rust); color: white; font: 800 20px/1 Georgia, serif;
}
.brand strong { display: block; font: 700 17px/1.2 Georgia, serif; }
.brand small { display: block; margin-top: 2px; color: #a8bbc3; font-size: 11px; }
.field-label { display: block; margin: 0 0 5px; color: #a8bbc3; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
#city-select, #search {
    width: 100%; padding: 10px 12px; border: 1px solid #40525c; border-radius: 8px;
    background: #22343e; color: #fff; font-size: 14px; outline: none;
}
#city-select:focus, #search:focus { border-color: #7db7c8; box-shadow: 0 0 0 3px rgba(125,183,200,.16); }
.status { margin-top: 7px; color: #91a5af; font-size: 12px; }
.search-wrap { display: block; margin: 4px 14px 10px; }
#search::placeholder { color: #8499a3; }
#route-list { flex: 1; overflow-y: auto; list-style: none; padding: 2px 10px 20px; }
#route-list li { border-radius: 8px; }
#route-list li:hover { background: #243944; }
#route-list li.active { background: var(--teal); }
#route-list a { display: flex; align-items: center; gap: 10px; padding: 9px 8px; text-decoration: none; font-size: 13px; line-height: 1.35; }
.badge {
    flex-shrink: 0; min-width: 42px; padding: 3px 6px; border-radius: 6px; text-align: center;
    font-size: 12px; font-weight: 800; color: white; background: #536a76;
}
.route-ends { color: #c2d0d6; }
#service-hours { margin: 0 14px 10px; padding: 10px; background: #243944; border-radius: 8px; font-size: 12px; }
.sh-title { font-weight: 700; margin-bottom: 5px; }
.sh-row { display: flex; flex-wrap: wrap; gap: 3px 8px; padding: 3px 0; }
.sh-day { flex: 1; color: #c2d0d6; }
.sh-time { font-weight: 700; color: #94d7b0; white-space: nowrap; }
.sh-days { flex-basis: 100%; color: #8197a2; font-size: 11px; text-align: right; }
.sh-note { margin-top: 5px; color: #91a5af; font-size: 11px; line-height: 1.35; }
.sh-note.warn { color: #f0bb78; }

#content { position: relative; min-width: 0; display: grid; grid-template-rows: minmax(240px, 42vh) minmax(360px, 1fr); overflow: auto; }
#seo-content { padding: 28px clamp(20px, 4vw, 64px) 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
#breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
#breadcrumbs a { color: var(--teal); text-decoration: none; }
#page-title { max-width: 850px; font: 700 clamp(27px, 3vw, 44px)/1.08 Georgia, serif; letter-spacing: -.02em; }
#page-intro { max-width: 780px; margin-top: 12px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.source-info { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--teal); background: #edf5f4; color: #45616c; font-size: 13px; }
#direction-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 22px; margin-top: 22px; }
.direction h2, .route-directory h2 { margin-bottom: 10px; font: 700 18px/1.2 Georgia, serif; }
.direction ol { padding-left: 24px; color: #334b56; columns: 2; column-gap: 28px; }
.direction li { break-inside: avoid; padding: 3px 0; font-size: 13px; line-height: 1.35; }
.direction li span { display: block; color: #7b8b92; font-size: 11px; }
.route-directory { grid-column: 1 / -1; }
.route-links { display: flex; flex-wrap: wrap; gap: 8px; }
.route-links a, .city-links a {
    padding: 7px 10px; border: 1px solid #cdd9d8; border-radius: 7px;
    color: var(--teal-dark); background: white; text-decoration: none; font-size: 13px; font-weight: 650;
}
.route-links a:hover, .city-links a:hover { border-color: var(--teal); background: #edf5f4; }
.city-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.route-utility { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hours-card {
    min-width: 280px; padding: 14px 16px; border: 1px solid #d6e1df; border-radius: 10px;
    background: #f4f8f6;
}
.hours-card h2 { margin-bottom: 8px; font: 700 17px/1.2 Georgia, serif; }
.hours-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hours-card th { padding: 3px 12px 3px 0; text-align: left; color: var(--muted); font-weight: 600; }
.hours-card td { padding: 3px 10px 3px 0; font-weight: 700; }
.hours-card p { margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.route-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.route-actions button {
    padding: 9px 13px; border: 1px solid #bfd0d1; border-radius: 8px; cursor: pointer;
    background: white; color: var(--teal-dark); font: 650 13px/1 system-ui, sans-serif;
}
.route-actions button:hover, .route-actions button.active { border-color: var(--teal); background: #edf5f4; }
#map { min-height: 360px; }
#data-age {
    position: fixed; top: 14px; right: 14px; z-index: 5; max-width: 340px; padding: 8px 12px;
    border-radius: 8px; color: white; background: #a5412c; box-shadow: 0 3px 18px rgba(0,0,0,.22); font-size: 13px;
}
#data-age.notice { background: var(--ink); line-height: 1.4; }
.vehicle-marker { position: relative; width: 30px; height: 30px; cursor: pointer; }
.vehicle-marker .arrow {
    position: absolute; inset: 0; display: grid; place-items: center; color: #197441;
    font-size: 25px; text-shadow: 0 0 2px white, 0 0 2px white;
}
.vehicle-marker .label {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    padding: 1px 5px; border-radius: 6px; background: var(--ink); color: white; font-size: 10px; font-weight: 800;
}
.forecast { margin-top: 6px; min-width: 200px; }
.arrival { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid #e6e9ef; font-size: 12px; }
.arrival .dest { flex: 1; color: #4a5568; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrival .eta { font-weight: 800; color: #197441; white-space: nowrap; }

@media (max-width: 760px) {
    #app { display: flex; flex-direction: column; height: auto; min-height: 100%; }
    #sidebar { position: relative; width: 100%; max-height: 46vh; min-height: 300px; }
    #content { display: flex; flex-direction: column; overflow: visible; }
    #seo-content { order: 2; padding: 24px 18px; }
    #map { order: 1; height: 52vh; min-height: 360px; }
    .direction ol { columns: 1; }
    #data-age { top: auto; bottom: 12px; left: 12px; right: 12px; max-width: none; }
}

.coverage-panel {
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid #d9e2e7;
    border-radius: 12px;
    background: #f8fbfc;
}

.coverage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.coverage-metric {
    display: grid;
    gap: .2rem;
    padding: .7rem;
    border-radius: 9px;
    background: white;
}

.coverage-metric strong {
    color: #176b87;
    font-size: 1.25rem;
}

.coverage-unknown strong {
    color: #6b7280;
    font-size: 1rem;
}

.city-sources {
    grid-column: 1 / -1;
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid #d9e2e7;
    border-radius: 12px;
    background: #fff;
}

.city-sources ul {
    display: grid;
    gap: .75rem;
    margin: .75rem 0 0;
    padding: 0;
    list-style: none;
}

.city-sources li {
    padding-top: .75rem;
    border-top: 1px solid #e6ecef;
}

.city-sources li:first-child {
    padding-top: 0;
    border-top: 0;
}

.city-sources li > div,
.source-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.city-sources small {
    display: block;
    margin-top: .3rem;
    color: #60727a;
}

.source-badges span {
    padding: .15rem .4rem;
    border-radius: 999px;
    background: #e8f1f4;
    color: #36535f;
    font-size: .75rem;
}

.source-badges .status-active,
.source-badges .status-verified {
    background: #def3e5;
    color: #24643b;
}

.source-badges .status-stale,
.source-badges .status-unavailable {
    background: #fff0d9;
    color: #82510b;
}

.coverage-metric small,
.route-ends small {
    display: block;
    color: #60727a;
}

@media (max-width: 760px) {
    .coverage-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
