/* ===================================================================
   NEXTSTOP — design tokens
   Palette pulled from physical transit signage: ink-green bus livery,
   ticket-paper surfaces, and the amber of an old LED destination board.
=================================================================== */
:root {
    --ink: #14241F;
    --ink-soft: #1C2E27;
    --ink-faint: #2A3D36;
    --paper: #F7F5EF;
    --paper-dim: #EFEAD9;
    --card: #FFFFFF;
    --line: #DED7C2;
    --line-soft: #EAE4D2;
    --brand: #1F6F54;
    --brand-deep: #154E3B;
    --brand-pale: #DCEFE6;
    --amber: #F2A93B;
    --amber-deep: #B9791F;
    --coral: #E2583E;
    --coral-pale: #FBE3DD;
    --text: #14241F;
    --text-soft: #5B6660;
    --text-faint: #93998F;

    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-pill: 999px;

    --shadow-card: 0 6px 20px rgba(20, 36, 31, 0.07);
    --shadow-float: 0 22px 48px rgba(20, 36, 31, 0.22);

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

/* ===================================================================
   RESET
=================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--paper-dim);
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
input { font-family: inherit; border: none; outline: none; background: none; color: inherit; }
ul { list-style: none; }
img, svg { display: block; }
.icon { width: 22px; height: 22px; flex-shrink: 0; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ===================================================================
   PAGE LAYOUT — a normal responsive page, comfortable to read on
   phones and just as fine on a desktop browser. No device chrome.
=================================================================== */
body {
    background: var(--paper-dim);
}

.app-shell {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--paper);
    position: relative;
}

.app-main {
    padding-bottom: 8px;
}

/* ===================================================================
   TYPE UTILITIES
=================================================================== */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.display-xl {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 34px;
    line-height: 1.12;
    letter-spacing: -0.01em;
}
.display-lg {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.2;
}
.display-md {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 18px;
}
.text-soft { color: var(--text-soft); }
.text-faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }

/* ===================================================================
   BUTTONS
=================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    padding: 15px 22px;
    border-radius: var(--radius-pill);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: var(--paper); box-shadow: var(--shadow-card); }
.btn-google {
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--line);
}
.btn-ghost { background: transparent; color: var(--text-soft); font-weight: 500; }
.btn-outline { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-sm { padding: 10px 16px; font-size: 13.5px; width: auto; }
.btn[disabled] { opacity: 0.6; pointer-events: none; }

/* ===================================================================
   FLASH MESSAGES
=================================================================== */
.flash {
    margin: 16px 22px 0;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    display: flex; align-items: center; gap: 9px;
}
.flash .icon { width: 17px; height: 17px; flex: 0 0 auto; }
.flash-success { background: var(--brand-pale); color: var(--brand-deep); }
.flash-error { background: var(--coral-pale); color: var(--coral); }

/* ===================================================================
   LOGIN SCREEN
=================================================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    color: var(--paper);
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(115deg, rgba(242,169,59,0.07) 0 1px, transparent 1px 80px),
        repeating-linear-gradient(25deg, rgba(247,245,239,0.05) 0 1px, transparent 1px 90px);
    pointer-events: none;
}
.login-content {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 28px 36px;
}
.login-top { padding-top: 0; }
.logo-mark {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 26px;
    box-shadow: 0 8px 22px rgba(31,111,84,0.45);
}
.logo-mark .icon { width: 30px; height: 30px; color: var(--paper); }
.login-screen .eyebrow { color: var(--amber); margin-bottom: 14px; }
.login-screen .display-xl { color: var(--paper); margin-bottom: 14px; }
.login-screen .lede { color: #B9C2BC; font-size: 15.5px; line-height: 1.55; max-width: 320px; }

.login-bottom { display: flex; flex-direction: column; gap: 14px; }
.login-fineprint {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: #8A958E;
    line-height: 1.5;
    padding: 4px 6px 0;
}
.login-fineprint .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--amber); }
.login-bottom .btn-ghost { align-self: center; }

/* Loading overlay shown briefly when "Continue with Google" is tapped */
.auth-overlay {
    position: absolute; inset: 0;
    background: var(--ink);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 20;
}
.auth-overlay.is-visible { opacity: 1; pointer-events: all; }
.spinner {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(247,245,239,0.18);
    border-top-color: var(--amber);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.auth-overlay p { color: #B9C2BC; font-size: 13.5px; font-family: var(--font-mono); }

/* ===================================================================
   APP HEADER (post-login screens)
=================================================================== */
.app-header {
    padding: 26px 22px 14px;
}
.app-header.is-sticky {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--paper);
}
.app-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.greeting-name { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.avatar-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--paper);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
}
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: var(--shadow-card);
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.icon-btn .icon { width: 19px; height: 19px; }
.notif-dot {
    position: absolute; top: 9px; right: 10px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--coral);
    border: 1.5px solid var(--card);
}

