/* ==========================================================================
   CheckMyTrain — Shared Design System  (components.css)
   Loaded by every page. Defines CSS custom properties and reusable component
   classes. Page-specific files provide only genuinely unique overrides.
   ========================================================================== */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg:            #001f5b;
    --bg-panel:      #00174a;
    --bg-input:      rgba(0,0,0,0.30);
    --bg-card:       rgba(255,255,255,0.04);
    --bg-row-even:   rgba(255,255,255,0.02);
    --bg-row-hover:  rgba(255,255,255,0.06);

    /* Borders */
    --border:        rgba(255,255,255,0.08);
    --border-input:  rgba(255,255,255,0.18);
    --border-strong: rgba(255,255,255,0.12);

    /* Text */
    --text:          #ffffff;
    --text-muted:    rgba(255,255,255,0.50);
    --text-dim:      rgba(255,255,255,0.35);

    /* Brand blues */
    --blue-primary:  #1466d6;
    --blue-dark:     #0c56bf;
    --blue-darker:   #003b8e;
    --blue-col:      #0050c8;
    --blue-header:   rgba(0,50,160,0.35);

    /* Status colours */
    --clr-success:   #8cf0a8;
    --clr-warning:   #ffd54a;
    --clr-danger:    #ff8b8b;
    --clr-live:      #4cff91;
    --clr-info:      #6bbfff;

    /* Shape */
    --r-sm:  6px;
    --r-md:  8px;
    --r-lg:  12px;

    /* Layout */
    --sidebar-w:   280px;
    --topbar-h:    56px;
    --input-h:     36px;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.25);
    --page-max-standard: 960px;
    --page-max-wide:     1120px;
    --page-max-board:    1400px;
    --page-pad-x:        20px;
    --page-pad-y:        24px;
    --page-pad-y-tight:  14px;
    --page-pad-y-loose:  40px;
    --panel-pad:         18px;
    --panel-pad-tight:   16px;
    --section-gap:       18px;
}

@media (max-width: 800px) {
    :root {
        --r-sm: 10px;
        --r-md: 14px;
        --r-lg: 18px;
        --input-h: 42px;
        --page-pad-x: 14px;
        --page-pad-y: 18px;
        --page-pad-y-tight: 10px;
        --page-pad-y-loose: 28px;
        --panel-pad: 16px;
        --panel-pad-tight: 14px;
        --section-gap: 14px;
    }
}

/* ── Page header card ─────────────────────────────────────────────────────── */
/* The blue gradient header card that appears at the top of content pages.    */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, var(--blue-dark) 0%, var(--blue-darker) 100%);
    padding: var(--panel-pad-tight) var(--page-pad-x);
    border-radius: var(--r-md);
    margin-bottom: var(--page-pad-y-tight);
    box-shadow: var(--shadow-card);
    gap: 16px;
}

.page-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.page-subtitle {
    font-size: 16px;
    opacity: 0.85;
    margin-top: 2px;
}

.page-clock {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Public content pages ────────────────────────────────────────────────── */
.public-page {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-y-loose);
}

.public-page--narrow {
    max-width: 700px;
}

.public-page-hero {
    display: grid;
    gap: 8px;
    margin: 0 0 22px;
    padding: 24px 26px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(20,102,214,0.2), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.024));
    box-shadow: 0 18px 40px rgba(0,0,0,0.16);
}

.public-page-kicker {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;
    color: rgba(255,255,255,0.52);
}

.public-page h1,
.public-page-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
}

.public-page-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    line-height: 1.6;
    margin: 0 0 24px;
    max-width: 640px;
}

.public-page h2,
.public-page-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 24px 0 8px;
}

.public-page p,
.public-page ul,
.public-page-copy,
.public-page-list {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    line-height: 1.7;
    margin: 0 0 12px;
}

.public-page ul,
.public-page-list {
    padding-left: 20px;
}

.public-page a,
.public-page-link {
    color: #6bbfff;
}

.public-page code {
    font-size: 12px;
    background: rgba(255,255,255,0.1);
    padding: 1px 5px;
    border-radius: 3px;
}

.public-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 12px;
    padding: 16px 18px;
}

.public-card + .public-card {
    margin-top: 12px;
}

.public-card-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #fff;
}

.public-card-copy {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    line-height: 1.6;
    margin: 0;
}

.public-form-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 18px;
}

.public-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.public-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.public-field--full {
    grid-column: 1 / -1;
}

.public-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
}

.public-input,
.public-textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 10px;
    color: #fff;
    font: inherit;
    padding: 10px 12px;
}

.public-textarea {
    min-height: 180px;
    resize: vertical;
}

.public-input:focus,
.public-textarea:focus {
    outline: none;
    border-color: rgba(255,255,255,0.34);
    background: rgba(0,0,0,0.34);
}

