/* Transit page styles — only loaded on /transit.
   See docs/transit/architecture.md for the overall component
   layout this fits into. */

/* The HTML `hidden` attribute normally sets display:none via the
   UA stylesheet, but our flex-display rules below (.transit-mode-row,
   .transit-timelapse) outrank it. Force [hidden] to actually hide. */
[hidden] { display: none !important; }

.transit-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Vertical list in the right-side sidebar. Each item now has a
   title button (click → highlight line on the map) and a small ↗
   icon (click → navigate to the line's deep-dive page). The whole
   row is bordered; the title button takes most of the width. */
/* Layers panel — broad category toggles above the per-line list.
   Slim vertical list, no item border (these are not actionable
   navigations like the line rows). */
.transit-layers-list {
    list-style: none;
    margin: 0 0 0.5rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.transit-layers-list li { margin: 0; }
.transit-layers-list label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-body);
    font-size: 0.85rem;
    cursor: pointer;
}
.transit-layers-list label small {
    color: #888;
    font-size: 0.72rem;
}

.transit-line-sidebar-hint {
    margin: 0 0 0.5rem 0;
    color: var(--text-body);
    font-size: 0.72rem;
    line-height: 1.3;
}
.transit-line-list-icon-demo {
    display: inline-block;
    padding: 0 0.2rem;
    color: var(--forest-green);
    font-weight: bold;
}
.transit-line-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.transit-line-list-item {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-outer);
    background: rgba(0, 0, 0, 0.05);
    transition: background-color 120ms, border-color 120ms;
}
.transit-line-list-item--active {
    /* Matches HIGHLIGHT_COLOR = #FF1493 in main.js. Translucent
       background tint keeps row text legible while signaling the
       row matches the magenta lines drawn on the map. */
    background: rgba(255, 20, 147, 0.18);
    border-color: #C71585;
}
.transit-line-list-eye {
    flex: 0 0 auto;
    padding: 0.15rem 0.35rem;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-outer);
    color: var(--text-body);
    font-size: 0.82rem;
    cursor: pointer;
    line-height: 1.2;
}
.transit-line-list-eye:hover {
    background: rgba(0, 0, 0, 0.08);
}
.transit-line-list-item--hidden .transit-line-list-eye {
    /* Visually mark the eye as "off" — half opacity + grayscale. */
    opacity: 0.35;
}
.transit-line-list-item--hidden .transit-line-list-title {
    color: #888;
    text-decoration: line-through;
    text-decoration-color: rgba(0, 0, 0, 0.3);
}

.transit-line-list-title {
    flex: 1 1 auto;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--forest-green);
    padding: 0.15rem 0.45rem;
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.2;
    cursor: pointer;
    /* Truncate over-long route names rather than wrapping — the
       sidebar is narrow at 25% of the row. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.transit-line-list-title:hover {
    color: var(--text-dark);
}
.transit-line-list-item--active .transit-line-list-title {
    color: var(--text-dark);
    font-weight: bold;
}
.transit-line-list-go {
    flex: 0 0 auto;
    padding: 0.15rem 0.4rem;
    color: var(--forest-green);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.82rem;
    border-left: 1px solid var(--border-outer);
    background: rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
}
.transit-line-list-go:hover {
    background: rgba(46, 139, 87, 0.18);
}

/* Proposals section — user-scenario routes. Each entry is a color
   swatch + static label (no eye/page-link wiring yet). The static
   class disables the hover/click affordance of regular line titles. */
