:root {
    color-scheme: dark;
    --bg: #070b11;
    --bg-soft: #0a1018;
    --panel: #0d141d;
    --panel-2: #111a25;
    --line: rgba(122, 164, 205, .13);
    --line-strong: rgba(122, 164, 205, .24);
    --text: #e8f0f8;
    --text-2: #b9c8d8;
    --muted: #7b8fa4;
    --muted-2: #5b6f84;
    --accent: #37e5c4;
    --accent-soft: rgba(55, 229, 196, .12);
    --blue: #4aa7ff;
    --good: #3ee08f;
    --warn: #ffb648;
    --bad: #ff6470;
    --sim: #c39bff;
    --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
    --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --radius: 16px;
    --shadow: 0 18px 50px rgba(0, 0, 0, .38);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    overflow: hidden;
    background:
        radial-gradient(1100px 640px at 10% -12%, rgba(55, 229, 196, .07), transparent 58%),
        radial-gradient(1000px 620px at 92% -6%, rgba(74, 167, 255, .08), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(122, 164, 205, .2) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(122, 164, 205, .18);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(122, 164, 205, .3);
}

button {
    font-family: inherit;
}

a {
    color: var(--accent);
}

/* ---------- shell ---------- */

.app-shell {
    display: grid;
    grid-template-rows: 66px minmax(0, 1fr) 32px;
    height: 100dvh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(12, 18, 27, .85), rgba(7, 11, 17, .55));
    backdrop-filter: blur(14px);
    position: relative;
    z-index: 1500;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 252px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: conic-gradient(from 215deg, #37e5c4, #4aa7ff 42%, #8a6bff 72%, #37e5c4);
    display: grid;
    place-items: center;
    position: relative;
    box-shadow: 0 0 22px rgba(55, 229, 196, .22);
}

.brand-mark::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 9px;
    background: #0a1018;
}

.brand-mark span {
    position: relative;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.06em;
    color: var(--accent);
}

.brand-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .15em;
    line-height: 1;
}

.brand-title em {
    font-style: normal;
    color: var(--accent);
    font-weight: 500;
}

.brand-sub {
    margin-top: 5px;
    font-size: 9.5px;
    color: var(--muted);
    letter-spacing: .14em;
    text-transform: uppercase;
}

.topbar-clock {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.clock {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.clock span {
    margin-left: 5px;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.clock-date {
    margin-top: 6px;
    font-size: 9.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.topbar-side {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 252px;
    justify-content: flex-end;
}

.status-pills {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--text-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.pill-live {
    color: #9ff5df;
    border-color: rgba(62, 224, 143, .26);
    background: rgba(62, 224, 143, .07);
}

.pill-warn {
    color: #ffd79a;
    border-color: rgba(255, 182, 72, .26);
    background: rgba(255, 182, 72, .07);
}

.pill-error {
    color: #ffb7bc;
    border-color: rgba(255, 100, 112, .3);
    background: rgba(255, 100, 112, .08);
}

.pill-quiet {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: .03em;
    text-transform: none;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    display: inline-block;
    flex: 0 0 auto;
}

.dot-live {
    background: var(--good);
    box-shadow: 0 0 0 3px rgba(62, 224, 143, .13);
    animation: pulse 2.4s ease-in-out infinite;
}

.dot-demo {
    background: var(--sim);
    box-shadow: 0 0 0 3px rgba(195, 155, 255, .13);
}

.dot-warn {
    background: var(--warn);
}

.dot-error {
    background: var(--bad);
}

.dot-muted {
    background: var(--muted-2);
}

.dot-loading {
    background: var(--blue);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.panel-toggles {
    display: flex;
    gap: 5px;
}

.display-settings {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
}

.settings-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 246px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--panel-2);
    box-shadow: var(--shadow);
    z-index: 40;
}

.settings-title {
    margin-bottom: 2px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-2);
}

.settings-row select {
    height: 28px;
    max-width: 142px;
    padding: 0 24px 0 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: 10.5px;
    cursor: pointer;
}

.icon-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.icon-btn.is-on {
    color: var(--accent);
    border-color: rgba(55, 229, 196, .3);
    background: rgba(55, 229, 196, .07);
}

.icon-btn.tiny {
    width: 26px;
    height: 26px;
    border-radius: 8px;
}

.icon-btn.tiny svg {
    width: 13px;
    height: 13px;
}

/* ---------- layout ---------- */

.main-grid {
    display: grid;
    gap: 12px;
    padding: 12px 14px;
    min-height: 0;
}

.main-grid.cols-both {
    grid-template-columns: 296px minmax(0, 1fr) 344px;
}

.main-grid.cols-left {
    grid-template-columns: 296px minmax(0, 1fr);
}

.main-grid.cols-right {
    grid-template-columns: minmax(0, 1fr) 344px;
}

.main-grid.cols-map {
    grid-template-columns: minmax(0, 1fr);
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(17, 26, 38, .92), rgba(10, 16, 24, .96));
    box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
    overflow: hidden;
}

.left-panel {
    padding: 13px 12px 10px;
    gap: 14px;
}

/* ---------- stats ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: linear-gradient(160deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--accent), transparent);
}

.stat:nth-child(2)::after {
    background: linear-gradient(180deg, var(--blue), transparent);
}

.stat:nth-child(3)::after {
    background: linear-gradient(180deg, var(--good), transparent);
}

.stat:nth-child(4)::after {
    background: linear-gradient(180deg, var(--warn), transparent);
}

.stat-label {
    font-size: 9px;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.stat-value {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-foot {
    font-size: 9.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- side sections ---------- */

.side-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.side-section.grow {
    flex: 1;
}

.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.side-head h2 {
    margin: 0;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--muted);
}

.side-note {
    font-size: 9.5px;
    letter-spacing: .05em;
    color: var(--muted-2);
    white-space: nowrap;
}

.side-note.is-live {
    color: var(--good);
}

.side-note.is-demo {
    color: var(--sim);
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 3px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .24);
}