.public-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 11px 18px;
    border-radius: 10px;
    border: none;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: filter 0.15s;
}

.public-btn--primary {
    background: linear-gradient(180deg, #1466d6 0%, #0c56bf 100%);
}

.public-btn--primary:hover {
    filter: brightness(1.1);
}

.public-btn--primary:active {
    filter: brightness(0.92);
}

.public-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.public-note {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    line-height: 1.5;
    max-width: 520px;
}

.public-support-copy {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255,255,255,0.64);
}

.public-message {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.public-message--success {
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.28);
    color: #9cf3b2;
}

.public-message--error {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.28);
    color: #ffb0b0;
}

.public-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

@media (max-width: 720px) {
    .public-page {
        padding-inline: 16px;
    }

    .public-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Content card ─────────────────────────────────────────────────────────── */
/* Bordered card block — used to group route bars, tables, panels.            */
.card {
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 14px;
}

.card-heading {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--blue-header);
    border-bottom: 1px solid var(--border);
}

/* ── Data table ───────────────────────────────────────────────────────────── */
/* Card wrapper + scrollable inner + table with consistent header/row style.  */
.data-table-wrap {
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.data-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 9px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
    white-space: nowrap;
    background: var(--blue-header);
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table tbody tr:nth-child(even) { background: var(--bg-row-even); }
.data-table tbody tr:hover           { background: var(--bg-row-hover); }
.data-table tbody tr:last-child      { border-bottom: none; }

.data-table td {
    padding: 10px 12px;
    vertical-align: middle;
    white-space: nowrap;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-ontime    { background: rgba(140,240,168,0.12); color: var(--clr-success); }
.badge-delayed   { background: rgba(255,213,74, 0.12); color: var(--clr-warning); }
.badge-severe    { background: rgba(255,100,60, 0.12); color: #ff9a75; }
.badge-cancelled { background: rgba(255,139,139,0.12); color: var(--clr-danger); }
.badge-info      { background: rgba(107,191,255,0.12); color: var(--clr-info); }

.bus-badge {
    display: inline-block;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    background: rgba(255,213,74,0.15);
    color: var(--clr-warning);
    vertical-align: middle;
    margin-right: 2px;
}

/* ── Status text colours ──────────────────────────────────────────────────── */
.clr-success  { color: var(--clr-success); }
.clr-warning  { color: var(--clr-warning); }
.clr-danger   { color: var(--clr-danger); }
.clr-info     { color: var(--clr-info); }

/* ── Live pulsing dot ─────────────────────────────────────────────────────── */
.live-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--clr-live);
    flex-shrink: 0;
    animation: anim-blink 1.4s infinite;
}

@keyframes anim-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.25; }
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spin {
    display: inline-block;
    animation: anim-spin 1.2s linear infinite;
}

@keyframes anim-spin {
    to { transform: rotate(360deg); }
}

/* ── Install prompt ─────────────────────────────────────────────────────── */
.pwa-install-prompt {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: min(360px, calc(100vw - 24px));
    padding: 16px 16px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(4,28,77,0.96) 0%, rgba(0,20,58,0.98) 100%);
    box-shadow: 0 24px 60px rgba(0,0,0,0.32);
    z-index: 900;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.pwa-install-prompt.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.pwa-install-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

/* ── Native app picker layer ────────────────────────────────────────────── */
.is-native-app .app-picker-native-control {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.app-picker-proxy {
    width: 100%;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    cursor: pointer;
    appearance: none;
}

.app-picker-proxy::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.48);
    font-size: 12px;
    pointer-events: none;
}

.app-picker-proxy-value {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    padding-right: 18px;
}

.app-picker-proxy.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-picker-modal[hidden] {
    display: none !important;
}

.app-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
}

.app-picker-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4,10,20,0.72);
}

.app-picker-sheet {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: #0d1830;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
    padding: 16px;
    max-height: min(78vh, 620px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.app-picker-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    flex: 1;
}

.app-picker-nav {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.app-picker-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-picker-grid--calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.app-picker-weekday {
    text-align: center;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-weight: 700;
    text-transform: uppercase;
}

.app-picker-day {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-radius: 12px;
    min-height: 42px;
    font-family: inherit;
}

.app-picker-day.is-empty {
    visibility: hidden;
}

.app-picker-day.is-selected {
    background: linear-gradient(180deg, #4e8ef7 0%, #3a7ae0 100%);
    border-color: transparent;
}

.app-picker-option {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 14px;
}

.app-picker-option:last-child {
    margin-bottom: 0;
}

.app-picker-option.is-selected {
    background: linear-gradient(180deg, rgba(78,142,247,0.24) 0%, rgba(58,122,224,0.28) 100%);
    border-color: rgba(98,157,255,0.58);
}

.app-picker-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.ds-track-sheet {
    max-width: 520px;
    margin: 0 auto;
}

.ds-track-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(18px, calc(env(safe-area-inset-top, 0px) + 12px)) 18px max(18px, calc(env(safe-area-inset-bottom, 0px) + 12px));
}

.ds-track-modal .app-picker-sheet {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 1;
    width: min(720px, calc(100vw - 24px));
    max-height: min(calc(100dvh - 36px), 760px);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.48);
}

.ds-track-sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ds-track-sheet-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
    margin-bottom: 4px;
}