.transit-line-list--proposals {
    border-top: 1px dashed var(--border-outer);
    padding-top: 0.3rem;
}
.transit-proposal-swatch {
    flex: 0 0 auto;
    width: 0.9rem;
    height: 0.9rem;
    margin: 0 0.4rem;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.25);
}
.transit-line-list-title--static {
    cursor: default;
    background: none;
    border: none;
    padding: 0.25rem 0.4rem;
    font: inherit;
    color: var(--text-dark);
    flex: 1 1 auto;
}
.transit-line-list-title--static:hover {
    background: none;
}
.transit-proposal-edit {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
}
.transit-proposal-edit:hover {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

/* When a proposal LI is in --editing state, hide its normal row
   content (swatch, name, ✏) and let the moved-in edit form take
   over the row. Keeping the LI itself preserves the layout slot. */
.transit-line-list-item--editing {
    flex-wrap: wrap;
}
.transit-line-list-item--editing > .transit-proposal-swatch,
.transit-line-list-item--editing > .transit-line-list-title,
.transit-line-list-item--editing > .transit-proposal-edit {
    display: none;
}

.transit-proposal-edit-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 0.4rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 3px;
}
.transit-proposal-edit-form label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}
.transit-proposal-edit-form input[type="text"],
.transit-proposal-edit-form select {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.2rem 0.35rem;
    font: inherit;
}
.transit-proposal-edit-form input[type="color"] {
    flex: 0 0 auto;
    width: 2.2rem;
    height: 1.6rem;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: transparent;
}
.transit-proposal-edit-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
}
.transit-proposal-edit-actions button {
    padding: 0.25rem 0.6rem;
    font: inherit;
    cursor: pointer;
}
.transit-proposal-edit-actions .transit-proposal-edit-delete {
    margin-left: auto;
    color: #c0392b;
    background: rgba(192,57,43,0.08);
    border-color: rgba(192,57,43,0.5);
}
.transit-proposal-edit-actions .transit-proposal-edit-delete:hover {
    background: rgba(192,57,43,0.2);
}

/* Draw toolbar — appears top-left of the map while drawing is
   active. Compact pill with vertex count + control buttons. */
.transit-draw-toolbar {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: rgba(0, 0, 0, 0.82);
    color: var(--cream);
    border: 1px solid var(--border-outer);
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
}
.transit-draw-toolbar button {
    font-family: inherit;
    font-size: 0.85rem;
    /* Min-height bumps these to a comfortable click/tap target.
       The toolbar is already 2-row-tall to accommodate the snap /
       smooth / radius controls below, so growing the button height
       doesn't disturb the layout. */
    min-height: 30px;
    padding: 0.3rem 0.7rem;
    background: var(--cream);
    color: var(--text-dark);
    border: 1px solid var(--border-outer);
    cursor: pointer;
}
.transit-draw-toolbar button:hover:not(:disabled) {
    background: var(--gold);
}
.transit-draw-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.transit-draw-snap-roads-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--cream);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 0.2rem;
    border-left: 1px solid rgba(255,255,255,0.2);
    margin-left: 0.2rem;
}
.transit-draw-smooth-radius-label input[type="number"] {
    width: 3.5rem;
    font: inherit;
    padding: 0.1rem 0.2rem;
}
/* Phase 5.b: yellow warning paint when the current smoothing
   radius is below the active vehicle's operational minimum. The
   hard clamp keeps it above absolute; this just flags the
   substandard zone (between absolute and operational). */
.transit-draw-smooth-radius--warn {
    background: rgba(224, 160, 32, 0.25);
    border-color: #b07a10 !important;
    outline: 2px solid #e0a020;
    outline-offset: -1px;
}
/* Phase 4.h.2 readout — live R + ∠ while the cursor moves in
   tangent-arc mode. Plain text, dimmed style so it reads as info
   rather than a button. */
.transit-draw-tangent-readout {
    display: inline-flex;
    align-items: center;
    color: var(--cream);
    font-size: 0.85rem;
    padding: 0 0.4rem;
    border-left: 1px solid rgba(255,255,255,0.2);
    margin-left: 0.2rem;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}
/* Phase 5.b: yellow tint on the tangent-arc readout when current
   R is below the vehicle's operational minimum. Whole-readout
   highlight (not just the R chip) so it's visible at a glance
   without scanning to find which value is the offending one. */
.transit-draw-tangent-readout.transit-draw-tangent-readout--warn {
    background: rgba(224, 160, 32, 0.22);
    border-radius: 3px;
    opacity: 1;
}