.segmented button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 29px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
}

.segmented button span {
    font-family: var(--mono);
    font-size: 9px;
    opacity: .65;
}

.segmented button:hover {
    color: var(--text);
}

.segmented button.is-on {
    color: var(--text);
    background: rgba(255, 255, 255, .065);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* ---------- rail lines ---------- */

.rail-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 188px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    flex-shrink: 0;
}

.rail-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: rgba(255, 255, 255, .018);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: .14s;
}

.rail-row:hover {
    background: rgba(255, 255, 255, .04);
}

.rail-row.is-active {
    border-color: var(--line-strong);
    background: rgba(55, 229, 196, .06);
}

.line-swatch {
    width: 4px;
    height: 26px;
    border-radius: 3px;
    background: var(--line, #8a9bb0);
    box-shadow: 0 0 10px var(--line, transparent);
    flex: 0 0 auto;
}

.rail-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.rail-name {
    font-size: 11.5px;
    font-weight: 600;
}

.rail-meta {
    font-size: 9px;
    color: var(--muted-2);
}

.rail-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}

/* ---------- lists ---------- */

.tabs2 {
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .22);
}

.tabs2 button {
    padding: 4px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
}

.tabs2 button.is-on {
    color: var(--text);
    background: rgba(255, 255, 255, .07);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .24);
    color: var(--muted);
}

.search-box:focus-within {
    border-color: rgba(55, 229, 196, .35);
}

.search-box svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.search-box input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font: inherit;
    font-size: 11.5px;
}

.search-box input::placeholder {
    color: var(--muted-2);
}

.side-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    padding-right: 2px;
}

.route-row,
.veh-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: .13s;
}

.route-row:hover,
.veh-row:hover {
    background: rgba(255, 255, 255, .035);
}

.route-row.is-active,
.veh-row.is-selected {
    border-color: rgba(55, 229, 196, .22);
    background: rgba(55, 229, 196, .07);
}

.route-badge {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    min-width: 34px;
    height: 25px;
    padding: 0 6px;
    border-radius: 7px;
    background: var(--badge, #2b3a4c);
    color: var(--badge-text, #fff);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -.02em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.route-badge.small {
    min-width: 30px;
    height: 21px;
    border-radius: 6px;
    font-size: 9px;
}

.route-badge.large {
    min-width: 48px;
    height: 42px;
    border-radius: 11px;
    font-size: 15px;
}

.route-copy,
.veh-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.route-name,
.veh-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-meta,
.veh-meta {
    font-size: 9px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-count {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--muted-2);
}

.veh-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.veh-dot.is-live {
    background: var(--good);
    box-shadow: 0 0 6px rgba(62, 224, 143, .5);
}

.veh-dot.is-sim {
    background: var(--sim);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 26px 10px;
    text-align: center;
}

.empty-state span {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-2);
}

.empty-state small {
    font-size: 10px;
    line-height: 1.45;
    color: var(--muted-2);
}

.empty-state.tall {
    padding: 42px 12px;
}

.empty-icon svg {
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
    color: var(--muted-2);
}

/* ---------- map ---------- */

.map-cell {
    position: relative;
    min-height: 0;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--bg-soft);
    box-shadow: var(--shadow);
}