.ds-track-sheet-title {
    text-align: left;
}

.ds-track-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.ds-track-form-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 2px;
}

.ds-track-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.ds-track-section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ds-track-section-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.52);
}

.ds-track-section-caption {
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255,255,255,0.66);
}

.ds-track-hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(23, 65, 128, 0.48) 0%, rgba(10, 26, 54, 0.72) 100%);
    border: 1px solid rgba(112, 159, 255, 0.18);
}

.ds-track-sheet-kicker--hero {
    margin-bottom: 0;
}

.ds-track-sheet-route {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.ds-track-sheet-route .arrow {
    opacity: 0.42;
    margin: 0 6px;
}

.ds-track-hero-meta {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

.ds-track-hero-summary {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255,255,255,0.82);
}

.ds-track-existing-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ds-track-summary-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(78,142,247,0.18);
    border: 1px solid rgba(98,157,255,0.3);
    color: #d8e7ff;
    font-size: 12px;
    font-weight: 700;
}

.ds-track-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ds-track-card {
    position: relative;
    display: block;
    color: inherit;
    cursor: pointer;
}

.ds-track-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ds-track-card-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ds-track-card-main::before {
    content: "";
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.34);
    background: rgba(255,255,255,0.02);
    flex: 0 0 auto;
    box-sizing: border-box;
}

.ds-track-card input:checked + .ds-track-card-main {
    background: rgba(31, 90, 175, 0.22);
    border-color: rgba(105, 165, 255, 0.55);
    box-shadow: inset 0 0 0 1px rgba(105, 165, 255, 0.16);
}

.ds-track-card input:checked + .ds-track-card-main::before {
    border-color: #74a8ff;
    background: radial-gradient(circle at center, #74a8ff 0 5px, transparent 6px);
}

.ds-track-card--subtle .ds-track-card-main {
    min-height: 52px;
}

.ds-track-card-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ds-track-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.ds-track-card-desc {
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255,255,255,0.64);
}

.ds-track-subgroup {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin-left: 28px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}

.ds-track-subgroup[hidden] {
    display: none !important;
}

.ds-track-subgroup--nested {
    margin-left: 0;
    background: rgba(255,255,255,0.03);
}

.ds-track-choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ds-track-choice {
    position: relative;
    display: inline-flex;
}

.ds-track-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ds-track-choice span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.84);
    font-size: 12px;
    font-weight: 700;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ds-track-choice input:checked + span {
    background: rgba(31, 90, 175, 0.28);
    border-color: rgba(105, 165, 255, 0.62);
    color: #fff;
}

.ds-track-field-label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.62);
}

.ds-track-help {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255,255,255,0.54);
}

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

.ds-panel-toast {
    position: fixed;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(10px);
    max-width: min(540px, calc(100vw - 24px));
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(7, 18, 38, 0.96);
    color: #fff;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 18px 44px rgba(0,0,0,0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 2200;
}

.ds-panel-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ds-panel-toast--success {
    background: rgba(9, 51, 31, 0.98);
    border-color: rgba(82, 214, 138, 0.35);
}

.ds-panel-toast--error {
    background: rgba(69, 18, 24, 0.98);
    border-color: rgba(255, 120, 128, 0.32);
}

.ds-track-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(13,24,48,0) 0%, rgba(13,24,48,0.96) 24%);
}

.ds-track-remove-btn {
    margin-right: auto;
}

@media (max-width: 700px) {
    .ds-track-modal {
        display: block;
        padding: 0;
    }

    .ds-track-modal .app-picker-sheet {
        position: absolute;
        left: 12px;
        right: 12px;
        top: max(12px, calc(env(safe-area-inset-top, 0px) + 12px));
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-height: none;
        padding: 16px;
        border-radius: 18px;
    }

    .ds-track-section {
        padding: 12px;
    }

    .ds-track-delivery-grid {
        grid-template-columns: 1fr;
    }
}

.app-picker-action {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-family: inherit;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.82);
}

.pwa-install-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.pwa-install-dismiss {
    appearance: none;
    border: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.pwa-install-body {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255,255,255,0.72);
    margin-bottom: 12px;
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pwa-install-btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.pwa-install-btn--primary {
    background: linear-gradient(180deg, #1466d6 0%, #0c56bf 100%);
    color: #fff;
}

.pwa-install-btn--secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.86);
}