/* Phase 5.c live-readout panel. Pinned at bottom-left of the map
   while drawing; small dark-on-cream pill matching the rest of the
   editor's overlay aesthetic. Each row shows a label + a tabular-
   numerals value so the numbers line up as they update. */
.transit-draw-readout {
    position: absolute;
    bottom: 0.6rem;
    left: 0.6rem;
    z-index: 7;
    background: var(--panel-bg);
    border: 3px solid var(--border-outer);
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
    min-width: 11rem;
    pointer-events: none;
}
.transit-draw-readout-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.8rem;
    padding: 0.05rem 0;
}
.transit-draw-readout-key {
    color: var(--text-body);
    opacity: 0.75;
}
.transit-draw-readout-value {
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
}
.transit-draw-readout-row--warn .transit-draw-readout-value {
    color: #8a6010;
    background: rgba(224, 160, 32, 0.25);
    padding: 0 0.3rem;
    border-radius: 3px;
}
.transit-draw-readout-row--danger .transit-draw-readout-value {
    color: #8a1f1f;
    background: rgba(210, 32, 32, 0.18);
    padding: 0 0.3rem;
    border-radius: 3px;
}
.transit-draw-readout-sep {
    border-top: 1px dashed var(--border-outer);
    margin: 0.3rem 0;
}
.transit-draw-readout-row--total .transit-draw-readout-key,
.transit-draw-readout-row--total .transit-draw-readout-value {
    font-weight: bold;
}
.transit-draw-tangent-readout span {
    font-weight: bold;
    min-width: 2.5em;
    text-align: right;
    display: inline-block;
}
.transit-draw-tangent-lock {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--cream);
    padding: 0 0.25rem;
    margin: 0 0.2rem 0 0.1rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1.2;
}
.transit-draw-tangent-lock:hover {
    background: rgba(255,255,255,0.12);
}
.transit-draw-tangent-lock--on {
    background: rgba(255,200,90,0.25);
    border-color: rgba(255,200,90,0.6);
}
.transit-draw-tangent-nudge {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--cream);
    cursor: pointer;
    border-radius: 3px;
    line-height: 1;
    font-weight: bold;
    /* Min 28x28 touch target so this is usable on touchscreens. */
    min-width: 28px;
    min-height: 28px;
    padding: 0 0.35rem;
    margin: 0 0.1rem;
    font-size: 1rem;
}
.transit-draw-tangent-nudge:hover {
    background: rgba(255,255,255,0.12);
}
.transit-draw-tangent-nudge:active {
    background: rgba(255,255,255,0.22);
}

/* Phase 4.h.4 copied-arc-radius pill. Visible only when something
   is on the clipboard. Sits in the draw toolbar between the smooth-
   corners controls and the arc buttons. */
.transit-draw-copied-arc-pill {
    display: inline-flex;
    align-items: center;
    color: var(--cream);
    font-size: 0.85rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(120,180,255,0.18);
    border: 1px solid rgba(120,180,255,0.45);
    margin-left: 0.25rem;
    font-variant-numeric: tabular-nums;
}
.transit-draw-copied-arc-pill span {
    font-weight: bold;
}
#transit-draw-copied-arc-clear {
    background: transparent;
    border: none;
    color: var(--cream);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
    margin-left: 0.25rem;
}
#transit-draw-copied-arc-clear:hover {
    color: #ff9090;
}

/* Save-segment form — modal-ish overlay at bottom-right of the
   map area. Shown after Finish, hidden after save / cancel. */
.transit-draw-save {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    z-index: 7;
    width: min(360px, calc(100% - 1.2rem));
    background: var(--panel-bg);
    border: 3px solid var(--border-outer);
    padding: 0.6rem 0.8rem;
}
.transit-draw-save h4 {
    margin: 0 0 0.6rem 0;
    color: var(--forest-green);
}
.transit-draw-save form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.transit-draw-save label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.85rem;
    color: var(--text-body);
}
.transit-draw-save input,
.transit-draw-save select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border-outer);
    background: white;
    color: var(--text-dark);
}
.transit-draw-save-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}
.transit-draw-save-actions button {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: var(--forest-green);
    color: var(--cream);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}