.map-shell {
    position: absolute;
    inset: 0;
}

.map-canvas {
    position: absolute;
    inset: 0;
    background: #0a1018;
}

.map-canvas.ml-map-dark .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.48);
}

.map-canvas.ml-map-light .leaflet-tile-pane {
    filter: none;
}

.leaflet-container {
    background: #0a1018;
    font-family: var(--font);
    outline: none;
}

.leaflet-control-attribution {
    padding: 2px 6px !important;
    border-radius: 6px 0 0 0;
    background: rgba(7, 11, 17, .74) !important;
    color: #90a4b8 !important;
    font-size: 9px !important;
    backdrop-filter: blur(6px);
}

.leaflet-control-attribution a {
    color: #b9c9da !important;
}

.leaflet-control-zoom {
    margin: 0 14px 14px 0 !important;
    border: none !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .4) !important;
}

.leaflet-control-zoom a {
    width: 28px !important;
    height: 28px !important;
    line-height: 26px !important;
    border-color: var(--line) !important;
    background: rgba(11, 18, 26, .94) !important;
    color: var(--text-2) !important;
    font-size: 16px !important;
    backdrop-filter: blur(8px);
}

.leaflet-control-zoom a:hover {
    background: rgba(24, 35, 48, .96) !important;
    color: var(--accent) !important;
}

.map-hud {
    position: absolute;
    left: 14px;
    top: 14px;
    z-index: 800;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: none;
}

.hud-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(8, 14, 21, .8);
    color: var(--text-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.hud-demo {
    color: #e3ccff;
    border-color: rgba(195, 155, 255, .3);
    background: rgba(70, 45, 105, .32);
}

.live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 6px rgba(62, 224, 143, .7);
    animation: pulse 2.2s ease-in-out infinite;
}

.map-tools {
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-tool {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(8, 14, 21, .82);
    color: var(--text-2);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: .15s;
}

.map-tool:hover {
    color: var(--accent);
    border-color: rgba(55, 229, 196, .3);
}

.map-tool svg {
    width: 15px;
    height: 15px;
}

.map-legend {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 11px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(8, 14, 21, .82);
    color: var(--muted);
    font-size: 9.5px;
    backdrop-filter: blur(8px);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-veh {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, .7);
}

.legend-bus {
    background: #9b3694;
}

.legend-rail {
    border-radius: 50%;
    background: #ce242b;
}

.legend-station {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #081019;
    background: #c9d8e8;
}

/* ---------- leaflet markers ---------- */

.ml-cluster-icon {
    background: transparent;
    border: none;
}

.ml-cluster {
    width: 42px;
    height: 42px;
    display: grid;
    place-content: center;
    gap: 1px;
    border-radius: 50%;
    border: 1.5px solid rgba(122, 164, 205, .5);
    background: rgba(8, 18, 29, .94);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .08);
    color: #f3f8ff;
    font-family: var(--mono);
    line-height: 1;
    text-align: center;
    transition: transform .15s ease, box-shadow .15s ease;
}

.ml-cluster b {
    font-size: 12px;
    font-weight: 800;
}

.ml-cluster span {
    font-size: 6.5px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #9db3c6;
}

.ml-cluster-bus {
    border-color: rgba(74, 144, 217, .9);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .6), 0 0 0 3px rgba(74, 144, 217, .14);
}

.ml-cluster-rail {
    border-color: rgba(55, 229, 196, .9);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .6), 0 0 0 3px rgba(55, 229, 196, .14);
}

.ml-cluster-mixed {
    border-color: rgba(226, 185, 74, .9);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .6), 0 0 0 3px rgba(226, 185, 74, .14);
}

.ml-cluster-icon:hover .ml-cluster {
    transform: scale(1.08);
}

.ml-cluster-icon:active .ml-cluster {
    transform: scale(.96);
}
.ml-veh-icon {
    background: transparent;
    border: none;
}