@media (max-width: 640px) {
    .pwa-install-prompt {
        right: 12px;
        left: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .page-header {
        padding: 14px 14px;
        border-radius: var(--r-md);
        margin-bottom: 12px;
    }

    .page-title {
        font-size: 22px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .page-clock {
        font-size: 20px;
    }
}

/* ── Summary stats bar ────────────────────────────────────────────────────── */
.stat-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--r-md);
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 90px;
}

.stat-num {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.stat-card.cancelled .stat-num { color: var(--clr-danger); }
.stat-card.delayed   .stat-num { color: var(--clr-warning); }
.stat-card.ontime    .stat-num { color: var(--clr-success); }

/* ── State panels ─────────────────────────────────────────────────────────── */
/* Centred panels for loading / empty / error states.                         */
.state-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    gap: 10px;
    text-align: center;
}

.state-panel[hidden] { display: none; }

.state-icon  { font-size: 40px; opacity: 0.5; line-height: 1; }
.state-title { font-size: 18px; font-weight: 700; color: rgba(255,255,255,0.7); }
.state-sub   { font-size: 14px; color: var(--text-muted); max-width: 380px; }
.state-note  { font-size: 12px; color: var(--text-dim);   max-width: 380px; margin-top: 4px; }

/* ── Placeholder (no results / initial state) ─────────────────────────────── */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    opacity: 0.3;
    gap: 12px;
    text-align: center;
}

.placeholder-icon { font-size: 48px; }
.placeholder-text { font-size: 16px; }

/* ── Live service banner ──────────────────────────────────────────────────── */
.live-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0,60,180,0.30);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--r-md);
    font-size: 14px;
    margin-bottom: 14px;
}

.ds-delay-repay-banner {
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    background: rgba(0, 98, 51, 0.22);
    border-color: rgba(91, 255, 160, 0.20);
}

.ds-delay-repay-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ds-delay-repay-copy strong {
    font-size: 14px;
    line-height: 1.35;
}

.ds-delay-repay-copy span {
    color: rgba(255,255,255,0.84);
    line-height: 1.45;
}

.ds-delay-repay-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.14);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.ds-delay-repay-link:hover,
.ds-delay-repay-link:focus-visible {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

@media (max-width: 560px) {
    .ds-delay-repay-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .ds-delay-repay-link {
        width: 100%;
        max-width: 100%;
    }
}

/* ── Responsive page-header ───────────────────────────────────────────────── */
@media (max-width: 700px) {
    .public-page-hero {
        padding: 18px 16px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .page-header   { padding: 14px 16px; }
    .page-title    { font-size: 22px; }
    .page-subtitle { font-size: 14px; }
    .page-clock    { font-size: 22px; }
}

@media (max-width: 440px) {
    .page-header   { padding: 10px 12px; margin-bottom: 10px; border-radius: var(--r-sm); }
    .page-title    { font-size: 18px; }
    .page-subtitle { font-size: 12px; }
    .page-clock    { font-size: 18px; }
}

/* ── Login modal ──────────────────────────────────────────────────────────── */
.lm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.lm-overlay[hidden] { display: none !important; }

.lm-card {
    background: #001840;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 32px 28px 26px;
    width: 100%;
    max-width: 380px;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,0.65);
}

.lm-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    transition: color 0.12s;
}
.lm-close:hover { color: #fff; }

.lm-logo {
    display: block;
    width: 160px;
    height: auto;
    margin: 0 auto 20px;
}

.lm-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    color: #fff;
    margin: 0 0 18px;
}

.lm-error {
    background: rgba(220,50,50,0.12);
    border: 1px solid rgba(220,50,50,0.3);
    border-radius: 6px;
    color: #ff8080;
    font-size: 13px;
    line-height: 1.5;
    padding: 9px 12px;
    margin-bottom: 14px;
}
.lm-error[hidden] { display: none; }

.lm-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.lm-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.4);
}

/* Override browser autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0px 1000px #001f5b inset !important;
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
}

.lm-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    font-family: inherit;
    height: 38px;
}
.lm-input:focus {
    border-color: rgba(255,255,255,0.45);
    background: rgba(0,0,0,0.4);
}

.lm-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    padding: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: filter 0.15s;
    margin-top: 6px;
}
.lm-btn--primary {
    background: linear-gradient(180deg, #1466d6 0%, #0c56bf 100%);
    color: #fff;
}
.lm-btn--primary:hover  { filter: brightness(1.1); }
.lm-btn--primary:active { filter: brightness(0.92); }
.lm-btn--primary:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }

.lm-body {
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    line-height: 1.6;
    text-align: center;
    margin: 0 0 10px;
}

.lm-links {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.35);
}
.lm-links a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.12s;
}
.lm-links a:hover { color: #fff; }

/* ── Service detail panel ───────────────────────────────────────────────────── */
.ds-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 700;
    display: flex;
    justify-content: flex-end;
}
.ds-panel-overlay[hidden] { display: none; }