/* ===================================================================
   SIGNATURE ELEMENT — destination-board ticker
=================================================================== */
.board {
    background: var(--ink);
    border-radius: var(--radius-md);
    padding: 13px 0;
    margin: 14px 22px 4px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-card);
}
.board::before {
    content: "";
    position: absolute; inset: 0;
    background-image: repeating-linear-gradient(180deg, rgba(0,0,0,0.25) 0 1px, transparent 1px 3px);
    pointer-events: none;
}
.board-row { display: flex; align-items: center; gap: 10px; padding: 0 18px; position: relative; z-index: 1; }
.board-live {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    color: var(--coral);
    flex: 0 0 auto;
}
.board-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.board-track { flex: 1; overflow: hidden; white-space: nowrap; }
.board-marquee {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--amber);
    text-shadow: 0 0 6px rgba(242,169,59,0.55);
    animation: marquee 16s linear infinite;
    padding-left: 100%;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ===================================================================
   SEARCH BAR
=================================================================== */
.search-bar {
    margin: 18px 22px 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: var(--radius-pill);
    padding: 13px 18px;
    box-shadow: var(--shadow-card);
}
.search-bar .icon { width: 18px; height: 18px; color: var(--text-faint); }
.search-bar input { flex: 1; font-size: 14.5px; color: var(--text); }
.search-bar input::placeholder { color: var(--text-faint); }

/* ===================================================================
   FIND A BUS — from/to route planner
=================================================================== */
.planner-card {
    margin: 18px 22px 0;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 6px 18px;
    box-shadow: var(--shadow-card);
}
.planner-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
    position: relative;
}
.planner-field + .planner-field { border-top: 1px solid var(--line-soft); }
.planner-field .icon { width: 18px; height: 18px; color: var(--brand); flex: 0 0 auto; }
.planner-field-text { flex: 1; min-width: 0; position: relative; }
.planner-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 2px; }
.planner-input {
    width: 100%;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    background: transparent;
    border: none;
    padding: 0;
}
.planner-input::placeholder { color: var(--text-faint); font-weight: 500; }
.planner-input:focus { outline: none; }

.autocomplete-wrap { padding-right: 36px; }
.autocomplete-panel {
    display: none;
    position: absolute;
    left: 0; right: 0; top: calc(100% + 6px);
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    border: 1px solid var(--line-soft);
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    padding: 5px;
}
.autocomplete-wrap.is-open .autocomplete-panel,
.autocomplete-panel.is-open { display: block; }

/* .autocomplete-option = used by home.php planner (highlight + icons)
   .autocomplete-item   = used by add-bus.php inline JS (plain text)
   Both share the same look so they feel consistent. */
.autocomplete-option,
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}
.autocomplete-option .icon { width: 15px; height: 15px; color: var(--text-faint); flex: 0 0 auto; }
.autocomplete-option:hover,
.autocomplete-option.is-active,
.autocomplete-item:hover { background: var(--paper-dim); }
.autocomplete-option mark { background: var(--brand-pale); color: var(--brand-deep); border-radius: 3px; }
.autocomplete-empty { padding: 14px 12px; font-size: 13px; color: var(--text-faint); }

.field-error {
    margin: 10px 22px 0;
    font-size: 12.5px;
    color: var(--coral);
    font-weight: 600;
}
.planner-swap {
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--paper-dim);
    color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
}
.planner-swap .icon { width: 15px; height: 15px; color: var(--brand-deep); }
.planner-submit { margin: 18px 22px 0; }