.ml-veh {
    position: relative;
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    border: 1.5px solid #05090f;
    background: var(--veh);
    color: var(--veh-text, #fff);
    box-shadow: 0 2px 9px rgba(0, 0, 0, .65), inset 0 0 0 1.5px rgba(255, 255, 255, .92);
    transition: opacity .22s ease, transform .22s ease, box-shadow .2s;
}

.ml-veh-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.04em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.ml-veh.ml-rail {
    border-radius: 8px;
    transform: rotate(45deg);
    box-shadow: 0 2px 9px rgba(0, 0, 0, .65), inset 0 0 0 1.5px rgba(255, 255, 255, .92);
}

.ml-veh.ml-rail .ml-veh-label {
    transform: rotate(-45deg);
    font-size: 7.5px;
}

.ml-bearing {
    display: none;
    position: absolute;
    top: -7px;
    left: 50%;
    width: 0;
    height: 0;
    margin-left: -3.5px;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-bottom: 5px solid var(--veh);
    transform-origin: 50% 22px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35));
}

.ml-rail .ml-bearing {
    display: none;
}

.ml-veh-icon:hover .ml-bearing,
.ml-veh-icon.ml-selected .ml-bearing {
    display: block;
}

.ml-sim-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid #081019;
    background: var(--sim);
}

.ml-veh-icon.ml-dim .ml-veh {
    opacity: .12;
    transform: scale(.8);
}

.ml-veh-icon.ml-selected .ml-veh {
    opacity: 1 !important;
    transform: scale(1.16);
    box-shadow: 0 0 0 4px rgba(55, 229, 196, .32), 0 6px 18px rgba(0, 0, 0, .55), inset 0 0 0 2px #fff;
}

.ml-veh-icon.ml-selected .ml-veh .ml-veh-label {
    font-size: 9.5px;
}

.ml-veh-icon.ml-selected .ml-veh.ml-rail {
    transform: rotate(45deg) scale(1.1);
}

.leaflet-tooltip.ml-tooltip {
    padding: 8px 10px;
    border: 1px solid rgba(122, 164, 205, .25);
    border-radius: 10px;
    background: rgba(9, 14, 21, .96);
    color: var(--text);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .5);
    backdrop-filter: blur(10px);
}

.leaflet-tooltip.ml-tooltip::before {
    display: none;
}

.ml-tip {
    min-width: 130px;
    font-size: 11px;
    line-height: 1.35;
}

.ml-tip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ml-tip-head b {
    font-size: 12px;
    letter-spacing: .02em;
}

.ml-tip-mode {
    padding: 1px 4px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--muted);
    font-size: 8px;
    letter-spacing: .12em;
}

.ml-tip-dest {
    margin-top: 3px;
    color: var(--text-2);
}

.ml-tip-meta {
    margin-top: 4px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9.5px;
}

.ml-tip-station {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ml-tip-station b {
    font-size: 11px;
    letter-spacing: .02em;
}

.ml-tip-station span {
    font-size: 9px;
    color: var(--muted);
}

/* ---------- map loading ---------- */

.map-loading {
    position: absolute;
    inset: 0;
    z-index: 850;
    display: grid;
    place-items: center;
    background:
        radial-gradient(600px 400px at 50% 40%, rgba(55, 229, 196, .06), transparent 65%),
        rgba(7, 11, 17, .93);
    backdrop-filter: blur(4px);
}

.map-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    max-width: 380px;
    padding: 24px;
    text-align: center;
}

.loading-mark {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 22px;
}

.loading-mark span {
    width: 4px;
    border-radius: 2px;
    background: var(--accent);
    animation: bars 1.1s ease-in-out infinite;
}

.loading-mark span:nth-child(2) {
    animation-delay: .14s;
    background: var(--blue);
}

.loading-mark span:nth-child(3) {
    animation-delay: .28s;
    background: var(--sim);
}

@keyframes bars {
    0%, 100% { height: 6px; opacity: .4; }
    50% { height: 20px; opacity: 1; }
}

.loading-title {
    font-size: 15px;
    font-weight: 600;
}

.loading-sub {
    font-size: 10.5px;
    line-height: 1.5;
    color: var(--muted);
}

.loading-feeds {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.loading-feed {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9.5px;
    color: var(--muted-2);
}

/* ---------- right panel ---------- */

.right-panel {
    min-height: 0;
}

.panel-tabs {
    display: flex;
    gap: 2px;
    padding: 10px 12px 0;
    border-bottom: 1px solid var(--line);
}

.panel-tabs button {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px 10px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.panel-tabs button.is-on {
    color: var(--text);
}

.panel-tabs button.is-on::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.tab-count {
    padding: 1px 4px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 8.5px;
}

.panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 13px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.panel-body > * {
    flex-shrink: 0;
}

.selection-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
    overflow: hidden;
}

.selection-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-line, var(--accent));
}