body.ds-panel-open {
    overflow: hidden;
}

.ds-panel {
    background: linear-gradient(180deg, #0d1b3e 0%, #09162f 100%);
    border-left: 1px solid rgba(255,255,255,0.1);
    width: min(680px, 100vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ds-panel-head {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ds-panel-head-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    float: right;
    padding-left: 12px;
}

.ds-panel-close,
.ds-panel-refresh {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.ds-panel-close:hover,
.ds-panel-refresh:hover { color: #fff; }
.ds-panel-refresh { font-size: 20px; }

.ds-panel-route {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.ds-panel-uid   { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 3px; }
.ds-panel-meta  { font-size: 13px; color: rgba(255,255,255,0.45); margin-top: 3px; }

.ds-panel-inline-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.ds-panel-distance {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.09);
    color: #dce8ff;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border: 0;
    appearance: none;
    font-family: inherit;
    line-height: 1.2;
}
.ds-panel-distance.is-clickable {
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.ds-panel-distance.is-clickable:hover {
    background: rgba(255,255,255,0.14);
}
.ds-panel-distance:focus-visible {
    outline: 2px solid rgba(107,191,255,0.95);
    outline-offset: 2px;
}
.ds-panel-header-actions {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, auto));
    gap: 10px;
}
.ds-panel-trust-id { font-size: 11px; color: var(--text-dim); margin-top: 2px; font-family: monospace; }
.ds-panel-td-pos   { font-size: 12px; color: #7ecfff; margin-top: 4px; font-style: italic; }
.ds-trust-ontime   { color: #7ecf7e; }
.ds-trust-early    { color: #7ecf7e; }
.ds-trust-late     { color: #ff8b8b; }

.ds-src-trust  { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 3px; border-radius: 2px; background: #4a7fa5; color: #fff; vertical-align: middle; margin-left: 3px; }
.ds-src-darwin { display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 3px; border-radius: 2px; background: #5a7a5a; color: #fff; vertical-align: middle; margin-left: 3px; }
.ds-detail-current-td { background: rgba(126, 207, 255, 0.08); }
.ds-td-here    { font-size: 11px; color: #7ecfff; font-weight: 600; }

.ds-panel-body { overflow-y: auto; flex: 1; padding: 16px 20px; }

.ds-route-map-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(2,10,24,0.8);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ds-route-map-overlay[hidden] {
    display: none !important;
}

.ds-route-map-shell {
    width: min(980px, 100%);
    height: min(78vh, 760px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(5,28,78,0.98) 0%, rgba(2,18,56,0.99) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0,0,0,0.45);
    overflow: hidden;
}

.ds-route-map-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px 8px;
}

.ds-route-map-kicker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.56);
}

.ds-route-map-title {
    margin-top: 4px;
    font-size: 19px;
    font-weight: 800;
    color: #fff;
}

.ds-route-map-subtitle {
    padding: 0 18px 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.72);
}

.ds-route-map-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.ds-route-map-body {
    position: relative;
    flex: 1;
    min-height: 0;
}

.ds-route-map-canvas {
    width: 100%;
    height: 100%;
}

.ds-route-map-status {
    position: absolute;
    top: 14px;
    left: 14px;
    max-width: min(420px, calc(100% - 28px));
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(7,22,52,0.88);
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    line-height: 1.45;
    backdrop-filter: blur(4px);
}

.ds-route-map-status.error {
    background: rgba(90,18,24,0.92);
}

.ds-panel-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.42);
    margin: 0 0 10px;
}

.ds-panel-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ds-journey-mode {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.ds-journey-mode-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #b8c8e8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
}

.ds-journey-mode-btn:hover {
    color: #ffffff;
}

.ds-journey-mode-btn.is-active {
    background: rgba(255,255,255,0.16);
    color: #ffffff;
}

.ds-journey-mode-count {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    padding: 1px 5px;
    margin-left: 3px;
    vertical-align: middle;
}

.ds-detail-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
}

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

.ds-detail-table thead th {
    background: rgba(0,50,160,0.3);
    padding: 6px 8px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ds-detail-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
.ds-detail-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.ds-detail-table tbody tr:last-child { border-bottom: none; }
.ds-detail-table td { padding: 6px 8px; vertical-align: middle; white-space: nowrap; color: rgba(255,255,255,0.75); }

.ds-detail-pass td      { color: rgba(255,255,255,0.35); font-style: italic; }
.ds-detail-cancelled td { color: rgba(255,100,100,0.7); }

.ds-detail-loc   { font-weight: 600; white-space: normal; max-width: 180px; }
.ds-detail-tpl   { font-size: 10px; color: var(--text-dim); display: block; font-family: monospace; }
.ds-detail-time  { font-variant-numeric: tabular-nums; }
.ds-detail-delay { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.ds-detail-delay.pos { color: var(--clr-warning); }
.ds-detail-delay.sev { color: #ff9a75; }
.ds-detail-delay.neg { color: var(--text-dim); }

.ds-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: rgba(255,255,255,0.4);
    font-size: 14px;
    gap: 8px;
}

.ds-panel-error { color: var(--clr-danger); padding: 20px 0; font-size: 14px; }

.ds-mobile-calls {
    display: none;
}

.ds-journey-track {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
}

.ds-journey-track::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: rgba(77,144,254,0.28);
    pointer-events: none;
}

.ds-journey-stop {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 14px;
    padding: 10px 0;
}

.ds-journey-rail {
    position: relative;
    min-height: 72px;
}

.ds-journey-connector {
    display: none;
}

.ds-journey-connector.top {
    top: 0;
    height: calc(50% - 7px);
}

.ds-journey-connector.bottom {
    bottom: 0;
    height: calc(50% - 7px);
}

.ds-journey-connector.hidden {
    display: none;
}

.ds-journey-marker {
    position: absolute;
    top: calc(50% - 7px);
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2f6fde;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0,20,70,0.3);
}

.ds-journey-train {
    position: absolute;
    left: 4px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border-radius: 50%;
    background: var(--clr-live);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0,20,70,0.3), 0 0 0 0 rgba(76,255,145,0.7);
    animation: train-pulse 1.6s infinite;
    z-index: 3;
}

.ds-journey-stop.passed .ds-journey-marker {
    background: rgba(77,144,254,0.38);
    border-color: rgba(255,255,255,0.6);
}

.ds-journey-stop.current .ds-journey-marker {
    background: var(--clr-live);
    box-shadow: 0 0 0 2px rgba(0,20,70,0.3), 0 0 0 0 rgba(76,255,145,0.7);
    animation: train-pulse 1.6s infinite;
}

.ds-journey-stop.cancelled .ds-journey-marker {
    background: rgba(255,139,139,0.4);
    border-color: var(--clr-danger);
}

.ds-journey-stop.passed .ds-journey-connector {
    background: rgba(77,144,254,0.55);
}

.ds-journey-main {
    min-width: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
}

.ds-journey-stop:last-child .ds-journey-main {
    border-bottom: none;
    padding-bottom: 0;
}

.ds-journey-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.ds-journey-loc-wrap {
    min-width: 0;
}

.ds-journey-loc {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
}

.ds-journey-stop.passed .ds-journey-loc {
    color: rgba(255,255,255,0.62);
}

.ds-journey-stop.cancelled .ds-journey-loc {
    color: var(--clr-danger);
    text-decoration: line-through;
}

.ds-journey-sub {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.42);
    margin-top: 2px;
}

.ds-journey-live-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(76,255,145,0.14);
    color: #8cf0a8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

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

.ds-journey-timeblock {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ds-journey-time-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.38);
}

.ds-journey-time-value {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    color: rgba(255,255,255,0.88);
    font-variant-numeric: tabular-nums;
}

.ds-journey-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.ds-journey-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    font-weight: 700;
}