.suggest-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggest-chip {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-deep);
    background: var(--brand-pale);
    padding: 8px 13px;
    border-radius: var(--radius-pill);
}

.results-meta {
    display: flex; align-items: center; gap: 8px;
    margin: 4px 22px 2px;
    font-size: 13px;
    color: var(--text-soft);
}
.results-meta strong { color: var(--text); }

.result-card {
    display: flex;
    gap: 14px;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
}
.result-times {
    display: flex; align-items: center; gap: 10px;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-soft);
}
.result-times .icon { width: 13px; height: 13px; color: var(--text-faint); }
.result-times .arrow { color: var(--text-faint); }
.result-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 12px;
}

/* ===================================================================
   SECTIONS
=================================================================== */
.section { padding: 22px 22px 4px; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 14px;
}
.section-head .display-md { color: var(--text); }
.section-link { font-size: 12.5px; font-weight: 600; color: var(--brand); }

.h-scroll {
    display: flex; gap: 12px;
    overflow-x: auto;
    padding: 2px 22px 10px;
    margin: 0 -22px;
    scrollbar-width: none;
}
.h-scroll::-webkit-scrollbar { display: none; }

/* Stop card (nearby stops, horizontal scroll) */
.stop-card {
    flex: 0 0 auto;
    width: 168px;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
}
.stop-card .pin-row { display: flex; align-items: center; gap: 7px; color: var(--brand); margin-bottom: 10px; }
.stop-card .pin-row .icon { width: 16px; height: 16px; }
.stop-card .stop-name { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.stop-card .stop-meta { font-size: 12px; color: var(--text-soft); }
.stop-card .stop-routes { display: flex; gap: 6px; margin-top: 12px; }

/* Route plate badge — a literal route-number plate, like on the bus itself */
.plate {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.02em;
    color: var(--paper);
    background: var(--brand-deep);
    border-radius: 7px;
    padding: 4px 7px;
    line-height: 1;
}
.plate.amber { background: var(--amber); color: var(--ink); }

/* Tracked bus card (vertical list) */
.bus-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
}
.bus-card-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: var(--brand-pale);
    color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.bus-card-icon .icon { width: 24px; height: 24px; }
.bus-card-body { flex: 1; min-width: 0; }
.bus-card-route { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.bus-card-dest { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bus-card-stop { font-size: 12.5px; color: var(--text-soft); }
.bus-card-eta { text-align: right; flex: 0 0 auto; }
.bus-card-eta .num { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1; }
.bus-card-eta .unit { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; }

/* Status pills */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
}
.pill .icon { width: 9px; height: 9px; }
.pill-ontime { background: var(--brand-pale); color: var(--brand-deep); }
.pill-delay { background: var(--coral-pale); color: var(--coral); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 34px 24px;
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.empty-state .icon-wrap {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--paper-dim);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    color: var(--text-faint);
}
.empty-state h3 { font-family: var(--font-display); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-soft); margin-bottom: 18px; line-height: 1.5; }

/* ===================================================================
   TRACK SCREEN
=================================================================== */
.track-header {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 22px 10px;
}
.track-header .route-tag { display: flex; align-items: center; gap: 8px; flex: 1; }
.track-header .dest { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.route-progress {
    margin: 4px 22px 0;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-card);
}
.route-progress-track {
    height: 6px;
    background: var(--line);
    border-radius: var(--radius-pill);
    position: relative;
    overflow: hidden;
}
.route-progress-fill {
    position: absolute; left: 0; top: 0; height: 100%;
    background: var(--brand);
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}
.route-progress-labels {
    display: flex; justify-content: space-between;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-faint);
}
.route-progress-labels .current { color: var(--brand-deep); font-weight: 600; }