.transit-draw-save-actions button[type="button"] {
    background: var(--cream-dark);
    color: var(--text-dark);
}

/* Realtime mode countdown pill — small UI element that ticks
   down 10..0 between vehicle-tile refreshes so the user can see
   the feed is alive even when no vehicles are moving. Positioned
   in the top-right of the map; hidden when not in Realtime mode. */
.transit-realtime-status {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    z-index: 5;
    padding: 0.3rem 0.6rem;
    background: rgba(0, 0, 0, 0.78);
    color: var(--cream);
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    border: 1px solid var(--border-outer);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.transit-realtime-status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #ff4040;
    box-shadow: 0 0 6px rgba(255, 64, 64, 0.7);
    animation: transit-realtime-pulse 1.6s ease-in-out infinite;
}
@keyframes transit-realtime-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.transit-mode-btn {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--border-outer);
    background: var(--panel-bg);
    color: var(--text-body);
    cursor: pointer;
}
.transit-mode-btn:hover { border-color: var(--gold-dark); }
.transit-mode-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.transit-mode-btn--active {
    background: linear-gradient(135deg, var(--forest-green), #2a6e35);
    color: var(--cream);
    border-color: var(--forest-green);
}

/* Map + sidebar share the row at desktop widths; flex children
   below set the 75/25 split. On phones the row stacks vertically
   (see media query below). */
.transit-map-row {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    /* Height is owned by the map container; sidebar matches it. */
    align-items: stretch;
}

.transit-map-container {
    background: #111;
    border: 4px solid var(--border-outer);
    position: relative;
    flex: 3 1 0;       /* 75% of the row */
    /* Phase 0.4 default: fill the natural reading width of the
       content area, with a height that's prominent but not
       overwhelming. Adjust per device via the responsive rule below. */
    height: 70vh;
    min-height: 480px;
    overflow: hidden;
}

.transit-line-sidebar {
    flex: 1 1 0;        /* 25% of the row */
    border: 4px solid var(--border-outer);
    background: var(--panel-bg);
    padding: 0.5rem 0.8rem;
    overflow-y: auto;
    /* Match the map's visible height so the sidebar's scroll is
       internal rather than the whole row growing taller than the map. */
    max-height: 70vh;
}
.transit-line-sidebar h3 {
    margin: 0.2rem 0 0.6rem 0;
    color: var(--forest-green);
    font-size: 1rem;
}

#transit-map {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

/* Home button — matches the size + dimensions of MapLibre's zoom
   controls so the two control groups read as a unified column. The
   house glyph is a unicode character ⌂ since adding a sprite for one
   button is overkill. */
.transit-home-btn {
    font-size: 1.4rem;
    line-height: 1;
    font-family: inherit;
    padding: 0;
}

/* Make the MapLibre attribution control fit the site's aesthetic
   rather than the default Mapbox-style chip. */
.maplibregl-ctrl-attrib {
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--cream);
}
.maplibregl-ctrl-attrib a {
    color: var(--gold);
}

/* ---- Responsive layout ----
 *
 * Three sizes:
 *   - desktop / wide tablet (default rules above): side-by-side
 *     75/25 split, both children 70vh tall
 *   - portrait phone / narrow tablet: stack map → list; the line +
 *     proposal lists go multi-column so a long list isn't an
 *     endless vertical scroll on a small screen
 *   - landscape phone (wide but short): keep side-by-side, but the
 *     map height tracks the visible viewport (dvh-based so iOS
 *     URL-bar shrink doesn't blow it out) and the sidebar gets the
 *     same ceiling
 *
 * Portrait detection uses both `orientation: portrait` AND a
 * max-width fallback because some phones land their landscape
 * viewport in the 600-700px range, which would otherwise still
 * trip max-width-only rules. */