.selection-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selection-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.selection-kicker {
    font-size: 9px;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--muted);
}

.selection-dest {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--line);
}

.detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 9px;
    background: rgba(9, 14, 21, .58);
}

.detail span {
    font-size: 8.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.detail b {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tone-good { color: var(--good) !important; }
.tone-warn { color: var(--warn) !important; }
.tone-bad { color: var(--bad) !important; }
.tone-muted { color: var(--muted) !important; }

.selection-actions {
    display: flex;
    gap: 6px;
}

.btn-primary,
.btn-ghost {
    height: 30px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
}

.btn-primary {
    flex: 1;
    background: var(--accent);
    color: #04241f;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-ghost {
    background: rgba(255, 255, 255, .04);
    border-color: var(--line);
    color: var(--text-2);
}

.btn-ghost:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.hint-card {
    display: flex;
    gap: 11px;
    padding: 13px;
    border: 1px dashed rgba(122, 164, 205, .25);
    border-radius: 14px;
    background: rgba(255, 255, 255, .02);
}

.hint-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}

.hint-icon svg {
    width: 18px;
    height: 18px;
}

.hint-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hint-copy b {
    font-size: 12px;
}

.hint-copy span {
    font-size: 10.5px;
    line-height: 1.45;
    color: var(--muted);
}

.pulse-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.pulse {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
}

.pulse span {
    font-size: 8.5px;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.pulse b {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feed-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, .015);
}

.feed-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.feed-name {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-2);
}

.feed-meta {
    font-size: 9px;
    line-height: 1.35;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-state {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.feed-state.state-live { color: var(--good); }
.feed-state.state-demo { color: var(--sim); }
.feed-state.state-error { color: var(--bad); }
.feed-state.state-warn { color: var(--warn); }

.notice {
    display: flex;
    gap: 9px;
    padding: 10px;
    border: 1px solid rgba(255, 182, 72, .22);
    border-radius: 11px;
    background: rgba(255, 182, 72, .055);
}

.notice-error {
    border-color: rgba(255, 100, 112, .26);
    background: rgba(255, 100, 112, .06);
}

.notice-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    height: 18px;
    padding: 0 4px;
    border: 1px solid rgba(255, 182, 72, .35);
    border-radius: 5px;
    color: var(--warn);
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .06em;
}

.notice-error .notice-mark {
    border-color: rgba(255, 100, 112, .4);
    color: var(--bad);
}

.notice-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.notice-copy b {
    font-size: 11px;
}

.notice-copy span {
    font-size: 10px;
    line-height: 1.45;
    color: var(--muted);
}

.notice-copy code {
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .06);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 9px;
}

.notice.compact {
    padding: 8px 9px;
}

.station-select {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(0, 0, 0, .24);
    color: var(--muted);
}

.station-select svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.station-select select {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.station-select option {
    background: var(--panel);
    color: var(--text);
}

.arrival-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.arrival-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .02);
}

.line-chip {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    min-width: 42px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: color-mix(in srgb, var(--line) 16%, transparent);
    color: var(--text);
    font-family: var(--mono);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .05em;
    box-shadow: inset 0 -2px 0 var(--line);
}

.arrival-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.arrival-dest {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arrival-meta {
    font-size: 9px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arrival-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.arrival-time b {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.arrival-time span {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--muted-2);
    white-space: nowrap;
}

.alert-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 11px;
    border: 1px solid rgba(255, 182, 72, .2);
    border-radius: 11px;
    background: rgba(255, 182, 72, .05);
}

.alert-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.alert-effect {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--warn);
}

.alert-routes {
    font-family: var(--mono);
    font-size: 8.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-title {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.alert-desc {
    max-height: 84px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.45;
    color: var(--muted);
}

/* ---------- footer ---------- */

.statusbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    border-top: 1px solid var(--line);
    background: rgba(7, 11, 17, .7);
    color: var(--muted-2);
    font-size: 9px;
    letter-spacing: .04em;
}

.sb-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.sb-item a {
    color: inherit;
    text-decoration: none;
}

.sb-item a:hover {
    color: var(--text-2);
}

.sb-spacer {
    flex: 1;
}

/* ---------- framework error ui ---------- */

#blazor-error-ui {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    padding: 10px 18px;
    border-top: 1px solid var(--bad);
    background: #1a0f13;
    color: #ffd7db;
    font-size: 12px;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 14px;
    top: 8px;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem;
    border-radius: 12px;
    background: #1a0f13;
    color: #ffd7db;
}