.eta-banner {
    display: flex; align-items: center; justify-content: space-between;
    margin: 16px 22px 0;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.eta-banner .eta-num { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1; }
.eta-banner .eta-unit { font-family: var(--font-mono); font-size: 11px; color: var(--amber); letter-spacing: 0.1em; }
.eta-banner .eta-label { font-size: 12.5px; color: #B9C2BC; margin-top: 4px; }
.notify-toggle {
    display: flex; align-items: center; gap: 8px;
    background: rgba(247,245,239,0.1);
    border: 1px solid rgba(247,245,239,0.25);
    border-radius: var(--radius-pill);
    padding: 9px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--paper);
    width: auto;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.notify-toggle .icon { width: 15px; height: 15px; color: var(--amber); }
.notify-toggle.is-on { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.notify-toggle.is-on .icon { color: var(--ink); }
.notify-toggle[disabled] { opacity: 0.6; pointer-events: none; }

/* Timeline */
.timeline { padding: 22px 22px 18px; }
.timeline-item {
    display: flex; gap: 14px;
    position: relative;
    padding-bottom: 22px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: 9px; top: 22px; bottom: 0;
    width: 2px;
    background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    flex: 0 0 auto;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--card);
    border: 2.5px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    z-index: 1;
}
.timeline-item.is-done .timeline-dot { border-color: var(--brand); background: var(--brand); color: var(--paper); }
.timeline-item.is-done .timeline-dot .icon { width: 11px; height: 11px; }
.timeline-item.is-current .timeline-dot { border-color: var(--amber); }
.timeline-item.is-current .timeline-dot::after {
    content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--amber);
}
.timeline-body { flex: 1; padding-top: 1px; }
.timeline-stop { font-weight: 600; font-size: 14px; }
.timeline-item.is-current .timeline-stop { color: var(--brand-deep); }
.timeline-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.timeline-tag { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; color: var(--amber-deep); background: #FCEFD9; padding: 3px 8px; border-radius: var(--radius-pill); }

.vehicle-card {
    margin: 4px 22px 22px;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex; align-items: center; gap: 14px;
}
.vehicle-card .display-md { font-size: 14.5px; margin-bottom: 2px; }

/* ===================================================================
   SAVED SCREEN
=================================================================== */
.saved-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 15px 14px;
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.saved-card.is-removing { transform: translateX(40px); opacity: 0; }
.saved-card-remove {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--paper-dim);
    color: var(--text-soft);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.saved-card-remove .icon { width: 14px; height: 14px; }

/* ===================================================================
   PROFILE: rider "Add a stop / Add a route" panels
=================================================================== */
.contribute-panel {
    margin: 0 22px 18px;
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.contribute-head {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 16px;
    cursor: pointer;
}
.contribute-head-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--brand-pale);
    color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.contribute-head-icon .icon { width: 17px; height: 17px; }
.contribute-head-body { flex: 1; }
.contribute-head-title { font-weight: 600; font-size: 14px; }
.contribute-head-sub { font-size: 12px; color: var(--text-soft); margin-top: 1px; }
.contribute-head .chev { width: 16px; height: 16px; color: var(--text-faint); transition: transform 0.2s ease; flex: 0 0 auto; }
.contribute-panel.is-open .contribute-head .chev { transform: rotate(90deg); }

.contribute-body {
    display: none;
    padding: 4px 16px 18px;
    border-top: 1px solid var(--line-soft);
}
.contribute-panel.is-open .contribute-body { display: block; }

.contribute-row { margin-top: 14px; }
.contribute-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.contribute-row input[type="text"] {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: var(--paper);
}
.contribute-row input:focus { outline: none; border-color: var(--brand); }
.contribute-row .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.contribute-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contribute-submit { margin-top: 16px; }
.contribute-submit .btn { width: auto; padding: 11px 20px; font-size: 13.5px; }

.contribute-list { margin-top: 16px; }
.contribute-list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0;
    border-top: 1px solid var(--line-soft);
    font-size: 13px;
}
.contribute-list-item .icon { width: 14px; height: 14px; color: var(--brand); flex: 0 0 auto; }
.contribute-list-empty { font-size: 12.5px; color: var(--text-faint); margin-top: 14px; }

/* ===================================================================
   PROFILE SCREEN
=================================================================== */
.profile-hero {
    display: flex; flex-direction: column; align-items: center;
    padding: 18px 22px 26px;
    text-align: center;
}
.profile-avatar {
    width: 78px; height: 78px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--paper);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700;
    box-shadow: var(--shadow-card);
    margin-bottom: 14px;
}
.profile-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.profile-email { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.google-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px;
    background: var(--paper-dim);
    padding: 5px 11px 5px 7px;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-soft);
}
.google-chip .icon { width: 14px; height: 14px; }