.ds-journey-chip.pos {
    color: var(--clr-warning);
}

.ds-journey-chip.sev {
    color: #ff9a75;
}

.ds-journey-chip.neg {
    color: rgba(255,255,255,0.62);
}

.ds-journey-notes {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255,255,255,0.66);
}

.ds-journey-stop.passing .ds-journey-main {
    opacity: 0.75;
}

.ds-journey-stop.passing .ds-journey-loc {
    font-size: 13px;
    font-weight: 600;
}

/* ── Reliability section ────────────────────────────────────────────────────── */
.ds-rel-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ds-rel-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ds-rel-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,0.85);
}
.ds-rel-value.ds-rel-good { color: #8cf0a8; }
.ds-rel-value.ds-rel-warn { color: var(--clr-warning); }
.ds-rel-value.ds-rel-bad  { color: #ff8b8b; }
.ds-rel-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ds-rel-note {
    font-size: 12px;
    color: rgba(255,255,255,0.48);
    line-height: 1.45;
    margin: -4px 0 12px;
}

.ds-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.ds-track-actions {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.ds-history-actions {
    display: block !important;
}

.ds-history-select {
    background: #001f5b !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    color: #fff !important;
    appearance: auto;
    padding-right: 8px;
}

.ds-history-select option {
    background: #001f5b;
    color: #fff;
}

.ds-track-btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #0f6ddc 0%, #0a53b0 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    padding: 9px 12px;
    cursor: pointer;
}

.ds-track-btn-icon {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1;
}

.ds-track-btn-label {
    display: inline-block;
    line-height: 1.1;
}

.ds-track-btn.tracked {
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.18);
}

.ds-track-btn.secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
}

