        /* ===== Design Tokens ===== */
        :root {
            color-scheme: light;
            --app-blue: #005cff;
            --app-blue-dark: #0047cc;
            --app-blue-light: #4d8eff;
            --app-navy: #162450;
            --app-green: #188038;
            --app-green-light: #1e8e3e;
            --app-red: #d93025;
            --app-amber: #b06000;
            --app-bg: #ffffff;
            --app-bg-subtle: #f7f9fc;
            --app-surface: #ffffff;
            --app-surface-alt: #f4f7ff;
            --app-footer-bg: #0b1220;
            --app-card-border: #e4e8ef;
            --app-border-strong: #c9d1de;
            --app-text-primary: #162450;
            --app-text-secondary: #51596b;
            --app-text-hint: #6b7383;
            --app-focus-ring: #005cff;
            --train-badge-bg: #005cff;
            --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
            --app-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06);
            --app-shadow-lg: 0 12px 28px rgba(16, 24, 40, 0.1);
            --border-radius-lg: 16px;
            --border-radius-md: 12px;
            --border-radius-sm: 8px;
            --tap-target: 44px;
            --shell-w: 1200px;
            --app-header-glass: rgba(255, 255, 255, 0.82);
            --app-grad-primary: linear-gradient(135deg, #005cff 0%, #3b7dff 58%, #6d5cff 100%);
            --app-grad-brand: linear-gradient(140deg, #005cff 0%, #4d8eff 50%, #7b5cff 100%);
            --app-grad-text: linear-gradient(115deg, #0047cc 0%, #005cff 45%, #4f46e5 100%);
            --z-base: 1;
            --z-sticky: 100;
            --z-backdrop: 900;
            --z-drawer: 1000;
            --dur-fast: 120ms;
            --dur-base: 200ms;
            --ease: cubic-bezier(0.2, 0, 0.2, 1);
        }

        /* ===== Reset & Base ===== */
        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        * {
            -webkit-tap-highlight-color: transparent;
        }

        /*
         * Several surfaces toggle `hidden` from JS; without this the UA default
         * is overridden by our own display rules.
         */
        [hidden] {
            display: none !important;
        }

        html {
            font-size: 16px;
            -webkit-text-size-adjust: 100%;
            scroll-behavior: smooth;
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            background: var(--app-bg);
            color: var(--app-text-primary);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        a {
            color: inherit;
            text-decoration: none;
        }

        button {
            cursor: pointer;
            border: none;
            background: none;
            font-family: inherit;
        }

        input {
            font-family: inherit;
        }

        img {
            max-width: 100%;
        }

        /* ===== Focus & Skip Link ===== */
        :focus-visible {
            outline: 3px solid var(--app-focus-ring);
            outline-offset: 2px;
            border-radius: 4px;
        }

        main:focus {
            outline: none;
        }

        .skip-link {
            position: absolute;
            left: 8px;
            top: -100px;
            z-index: calc(var(--z-drawer) + 10);
            padding: 12px 18px;
            background: var(--app-blue);
            color: #fff;
            font-weight: 600;
            border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
            transition: top var(--dur-base) var(--ease);
        }

        .skip-link:focus {
            top: 0;
        }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        /* ===== Main Container (formerly Mobile Shell) ===== */
        .mobile-shell {
            width: 100%;
            max-width: var(--shell-w, 1200px);
            margin: 0 auto;
        }

        /* ===== App Header (aurora glass, sticky, condensing) ===== */
        .app-header {
            --hdr-min: 72px;
            --hdr-pad: 12px;
            position: sticky;
            top: 0;
            z-index: var(--z-sticky);
            background: linear-gradient(120deg, #0049c7 0%, #006ff5 48%, #57b6ff 100%);
            color: #fff;
            border-bottom: 1px solid rgba(255, 255, 255, 0.28);
            transition: box-shadow var(--dur-base) var(--ease);
        }

        @keyframes shimmer {
            0% { transform: translateX(-130%); opacity: 0; }
            25% { opacity: 1; }
            100% { transform: translateX(130%); opacity: 0; }
        }

        /* Condense the bar once the page scrolls. */
        .app-header.is-scrolled {
            --hdr-min: 60px;
            --hdr-pad: 6px;
            box-shadow: 0 10px 30px -12px rgba(16, 24, 40, 0.28);
        }

        .app-header-inner {
            position: relative;
            z-index: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            min-height: var(--hdr-min);
            padding: var(--hdr-pad) 16px;
            transition: min-height var(--dur-base) var(--ease), padding var(--dur-base) var(--ease);
        }

        .app-header-btn {
            position: relative;
            z-index: var(--z-sticky);
            pointer-events: auto !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: var(--tap-target);
            height: var(--tap-target);
            flex-shrink: 0;
            color: #fff;
            background: rgba(255, 255, 255, 0.18);
            border-radius: 50%;
            transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
        }

        .app-header-btn:hover {
            background: rgba(255, 255, 255, 0.30);
            color: #fff;
            box-shadow: 0 6px 16px -6px rgba(0, 25, 70, 0.55);
            transform: translateY(-1px);
        }

        .app-header-btn:active {
            transform: scale(0.93);
        }

        /* Brand + page title lockup.
           Absolutely centred on mobile so the hamburger does not push it off-axis. */
        .app-header-identity {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1px;
            max-width: calc(100% - 2 * (var(--tap-target) + 18px));
            min-width: 0;
        }

        /* Text-only wordmark: solid white on the header gradient. */
        .app-brand {
            display: inline-flex;
            align-items: baseline;
            max-width: 100%;
            border-radius: var(--border-radius-sm);
        }

        .app-brand-name {
            font-size: 1.22rem;
            font-weight: 800;
            letter-spacing: -0.035em;
            line-height: 1.15;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            background: none;
            color: #fff;
            transition: opacity var(--dur-base) var(--ease);
        }

        .app-brand:hover .app-brand-name {
            opacity: 0.88;
        }

        .app-header-title {
            font-size: 0.78rem;
            font-weight: 500;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.85);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        /* Desktop primary nav (progressive disclosure) */
        .app-desktop-nav {
            display: none;
            position: relative;
            z-index: 1;
        }

        /* Nav items sit directly on the header glass — no extra pill container.
           Horizontal centring comes from .mobile-shell, so no side margins here. */
        .app-desktop-nav-inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .app-nav-group {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .app-nav-link {
            position: relative;
            overflow: hidden;
            display: inline-flex;
            align-items: center;
            gap: 7px;
            min-height: var(--tap-target);
            padding: 0 14px;
            font-size: 0.9rem;
            font-weight: 600;
            letter-spacing: -0.01em;
            color: rgba(255, 255, 255, 0.88);
            white-space: nowrap;
            border-radius: 999px;
            transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
        }

        .app-nav-link .material-icons {
            font-size: 19px;
            opacity: 0.7;
            transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
        }

        .app-nav-link:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.20);
            transform: translateY(-1px);
        }

        .app-nav-link:hover .material-icons {
            opacity: 1;
            transform: scale(1.1);
        }

        /* Light sweep across inactive links on hover. */
        .app-nav-link:not([aria-current='page'])::after {
            content: '';
            position: absolute;
            inset: 0;
            pointer-events: none;
            background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.9) 50%, transparent 78%);
            transform: translateX(-130%);
            opacity: 0;
        }

        .app-nav-link:not([aria-current='page']):hover::after {
            animation: shimmer 750ms var(--ease);
        }

        .app-nav-link[aria-current='page'] {
            color: #0052c7;
            background: rgba(255, 255, 255, 0.92);
            box-shadow: none;
            transform: translateY(-1px);
        }

        .app-nav-link[aria-current='page'] .material-icons {
            opacity: 1;
        }


        @media (min-width: 900px) {
            .app-desktop-nav {
                display: block;
                padding: 0 max(20px, calc((100% - var(--shell-w)) / 2)) 12px;
            }

            /* The inline nav replaces the drawer trigger on desktop. */
            .app-header-btn {
                display: none;
            }

            .app-header-inner {
                max-width: none;
                margin: 0;
                padding: var(--hdr-pad) max(20px, calc((100% - var(--shell-w)) / 2)) 6px;
            }

            .app-header-identity {
                position: static;
                left: auto;
                transform: none;
                max-width: none;
                flex: 0 1 auto;
                flex-direction: row;
                align-items: baseline;
                gap: 12px;
                justify-content: flex-start;
            }

            .app-header-title {
                font-size: 0.72rem;
                padding-left: 14px;
                border-left: 1px solid rgba(255, 255, 255, 0.35);
            }
        }

        /* Wide screens: one single row — brand on the left, nav on the right. */
        @media (min-width: 1200px) {
            .app-header {
                display: flex;
                align-items: center;
                gap: 16px;
                min-height: var(--hdr-min);
                padding-inline: max(20px, calc((100% - var(--shell-w)) / 2));
            }

            .app-header-inner {
                flex: 0 0 auto;
                width: auto;
                min-height: 0;
                padding: 0;
            }

            /* flex-basis 0 avoids the cyclic width:100% collapse; nav hugs the right. */
            .app-desktop-nav {
                display: flex;
                justify-content: flex-end;
                flex: 1 1 0;
                min-width: 0;
                padding: 0;
            }

            .app-desktop-nav-inner {
                width: auto;
                max-width: none;
                margin: 0;
            }
        }

        /* ===== App Cards ===== */
        .app-card {
            background: var(--app-surface);
            border-radius: var(--border-radius-md);
            border: 1px solid var(--app-card-border);
            box-shadow: var(--app-shadow-sm);
            transition: box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
        }

        @media (hover: hover) and (pointer: fine) {
            .app-card:hover {
                box-shadow: var(--app-shadow-md);
            }
        }

        /* ===== Inputs ===== */
        .app-input {
            width: 100%;
            min-height: var(--tap-target);
            border: 1px solid var(--app-card-border);
            border-radius: var(--border-radius-sm);
            padding: 10px 12px;
            background: var(--app-surface);
            font-size: 1rem;
            color: var(--app-text-primary);
            outline: none;
            transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
        }

        .app-input::placeholder {
            color: var(--app-text-hint);
            font-size: 0.95rem;
        }

        .app-input:hover {
            border-color: var(--app-border-strong);
        }

        .app-input:focus {
            border-color: var(--app-blue);
            box-shadow: 0 0 0 3px rgba(0, 92, 255, 0.16);
        }

        .app-input:disabled {
            background: var(--app-bg-subtle);
            color: var(--app-text-hint);
            cursor: not-allowed;
        }

        /* Inline / underline variant retained for dense legacy rows */
        .app-input-inline {
            border: 0;
            border-bottom: 1px solid var(--app-card-border);
            border-radius: 0;
            background: transparent;
        }

        /* ===== Buttons ===== */
        .app-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-height: var(--tap-target);
            border-radius: var(--border-radius-sm);
            padding: 11px 18px;
            font-size: 0.95rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            transition: background-color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
            border: none;
        }

        .app-btn:active {
            opacity: 0.9;
        }

        .app-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .app-btn-primary {
            background: var(--app-green);
            color: #fff;
        }

        .app-btn-blue {
            background: var(--app-blue);
            color: #fff;
        }

        .app-btn-ghost {
            background: transparent;
            color: var(--app-blue);
            border: 1px solid var(--app-border-strong);
        }

        /* ===== Green Search Action Button ===== */
        .search-action-btn {
            width: var(--tap-target);
            height: var(--tap-target);
            border-radius: var(--border-radius-sm);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--app-green);
            color: #fff;
            flex-shrink: 0;
            transition: background-color var(--dur-fast) var(--ease);
        }

        .search-action-btn:hover {
            background: var(--app-green-light);
        }

        /* ===== Surface Title ===== */
        .surface-title {
            color: var(--app-text-secondary);
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        /* ===== Feature Search Row ===== */
        .feature-search-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
        }

        .feature-search-row-icon {
            width: 36px;
            height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: var(--app-blue);
            flex-shrink: 0;
        }

        .feature-search-label {
            flex: 1;
            font-size: 1.05rem;
            color: var(--app-text-secondary);
            line-height: 1.3;
        }

        /* ===== Tab Pills ===== */
        .tab-pill {
            display: flex;
            border-radius: 20px;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        .tab-pill a {
            flex: 1;
            text-align: center;
            padding: 8px 6px;
            font-weight: 500;
            font-size: 0.9rem;
            color: #fff;
            background: transparent;
            transition: background 0.2s;
        }

        .tab-pill a.active {
            background: #fff;
            color: var(--app-blue);
        }

        /* ===== Train Number Badge ===== */
        .train-badge {
            display: inline-block;
            background: var(--train-badge-bg);
            color: #fff;
            font-size: 0.82rem;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 3px;
            letter-spacing: 0.02em;
        }

        /* ===== Running Days ===== */
        .running-days {
            display: flex;
            gap: 2px;
            font-size: 0.82rem;
            font-weight: 500;
        }

        .running-days span {
            color: var(--app-text-hint);
        }

        .running-days span.active {
            color: var(--app-blue);
            font-weight: 700;
        }

        /* ===== Filter Pill Buttons ===== */
        .filter-pill {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: rgba(255, 255, 255, 0.15);
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 20px;
            padding: 6px 14px;
            font-size: 0.82rem;
            font-weight: 500;
        }

        /* ===== Timeline ===== */
        /*
         * 4-column grid per row:
         *  Col-1 (68px) : Arrival time  — LEFT of the line
         *  Col-2 (28px) : Line column   — vertical bar + dot/icon live here
         *  Col-3 (1fr)  : Station name + details
         *  Col-4 (68px) : Departure time
         */
        .timeline {
            position: relative;
        }

        .timeline-stop {
            position: relative;
            display: grid;
            grid-template-columns: 68px 28px 1fr 68px;
            gap: 0;
            align-items: start;
            height: 80px;
        }

        .timeline-stop+.timeline-stop {
            border-top: none;
        }

        /* Vertical blue line drawn as a pseudo on the line-column cell */
        .timeline-line-col {
            position: relative;
            display: flex;
            justify-content: center;
            /* stretch full height of the row */
            align-self: stretch;
        }

        /* The continuous vertical bar */
        .timeline-line-col::before {
            content: '';
            position: absolute;
            top: 0;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 8px;
            background: #90CAF9;
        }

        /* Normal dot */
        .timeline-dot {
            position: relative;
            margin-top: 18px;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--app-blue);
            border: 2px solid #fff;
            box-shadow: 0 0 0 2px var(--app-blue);
            z-index: 2;
            flex-shrink: 0;
        }

        /* Start dot — green */
        .timeline-dot.start-dot {
            background: var(--app-green);
            box-shadow: 0 0 0 2px var(--app-green);
            width: 14px;
            height: 14px;
            margin-top: 17px;
        }

        /* End dot — green */
        .timeline-dot.end-dot {
            background: var(--app-green);
            box-shadow: 0 0 0 2px var(--app-green);
            width: 14px;
            height: 14px;
            margin-top: 17px;
        }

        /* Train icon badge for current station */
        .timeline-train-icon {
            position: relative;
            margin-top: 8px;
            margin-left: 8px;
            width: 38px;
            height: 38px;
            border-radius: 50%;
            background: var(--app-blue);
            border: 3px solid #fff;
            box-shadow: 0 2px 8px rgba(21, 101, 192, 0.45);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 3;
            color: #fff;
            /* Shift it to overlap the line */
            transform: translateX(-5px);
            flex-shrink: 0;
        }

        .timeline-train-icon .material-icons {
            font-size: 19px;
        }

        /* Left time column (Arrival) */
        .timeline-time-left {
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--app-text-primary);
            text-align: right;
            line-height: 1.45;
            padding-right: 8px;
            padding-top: 16px;
        }

        .timeline-time-left .actual {
            font-size: 0.78rem;
            color: var(--app-green-light);
            font-style: italic;
        }

        .timeline-time-left .actual.late {
            color: var(--app-red);
        }

        .timeline-time-left .hint {
            font-size: 0.78rem;
            color: var(--app-text-hint);
        }

        /* Station info column */
        .timeline-station {
            font-size: 0.95rem;
            font-weight: 500;
            color: var(--app-text-primary);
            line-height: 1.4;
            padding-top: 16px;
            padding-left: 4px;
        }

        .timeline-station-detail {
            font-size: 0.78rem;
            color: var(--app-text-secondary);
            margin-top: 3px;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 4px;
            padding-left: 4px;
        }

        .timeline-platform-badge {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            background: #E3F2FD;
            color: var(--app-blue);
            font-size: 0.72rem;
            font-weight: 600;
            padding: 1px 7px;
            border-radius: 3px;
            letter-spacing: 0.01em;
        }

        /* Right time column (Departure) */
        .timeline-time-right {
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--app-text-primary);
            text-align: right;
            line-height: 1.45;
            padding-top: 16px;
        }

        .timeline-time-right .actual {
            font-size: 0.78rem;
            font-style: italic;
        }

        .timeline-time-right .actual.on-time {
            color: var(--app-green-light);
        }

        .timeline-time-right .actual.late {
            color: var(--app-red);
        }

        .timeline-time-right .hint {
            font-size: 0.78rem;
            color: var(--app-text-hint);
        }

        /* ───── Current stop ───── */
        .timeline-stop.is-current .timeline-station {
            font-weight: 600;
            color: var(--app-blue);
        }

        /* Pulsing glow on the train icon badge */
        @keyframes trainPulse {
            0% {
                box-shadow: 0 0 0 0 rgba(21, 101, 192, 0.55);
            }

            60% {
                box-shadow: 0 0 0 8px rgba(21, 101, 192, 0);
            }

            100% {
                box-shadow: 0 0 0 0 rgba(21, 101, 192, 0);
            }
        }

        .timeline-stop.is-current .timeline-train-icon {
            animation: trainPulse 1.6s ease-out infinite;
        }

        /* Passed line segment — solid blue instead of light blue */
        /* .timeline-stop.is-passed .timeline-line-col::before {
            background: var(--app-blue);
        } */

        /* Passed dot — filled solid blue, slightly smaller */
        .timeline-stop.is-passed .timeline-dot {
            background: var(--app-blue);
            box-shadow: 0 0 0 2px var(--app-blue);
        }

        /* ───── Passed stop ───── */
        /* Dim the text of stops already visited */
        .timeline-stop.is-passed .timeline-time-left,
        .timeline-stop.is-passed .timeline-time-right {
            opacity: 0.55;
        }

        .timeline-stop.is-passed .timeline-station {
            color: var(--app-text-secondary);
        }

        .timeline-stop.is-passed .timeline-station-detail {
            opacity: 0.6;
        }

        /* ===== Google Maps Link ===== */
        .gmaps-link {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: #fff;
            border: 1px solid #E0E0E0;
            border-radius: 24px;
            padding: 8px 16px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
            font-size: 0.88rem;
            color: var(--app-blue);
            font-weight: 500;
        }

        /* ===== Sidebar ===== */
        .sidebar-backdrop {
            position: fixed;
            inset: 0;
            z-index: var(--z-backdrop);
            background: rgba(8, 12, 22, 0.55);
            pointer-events: auto;
            opacity: 0;
            visibility: hidden;
            transition: opacity var(--dur-base) var(--ease), visibility var(--dur-base) var(--ease);
        }

        .sidebar-backdrop.open {
            opacity: 1;
            visibility: visible;
        }

        .app-sidebar {
            position: fixed;
            left: 0;
            top: 0;
            z-index: var(--z-drawer);
            height: 100%;
            width: 288px;
            max-width: 86vw;
            background: var(--app-surface);
            border-right: 1px solid var(--app-card-border);
            box-shadow: var(--app-shadow-lg);
            transform: translateX(-100%);
            visibility: hidden;
            transition: transform var(--dur-base) var(--ease), visibility var(--dur-base) var(--ease);
            pointer-events: auto;
            overflow-y: auto;
            overscroll-behavior: contain;
        }

        .app-sidebar.open {
            transform: translateX(0);
            visibility: visible;
        }

        .sidebar-header {
            background: var(--app-blue);
            color: #fff;
            padding: 18px 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: sticky;
            top: 0;
        }

        .sidebar-header h2 {
            font-weight: 700;
            font-size: 1.2rem;
            letter-spacing: -0.01em;
        }

        .sidebar-close-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: var(--tap-target);
            height: var(--tap-target);
            margin-right: -10px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.18);
            border: none;
            color: #fff;
            transition: background var(--dur-fast) var(--ease);
        }

        .sidebar-close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .sidebar-nav {
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .sidebar-nav a {
            display: flex;
            align-items: center;
            gap: 14px;
            min-height: var(--tap-target);
            padding: 10px 14px;
            border-radius: var(--border-radius-sm);
            font-size: 0.95rem;
            font-weight: 500;
            color: var(--app-text-primary);
            transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
            pointer-events: auto;
            position: relative;
            z-index: var(--z-drawer);
        }

        .sidebar-nav a:hover,
        .sidebar-nav a:focus-visible {
            background: var(--app-surface-alt);
            color: var(--app-blue);
        }

        .sidebar-nav a[aria-current='page'] {
            background: var(--app-surface-alt);
            color: var(--app-blue);
            font-weight: 600;
        }

        .sidebar-nav a .material-icons {
            font-size: 22px;
            color: var(--app-text-secondary);
            transition: color var(--dur-fast) var(--ease);
        }

        .sidebar-nav a:hover .material-icons,
        .sidebar-nav a:focus-visible .material-icons,
        .sidebar-nav a[aria-current='page'] .material-icons {
            color: var(--app-blue);
        }

        /* ===== Main Content ===== */
        .app-main {
            flex: 1;
        }

        .app-main-inner {
            padding: 16px 16px 32px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        @media (min-width: 640px) {
            .app-main-inner {
                padding: 24px 24px 40px;
                gap: 20px;
            }
        }

        /* ===== Skeleton Loader ===== */
        .skeleton-loading {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .skeleton-block {
            border-radius: 4px;
            background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
            background-size: 400% 100%;
            animation: skeletonShimmer 1.2s ease-in-out infinite;
        }

        .skeleton-text-sm {
            height: 10px;
        }

        .skeleton-text-md {
            height: 14px;
        }

        .skeleton-text-lg {
            height: 18px;
        }

        .skeleton-card {
            border: 1px solid var(--app-card-border);
            border-radius: var(--border-radius-md);
            background: var(--app-surface);
            padding: 14px;
            display: grid;
            gap: 8px;
        }

        @keyframes skeletonShimmer {
            0% {
                background-position: 100% 0;
            }

            100% {
                background-position: 0 0;
            }
        }

        /* ===== Utility ===== */
        .w-full {
            width: 100%;
        }

        .text-center {
            text-align: center;
        }

        .hidden {
            display: none !important;
        }

        .flex {
            display: flex;
        }

        .flex-1 {
            flex: 1;
        }

        .items-center {
            align-items: center;
        }

        .justify-between {
            justify-content: space-between;
        }

        .gap-2 {
            gap: 8px;
        }

        .gap-3 {
            gap: 12px;
        }

        .mt-1 {
            margin-top: 4px;
        }

        .mt-2 {
            margin-top: 8px;
        }

        .mt-3 {
            margin-top: 12px;
        }

        .mb-2 {
            margin-bottom: 8px;
        }

        .mb-3 {
            margin-bottom: 12px;
        }

        .p-3 {
            padding: 12px;
        }

        .p-4 {
            padding: 16px;
        }

        .px-3 {
            padding-left: 12px;
            padding-right: 12px;
        }

        .py-2 {
            padding-top: 8px;
            padding-bottom: 8px;
        }

        .font-medium {
            font-weight: 500;
        }

        .font-semibold {
            font-weight: 600;
        }

        .font-bold {
            font-weight: 700;
        }

        .text-sm {
            font-size: 0.875rem;
        }

        .text-xs {
            font-size: 0.75rem;
        }

        .text-lg {
            font-size: 1.125rem;
        }

        .text-xl {
            font-size: 1.25rem;
        }

        .text-white {
            color: #fff;
        }

        .block {
            display: block;
        }

        .relative {
            position: relative;
        }

        .overflow-hidden {
            overflow: hidden;
        }

        .truncate {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* ===== Desktop Grid ===== */
        .desktop-grid {
            display: grid;
            gap: 8px;
        }

        @media (min-width: 768px) {
            :root {
                --shell-w: 1080px;
            }
        }

        @media (min-width: 1024px) {
            .desktop-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* ===== Error / Warning Messages ===== */
        .msg-error {
            background: #fff;
            border-radius: 4px;
            padding: 8px 12px;
            font-size: 0.875rem;
            color: #C62828;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        }

        .msg-warning {
            background: #fff;
            border-radius: 4px;
            padding: 8px 12px;
            font-size: 0.875rem;
            color: #E65100;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        }

        /* ===== Autocomplete Dropdown =====
           Anchored to the bottom edge of its containing field. `top: 100%` is
           required: these fields are flex containers, and per the flexbox spec
           an absolutely-positioned child with `top: auto` resolves to the
           container's content-box start corner (not the static position after
           the previous sibling), which drew the list on top of the input.
           Every field that hosts a dropdown must be `position: relative`. */
        .autocomplete-dropdown {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            z-index: 20;
            margin-top: 4px;
            border-radius: 4px;
            border: 1px solid var(--app-card-border);
            background: var(--app-surface);
            box-shadow: var(--app-shadow-md);
            max-height: 300px;
            overflow-y: auto;
        }

        .autocomplete-dropdown:not(.hidden) {
            display: block;
        }

        .suggestion-item,
        .station-item {
            display: flex;
            flex-direction: column;
            gap: 2px;
            width: 100%;
            text-align: left;
            padding: 10px 12px;
            min-height: var(--tap-target);
            border-bottom: 1px solid var(--app-card-border);
            cursor: pointer;
            transition: background var(--dur-fast) var(--ease);
        }

        .suggestion-item:last-child,
        .station-item:last-child {
            border-bottom: none;
        }

        .suggestion-item:hover,
        .suggestion-item:focus-visible,
        .station-item:hover,
        .station-item:focus-visible,
        .suggestion-item.is-active,
        .station-item.is-active {
            background: var(--app-surface-alt);
        }

        /* Keyboard-driven selection: the active option is pointed at with
           aria-activedescendant, so it needs a persistent visual cue that
           survives while focus stays in the text input. */
        .suggestion-item.is-active,
        .station-item.is-active {
            box-shadow: inset 3px 0 0 var(--app-blue);
        }

        @media (prefers-reduced-motion: no-preference) {
            .suggestion-item,
            .station-item {
                transition: background-color 0.15s ease, box-shadow 0.15s ease;
            }
        }

        .suggestion-item-title,
        .station-item-name {
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--app-text-primary);
        }

        .suggestion-item-meta {
            font-size: 0.78rem;
            color: var(--app-text-secondary);
        }

        /* ===== Table Styles ===== */
        .data-table {
            width: 100%;
            font-size: 0.875rem;
            border-collapse: collapse;
        }

        .data-table thead {
            text-align: left;
            color: var(--app-text-secondary);
        }

        .data-table th,
        .data-table td {
            padding: 8px 4px;
        }

        .data-table tbody tr {
            border-top: 1px solid #F5F5F5;
        }

        /* ===== Badge Utility ===== */
        .badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .badge-green {
            background: #E8F5E9;
            color: #2E7D32;
        }

        .badge-red {
            background: #FFEBEE;
            color: #C62828;
        }

        .badge-amber {
            background: #FFF8E1;
            color: #E65100;
        }

        .badge-slate {
            background: #ECEFF1;
            color: #546E7A;
        }

        .badge-blue {
            background: #E3F2FD;
            color: #1565C0;
        }

        /* ===== Reduced Motion ===== */
        @media (prefers-reduced-motion: reduce) {
            html {
                scroll-behavior: auto;
            }

            *,
            *::before,
            *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
                scroll-behavior: auto !important;
            }
        }

        /* ===== Print ===== */
        @media print {
            .app-header,
            .app-desktop-nav,
            .app-sidebar,
            .sidebar-backdrop,
            .rail-footer,
            .app-footer {
                display: none !important;
            }

            .app-main-inner {
                padding: 0;
            }
        }

/* ===== Page: home ===== */
/* ===== Home: image cards row ===== */
    /* Three-up image cards at the very top of the home page. The card art is
       transparent PNG, so every tile gets its own soft tinted surface to stay
       legible against the plain white page. */
    .home-cards {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        width: 100%;
    }

    .home-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }

    .home-card-label {
        margin: 8px 0 0;
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--app-text-primary);
        text-align: center;
    }

    .home-card-img {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 334 / 261;
        object-fit: contain;
    }

    .home-search-form {
        background: var(--app-surface);
        border-radius: var(--border-radius-md);
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 14px;
        color: var(--app-text-primary);
        box-shadow: var(--app-shadow-lg);
    }

    .home-field {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .home-field label {
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--app-text-secondary);
    }

    .home-input-wrap {
        position: relative;
        display: flex;
        align-items: center;
    }

    .home-input-wrap .material-icons {
        position: absolute;
        left: 12px;
        font-size: 20px;
        color: var(--app-text-hint);
        pointer-events: none;
    }

    .home-input-wrap .app-input {
        padding-left: 40px;
        padding-right: 52px;
    }

    .home-input-wrap .home-clear-btn {
        position: absolute;
        right: 2px;
        top: 50%;
        transform: translateY(-50%);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--tap-target);
        height: var(--tap-target);
        border: none;
        border-radius: 50%;
        background: transparent;
        color: var(--app-text-hint);
        transition: background var(--dur-fast) var(--ease);
    }

    .home-input-wrap .home-clear-btn:hover {
        background: var(--app-surface-alt);
        color: var(--app-text-primary);
    }

    /* From and To each keep their own full-width row. The swap control floats
       on the divider between them, anchored to the right edge.
       The band between the two inputs is the "To" label row plus its 6px gap
       (24px). Cancelling the form's 14px row gap leaves a 24px band, so the
       44px button overhangs each input by an equal 10px.
         button top    = 14 - 24            = -10px  (10px over the From input)
         To field top  = -10 + 44 + 14 - 48 =  0px   (band closed, label at left)
         button bottom = -10 + 44           = +34px
         To input top  = 0 + 24             = +24px  (10px under the button) */
    .home-swap-wrap {
        display: flex;
        justify-content: flex-end;
        margin-top: -24px;
        margin-bottom: -48px;
        position: relative;
        z-index: var(--z-base);
    }


    .home-swap-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: var(--tap-target);
        height: var(--tap-target);
        border-radius: 50%;
        border: 1px solid var(--app-card-border);
        background: var(--app-surface);
        color: var(--app-blue);
        box-shadow: var(--app-shadow-sm);
        transition: transform var(--dur-base) var(--ease), background var(--dur-fast) var(--ease);
    }

    .home-swap-btn:hover {
        background: var(--app-surface-alt);
    }

    .home-swap-btn:active {
        transform: rotate(180deg);
    }

    .home-search-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    .home-search-actions .app-btn {
        flex: 1 1 140px;
    }

    /* ===== Home: quick actions ===== */
    .home-section-title {
        font-size: 1.05rem;
        font-weight: 700;
        color: var(--app-navy);
        margin: 8px 0 12px 0;
        letter-spacing: -0.01em;
    }

    /* Soft mesh-gradient panel. The cards float on a frosted surface instead of
       sitting in a hard bordered box, so the section reads as one calm surface. */
    .home-quick {
        position: relative;
        isolation: isolate;
        width: 100%;
        padding: 14px;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.85);
        background:
            radial-gradient(115% 130% at 6% 0%, rgba(0, 92, 255, 0.10) 0%, rgba(0, 92, 255, 0) 56%),
            radial-gradient(115% 130% at 98% 8%, rgba(0, 201, 255, 0.12) 0%, rgba(0, 201, 255, 0) 58%),
            radial-gradient(120% 140% at 62% 110%, rgba(124, 58, 237, 0.10) 0%, rgba(124, 58, 237, 0) 62%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.90) 0%, rgba(255, 255, 255, 0.62) 100%);
        box-shadow: 0 18px 40px -30px rgba(16, 24, 40, 0.35);
        -webkit-backdrop-filter: blur(14px) saturate(160%);
        backdrop-filter: blur(14px) saturate(160%);
    }

    .home-quick-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        margin: 0 2px 12px;
    }

    .home-quick-title {
        margin: 0;
        font-size: 1.02rem;
        font-weight: 700;
        letter-spacing: -0.015em;
        color: var(--app-navy);
    }

    .home-quick-hint {
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--app-text-secondary);
    }

    .home-link-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .home-link-card {
        --qc-a: #0f5cff;
        --qc-b: #00c9ff;
        --qc-wash: rgba(15, 92, 255, 0.10);
        position: relative;
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 68px;
        padding: 12px;
        text-align: left;
        text-decoration: none;
        border-radius: 15px;
        border: 1px solid rgba(16, 24, 40, 0.06);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.70) 100%);
        box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
        transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
            border-color var(--dur-base) var(--ease);
    }

    /* Accent wash revealed on hover / keyboard focus. */
    .home-link-card::before {
        content: '';
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(115deg, var(--qc-wash) 0%, rgba(255, 255, 255, 0) 72%);
        opacity: 0;
        transition: opacity var(--dur-base) var(--ease);
    }

    .home-link-card:hover,
    .home-link-card:focus-visible {
        transform: translateY(-2px);
        border-color: transparent;
        box-shadow: 0 16px 30px -18px var(--qc-a);
    }

    .home-link-card:hover::before,
    .home-link-card:focus-visible::before {
        opacity: 1;
    }

    .home-link-card:active {
        transform: translateY(0) scale(0.985);
    }

    .home-link-card:focus-visible {
        outline: 3px solid var(--app-blue);
        outline-offset: 2px;
    }

    .home-link-card:nth-child(1) { --qc-a: #0f5cff; --qc-b: #00c9ff; --qc-wash: rgba(15, 92, 255, 0.10); }
    .home-link-card:nth-child(2) { --qc-a: #4f46e5; --qc-b: #7c3aed; --qc-wash: rgba(99, 102, 241, 0.10); }
    .home-link-card:nth-child(3) { --qc-a: #0d9488; --qc-b: #10b981; --qc-wash: rgba(13, 148, 136, 0.10); }
    .home-link-card:nth-child(4) { --qc-a: #ea580c; --qc-b: #f59e0b; --qc-wash: rgba(234, 88, 12, 0.10); }
    .home-link-card:nth-child(5) { --qc-a: #e11d48; --qc-b: #f43f5e; --qc-wash: rgba(225, 29, 72, 0.10); }
    .home-link-card:nth-child(6) { --qc-a: #0284c7; --qc-b: #06b6d4; --qc-wash: rgba(2, 132, 199, 0.10); }

    .home-link-icon {
        position: relative;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--qc-a) 0%, var(--qc-b) 100%);
        color: #fff;
        box-shadow: 0 8px 18px -9px var(--qc-a);
        transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
    }

    .home-link-icon .material-icons {
        font-size: 21px;
    }

    .home-link-card:hover .home-link-icon,
    .home-link-card:focus-visible .home-link-icon {
        transform: scale(1.06) rotate(-3deg);
    }

    .home-link-label {
        position: relative;
        z-index: 1;
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.88rem;
        font-weight: 600;
        line-height: 1.3;
        letter-spacing: -0.01em;
        color: var(--app-text-primary);
    }

    .home-link-arrow {
        position: relative;
        z-index: 1;
        display: inline-flex;
        flex-shrink: 0;
        color: var(--qc-a);
        opacity: 0.45;
        transform: translateX(-2px);
        transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
    }

    .home-link-arrow .material-icons {
        font-size: 18px;
    }

    .home-link-card:hover .home-link-arrow,
    .home-link-card:focus-visible .home-link-arrow {
        opacity: 1;
        transform: none;
    }

    @media (min-width: 560px) {
        .home-quick {
            padding: 16px;
        }

        .home-link-grid {
            grid-template-columns: repeat(2, 1fr);
        }

        .home-cards {
            gap: 10px;
        }
    }

    @media (min-width: 900px) {
        .home-quick {
            padding: 18px;
        }

        .home-link-grid {
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }

        .home-cards {
            gap: 12px;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .home-link-card,
        .home-link-card::before,
        .home-link-icon,
        .home-link-arrow {
            transition: none;
        }

        .home-link-card:hover,
        .home-link-card:focus-visible,
        .home-link-card:hover .home-link-icon,
        .home-link-card:focus-visible .home-link-icon,
        .home-link-card:hover .home-link-arrow,
        .home-link-card:focus-visible .home-link-arrow {
            transform: none;
        }
    }

    /* ===== Home: info banner ===== */
    .home-banner {
        border-radius: var(--border-radius-md);
        overflow: hidden;
        border: 1px solid var(--app-card-border);
        background: var(--app-surface);
    }

    .home-banner img {
        display: block;
        width: 100%;
        height: auto;
        max-height: 320px;
        object-fit: cover;
    }

/* ===== Page: search ===== */
        .search-route-summary {
            background: var(--app-blue);
            color: #fff;
            padding: 12px 14px;
            border-radius: var(--border-radius-sm);
            font-size: 0.92rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .search-route-summary .material-icons {
            font-size: 18px;
        }

        .search-empty {
            text-align: center;
            padding: 32px 20px;
            color: var(--app-text-secondary);
            font-size: 0.95rem;
        }

        .search-empty .material-icons {
            font-size: 44px;
            color: var(--app-text-hint);
            display: block;
            margin-bottom: 10px;
        }

/* ===== Pages: tools (live-status, pnr, seat, station, route) ===== */
        /*
         * Shared shell for the five single-purpose tool pages. They all render
         * the same four regions: a filter form, an optional hero, a result card
         * and an empty state, so the layout lives here instead of in inline
         * style attributes on every view.
         */
        .tool-page {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .tool-form {
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .tool-form-grid {
            display: grid;
            gap: 12px;
        }

        /* Two fields side by side, collapsing to one column on narrow screens. */
        .tool-form-cols {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        @media (min-width: 600px) {
            .tool-form-cols {
                grid-template-columns: 1fr 1fr;
            }
        }

        /*
         * Each field is its own positioning context so the absolutely
         * positioned .autocomplete-dropdown anchors to the control below the
         * label rather than the whole form.
         */
        .tool-field {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 6px;
            min-width: 0;
        }

        .tool-field > label {
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--app-text-secondary);
        }

        .tool-input-wrap {
            position: relative;
            display: flex;
            align-items: center;
        }

        .tool-input-wrap .material-icons {
            position: absolute;
            left: 12px;
            font-size: 20px;
            color: var(--app-text-hint);
            pointer-events: none;
        }

        .tool-input-wrap .app-input {
            padding-left: 40px;
        }

        /* Opt a control out of the icon gutter (native date inputs). */
        .tool-input-wrap .app-input.no-icon {
            padding-left: 12px;
        }

        .tool-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .tool-actions .app-btn {
            flex: 1 1 auto;
        }

        .tool-hint {
            font-size: 0.8rem;
            color: var(--app-text-hint);
        }

        .tool-empty {
            text-align: center;
            padding: 28px 18px;
            color: var(--app-text-secondary);
            font-size: 0.95rem;
        }

        .tool-empty .material-icons {
            font-size: 40px;
            color: var(--app-text-hint);
            display: block;
            margin: 0 auto 10px;
        }

        /* ===== Result card internals ===== */
        .result-card {
            padding: 16px;
        }

        .result-head {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }

        .result-head .material-icons {
            font-size: 22px;
            color: var(--app-blue);
        }

        .result-title {
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--app-text-primary);
        }

        .result-sub {
            font-size: 0.82rem;
            color: var(--app-text-hint);
            margin-top: 2px;
        }

        .meta-list {
            display: grid;
            gap: 8px;
            font-size: 0.875rem;
            color: var(--app-text-secondary);
        }

        .meta-row {
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .meta-row .material-icons {
            font-size: 16px;
            flex-shrink: 0;
            margin-top: 1px;
        }

        .meta-label {
            color: var(--app-text-hint);
        }

        .meta-value {
            color: var(--app-text-primary);
            font-weight: 500;
        }

        /* ===== Scrollable data table ===== */
        .table-scroll {
            overflow-x: auto;
            margin-top: 12px;
            -webkit-overflow-scrolling: touch;
        }

        .table-scroll .data-table {
            min-width: 420px;
        }

        .data-table thead tr {
            border-bottom: 2px solid var(--app-card-border);
        }

        .data-table tbody tr:last-child {
            border-bottom: 1px solid #F5F5F5;
        }

        .data-table th:first-child,
        .data-table td:first-child {
            padding-left: 0;
        }

        .data-table th:last-child,
        .data-table td:last-child {
            padding-right: 0;
        }

        .row-index {
            color: var(--app-text-hint);
            font-size: 0.8rem;
            font-variant-numeric: tabular-nums;
        }

        /* ===== Station match list ===== */
        .station-match-list {
            display: grid;
            gap: 8px;
        }

        .station-match {
            display: flex;
            align-items: center;
            gap: 10px;
            border: 1px solid var(--app-card-border);
            border-radius: var(--border-radius-sm);
            padding: 10px 12px;
        }

        .station-match-name {
            font-size: 0.92rem;
            font-weight: 500;
            color: var(--app-text-primary);
            min-width: 0;
        }

        /* ===== Live status: train hero ===== */
        .train-hero {
            padding: 14px;
            background: linear-gradient(135deg, #1565C0, #1E88E5);
            color: #fff;
            border: none;
        }

        .train-hero-top {
            display: flex;
            align-items: baseline;
            gap: 8px;
            flex-wrap: wrap;
        }

        .train-hero-badge {
            background: rgba(255, 255, 255, 0.2);
            padding: 2px 8px;
            border-radius: 3px;
            font-size: 0.9rem;
            font-weight: 600;
        }

        .train-hero-name {
            font-size: 1.1rem;
            font-weight: 500;
        }

        .train-hero-route {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 10px;
            font-size: 0.95rem;
            flex-wrap: wrap;
        }

        .train-hero-route .sep {
            opacity: 0.6;
        }

        .train-hero-days {
            display: flex;
            gap: 4px;
            margin-top: 8px;
        }

        .train-hero-day {
            width: 24px;
            height: 24px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            font-size: 0.72rem;
            opacity: 0.4;
        }

        .train-hero-day.on {
            background: rgba(255, 255, 255, 0.3);
            font-weight: 600;
            opacity: 1;
        }

        .train-hero-meta {
            font-size: 0.82rem;
            opacity: 0.9;
            margin-top: 8px;
        }

        .train-hero-top {
            align-items: center;
        }

        .train-hero-name {
            flex: 1;
            min-width: 0;
        }

        .train-hero-refresh {
            flex-shrink: 0;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.18);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .train-hero-refresh .material-icons {
            font-size: 18px;
        }

        .train-hero-stop {
            display: inline-flex;
            align-items: baseline;
            gap: 5px;
            white-space: nowrap;
        }

        .train-hero-stop strong {
            font-weight: 600;
        }

        .train-hero-stop em {
            font-style: normal;
            font-size: 0.82rem;
            opacity: 0.85;
        }

        /* ===== Live status: hero summary stats ===== */
        .live-summary {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
            gap: 8px;
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.25);
        }

        .live-stat {
            background: rgba(255, 255, 255, 0.14);
            border-radius: 8px;
            padding: 6px 8px;
            min-width: 0;
        }

        .live-stat dt {
            font-size: 0.68rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            opacity: 0.8;
        }

        .live-stat dd {
            margin: 2px 0 0;
            font-size: 0.86rem;
            font-weight: 500;
            line-height: 1.25;
            overflow-wrap: anywhere;
        }

        .tone-late {
            color: #FFD3D3;
        }

        .tone-early {
            color: #C8E6C9;
        }

        .tone-on-time {
            color: #E8F5E9;
        }

        .tone-ok {
            color: #E8F5E9;
        }

        .tone-muted {
            opacity: 0.85;
        }

        /*
         * Journey progress header. Replaces the old "Arrival | date | Departure"
         * banner, which never varied with the actual route.
         */
        .timeline-head {
            background: var(--app-card-bg);
            border: 1px solid var(--app-card-border);
            border-radius: 12px;
            padding: 12px 14px;
        }

        .timeline-head-ends {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 12px;
        }

        .timeline-head-end {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .timeline-head-end--right {
            align-items: flex-end;
            text-align: right;
        }

        .timeline-head-end strong {
            font-size: 1rem;
            color: var(--app-text-primary);
            line-height: 1.2;
        }

        .timeline-head-end em {
            font-style: normal;
            font-size: 0.74rem;
            color: var(--app-text-hint);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 40vw;
        }

        .timeline-progress {
            margin-top: 10px;
            height: 6px;
            border-radius: 3px;
            background: #E3E6EA;
            overflow: hidden;
        }

        .timeline-progress-fill {
            display: block;
            height: 100%;
            border-radius: 3px;
            background: linear-gradient(90deg, var(--app-blue), #42A5F5);
        }

        /* No distance telemetry for this run: show a neutral full-width rail
           rather than implying the train has arrived. */
        .timeline-progress-fill.is-unknown {
            background: #CFD8DC;
        }

        .timeline-head-foot {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-top: 8px;
            font-size: 0.76rem;
            color: var(--app-text-hint);
        }

        /* ===== Timeline toolbar: past-stops disclosure ===== */
        .timeline-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .timeline-tool-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            min-height: var(--tap-target);
            padding: 6px 14px;
            border-radius: 20px;
            border: 1px solid var(--app-card-border);
            background: var(--app-card-bg);
            color: var(--app-blue);
            font-size: 0.84rem;
            font-weight: 500;
        }

        .timeline-tool-btn .material-icons {
            font-size: 18px;
            transition: transform var(--dur-fast) var(--ease);
        }

        .timeline-tool-btn[aria-expanded="true"] .material-icons {
            transform: rotate(180deg);
        }

        .timeline-stop-count {
            font-size: 0.78rem;
            color: var(--app-text-hint);
        }

        .skeleton-grid-3 {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 8px;
        }

        .timeline-card {
            padding: 8px 12px 16px;
        }

        /*
         * Jump-to-current affordance. Sticks to the top of the timeline card and
         * is revealed by app.js only while the current stop is scrolled out of
         * view, so it never floats over unrelated sections.
         */
        .timeline-jump {
            position: sticky;
            top: 8px;
            z-index: 5;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            width: 100%;
            min-height: var(--tap-target);
            margin-bottom: 8px;
            border-radius: 20px;
            background: var(--app-blue);
            color: #fff;
            font-size: 0.84rem;
            font-weight: 500;
            box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
        }

        .timeline-jump[hidden] {
            display: none;
        }

        .timeline-jump .material-icons {
            font-size: 18px;
        }

        .timeline-past {
            border-top: 1px dashed var(--app-card-border);
            border-bottom: 1px dashed var(--app-card-border);
            margin-bottom: 4px;
        }

        .timeline-past[hidden] {
            display: none;
        }

        .timeline-station-detail .platform-flag {
            font-size: 9px;
            vertical-align: middle;
        }

        .gmaps-wrap {
            margin-top: 12px;
            text-align: center;
        }

        .gmaps-link svg {
            width: 30px;
            height: 30px;
            flex-shrink: 0;
        }

        .ad-slot {
            display: block;
            text-align: center;
            max-width: 100%;
            /* Ad iframes are injected at fixed widths; clip them to the slot. */
            overflow: hidden;
        }

        @media (prefers-reduced-motion: no-preference) {
            .gmaps-link {
                transition: box-shadow var(--dur-fast) var(--ease);
            }

            .gmaps-link:hover {
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            }
        }

/* ===== Page: footer ===== */
/* ===== Footer ===== */
    .app-footer {
        margin-top: auto;
        background: var(--app-footer-bg);
        color: #fff;
    }

    .app-footer-inner {
        max-width: 1200px;
        margin: 0 auto;
        padding: 48px 20px 28px;
        display: grid;
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .app-footer-brand {
        display: flex;
        flex-direction: column;
        gap: 10px;
        max-width: 34ch;
    }

    .app-footer-brand .app-brand {
        color: #fff;
    }

    .app-footer-brand .app-brand-mark {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        flex-shrink: 0;
        color: #fff;
        background: var(--app-grad-brand);
        border-radius: 10px;
        box-shadow: 0 6px 16px -6px rgba(0, 92, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }

    .app-footer-brand .app-brand-name {
        color: #fff;
        font-size: 1.1rem;
    }

    .app-footer-brand p {
        font-size: 0.85rem;
        line-height: 1.6;
        color: rgba(255, 255, 255, 0.72);
    }

    .app-footer-cols {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 28px;
    }

    .app-footer-col h2 {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 14px;
    }

    .app-footer-col ul {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .app-footer-col a {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
        font-size: 0.875rem;
        color: rgba(255, 255, 255, 0.86);
        transition: color var(--dur-fast) var(--ease);
    }

    .app-footer-col a:hover,
    .app-footer-col a:focus-visible {
        color: #fff;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .app-footer-bottom {
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    .app-footer-bottom-inner {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.66);
    }

    .app-footer-bottom a {
        color: inherit;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .app-footer-bottom a:hover {
        color: #fff;
    }

    @media (min-width: 768px) {
        .app-footer-inner {
            grid-template-columns: minmax(240px, 1.2fr) 2fr;
            padding: 56px 24px 32px;
        }
    }

    /* ===== Live status: encounters panel ===== */
    .encounters-card {
        padding: 16px;
    }

    .encounters-head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 12px;
        margin-bottom: 14px;
    }

    .encounters-sub {
        margin-top: 4px;
        color: var(--app-text-secondary);
        font-size: 0.8125rem;
        line-height: 1.45;
    }

    .encounters-journey {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 28px;
        padding: 4px 10px;
        border: 1px solid var(--app-card-border);
        border-radius: 999px;
        background: var(--app-bg-subtle);
        color: var(--app-text-secondary);
        font-size: 0.75rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .encounters-journey .material-icons {
        font-size: 15px;
        color: var(--app-text-hint);
    }

    .encounters-empty,
    .encounters-card--unavailable .encounters-note {
        color: var(--app-text-secondary);
        font-size: 0.875rem;
        line-height: 1.5;
    }

    .encounters-card--unavailable {
        padding: 14px 16px;
    }

    .encounters-card--unavailable .encounters-note {
        margin-top: 6px;
    }

    .encounter-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }

    .encounter-filter {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: var(--tap-target);
        padding: 8px 14px;
        border: 1px solid var(--app-card-border);
        border-radius: 999px;
        background: var(--app-surface);
        color: var(--app-text-secondary);
        font-family: inherit;
        font-size: 0.8125rem;
        font-weight: 600;
        line-height: 1.2;
        cursor: pointer;
        transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
            color var(--dur-fast) var(--ease);
    }

    .encounter-filter-num {
        display: inline-block;
        min-width: 20px;
        padding: 1px 6px;
        border-radius: 999px;
        background: var(--app-bg-subtle);
        color: var(--app-text-secondary);
        font-size: 0.75rem;
        font-weight: 700;
        text-align: center;
    }

    .encounter-filter.is-active {
        background: var(--app-blue);
        border-color: var(--app-blue);
        color: #fff;
    }

    .encounter-filter.is-active .encounter-filter-num {
        background: rgba(255, 255, 255, 0.22);
        color: #fff;
    }

    .encounter-filter:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

    .encounter-filter--overtakes.is-active {
        background: var(--app-green);
        border-color: var(--app-green);
    }

    .encounter-filter--overtaken.is-active {
        background: var(--app-amber);
        border-color: var(--app-amber);
    }

    .encounter-filter--crossings.is-active {
        background: var(--app-blue);
        border-color: var(--app-blue);
    }

    .encounter-status {
        margin-bottom: 8px;
        color: var(--app-text-hint);
        font-size: 0.75rem;
    }

    .encounters-list {
        list-style: none;
        display: flex;
        flex-direction: column;
        border: 1px solid var(--app-card-border);
        border-radius: var(--border-radius-sm);
        overflow: hidden;
    }

    .encounter-item + .encounter-item {
        border-top: 1px solid var(--app-card-border);
    }

    .encounter-row {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr) 20px;
        align-items: center;
        gap: 12px;
        min-height: 65px;
        padding: 12px;
        color: inherit;
        text-decoration: none;
        transition: background var(--dur-fast) var(--ease);
    }

    .encounter-chip {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 50%;
    }

    .encounter-chip .material-icons {
        font-size: 18px;
    }

    .encounter-row--overtakes .encounter-chip {
        background: #eef7f0;
        color: var(--app-green);
    }

    .encounter-row--overtaken .encounter-chip {
        background: #fff6e8;
        color: var(--app-amber);
    }

    .encounter-row--crossings .encounter-chip {
        background: var(--app-surface-alt);
        color: var(--app-blue);
    }

    .encounter-body {
        min-width: 0;
    }

    .encounter-train {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px 8px;
    }

    .encounter-no {
        font-size: 0.9375rem;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

    .encounter-name {
        min-width: 0;
        color: var(--app-text-secondary);
        font-size: 0.8125rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .encounter-meta {
        display: block;
        margin-top: 3px;
        color: var(--app-text-hint);
        font-size: 0.75rem;
        line-height: 1.45;
    }

    .encounter-meta strong {
        color: var(--app-text-secondary);
        font-weight: 600;
    }

    .encounter-chevron {
        font-size: 18px;
        color: var(--app-text-hint);
    }

    .encounter-more {
        width: 100%;
        min-height: var(--tap-target);
        margin-top: 12px;
        border: 1px solid var(--app-card-border);
        border-radius: var(--border-radius-sm);
        background: var(--app-surface);
        color: var(--app-blue);
        font-family: inherit;
        font-size: 0.875rem;
        font-weight: 600;
        cursor: pointer;
        transition: background var(--dur-fast) var(--ease);
    }

    .encounter-more:hover {
        background: var(--app-bg-subtle);
    }

    .encounters-note {
        margin-top: 10px;
        color: var(--app-text-hint);
        font-size: 0.75rem;
        line-height: 1.5;
    }

    @media (hover: hover) and (pointer: fine) {
        .encounter-row:hover {
            background: var(--app-bg-subtle);
        }

        .encounter-filter:hover:not(:disabled):not(.is-active) {
            background: var(--app-bg-subtle);
        }
    }

    .encounter-row:focus-visible,
    .encounter-filter:focus-visible,
    .encounter-more:focus-visible {
        outline: 2px solid var(--app-focus-ring);
        outline-offset: 2px;
    }

/* ===== Quick date tabs (coach position) ===== */
.date-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    border-radius: 16px;
    background: var(--app-bg-subtle);
    border: 1px solid var(--app-card-border);
}
.date-chip {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 9px 4px 8px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--app-text-secondary);
    cursor: pointer;
    min-height: 56px;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
        box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.date-chip-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.date-chip-sub {
    font-size: 0.68rem;
    font-weight: 500;
    opacity: 0.75;
}
.date-check {
    position: absolute;
    top: 5px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.date-check .material-icons {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}
.date-chip:hover:not(.is-active) {
    background: rgba(0, 92, 255, 0.07);
    color: var(--app-text-primary);
}
.date-chip.is-active {
    background: var(--app-grad-primary);
    color: #fff;
    box-shadow: 0 4px 12px -4px rgba(0, 92, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.date-chip.is-active .date-check {
    opacity: 1;
    transform: scale(1);
}
.date-chip:active:not(.is-active) {
    transform: scale(0.97);
}
.date-chip:focus-visible {
    outline: 2px solid var(--app-focus-ring);
    outline-offset: 2px;
}

/* ===== Coach Position — premium page ===== */
.coach-page {
    display: grid;
    gap: 14px;
}
.coach-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: var(--border-radius-md);
    background: var(--app-grad-brand);
    color: #fff;
    box-shadow: var(--app-shadow-md);
    overflow: hidden;
    position: relative;
}
.coach-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}
.coach-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}
.coach-hero-icon .material-icons {
    font-size: 28px;
}
.coach-hero-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.coach-hero-sub {
    margin: 2px 0 0;
    font-size: 0.82rem;
    opacity: 0.9;
}
.coach-form {
    padding: 18px;
}
.coach-submit {
    width: 100%;
    background: var(--app-grad-primary);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(0, 92, 255, 0.65);
}
.coach-submit:active {
    opacity: 0.92;
}
.coach-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    color: var(--app-text-secondary);
}
.coach-empty .material-icons {
    color: var(--app-amber);
    font-size: 26px;
}
.coach-empty p {
    margin: 0;
    font-size: 0.9rem;
}
/* --- Result summary --- */
.coach-result {
    padding: 0;
    overflow: hidden;
}
.coach-summary {
    padding: 18px 18px 14px;
    background: linear-gradient(180deg, var(--app-blue-light) 0%, var(--app-surface) 100%);
    border-bottom: 1px solid var(--app-card-border);
}
.coach-id {
    display: flex;
    align-items: center;
    gap: 12px;
}
.coach-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--app-navy);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}
.coach-id-text h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--app-text-primary);
}
.coach-id-text p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--app-text-secondary);
}
.coach-route {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.coach-stn {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.coach-stn strong {
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--app-text-primary);
}
.coach-stn span {
    font-size: 0.72rem;
    color: var(--app-text-hint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}
.coach-stn--right {
    text-align: right;
    margin-left: auto;
}
.coach-route-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--app-blue);
    min-width: 60px;
}
.coach-route-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-blue);
    flex-shrink: 0;
}
.coach-route-line {
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: repeating-linear-gradient(90deg, var(--app-blue) 0 6px, transparent 6px 10px);
    opacity: 0.6;
}
.coach-route-track .material-icons {
    font-size: 20px;
}
.coach-boarding {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--app-surface);
    border: 1px dashed var(--app-border-strong);
    font-size: 0.82rem;
    color: var(--app-text-secondary);
}
.coach-boarding .material-icons {
    color: var(--app-blue);
    font-size: 19px;
}
.coach-pf {
    margin-left: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--app-green);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
}
.coach-flip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 18px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fef6e7;
    color: #92600a;
    font-size: 0.82rem;
    font-weight: 500;
}
.coach-flip .material-icons {
    font-size: 20px;
    flex-shrink: 0;
}
/* --- Rake diagram --- */
.coach-rake-scroll {
    padding: 6px 0 0;
}
.coach-rake-dir {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 12px 18px 8px;
    font-size: 0.72rem;
    color: var(--app-text-hint);
}
.coach-rake-dir .material-icons {
    font-size: 16px;
}
.coach-rake {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    overflow-x: auto;
    overflow-anchor: none;
    padding: 6px 52px 2px;
    scroll-padding: 0 52px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.coach-engine {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 60px;
    padding: 12px 8px 14px;
    border-radius: 12px 12px 8px 8px;
    background: linear-gradient(180deg, #1e2a4a 0%, var(--app-navy) 100%);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    scroll-snap-align: start;
    flex-shrink: 0;
    box-shadow: var(--app-shadow-sm);
}
.coach-engine .material-icons {
    font-size: 24px;
}
.coach-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 64px;
    padding: 14px 8px 16px;
    border-radius: 12px 12px 8px 8px;
    border: 1px solid transparent;
    border-top-width: 4px;
    scroll-snap-align: start;
    flex-shrink: 0;
    box-shadow: var(--app-shadow-sm);
    background: var(--app-surface);
    border-color: var(--app-card-border);
}
.coach-roof {
    position: absolute;
    top: -4px;
    left: 8px;
    right: 8px;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: currentColor;
    opacity: 0.55;
}
.coach-box.coach--ac {
    background: linear-gradient(180deg, #cfe3ff 0%, #e8f1ff 100%);
    border-color: #2f7bff;
    color: #0b4fd6;
}
.coach-box.coach--sl {
    background: linear-gradient(180deg, #c9f2d6 0%, #e7f7ee 100%);
    border-color: #1fae54;
    color: #0e6e35;
}
.coach-box.coach--gen {
    background: linear-gradient(180deg, #f3e6c8 0%, #faf3e3 100%);
    border-color: #d99a3d;
    color: #8a5a12;
}
.coach-box.coach--food {
    background: linear-gradient(180deg, #fcdf9e 0%, #fdf3e3 100%);
    border-color: #e8930c;
    color: #925e04;
}
.coach-box.coach--van {
    background: linear-gradient(180deg, #dccffb 0%, #f4f2fb 100%);
    border-color: #8b5cf6;
    color: #5b34c4;
}
.coach-code {
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    color: inherit;
}
.coach-kind {
    font-size: 0.62rem;
    font-weight: 600;
    color: inherit;
    opacity: 0.85;
    white-space: nowrap;
}
.coach-wheels {
    position: absolute;
    bottom: -5px;
    left: 10px;
    right: 10px;
    height: 6px;
}
.coach-wheels::before,
.coach-wheels::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2b3245;
    border: 2px solid #9aa3b5;
}
.coach-wheels::before {
    left: 0;
}
.coach-wheels::after {
    right: 0;
}
.coach-rails {
    height: 8px;
    margin: 6px 18px 0;
    border-radius: 4px;
    background:
        linear-gradient(180deg, transparent 0 2px, #b9c1cf 2px 4px, transparent 4px),
        repeating-linear-gradient(90deg, #c9d1dd 0 3px, transparent 3px 12px);
}
.coach-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 18px 0;
    padding: 0;
}
.coach-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid var(--app-card-border);
    background: var(--app-surface);
    color: var(--app-text-secondary);
}
.coach-pill strong {
    color: var(--app-text-primary);
}
.coach-pill.coach--ac {
    background: #d6e7ff;
    border-color: #2f7bff;
}
.coach-pill.coach--sl {
    background: #d3f4de;
    border-color: #1fae54;
}
.coach-pill.coach--gen {
    background: #f5e9cd;
    border-color: #d99a3d;
}
.coach-pill.coach--food {
    background: #fde4ae;
    border-color: #e8930c;
}
.coach-pill.coach--van {
    background: #e0d2fb;
    border-color: #8b5cf6;
}
.coach-note {
    margin: 10px 18px 0;
    font-size: 0.74rem;
    color: var(--app-text-hint);
}
.coach-note:last-child {
    margin-bottom: 16px;
}
.coach-guide {
    padding: 18px;
}
@media (max-width: 420px) {
    .coach-hero-title {
        font-size: 1.15rem;
    }
    .coach-box {
        min-width: 58px;
    }
}

/* ===== Rake slider (swipe + arrows) ===== */
.coach-rake-wrap {
    position: relative;
}
.coach-rake {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.coach-rake::-webkit-scrollbar {
    display: none;
}
.coach-rake-wrap::before,
.coach-rake-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 26px;
    pointer-events: none;
    z-index: 2;
}
.coach-rake-wrap::before {
    left: 0;
    background: linear-gradient(90deg, var(--app-surface) 0%, transparent 100%);
}
.coach-rake-wrap::after {
    right: 0;
    background: linear-gradient(-90deg, var(--app-surface) 0%, transparent 100%);
}
.coach-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--app-card-border);
    background: var(--app-surface);
    color: var(--app-text-primary);
    box-shadow: var(--app-shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.coach-nav .material-icons {
    font-size: 22px;
}
.coach-nav--prev {
    left: 6px;
}
.coach-nav--next {
    right: 6px;
}
.coach-nav:disabled {
    opacity: 0.25;
    cursor: default;
}
.coach-nav:not(:disabled):active {
    transform: translateY(-50%) scale(0.94);
}
.coach-nav:focus-visible {
    outline: 2px solid var(--app-focus-ring);
    outline-offset: 2px;
}

/* ===== Rake grab-drag + bottom slider ===== */
.coach-rake {
    cursor: grab;
}
.coach-rake.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
    -webkit-user-select: none;
}
.coach-rake.no-snap {
    scroll-snap-type: none;
}
.coach-slider {
    margin: 12px 18px 0;
    padding: 6px 2px;
    touch-action: none;
}
.coach-slider-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: var(--app-bg-subtle);
    border: 1px solid var(--app-card-border);
    cursor: pointer;
}
.coach-slider-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 56px;
    height: 16px;
    margin-top: -8px;
    border-radius: 999px;
    background: var(--app-grad-primary);
    box-shadow: 0 2px 8px -2px rgba(0, 92, 255, 0.6);
    cursor: grab;
    touch-action: none;
}
.coach-slider-thumb:active {
    cursor: grabbing;
}

/* ===== Shared premium page hero (all tool pages) ===== */
.page-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: var(--border-radius-md);
    background: var(--app-grad-brand);
    color: #fff;
    box-shadow: var(--app-shadow-md);
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
}
.page-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}
.page-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}
.page-hero-icon .material-icons {
    font-size: 28px;
}
.page-hero-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.page-hero-sub {
    margin: 2px 0 0;
    font-size: 0.82rem;
    opacity: 0.9;
}
.tool-page {
    display: grid;
    gap: 14px;
    align-content: start;
}
.tool-form {
    padding: 18px;
}
/* Gradient submit button shared by all tool forms */
.app-btn-gradient {
    width: 100%;
    background: var(--app-grad-primary);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(0, 92, 255, 0.65);
}
.app-btn-gradient:active {
    opacity: 0.92;
}
/* ===== Search result train cards ===== */
.train-card {
    display: block;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    border-left: 4px solid transparent;
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.train-card:hover {
    border-left-color: var(--app-blue);
}
.train-card-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.train-card-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--app-text-primary);
}
.train-card-dur {
    font-size: 0.78rem;
    color: var(--app-text-hint);
}
.train-card-name {
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--app-text-primary);
}
.train-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    flex-wrap: wrap;
    gap: 4px;
}
.train-card-route {
    font-size: 0.82rem;
    color: var(--app-text-secondary);
    font-weight: 500;
}
.runs-daily {
    font-size: 0.78rem;
    color: var(--app-green);
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    background: #e7f7ee;
}
.route-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    background: var(--app-blue-light);
    border: 1px solid #bcd6ff;
    color: var(--app-text-primary);
    font-weight: 600;
    font-size: 0.92rem;
}
.route-summary .material-icons {
    color: var(--app-blue);
}
/* ===== Premium empty states ===== */
.empty-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 24px;
    gap: 6px;
}
.empty-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: var(--app-grad-primary);
    color: #fff;
    margin-bottom: 8px;
    box-shadow: 0 8px 20px -8px rgba(0, 92, 255, 0.7);
}
.empty-hero-icon .material-icons {
    font-size: 36px;
}
.empty-hero h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}
.empty-hero p {
    margin: 0;
    color: var(--app-text-secondary);
    font-size: 0.9rem;
    max-width: 320px;
}
.empty-hero .app-btn {
    margin-top: 12px;
}
@media (max-width: 420px) {
    .page-hero-title {
        font-size: 1.15rem;
    }
}

/* ===== Home about / SEO section (plain, no card) ===== */
.home-about-plain {
    padding: 6px 2px 0;
}
.home-about-plain p {
    margin: 10px 0 0;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--app-text-secondary);
}
.home-about-plain p strong {
    color: var(--app-text-primary);
}
.home-section-sub {
    margin: 18px 0 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-text-primary);
}

/* ===== Header Services dropdown ===== */
.nav-drop {
    position: relative;
}
.nav-drop .nav-drop-btn {
    overflow: visible;
}
.nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    padding: 8px;
    border-radius: 14px;
    background: var(--app-surface);
    border: 1px solid var(--app-card-border);
    box-shadow: var(--app-shadow-lg);
    display: none;
    z-index: var(--z-sticky);
}
/* Invisible hover bridge: fills the gap between trigger and menu so moving
   the mouse down never leaves the hover area. */
.nav-menu::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}
.nav-drop:hover .nav-menu,
.nav-drop:focus-within .nav-menu,
.nav-drop.open .nav-menu {
    display: block;
}
.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--app-text-primary);
    white-space: nowrap;
}
.nav-menu a .material-icons {
    font-size: 19px;
    color: var(--app-blue);
}
.nav-menu a:hover {
    background: var(--app-bg-subtle);
}