.settings-list { padding: 4px 22px 18px; }
.settings-group { background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow-card); margin-bottom: 18px; overflow: hidden; }
.settings-row {
    display: flex; align-items: center; gap: 13px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--line-soft);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--paper-dim);
    color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.settings-row-icon .icon { width: 17px; height: 17px; }
.settings-row-body { flex: 1; }
.settings-row-title { font-weight: 600; font-size: 14px; }
.settings-row-sub { font-size: 12px; color: var(--text-soft); margin-top: 1px; }
.settings-row .icon.chev { width: 16px; height: 16px; color: var(--text-faint); }
.settings-row.danger .settings-row-title { color: var(--coral); }
.settings-row.danger .settings-row-icon { background: var(--coral-pale); color: var(--coral); }

.data-note {
    margin: 0 22px 18px;
    background: var(--brand-pale);
    border-radius: var(--radius-md);
    padding: 15px 16px;
    display: flex; gap: 11px;
}
.data-note .icon { width: 18px; height: 18px; color: var(--brand-deep); flex: 0 0 auto; margin-top: 1px; }
.data-note p { font-size: 12.5px; line-height: 1.55; color: var(--brand-deep); }
.data-note strong { color: var(--ink); }

/* Toggle switch */
.switch { position: relative; width: 42px; height: 25px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; background: var(--line); border-radius: var(--radius-pill); transition: background 0.2s ease; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s ease; }
.switch input:checked ~ .switch-track { background: var(--brand); }
.switch input:checked ~ .switch-thumb { transform: translateX(17px); }

/* ===================================================================
   PAGE TRANSITION
=================================================================== */
.app-main, .login-screen { animation: fade-up 0.35s ease both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Spacer so last card isn't flush against bottom nav */
.bottom-spacer { height: 14px; }

/* ===================================================================
   ADD A BUS — full form page
=================================================================== */
.form-page-card {
    margin: 18px 22px 0;
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
}
.form-section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14.5px;
    margin: 22px 0 4px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}
.form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.form-section-sub { font-size: 12px; color: var(--text-soft); margin-bottom: 14px; }

.field { margin-top: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 7px; }
.field .req { color: var(--coral); }
.field input[type="text"],
.field input[type="tel"],
.field input[type="time"],
.field select {
    width: 100%;
    padding: 12px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    background: var(--paper);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }

.image-drop {
    margin-top: 14px;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-md);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    position: relative;
    background: var(--paper-dim);
}
.image-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-drop .icon-wrap { width: 44px; height: 44px; border-radius: 50%; background: var(--card); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; color: var(--brand); box-shadow: var(--shadow-card); }
.image-drop .icon-wrap .icon { width: 21px; height: 21px; }
.image-drop p { font-size: 13px; font-weight: 600; }
.image-drop .hint { margin-top: 3px; }
.image-preview { display: none; margin-top: 14px; }
.image-preview.is-visible { display: block; }
.image-preview img { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius-md); }

/* Stopage rows builder */
.stop-builder-row {
    display: flex; gap: 10px; align-items: flex-end;
    margin-top: 12px;
}
.stop-builder-row .field { margin-top: 0; flex: 1; }
.stop-builder-row .field-time { flex: 0 0 130px; }
.stop-builder-remove {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    background: var(--coral-pale);
    color: var(--coral);
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
}
.stop-builder-remove .icon { width: 16px; height: 16px; }
.stop-builder-add {
    margin-top: 14px;
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 600;
    color: var(--brand-deep);
    background: var(--brand-pale);
    padding: 9px 15px;
    border-radius: var(--radius-pill);
}
.stop-builder-add .icon { width: 14px; height: 14px; }

.form-submit-bar { margin: 22px 22px 0; }