@media (orientation: portrait) and (max-width: 768px),
       (max-width: 600px) {
    .transit-map-row {
        flex-direction: column;
    }
    .transit-map-container {
        height: 55vh;
        min-height: 360px;
        flex: 0 0 auto;
    }
    .transit-line-sidebar {
        max-height: none;   /* let the list be its natural height */
        flex: 0 0 auto;
    }
    /* Multi-column layout for the Lines + Proposals lists so a long
       list doesn't dominate the small screen. 100 px minimum column
       width gives 3-4 cols on a phone in portrait. */
    .transit-line-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.2rem 0.3rem;
    }
    .transit-line-list-item {
        font-size: 0.8rem;
    }
    /* The hint paragraph is too verbose for narrow viewports — the
       icons in the entries explain themselves and the hint just
       clutters. */
    .transit-line-sidebar-hint {
        display: none;
    }
}

/* Landscape phone: wide but short. Side-by-side fits horizontally,
   but the desktop 70vh map height crowds out everything. Cap to dvh
   so the URL bar shrinking on iOS doesn't push the map off-screen.
   Using max-height keeps the rule from interfering with desktop
   landscape (where height is plenty). */
@media (orientation: landscape) and (max-height: 500px) {
    .transit-map-container {
        height: 85dvh;
        min-height: 0;
    }
    .transit-line-sidebar {
        max-height: 85dvh;
    }
}

/* MapLibre popup tweaks. The default popup styling is light-on-dark
   browser default; we override to match the site's panel aesthetic
   without fighting the popup positioning logic. */
.maplibregl-popup-content {
    background: var(--panel-bg);
    color: var(--text-body);
    border: 2px solid var(--border-outer);
    font-family: 'VT323', monospace;
    font-size: 1rem;
    padding: 0.75rem 0.9rem;
}
.maplibregl-popup-tip {
    border-top-color: var(--border-outer) !important;
}
.transit-popup-title {
    font-family: 'Press Start 2P', 'VT323', monospace;
    font-size: 0.85rem;
    color: var(--forest-green);
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-outer);
}
.transit-popup-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.6rem;
    line-height: 1.25;
    word-break: break-word;
    max-height: 240px;
    overflow-y: auto;
}
.transit-popup-body > div {
    display: contents;
}
.transit-popup-key {
    color: #aaa;
    font-size: 0.85rem;
}
/* Phase 5 engineering-warning banner inside the popup. Red-tinted
   so the user clocks it before reading any other property. */
.transit-popup-warning {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.55rem;
    background: rgba(210, 32, 32, 0.12);
    border: 1px solid #d22020;
    color: #8a1f1f;
    font-size: 0.85rem;
    line-height: 1.3;
}
/* Phase 5.a soft-limit warning — same shape as the hard variant
   but yellow (substandard but traversable). */
.transit-popup-warning.transit-popup-warning--soft {
    background: rgba(224, 160, 32, 0.15);
    border-color: #b07a10;
    color: #6e4d10;
}

/* Phase 6.b: route-runtime row in track popups. Shows total minutes,
   avg speed, stop count. Hydrated async by hydrateTrackPopupRuntime
   after the popup mounts — fade-in via the loading placeholder. */
.transit-popup-runtime {
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.55rem;
    background: rgba(46, 139, 87, 0.08);
    border: 1px solid var(--forest-green);
    border-radius: 3px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.transit-popup-runtime-key {
    color: var(--forest-green);
    font-weight: bold;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.transit-popup-runtime-value {
    font-variant-numeric: tabular-nums;
}
.transit-popup-runtime-sub {
    opacity: 0.75;
    font-size: 0.8em;
}
.transit-popup-runtime-value[data-runtime-loading] {
    opacity: 0.5;
    font-style: italic;
}

/* Phase 6.c: bottleneck list within the runtime row. Each item is a
   click-to-jump button. Compact + tabular so the user can scan
   "R, speed" at a glance. */
.transit-popup-bottlenecks {
    margin-top: 0.4rem;
    padding-top: 0.3rem;
    border-top: 1px dashed rgba(46, 139, 87, 0.5);
}
.transit-popup-bottlenecks-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--forest-green);
    font-weight: bold;
    margin-bottom: 0.2rem;
}
.transit-popup-bottleneck {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(46, 139, 87, 0.25);
    border-radius: 3px;
    padding: 0.15rem 0.4rem;
    margin-bottom: 0.15rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}