/* ---------- mobile shell (hidden on desktop) ---------- */

.mobile-only,
.sheet-head,
.mobile-nav,
.sheet-backdrop {
    display: none;
}

.panel.panel-hidden {
    display: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1460px) {
    .main-grid.cols-both {
        grid-template-columns: 278px minmax(0, 1fr) 320px;
    }

    .brand,
    .topbar-side {
        min-width: 220px;
    }

    .pill-quiet {
        display: none;
    }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-rows: 54px minmax(0, 1fr) auto;
    }

    .topbar {
        height: 54px;
        padding: 0 12px;
        gap: 10px;
    }

    .brand {
        flex: 1;
        min-width: 0;
        gap: 9px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .brand-mark span {
        font-size: 15px;
    }

    .brand-title {
        font-size: 12.5px;
        letter-spacing: .13em;
    }

    .brand-sub {
        display: none;
    }

    .topbar-clock {
        display: none;
    }

    .topbar-side {
        flex: 0 0 auto;
        min-width: 0;
        gap: 8px;
    }

    .panel-toggles {
        display: none;
    }

    .status-pills {
        gap: 4px;
    }

    .status-pills .pill-quiet {
        display: none;
    }

    .pill {
        height: 24px;
        padding: 0 8px;
        font-size: 8.5px;
        letter-spacing: .06em;
    }

    .statusbar {
        display: none;
    }

    .main-grid,
    .main-grid.cols-both,
    .main-grid.cols-left,
    .main-grid.cols-right,
    .main-grid.cols-map {
        display: block;
        position: relative;
        height: 100%;
        min-height: 0;
        padding: 0;
    }

    .map-cell {
        position: absolute;
        inset: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .map-hud {
        top: 10px;
        left: 10px;
        gap: 4px;
        max-width: calc(100% - 96px);
    }

    .hud-chip {
        height: 24px;
        padding: 0 8px;
        font-size: 8.5px;
    }

    .map-tools {
        top: 10px;
        right: 10px;
        gap: 5px;
    }

    .map-tool {
        width: 34px;
        height: 34px;
    }

    .leaflet-control-zoom {
        margin: 0 10px 10px 0 !important;
    }

    .map-legend {
        display: none;
    }

    /* Panels become bottom sheets */
    .panel.panel-hidden {
        display: flex;
    }

    .left-panel,
    .right-panel {
        position: fixed;
        left: 50%;
        right: auto;
        top: auto;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        width: min(calc(100% - 12px), 640px);
        height: min(78dvh, 760px);
        max-height: calc(100dvh - 132px);
        z-index: 1200;
        background: linear-gradient(180deg, #121b26, #0b1119);
        border-radius: 18px 18px 0 0;
        border-bottom: none;
        box-shadow: 0 -22px 60px rgba(0, 0, 0, .55);
        transform: translate(-50%, calc(100% + 90px));
        visibility: hidden;
        transition: transform .3s cubic-bezier(.22, .8, .28, 1), visibility 0s linear .3s;
        will-change: transform;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        overscroll-behavior: contain;
    }

    .left-panel {
        padding: 6px 12px 10px;
        gap: 12px;
        overflow-y: auto;
    }

    .left-panel > * {
        flex-shrink: 0;
    }

    .left-panel .side-section.grow {
        flex: 0 0 auto;
    }

    .left-panel .side-list {
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
    }

    .right-panel {
        padding-top: 0;
    }

    .left-panel.is-open,
    .right-panel.is-open {
        transform: translate(-50%, 0);
        visibility: visible;
        transition: transform .3s cubic-bezier(.22, .8, .28, 1), visibility 0s;
    }

    .sheet-head {
        position: relative;
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 15px 12px 7px;
    }

    .sheet-grabber {
        position: absolute;
        top: 7px;
        left: 50%;
        width: 34px;
        height: 4px;
        border-radius: 3px;
        background: rgba(122, 164, 205, .28);
        transform: translateX(-50%);
    }

    .sheet-title {
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 600;
        letter-spacing: .16em;
        text-transform: uppercase;
    }

    .mobile-only {
        display: block;
    }

    .sheet-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1100;
        display: block;
        background: rgba(3, 6, 10, .62);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
        backdrop-filter: blur(2px);
    }

    .sheet-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .panel-tabs {
        padding-top: 4px;
    }

    /* The sheet header already labels the active tab; avoid duplicate headings. */
    .right-panel .panel-body > .side-head h2 {
        display: none;
    }

    .right-panel .panel-body > .side-head {
        justify-content: flex-end;
    }

    .stat-grid {
        gap: 8px;
    }

    .stat {
        padding: 10px 11px;
    }

    .side-list {
        overscroll-behavior: contain;
    }

    .mobile-nav {
        position: relative;
        z-index: 1300;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: stretch;
        height: calc(58px + env(safe-area-inset-bottom, 0px));
        padding: 4px 4px env(safe-area-inset-bottom, 0px);
        border-top: 1px solid var(--line);
        background: linear-gradient(180deg, rgba(10, 16, 24, .96), rgba(7, 11, 17, .99));
        backdrop-filter: blur(16px);
    }

    .mobile-tab {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 4px 0;
        border: none;
        border-radius: 10px;
        background: transparent;
        color: var(--muted);
        font: inherit;
        font-size: 8.5px;
        font-weight: 600;
        letter-spacing: .02em;
        cursor: pointer;
    }

    .mobile-tab svg {
        width: 19px;
        height: 19px;
    }

    .mobile-tab.is-on {
        color: var(--accent);
    }

    .mobile-tab.is-on::before {
        content: "";
        position: absolute;
        top: 0;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: var(--accent);
    }

    .nav-badge {
        position: absolute;
        top: 2px;
        left: calc(50% + 7px);
        min-width: 14px;
        height: 14px;
        padding: 0 3px;
        border-radius: 999px;
        background: var(--bad);
        color: #fff;
        font-family: var(--mono);
        font-size: 8px;
        line-height: 14px;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .status-pills {
        display: none;
    }

    .hud-chip.hud-demo {
        display: none;
    }

    .map-hud {
        max-width: calc(100% - 70px);
    }

    .left-panel,
    .right-panel {
        width: calc(100% - 8px);
    }
}

@media (max-height: 760px) {
    .stat {
        padding: 7px 9px;
    }

    .stat-value {
        font-size: 19px;
    }

    .left-panel {
        gap: 10px;
    }
}






/* Multi-city selector */
.city-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.city-switch > span {
    font-size: 9px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.city-switch select {
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    padding-right: 16px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 7px) 52%, calc(100% - 3px) 52%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}

.city-switch select option {
    background: #10151e;
    color: #eef4ff;
}

@media (max-width: 900px) {
    .city-switch {
        padding: 4px 7px;
    }

    .city-switch > span {
        display: none;
    }

    .city-switch select {
        max-width: 132px;
        font-size: 10.5px;
    }
}


/* ---------- trip planner ---------- */

.plan-fab {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 860;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(55, 229, 196, .34);
    background: rgba(8, 20, 26, .9);
    color: var(--accent);
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    transition: .15s;
}

.plan-fab:hover,
.plan-fab.is-on {
    background: rgba(55, 229, 196, .16);
    border-color: rgba(55, 229, 196, .55);
}

.plan-fab svg {
    width: 16px;
    height: 16px;
}

.map-pick-banner {
    position: absolute;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    z-index: 870;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 120px);
    padding: 8px 11px;
    border: 1px solid rgba(55, 229, 196, .4);
    border-radius: 10px;
    background: rgba(5, 18, 18, .92);
    color: var(--text-2);
    font-size: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

.map-pick-banner button {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    font: inherit;
    font-size: 9px;
    padding: 4px 8px;
    cursor: pointer;
}

.plan-intro {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.plan-kicker {
    color: var(--accent);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.plan-intro h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: -.01em;
}

.plan-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.5;
}

.plan-fields {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.plan-field {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
    transition: .15s;
}

.plan-field.is-picking {
    border-color: rgba(55, 229, 196, .5);
    box-shadow: 0 0 0 3px rgba(55, 229, 196, .08);
}

.plan-pin {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #04241f;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
}

.plan-pin-b {
    background: #ff9f6b;
    color: #2a1004;
}

.plan-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 11.5px;
}

.plan-field input::placeholder {
    color: var(--muted-2);
}

.plan-field-btn {
    flex: 0 0 auto;
    height: 24px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .04);
    color: var(--text-2);
    font: inherit;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
}

.plan-field-btn:hover {
    color: var(--accent);
    border-color: rgba(55, 229, 196, .3);
}

.plan-field-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -2px 2px 0;
}