/* ===================================================================
   BUS CARDS — used on "your buses", "all buses", and search results
=================================================================== */
.bus-listing-card {
    display: flex; gap: 14px;
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 14px;
    margin-bottom: 12px;
}
.bus-listing-thumb {
    width: 64px; height: 64px;
    border-radius: var(--radius-sm);
    background: var(--brand-pale);
    color: var(--brand-deep);
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.bus-listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bus-listing-thumb .icon { width: 26px; height: 26px; }
.bus-listing-body { flex: 1; min-width: 0; }
.bus-listing-name { font-weight: 600; font-size: 14.5px; }
.bus-listing-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bus-listing-reg { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-soft); margin-top: 5px; }
.bus-listing-agency { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.bus-listing-actions { display: flex; gap: 8px; margin-top: 10px; }

.type-pill {
    font-size: 10.5px; font-weight: 600;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    background: var(--paper-dim);
    color: var(--text-soft);
}
.type-pill.ac { background: var(--brand-pale); color: var(--brand-deep); }

/* Public buses directory search */
.directory-search {
    margin: 18px 22px 6px;
    background: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 14px 16px;
}
.directory-search form { display: flex; align-items: center; gap: 10px; }
.directory-search input { flex: 1; font-size: 14.5px; }
.directory-search input::placeholder { color: var(--text-faint); }
.directory-search button { color: var(--text-faint); display: flex; }
.directory-search-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }

/* Bus detail page */
.bus-detail-hero {
    margin: 0 0 4px;
    height: 200px;
    background: var(--brand-pale);
    color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.bus-detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.bus-detail-hero .icon { width: 48px; height: 48px; }
.bus-detail-info { padding: 18px 22px 4px; }
.bus-detail-row {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}
.bus-detail-row .icon { width: 16px; height: 16px; color: var(--brand-deep); flex: 0 0 auto; }
.bus-detail-row-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.bus-detail-row-value { font-size: 14px; font-weight: 600; margin-top: 1px; }

/* ===================================================================
   BOTTOM NAV
=================================================================== */
.bottom-nav {
    position: sticky;
    bottom: 0;
    display: flex;
    background: var(--card);
    border-top: 1px solid var(--line-soft);
    padding: 10px 6px calc(10px + env(safe-area-inset-bottom, 0px));
    margin-top: 18px;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    color: var(--text-faint);
    transition: color 0.15s ease;
}
.nav-item .nav-icon { width: 22px; height: 22px; }
.nav-item span { font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; }
.nav-item.is-active { color: var(--brand); }
.nav-item.is-active .nav-icon { color: var(--brand); }

/* ===================================================================
   DESKTOP / WIDE-VIEWPORT LAYOUT
   The app-shell stays phone-comfortable by default; past 760px it
   widens and switches stacked card lists into multi-column grids.
=================================================================== */
@media (min-width: 760px) {
    .app-shell { max-width: 760px; }

    .h-scroll {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        overflow: visible;
        padding: 2px 22px 4px;
    }
    .stop-card { width: auto; }

    .planner-card { max-width: 600px; margin-left: auto; margin-right: auto; }
    .planner-submit { max-width: 600px; margin-left: auto; margin-right: auto; }
    .form-page-card { max-width: 600px; margin-left: auto; margin-right: auto; }
    .form-submit-bar { max-width: 600px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1020px) {
    .app-shell { max-width: 1100px; }

    .section { padding-left: 0; padding-right: 0; }
    .board, .search-bar, .planner-card, .directory-search, .form-page-card, .form-submit-bar, .planner-submit { margin-left: 0; margin-right: 0; }
    .h-scroll { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

    .app-main { padding-left: 24px; padding-right: 24px; }

    .bus-card, .result-card, .bus-listing-card, .saved-card { max-width: none; }

    .results-section-grid,
    #savedList,
    #myBusesList {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 12px;
        align-items: start;
    }
    .results-section-grid .result-card,
    #savedList .saved-card,
    #myBusesList .bus-listing-card { margin-bottom: 0; }

    .track-header, .app-header { padding-left: 0; padding-right: 0; }
}