.ds-track-btn.secondary:hover {
    background: rgba(255,255,255,0.12);
}

.ds-track-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.ds-track-note {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255,255,255,0.56);
}

.ds-panel-header-actions .ds-track-note {
    display: none;
}

.ds-panel-header-actions .ds-track-btn {
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

.ds-train-log-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ds-train-log-type {
    min-height: 34px;
    min-width: 110px;
    padding: 6px 12px;
    border-radius: 999px;
}

@media (max-width: 640px) {
    .ds-action-row {
        grid-template-columns: 1fr;
    }
}
.ds-rel-recent {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.ds-rel-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    cursor: default;
}
.ds-rel-dot-ok     { background: #3d9e55; }
.ds-rel-dot-late   { background: #c9922a; }
.ds-rel-dot-sev    { background: #b34a2a; }
.ds-rel-dot-cancel { background: #7a1a1a; border: 1px solid #ff4444; }

.ds-service-status {
    margin: 0 0 18px;
    padding: 14px 15px;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.04) 100%),
        linear-gradient(135deg, rgba(43,91,204,0.16) 0%, rgba(16,27,53,0.12) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.ds-service-status--cancelled,
.ds-service-status--part_cancelled {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.03) 100%),
        linear-gradient(135deg, rgba(163,34,34,0.22) 0%, rgba(56,17,17,0.18) 100%);
}

.ds-service-status-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ds-service-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.74);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ds-service-status-title {
    font-size: 19px;
    line-height: 1.2;
    font-weight: 800;
    color: #fff;
}

.ds-service-status-reason {
    font-size: 14px;
    line-height: 1.45;
    color: rgba(255,255,255,0.82);
    max-width: 52ch;
}

.ds-consist-block {
    margin: 0 0 18px;
    padding: 15px 16px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.ds-consist-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.ds-consist-summary {
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ds-consist-note {
    margin: 8px 0 0;
    color: rgba(255,255,255,0.74);
    font-size: 12px;
    line-height: 1.45;
}

.ds-consist-frame {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 12px 12px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    overflow-x: auto;
    overflow-y: hidden;
}

.ds-consist-frame.is-illustrated {
    padding: 12px 10px 12px;
    background: rgba(255,255,255,0.03);
}

.ds-consist-visual {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.ds-consist-visual--illustrated {
    gap: 0;
    align-items: flex-end;
}

.ds-consist-set {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ds-consist-set-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.46);
}

.ds-consist-set-cars {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex-wrap: nowrap;
    overflow: visible;
    padding-bottom: 0;
}

.ds-consist-car {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 56px;
    padding: 7px 8px;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.04) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    margin-left: -1px;
    flex: 0 0 auto;
    text-align: center;
}

.ds-consist-car.has-image {
    min-width: 132px;
    min-height: 98px;
    padding: 4px 6px 8px;
}

.ds-consist-visual--illustrated .ds-consist-set {
    gap: 6px;
}

.ds-consist-visual--illustrated .ds-consist-set-label {
    display: none;
}

.ds-consist-visual--illustrated .ds-consist-set-cars {
    overflow: visible;
    padding-bottom: 0;
}

.ds-consist-visual--illustrated .ds-consist-car {
    background: transparent;
    border: 0;
    box-shadow: none;
    margin-left: 0;
    min-width: 0;
    min-height: 0;
    padding: 0;
}

.ds-consist-visual--illustrated .ds-consist-car.has-image {
    min-width: 110px;
    min-height: 0;
    padding: 0;
}

.ds-consist-visual--illustrated .ds-consist-car-id {
    margin-top: 2px;
    font-size: 10px;
    color: rgba(255,255,255,0.88);
}

.ds-consist-visual--illustrated .ds-consist-car-name {
    display: block;
    max-width: 116px;
    margin-top: 2px;
    font-size: 9px;
    line-height: 1.2;
    color: rgba(255,255,255,0.68);
    text-align: center;
    text-wrap: balance;
}

.ds-consist-visual--illustrated .ds-consist-car-meta {
    display: none;
    margin-top: 1px;
    font-size: 9px;
    line-height: 1.15;
    color: rgba(255,255,255,0.56);
    white-space: nowrap;
}

.ds-consist-visual--illustrated .ds-consist-car-facility {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
    font-size: 9px;
    line-height: 1.15;
    color: rgba(255,255,255,0.66);
    white-space: nowrap;
}

.ds-consist-visual--illustrated .ds-consist-car-image {
    width: 116px;
}

.ds-consist-visual--illustrated .ds-consist-car.has-image + .ds-consist-car.has-image {
    margin-left: 0;
}

.ds-consist-visual--illustrated .ds-consist-car.fleet-350-1.has-image + .ds-consist-car.fleet-350-1.has-image,
.ds-consist-visual--illustrated .ds-consist-car.fleet-350-3.has-image + .ds-consist-car.fleet-350-3.has-image,
.ds-consist-visual--illustrated .ds-consist-car.fleet-350-4.has-image + .ds-consist-car.fleet-350-4.has-image {
    margin-left: -8px;
}

.ds-consist-car.is-cab {
    background: linear-gradient(180deg, rgba(79,128,255,0.16) 0%, rgba(31,56,111,0.14) 100%);
    border-color: rgba(112,151,255,0.35);
}

.ds-consist-set-cars .ds-consist-car:first-child {
    margin-left: 0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.ds-consist-set-cars .ds-consist-car:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.ds-consist-car-image {
    display: block;
    width: 116px;
    height: auto;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

.ds-consist-car-icon {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
    line-height: 1.1;
}

.ds-consist-car-role {
    display: block;
    margin-top: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.56);
    line-height: 1.15;
}

.ds-consist-car-meta {
    display: none;
}

.ds-consist-car-facility {
    display: none;
}

.ds-consist-car-id {
    display: block;
    width: 100%;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
}

.ds-consist-car-name {
    display: block;
    width: 100%;
    max-width: 120px;
    margin-top: 3px;
    font-size: 10px;
    line-height: 1.2;
    color: rgba(255,255,255,0.72);
    text-align: center;
    text-wrap: balance;
}

.ds-consist-couple {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    margin-top: 18px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 800;
}

.ds-consist-visual--illustrated .ds-consist-couple {
    margin-top: 0;
    min-width: 18px;
    min-height: 18px;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

.ds-consist-units {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.ds-consist-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 56px;
    padding: 10px 11px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.05) 100%);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
    font-size: 12px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.ds-consist-chip-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
    margin-bottom: 3px;
}

.ds-consist-chip-main {
    display: block;
    line-height: 1.15;
    font-size: 15px;
    font-weight: 800;
}

.ds-consist-chip-sub {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: rgba(255,255,255,0.62);
}

.ds-consist-chip-extra {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    color: rgba(255,255,255,0.84);
}

/* ── Formation ─────────────────────────────────────────────────────────────── */
.ds-formation-wrap {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ds-coach-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 0 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    cursor: default;
}

.ds-coach-box.low  { border-color: #3d9e55; background: rgba(61,158,85,0.12); }
.ds-coach-box.med  { border-color: #c9922a; background: rgba(201,146,42,0.12); }
.ds-coach-box.high { border-color: #b34a2a; background: rgba(179,74,42,0.12); }

.ds-toilet-icon {
    line-height: 1;
}

/* ── Panel responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ds-panel-overlay {
        justify-content: center;
        align-items: flex-end;
        background: rgba(0,0,0,0.62);
    }

    .ds-panel {
        width: min(100% - 24px, 520px);
        height: min(88dvh, 760px);
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -24px 60px rgba(0,0,0,0.36);
    }

    .ds-panel-head {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 16px 14px 10px;
        background: linear-gradient(180deg, rgba(13,27,62,0.98) 0%, rgba(13,27,62,0.94) 100%);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .ds-panel-head::before {
        content: "";
        display: block;
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: rgba(255,255,255,0.24);
        margin: 0 auto 12px;
    }

    .ds-panel-head-btns {
        gap: 8px;
        padding-left: 10px;
    }

    .ds-panel-close,
    .ds-panel-refresh {
        width: 34px;
        height: 34px;
        border-radius: 999px;
        background: rgba(255,255,255,0.08);
        border: 1px solid rgba(255,255,255,0.1);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .ds-panel-route {
        font-size: 15px;
        line-height: 1.25;
        padding-right: 8px;
    }

    .ds-panel-meta {
        font-size: 12px;
        line-height: 1.4;
    }

    .ds-panel-distance {
        margin-top: 7px;
        font-size: 11px;
    }

    .ds-route-map-overlay {
        padding: 10px;
    }

    .ds-route-map-shell {
        height: min(82vh, 680px);
        border-radius: 16px;
    }

    .ds-route-map-title {
        font-size: 16px;
    }

    .ds-panel-trust-id,
    .ds-panel-td-pos {
        line-height: 1.45;
        word-break: break-word;
    }

    .ds-panel-body {
        padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .ds-panel-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .ds-platform {
        display: inline-flex;
        align-items: center;
        line-height: 1;
    }

    .ds-platform-num {
        display: block;
    }

    .ds-detail-wrap {
        display: none;
    }

    .ds-rel-stats {
        gap: 14px;
    }

    .ds-rel-value {
        font-size: 20px;
    }

    .ds-dc-type, .ds-dc-plat, .ds-dc-gbtt { display: none; }
}