.plan-link {
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 9.5px;
    cursor: pointer;
}

.plan-link:hover {
    color: var(--accent);
}

.plan-resolved {
    max-width: 62%;
    overflow: hidden;
    color: var(--accent);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-matches {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(7, 12, 18, .55);
}

.plan-match {
    display: flex;
    gap: 8px;
    padding: 6px 7px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2);
    text-align: left;
    cursor: pointer;
}

.plan-match:hover {
    background: rgba(55, 229, 196, .08);
}

.plan-match-kind {
    align-self: flex-start;
    flex: 0 0 auto;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .07);
    color: var(--muted);
    font-size: 7.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.plan-match-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.plan-match-copy b {
    overflow: hidden;
    color: var(--text);
    font-size: 10.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-match-copy small {
    overflow: hidden;
    color: var(--muted-2);
    font-size: 8.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-submit {
    width: 100%;
    height: 36px;
}

.plan-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 9.5px;
}

.plan-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(55, 229, 196, .2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: plan-spin .7s linear infinite;
}

@keyframes plan-spin {
    to { transform: rotate(360deg); }
}

.plan-hint {
    display: flex;
    gap: 10px;
    padding: 11px;
    border: 1px dashed rgba(122, 164, 205, .24);
    border-radius: 12px;
    background: rgba(255, 255, 255, .02);
}

.plan-hint-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    height: 24px;
    padding: 0 6px;
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
}