.transit-popup-bottleneck:hover {
    background: rgba(46, 139, 87, 0.12);
    border-color: var(--forest-green);
}
.transit-popup-bottleneck-r {
    font-weight: bold;
}
.transit-popup-bottleneck-v {
    opacity: 0.85;
}

/* Phase 6.d: fleet + annual op-cost line within the runtime row. */
.transit-popup-runtime-fleet {
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px dashed rgba(46, 139, 87, 0.4);
}

/* Phase 6 polish — collapse the fleet + bottleneck content behind
   a "Details" disclosure so the summary stays compact by default. */
.transit-popup-runtime-details {
    margin-top: 0.25rem;
}
.transit-popup-runtime-details > summary {
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--forest-green);
    font-weight: bold;
    padding: 0.2rem 0;
    user-select: none;
    list-style: none;     /* hide default disclosure triangle */
}
.transit-popup-runtime-details > summary::before {
    content: "▶ ";
    display: inline-block;
    font-size: 0.7em;
    transition: transform 0.15s ease;
}
.transit-popup-runtime-details[open] > summary::before {
    transform: rotate(90deg);
}
.transit-popup-runtime-details > summary:hover {
    color: var(--gold);
}
/* When the details are open, the first child gets no top-border
   (the disclosure summary already sits on a dashed line). */
.transit-popup-runtime-details[open] .transit-popup-runtime-fleet {
    margin-top: 0.15rem;
    padding-top: 0.15rem;
    border-top: none;
}

/* Phase 5.f: nested op-cost breakdown disclosure inside Details.
   Lighter visual weight than the parent so the hierarchy reads as
   "headline → breakdown → component rows." */
.transit-popup-cost-breakdown {
    margin: 0.2rem 0 0.1rem 0.6rem;
    font-size: 0.78rem;
}
.transit-popup-cost-breakdown > summary {
    cursor: pointer;
    color: rgba(46, 139, 87, 0.85);
    list-style: none;
    user-select: none;
    padding: 0.1rem 0;
    font-style: italic;
}
.transit-popup-cost-breakdown > summary::before {
    content: "▸ ";
    font-size: 0.85em;
    transition: transform 0.15s ease;
    display: inline-block;
}
.transit-popup-cost-breakdown[open] > summary::before {
    transform: rotate(90deg);
}
.transit-popup-cost-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.08rem 0;
    color: rgba(0, 0, 0, 0.7);
}
.transit-popup-cost-amount {
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    color: rgba(0, 0, 0, 0.9);
}

/* Phase 7.j: per-station ridership table rows. Click-to-jump
   styling — hoverable like the bottleneck list, same indent as
   the cost-breakdown rows so they read as sub-content of Details. */
.transit-popup-station-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.18rem 0.3rem;
    margin: 0;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    text-align: left;
    border-radius: 3px;
}
.transit-popup-station-row:hover {
    background: rgba(218, 165, 32, 0.12);
    color: var(--forest-green);
}
.transit-popup-station-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.transit-popup-station-stats {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Phase 6 polish — "All properties" disclosure for the raw property
   dump. Same visual treatment as the runtime-details disclosure so
   the two collapsibles read as a consistent affordance. */
.transit-popup-all-props {
    margin-top: 0.4rem;
}
.transit-popup-all-props > summary {
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--forest-green);
    font-weight: bold;
    padding: 0.2rem 0;
    user-select: none;
    list-style: none;
}
.transit-popup-all-props > summary::before {
    content: "▶ ";
    display: inline-block;
    font-size: 0.7em;
    transition: transform 0.15s ease;
}
.transit-popup-all-props[open] > summary::before {
    transform: rotate(90deg);
}
.transit-popup-all-props > summary:hover {
    color: var(--gold);
}
.transit-popup-all-props .transit-popup-body {
    font-size: 0.8rem;
    opacity: 0.85;
}