.plan-hint div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.plan-hint b {
    font-size: 11px;
}

.plan-hint span {
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.45;
}

.plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.plan-actions .btn-ghost {
    flex: 1;
}

.plan-notice {
    border-color: rgba(55, 229, 196, .24);
    background: rgba(55, 229, 196, .055);
}

/* trip planner result */

.trip-plan {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(165deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
}

.trip-plan-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trip-plan-kicker {
    color: var(--accent);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.trip-plan-duration {
    font-family: var(--mono);
    font-size: 25px;
    font-weight: 600;
    line-height: 1.05;
}

.trip-plan-window {
    color: var(--text-2);
    font-size: 10.5px;
}

.trip-plan-window span {
    margin: 0 4px;
    color: var(--muted-2);
}

.trip-plan-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 9px;
}

.trip-plan-summary {
    overflow: hidden;
    color: var(--text-2);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-legs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.trip-leg {
    display: flex;
    gap: 9px;
    padding: 7px 4px;
    border-radius: 8px;
}

.trip-leg + .trip-leg {
    border-top: 1px dashed rgba(122, 164, 205, .13);
}

.trip-leg-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
}

.trip-walk-icon {
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
}

.trip-walk-icon svg {
    width: 15px;
    height: 15px;
}

.trip-route-badge {
    width: auto;
    min-width: 24px;
    padding: 0 5px;
    border-radius: 6px;
    background: var(--badge);
    color: var(--badge-text);
    font-family: var(--mono);
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.trip-leg-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.trip-leg-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.trip-leg-title b {
    overflow: hidden;
    font-size: 10.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-leg-title span {
    flex: 0 0 auto;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 8.5px;
}

.trip-leg-sub {
    overflow: hidden;
    color: var(--muted-2);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-leg-meta {
    color: var(--muted-2);
    font-size: 8px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* trip itinerary markers */

.ml-trip-icon {
    background: transparent;
    border: none;
}

.ml-trip-point,
.ml-trip-end {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, .78);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .55);
    font-family: var(--mono);
    font-weight: 800;
}

.ml-trip-point {
    font-size: 7.5px;
    letter-spacing: -.04em;
}

.ml-trip-point.board {
    background: #0d2a26;
    color: #7df5dd;
}

.ml-trip-point.alight {
    background: #2b1c10;
    color: #ffc08a;
}

.ml-trip-end {
    font-size: 11px;
}

.ml-trip-end.start {
    border-color: #071018;
    background: var(--accent);
    color: #04241f;
}

.ml-trip-end.end {
    border-color: #071018;
    background: #ff7a67;
    color: #2a0804;
}

@media (max-width: 1180px) {
    .mobile-nav {
        grid-template-columns: repeat(6, 1fr);
    }

    .plan-fab {
        display: none;
    }
}
.plan-submit {
    flex: 0 0 auto;
}
@media (max-width: 980px) {
    .settings-popover {
        position: fixed;
        top: 64px;
        right: 10px;
    }
}

.plan-alt-head {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
@media (max-width: 980px) and (max-height: 520px) {
    .left-panel,
    .right-panel {
        top: 54px;
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
        height: auto;
        max-height: none;
        border-radius: 14px 14px 0 0;
        transform: translate(-50%, calc(100% + 70px));
    }

    .left-panel.is-open,
    .right-panel.is-open {
        transform: translate(-50%, 0);
    }
}