.transit-popup-link {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-outer);
    text-align: right;
}
.transit-popup-link a {
    color: var(--forest-green);
    text-decoration: none;
    font-weight: bold;
}
.transit-popup-link a:hover {
    text-decoration: underline;
}

/* Proposal-feature actions in the popup (Phase 4.e). Rendered as a
   row of compact buttons; the danger variant marks destructive
   actions (Delete) so the user clocks the difference. */
.transit-popup-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border-outer);
}
.transit-popup-action {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--border-outer);
    background: var(--cream);
    color: var(--text-dark);
    cursor: pointer;
}
.transit-popup-action:hover {
    background: var(--cream-dark);
    border-color: var(--forest-green);
}
.transit-popup-action--danger {
    background: #fde8e8;
    border-color: #d35454;
    color: #8a1f1f;
}
.transit-popup-action--danger:hover {
    background: #f7c7c7;
    border-color: #b03333;
}

/* Time-lapse slider overlay. Sits over the bottom of the map
   when active. Native [hidden] kicks in via the attribute when
   not in time-lapse mode. */
.transit-timelapse {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid var(--border-outer);
    padding: 0.4rem 0.7rem;
    font-family: 'VT323', monospace;
    color: var(--cream);
    /* Keep the bar from getting wider than the map on phones. */
    max-width: calc(100% - 2rem);
}

.transit-timelapse-play {
    font-family: inherit;
    font-size: 1rem;
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid var(--border-outer);
    background: var(--panel-bg);
    color: var(--forest-green);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.transit-timelapse-play:hover { border-color: var(--gold); }

.transit-timelapse-slider {
    flex: 1 1 320px;
    min-width: 200px;
    accent-color: var(--gold);
    cursor: pointer;
}

.transit-timelapse-year {
    font-size: 1.1rem;
    color: var(--gold);
    min-width: 3.5rem;
    text-align: right;
}

/* Editor / scenario panel — visible when Editor mode is active.
   Sits in the same top-panel grid as the timeline-settings row;
   uses .transit-mode-row's flex layout for free. */
.transit-scenario-name {
    color: var(--text-body);
    font-style: italic;
    margin-right: 0.4rem;
}
/* Click-to-rename affordance — only when there's an active scenario.
   The dashed under-decoration hints "editable" without making the
   non-active case look interactive. */
.transit-scenario-name.transit-scenario-name--editable {
    cursor: text;
    border-bottom: 1px dashed var(--border-outer);
    font-style: normal;
    color: var(--forest-green);
}
.transit-scenario-name.transit-scenario-name--editable:hover {
    background: rgba(46, 139, 87, 0.08);
}
/* Phase 4.i scenario kind chip — "Blank" vs "Fork". A small pill
   that sits next to the scenario name so the user can tell at a
   glance whether they're in an additive overlay or a full clone. */
.transit-scenario-kind {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.05rem 0.4rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--cream);
    margin-right: 0.4rem;
    vertical-align: middle;
}
.transit-scenario-kind[data-kind="user_fork"] {
    background: rgba(255,200,90,0.25);
    border-color: rgba(255,200,90,0.6);
    color: var(--cream);
}
.transit-scenario-name-input {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.15rem 0.4rem;
    border: 2px solid var(--forest-green);
    background: white;
    color: var(--text-dark);
    margin-right: 0.4rem;
    min-width: 12rem;
}

/* Start / End / Speed controls (top panel, time-lapse only). */
.transit-timelapse-settings label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-body);
    font-size: 0.9rem;
}
.transit-timelapse-settings input[type="number"],
.transit-timelapse-settings select {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.2rem 0.4rem;
    border: 2px solid var(--border-outer);
    background: var(--panel-bg);
    color: var(--text-body);
}
.transit-timelapse-settings input[type="number"] {
    width: 5rem;
}
