:root {
  /* Palette - washed-out, white-text-readable dark mode. Tones chosen to read
     as trustworthy/reliable and to stay DISTANT from SJTA's bold line colors so
     UI chrome never competes with the routes. Light/high-contrast mode = later. */
  --bg: #14181f;          /* app background (darker grey shell, restored by request) */
  --bg-raised: #1c222b;   /* cards / panels (and the top/bottom menu bars) */
  --bg-panel: #0e1116;    /* map popout menu: darker grey to contrast the bars */
  --bg-sheet: #1b212b;    /* detail sheet */
  --line: #2c333e;        /* borders */
  /* Design rule: NEVER grey text on any background (light OR dark). Secondary
     text uses a warm sand tone, not grey, and stays high-contrast for older
     riders. Larger, obvious UI is the default. */
  --text: #d6cec7;
  --text-dim: #c8b893;       /* warm sand, deliberately not grey */
  --accent: #587e95;      /* palette 1 - primary actions */
  --nav-active: #8fc0e0;  /* lighter blue for the selected nav + page header */
  --signal: #e26048;      /* palette 2 - "start here / selected" signal color */
  --ok: #117b68;          /* palette 3 - save / confirm */
  --danger: #a04b4c;      /* palette 4 - delays / alerts */
  --warn: #8b8137;        /* palette 5 */
  --radius: 16px;
  --nav-h: 84px;
  --appbar-h: calc(56px + env(safe-area-inset-top));
  /* Lato, with the Black (900) weight for headings/tabs/buttons. Default
     tracking (no negative letter-spacing) so type breathes, not taut. */
  --font: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* keep the attribute authoritative over .class display rules */
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 17px; }
body { overscroll-behavior: none; }

/* ---------- Global top bar ---------- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 700; height: var(--appbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: env(safe-area-inset-top) 14px 0; background: var(--bg-raised); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; white-space: nowrap; font-size: 18px; color: var(--text); flex: none; }
.brand b { font-weight: 900; }
.appbar-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search-ic { position: absolute; left: 11px; width: 18px; height: 18px; color: var(--text-dim); pointer-events: none; }
.appbar-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 11px; padding: 11px 36px 11px 36px; font-size: 15px; font-family: inherit; font-weight: 600;
}
.appbar-search input::placeholder { color: var(--text-dim); }
.search-clear { position: absolute; right: 6px; background: none; border: none; color: var(--text-dim); padding: 6px; display: flex; }
.search-clear .ic { width: 16px; height: 16px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; max-height: 60vh; overflow-y: auto;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.sr-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.sr-item:first-child { border-top: none; }
.sr-swatch { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.sr-name { font-size: 15px; font-weight: 700; }
.sr-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.sr-empty { padding: 14px; color: var(--text-dim); font-size: 14px; }
.icon-btn { background: none; border: none; color: var(--text-dim); padding: 6px; display: flex; flex: none; }
.icon-btn .ic { width: 25px; height: 25px; }

/* ---------- Screens ---------- */
.screen { display: none; position: fixed; top: var(--appbar-h); bottom: var(--nav-h); left: 0; right: 0; flex-direction: column; }
.screen.is-active { display: flex; }
.screen-body { flex: 1; overflow-y: auto; padding: 20px; }
/* Page header (under the search bar): icon + page name, shows where you are. */
.page-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 20px 10px; }
.page-head .ic { width: 27px; height: 27px; color: var(--nav-active); flex: none; }
.page-head span { font-size: 23px; font-weight: 900; color: #fff; }

/* Minimalist hollow line icons */
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Home ---------- */
.eyebrow { color: var(--text-dim); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin: 4px 0 12px; }
.hero-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px; }
.hero-empty { text-align: center; }
.hero-empty-art { color: var(--accent); margin-bottom: 10px; }
.hero-empty-art .ic { width: 40px; height: 40px; stroke-width: 1.4; }
.hero-empty h2 { font-size: 24px; margin: 6px 0 10px; }
.hero-empty p { color: var(--text-dim); font-size: 17px; line-height: 1.5; margin: 0 0 22px; }
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 14px; padding: 16px 20px; font-size: 18px; font-weight: 700; width: 100%; }
.muted-note { color: var(--text-dim); font-size: 15px; text-align: center; margin-top: 18px; }

/* ---------- Stop detail: Street View + amenities ---------- */
.sv-img { width: 100%; height: 170px; object-fit: cover; border-radius: 12px; margin: 4px 0 14px; display: block; background: var(--bg-raised); }
.sv-placeholder { width: 100%; min-height: 90px; display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--bg-raised); border: 1px dashed var(--line); border-radius: 12px; color: var(--text-dim); font-size: 13px; font-weight: 700; padding: 16px; margin: 4px 0 14px; }
.est-tag { font-size: 11px; font-weight: 800; color: var(--bg); background: var(--text-dim); border-radius: 5px; padding: 2px 6px; text-transform: uppercase; letter-spacing: .4px; }
.amenity-val { font-weight: 900; font-size: 14px; }
.av-yes { color: #3fcf6a; }
.av-likely { color: #6fa8c7; }
.av-no { color: #e0564a; }
.av-unk { color: var(--text-dim); }

/* ---------- Home: Schedule a Pickup CTA ---------- */
.schedule-cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--signal); color: #fff; border: none; border-radius: 14px; padding: 18px; font-size: 19px; font-weight: 900;
  font-family: inherit; margin-bottom: 22px; box-shadow: 0 4px 14px rgba(226,96,72,.35); }
.schedule-cta .ic { width: 26px; height: 26px; }

/* ---------- Pickup wizard ---------- */
.wizard { position: fixed; inset: 0; z-index: 1300; background: var(--bg); display: none; flex-direction: column; }
.wizard.is-open { display: flex; }
.wiz-head { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 16px 14px; border-bottom: 1px solid var(--line); }
.wiz-title { font-size: 19px; font-weight: 900; }
.wiz-x { background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 8px; display: flex; }
.wiz-x .ic { width: 22px; height: 22px; }
.wiz-body { flex: 1; overflow-y: auto; padding: 22px 18px; }
.wiz-intro p { font-size: 18px; line-height: 1.55; margin: 0 0 16px; }
.wiz-intro a, .wiz-note a, .wiz-done a { color: var(--accent); font-weight: 800; }
.wiz-field { display: block; margin-bottom: 18px; }
.wiz-label { display: block; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin-bottom: 8px; }
.wiz-field input { width: 100%; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 16px; font-size: 18px; font-family: inherit; }
.wiz-sub { font-size: 17px; font-weight: 800; margin: 0 0 14px; }
.wiz-line { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--bg-raised); border: 2px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 14px; font-size: 16px; font-weight: 700; font-family: inherit; margin-bottom: 8px; }
.wiz-line.is-sel { border-color: #fff; background: color-mix(in srgb, var(--accent) 22%, var(--bg-raised)); }
.wiz-line-sw { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.wiz-check { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.wiz-check input { width: 26px; height: 26px; accent-color: var(--accent); }
.wiz-summary { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; margin-bottom: 16px; }
.ws-row { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; }
.ws-row:first-child { border-top: none; }
.wiz-note { font-size: 15px; line-height: 1.5; color: var(--text-dim); }
.wiz-foot { display: flex; gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.wiz-foot .btn-primary { flex: 1; }
.btn-ghost { flex: none; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 14px; padding: 16px 22px; font-size: 17px; font-weight: 800; font-family: inherit; }
.wiz-done { text-align: center; padding-top: 30px; }
.wiz-check-art { width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%; background: var(--ok); display: flex; align-items: center; justify-content: center; }
.wiz-check-art .ic { width: 40px; height: 40px; stroke-width: 2.6; color: #fff; }
.wiz-done h2 { font-size: 23px; margin: 4px 0 10px; }
.wiz-done p { font-size: 17px; line-height: 1.5; color: var(--text-dim); }

/* ---------- Saved Routes (Home) ---------- */
/* Home sections: My Routes + Saved Trips */
/* Home sub-tabs (Saved / Learn More / Feedback / Blog / App Info) */
.home-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 18px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.home-tabs::-webkit-scrollbar { display: none; }
.ht-tab { flex: none; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 10px 18px; font-size: 15px; font-weight: 900; font-family: inherit; white-space: nowrap; }
.ht-tab.is-active { background: var(--accent); border-color: #fff; color: #fff; }
.home-panel { display: none; }
.home-panel.is-active { display: block; }

/* Info / link cards shared by Learn More, Blog, App Info */
.info-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px; margin-bottom: 12px; }
.ic-title { font-size: 21px; font-weight: 900; color: #fff; margin: 0 0 10px; }
.ic-sub { font-size: 17px; font-weight: 900; color: #fff; margin: 0 0 8px; }
.ic-version { font-size: 14px; font-weight: 800; color: var(--accent); margin: -4px 0 10px; }
.info-card p { font-size: 16px; line-height: 1.55; margin: 0 0 10px; }
.info-card p:last-child { margin-bottom: 0; }
.ic-fine { font-size: 13px; color: var(--text-dim); }
.link-card { display: flex; align-items: center; gap: 12px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 10px; text-decoration: none; color: var(--text); }
.lc-main { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lc-main b { font-size: 17px; font-weight: 900; color: #fff; }
.lc-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.lc-go { font-size: 26px; font-weight: 900; color: var(--accent); line-height: 1; }

/* Feedback form */
.fb-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.fb-half { flex: 1; min-width: 0; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 6px; font-size: 16px; font-weight: 800; font-family: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-half.is-active { background: var(--accent); border-color: #fff; color: #fff; }
.fb-help { font-size: 15px; line-height: 1.5; color: var(--text); margin: 0 0 12px; }
.fb-msg { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 14px; font-size: 16px; font-family: inherit; line-height: 1.5; resize: vertical; margin-bottom: 12px; }
.fb-alt { font-size: 14px; font-weight: 700; color: var(--text-dim); margin: 12px 0 0; }
.fb-alt a, .info-card a, .link-card a { color: var(--accent); }
/* Guided feedback wizard */
.fb-back { background: none; border: none; color: var(--accent); font-size: 16px; font-weight: 900; font-family: inherit; padding: 4px 0; margin-bottom: 4px; }
.fb-trail { font-size: 13px; font-weight: 800; color: var(--text-dim); margin: 0 0 12px; line-height: 1.4; }
.fb-cats { display: flex; flex-direction: column; gap: 10px; }
.fb-cat { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; background: var(--bg-raised); border: 1px solid var(--line); color: #fff; border-radius: 14px; padding: 16px 18px; font-size: 17px; font-weight: 900; font-family: inherit; }
.fb-prompt { font-size: 17px; font-weight: 900; color: #fff; margin: 0 0 12px; line-height: 1.4; }
.fb-prompt.fb-sub { font-size: 15px; margin-top: 16px; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.fb-chip { background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 10px 16px; font-size: 15px; font-weight: 800; font-family: inherit; }
.fb-chip.is-on { background: var(--accent); border-color: #fff; color: #fff; }
.fb-dtl { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.fb-dt { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; font-size: 16px; font-family: inherit; }
.fb-dt::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.fb-step { margin-bottom: 14px; }
/* Line / stop pickers in feedback: rectangular, left-justified, brand-colored
   to match the List section. */
.fb-line-list { display: flex; flex-direction: column; gap: 8px; }
.fb-line { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-family: inherit; }
.fb-line .fb-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; background: var(--c); }
.fb-line-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fb-line-name { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.25; }
.fb-line-sub { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.fb-line .fb-check { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; color: transparent; font-size: 15px; font-weight: 900; }
.fb-line.is-on { border-color: var(--c); background: color-mix(in srgb, var(--c) 20%, var(--bg-raised)); }
.fb-line.is-on .fb-line-name { color: #fff; }
.fb-line.is-on .fb-check { background: var(--c); border-color: var(--c); color: #fff; }

/* Avoid 1-2 word orphans on the last line of explanatory copy app-wide. */
.coach-title, .info-card p, .ic-fine, .lc-sub, .fb-help, .fb-prompt, .hs-help,
.placeholder-note, .connect-note, .dp-foot, .wiz-note { text-wrap: pretty; }
/* First-session coach overlay - explains the bottom nav on first open */
.coach { position: fixed; inset: 0; z-index: 1500; background: rgba(8,10,14,.84);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 16px calc(86px + env(safe-area-inset-bottom)); }
.coach-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 18px; padding: 20px 20px 16px; box-shadow: 0 14px 40px rgba(0,0,0,.6); }
.coach-title { font-size: 23px; font-weight: 900; color: #fff; margin: 0 0 6px; }
.coach-intro { font-size: 15px; line-height: 1.5; color: var(--text); margin: 0 0 14px; text-wrap: pretty; }
.coach-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.coach-list li { display: flex; align-items: baseline; gap: 10px; }
.coach-k { flex: none; min-width: 96px; font-size: 15px; font-weight: 900; color: var(--nav-active); }
.coach-v { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.4; text-wrap: pretty; }
.coach-go { width: 100%; }
.coach-arrow { display: flex; justify-content: center; margin-top: 8px; animation: coachBounce 1.1s ease-in-out infinite; }
.coach-arrow svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes coachBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
/* Spotlight the nav above the scrim while the coach is showing */
.bottom-nav.coach-lit { z-index: 1600; box-shadow: 0 0 0 2px var(--accent), 0 -8px 28px rgba(0,0,0,.7); }

.home-sec { margin-bottom: 24px; }
.home-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.hs-title { font-size: 19px; font-weight: 900; color: #fff; }
.hs-dot { width: 5px; height: 5px; border-radius: 50%; background: color-mix(in srgb, #fff 55%, var(--bg)); flex: none; }
.hs-adjust { background: none; border: 1px solid var(--line); color: #fff; border-radius: 9px; padding: 6px 14px; font-size: 14px; font-weight: 900; font-family: inherit; }
.hs-help { font-style: italic; font-size: 13px; font-weight: 600; color: color-mix(in srgb, #fff 70%, var(--bg)); margin: 0 0 12px; }
.home-empty { background: var(--bg-raised); border: 1px dashed var(--line); border-radius: 12px; padding: 16px; }
.home-empty p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: #fff; }
/* Solid, clearly-a-button add/save action (the app's green = add/save). */
.home-add { width: 100%; background: var(--ok); color: #fff; border: none; border-radius: 12px;
  padding: 15px 16px; font-size: 16px; font-weight: 900; font-family: inherit; margin-top: 2px;
  box-shadow: 0 3px 10px rgba(17,123,104,.4); }

/* Route card (a whole line): color-filled like the List view's route header,
   so the saved route keeps its color + typography cues. */
.route-card { display: flex; align-items: center; gap: 11px; background: var(--c); border: none;
  border-radius: 12px; padding: 15px 14px; margin-bottom: 9px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.rc-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.rc-go { font-size: 26px; font-weight: 900; color: #fff; flex: none; line-height: 1; }

/* Trip card (stop to stop on one line) */
.trip-card { display: flex; align-items: center; gap: 11px; background: var(--bg-raised); border: 1px solid var(--line);
  border-left: 6px solid var(--c); border-radius: 12px; padding: 12px 14px; margin-bottom: 9px; cursor: pointer; }
.tc-main { flex: 1; min-width: 0; }
.tc-route { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 900; color: #fff; }
.tc-sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.tc-od { font-size: 16px; font-weight: 800; color: #fff; margin-top: 4px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tc-arrow { color: var(--c); font-weight: 900; }

/* Edit-mode tools (reorder + remove) */
.edit-tools { display: flex; gap: 6px; flex: none; }
.et-btn { width: 38px; height: 38px; border-radius: 9px; background: #0b0d11; border: 1px solid var(--line); color: #fff; font-size: 15px; font-weight: 900; font-family: inherit; display: flex; align-items: center; justify-content: center; }
.et-btn:disabled { opacity: .35; }
.et-del { border-color: var(--signal); color: var(--signal); }

/* Route picker rows */
.rp-row { display: flex; align-items: center; gap: 11px; width: 100%; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; font-family: inherit; }
.rp-tag { margin-left: auto; font-size: 14px; font-weight: 900; color: var(--signal); flex: none; }
.rp-row.is-have { opacity: .55; } .rp-row.is-have .rp-tag { color: #fff; }
.btn-save.is-saved { background: var(--text-dim); }

/* ---------- Trip Planner ---------- */
.planner .tp-fieldrow { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.tp-flabel { width: 96px; flex: none; padding-right: 6px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }
.tp-field { flex: 1; text-align: left; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text-dim); border-radius: 11px; padding: 14px 14px; font-size: 16px; font-weight: 700; font-family: inherit; }
.tp-field.is-set { color: var(--text); border-color: var(--accent); }
.tp-remove { flex: none; background: none; border: none; color: var(--text-dim); font-size: 22px; line-height: 1; padding: 0 4px; }
.tp-add { width: 100%; background: none; border: 1px dashed var(--line); color: var(--text); border-radius: 11px; padding: 12px; font-size: 14px; font-weight: 800; margin-bottom: 16px; }
.tp-result { margin-top: 6px; }
.tp-leg { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.tp-leg-head { background: var(--c); color: #fff; font-size: 16px; font-weight: 800; padding: 10px 12px; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tp-leg-body { padding: 11px 12px; font-size: 15px; line-height: 1.5; }
.tp-transfer { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 10px 4px 10px 8px; font-size: 14px; font-weight: 800; color: var(--text-dim); }
.tp-tdot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--text-dim); margin-top: 3px; flex: none; }
.tp-transfer .node-conns { flex-basis: 100%; margin-top: 0; }
/* Wait stage between legs: hollow square marker so it reads as "stand by",
   warm sand text (never grey-on-grey). */
.tp-wait { padding-top: 0; }
.tp-wait .tp-tdot { border-radius: 3px; }
/* Walk legs (to/from a typed address) + the "closest you can get" note. */
.tp-walk .tp-leg-head { background: #5a6473; }
.tp-walknote { background: var(--bg-raised); border: 1px solid var(--line); border-left: 5px solid #5a6473; border-radius: 12px; padding: 11px 13px; font-size: 14px; font-weight: 700; line-height: 1.5; margin-bottom: 8px; color: var(--text); }

/* When-controls: Depart at / Arrive by + date + time. */
.tp-when { margin-bottom: 16px; }
.tp-whenmode { display: flex; gap: 6px; margin-bottom: 8px; }
.twm { flex: 1; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 900; font-family: inherit; }
.twm.is-active { background: var(--signal); border-color: var(--signal); color: #fff; }
.tp-whenrow { display: flex; gap: 8px; }
.tp-dt { flex: 1; min-width: 0; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; font-size: 16px; font-weight: 700; font-family: inherit; }
/* Make the native calendar/clock icons white (they default to black = invisible
   on the dark shell) and as large as the box comfortably allows. */
.tp-dt::-webkit-calendar-picker-indicator {
  filter: invert(1); opacity: 1; cursor: pointer;
  width: 26px; height: 26px; transform: scale(1.25); margin-left: 4px;
}

/* Timed itinerary: summary band + per-leg times. */
.tp-summary { background: var(--bg-raised); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.tp-sum-time { font-size: 22px; font-weight: 900; color: #fff; }
.tp-sum-meta { font-size: 13px; font-weight: 700; color: color-mix(in srgb, #fff 72%, var(--bg)); margin-top: 3px; }
.tp-leg-time { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px 0; }
.tpt-board { font-size: 18px; font-weight: 900; color: #fff; }
.tpt-arr { font-size: 13px; font-weight: 800; color: var(--text-dim); }  /* warm sand, never grey-on-grey */

/* Flexible-time popup (rendered into the detail sheet). */
.flex-pop { padding: 4px 2px 8px; }
.flex-ico { width: 42px; height: 42px; border-radius: 50%; background: var(--signal); color: #fff; font-size: 26px; font-weight: 900; display: flex; align-items: center; justify-content: center; margin: 2px 0 12px; }
.flex-msg { font-size: 17px; font-weight: 700; line-height: 1.45; color: #fff; margin: 0 0 18px; }
.flex-actions { display: flex; flex-direction: column; gap: 9px; }
.flex-actions .btn-primary { margin: 0; }
.flex-actions .btn-ghost { width: 100%; }

/* ---------- Stop picker ---------- */
.picker-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 1100; }
.picker-backdrop.is-open { opacity: 1; pointer-events: auto; }
.picker { position: fixed; left: 0; right: 0; bottom: 0; top: 20vh; z-index: 1200; background: var(--bg); border-radius: 18px 18px 0 0; border-top: 1px solid var(--line);
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
/* Mobile: dynamic viewport units track the URL bar / keyboard, so the sheet
   never rides up past the top of the visible screen. */
@supports (height: 1dvh) {
  .picker { top: max(20dvh, env(safe-area-inset-top)); }
}
.picker.is-open { transform: none; }
.picker-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.picker-head input { flex: 1; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 11px; padding: 13px 14px; font-size: 16px; font-family: inherit; }
.picker-close { background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 11px; padding: 0 12px; display: flex; align-items: center; }
.picker-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.pk-sw { width: 16px; height: 16px; border-radius: 5px; flex: none; }
.pk-name { font-size: 16px; font-weight: 700; }
.pk-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.pk-pin { width: 16px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.pk-pin .ic { width: 18px; height: 18px; }
.picker-addr .pk-name { color: var(--accent); }
.picker-place .pk-sub { white-space: normal; }
.picker-loading { padding: 16px 14px; font-size: 14px; font-weight: 700; color: var(--text-dim); border-top: 1px solid var(--line); }

/* ---------- Lens tabs ---------- */
/* Scrollable so 5 tabs stay big and readable; swipe horizontally. */
.lens-tabs { display: flex; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.lens-tabs::-webkit-scrollbar { display: none; }
/* All tabs share the normal text color; the selected one is marked by the accent
   fill PLUS a white ring floating a few px off the pill ("you've chosen this"). */
.lens-tab { position: relative; flex: none; white-space: nowrap; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 16px; font-size: 16px; font-weight: 900; }
.lens-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lens-tab.is-active::after { content: ''; position: absolute; inset: -5px; border: 2px solid #fff; border-radius: 14px; pointer-events: none; }

.lens-panel { display: none; flex: 1; min-height: 0; position: relative; }
.lens-panel.is-active { display: flex; flex-direction: column; }

/* ---------- Map + side panel ---------- */
.map-split { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
.leaflet-container { background: var(--bg) !important; font-family: inherit; }

/* "Near me" crosshair on the map (replaces the old Near Me tab) */
.map-locate {
  position: absolute; z-index: 500; right: 12px; bottom: 12px;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--bg-raised); border: 1px solid var(--line); color: var(--accent);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.map-locate .ic { width: 26px; height: 26px; }
.map-locate.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.user-dot { width: 18px; height: 18px; border-radius: 50%; background: #2a8cff; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(42,140,255,.3); }

/* Conventional zoom in/out control (top-left, under the header) - large, dark,
   high-contrast for elderly riders. Overrides Leaflet's small white default. */
/* Lift the dark basemap a bit (streets/landmarks read better for older riders)
   and make the overlaid street-name labels brighter and crisper. */
.basemap-tiles { filter: brightness(1.45) contrast(0.92) saturate(1.05); }
.basemap-labels { filter: brightness(1.7) contrast(1.1); }
.leaflet-control-zoom.leaflet-bar { margin: 12px 0 0 12px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.45); overflow: hidden; }
.leaflet-control-zoom a {
  width: 46px; height: 46px; line-height: 46px; font-size: 28px; font-weight: 700;
  background: var(--bg-raised); color: var(--text); border: none;
}
.leaflet-control-zoom a:hover { background: var(--line); color: #fff; }
.leaflet-control-zoom a.leaflet-disabled { background: var(--bg-raised); color: var(--text-dim); opacity: .5; }
.leaflet-control-zoom-in { border-bottom: 1px solid var(--line) !important; }

/* Nearest-stops list overlay (map <-> list toggle) */
.near-list {
  position: absolute; z-index: 520; left: 10px; right: 10px; bottom: 74px;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
.near-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.near-title { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; }
.near-close { background: none; border: none; color: var(--text); display: flex; padding: 4px; }
.near-close .ic { width: 20px; height: 20px; }
.near-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.near-row:first-child { border-top: none; }
.near-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.near-name { font-size: 15px; font-weight: 700; }
.near-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.near-dist { margin-left: auto; font-size: 13px; font-weight: 900; color: var(--accent); white-space: nowrap; }

/* Bottom-left overlay row: the connection filter box + the "tips" hint, side by
   side. Wraps and stays clear of the locate button (bottom-right). */
.map-overlay-bl {
  position: absolute; z-index: 500; left: 10px; bottom: 12px; right: 70px;
  display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 9px; pointer-events: none;
}
.map-overlay-bl > * { pointer-events: auto; }
.map-overlay-bl .map-filters { flex: none; }

/* Connection filter box: a compact rounded box with a red header fill and a
   black body holding a 2x2 grid of choices. */
.map-filters {
  background: #0b0d11; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
.mf-head {
  background: var(--signal); color: #fff; margin: 0; border: none; width: 100%;
  font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 12px; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-family: inherit;
}
.mf-toggle { font-size: 18px; line-height: 1; flex: none; }
.map-filters.is-min .mf-chips { display: none; }
.mf-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; }
.mf-chip {
  display: inline-flex; align-items: center; gap: 7px; width: 100%;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; font-weight: 900;
}
.mf-sw { width: 13px; height: 13px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }

/* "Tips" hint bubble sitting to the right of the connections box. */
.map-hint {
  position: relative; flex: 1 1 auto; min-width: 0; background: color-mix(in srgb, var(--signal) 30%, #0b0d11);
  border: 1px solid var(--signal); border-radius: 14px; padding: 11px 32px 11px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
.map-hint.is-min { flex: 0 0 auto; }
.hint-body { color: #fff; font-size: 13px; font-weight: 800; line-height: 1.35; }
.hint-min {
  position: absolute; top: 6px; right: 7px; width: 24px; height: 24px; border-radius: 7px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); color: #fff;
  font-size: 17px; font-weight: 900; line-height: 1; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: inherit;
}
.hint-tag { display: none; color: #fff; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; }
.map-hint.is-min { padding: 9px 36px 9px 13px; }
.map-hint.is-min .hint-body { display: none; }
.map-hint.is-min .hint-tag { display: inline; }
/* On phones there's no room for side-by-side: stack the hint ABOVE the box,
   each sized to its content (no skinny squished column). */
@media (max-width: 600px) {
  .map-overlay-bl { flex-direction: column; align-items: flex-start; gap: 8px; right: 10px; }
  .map-hint { order: -1; flex: 0 0 auto; max-width: min(86vw, 300px); }
}
.mf-chip.is-active { border-color: #fff; background: color-mix(in srgb, var(--accent) 26%, #0b0d11); }
/* Connection-point pins (diamonds, distinct from round route dots) */
.conn-pin { display: block; width: 14px; height: 14px; transform: rotate(45deg); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
/* Rail / light-rail station markers: off-white crosses on the trackage */
.rail-x { display: block; width: 14px; height: 14px; --xc: #ece6da; background:
  linear-gradient(var(--xc), var(--xc)) center/14px 3px no-repeat,
  linear-gradient(var(--xc), var(--xc)) center/3px 14px no-repeat;
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 1px 1px rgba(0,0,0,.7)); }

/* The panel overlays the map's right edge, dropping down from the lens tabs.
   COLLAPSED (default): just a signal-colored "Select Route to Begin" chip.
   OPEN (after a line is tapped): full-height list of stops. */
.map-panel {
  position: absolute; top: 10px; right: 10px; z-index: 500;
  display: flex; flex-direction: column; min-height: 0;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,.38);
}
/* Nothing shows top-right until a line is tapped; the "tap a route" guidance now
   lives in the hint bubble by the connections box. */
.map-panel:not(.is-open) {
  display: none;
}
.map-panel.is-open {
  top: 0; right: 0; bottom: 0; border-radius: 0;
  width: clamp(250px, 44%, 380px);
  background: var(--bg-panel); border-left: 1px solid var(--line);
  box-shadow: -8px 0 28px rgba(0,0,0,.3);
  overflow: visible;   /* let the floating X spill onto the map */
}

.map-panel-head { padding: 16px; border-bottom: 1px solid transparent; }
/* Open header takes the selected line's color (--rc). White title with a soft
   shadow keeps it legible even on lighter line colors. */
/* Open header: the line color fills the whole block, framed by a white border,
   like a classic subway line header. */
.map-panel.is-open .map-panel-head {
  background: var(--rc, var(--accent)); padding: 16px 14px;
  box-shadow: inset 0 0 0 3px #fff;
}
.map-panel.is-open .map-panel-head h2 {
  color: #fff; text-align: center;
  white-space: nowrap; overflow: hidden;               /* one line, always */
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.map-panel-head h2 { font-size: 21px; font-weight: 900; margin: 0; }

/* X floats just off the panel's left edge, onto the map, with a faded red glow */
.panel-close {
  position: absolute; top: 12px; left: -56px; z-index: 600;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(224,72,72,.22); border: 2px solid #fff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.panel-close .ic { width: 24px; height: 24px; stroke-width: 2.4; }

/* Channel-style direction switch: two rounded halves. The active one is a much
   DARKER derivative of the line color, framed by a white band (its own border,
   so the fill stays contained). No checkmark; shade + band = clearly selected. */
.dir-switch { display: flex; gap: 8px; padding: 8px 10px; margin-top: 8px; border-bottom: 1px solid var(--line); background: var(--bg-panel); }
.dir-half { flex: 1; min-width: 0; border: 2px solid transparent; border-radius: 10px; background: color-mix(in srgb, var(--rc, var(--accent)) 20%, var(--bg-raised)); color: var(--text); padding: 13px 8px; font-size: 14px; font-weight: 900; cursor: pointer; overflow: hidden; }
.dir-half.is-active { background: color-mix(in srgb, var(--rc, var(--accent)) 24%, #000); color: #fff; border-color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* Collapsed chip = the app's "look here first" signal */
.map-panel:not(.is-open) .map-panel-head {
  background: var(--signal); color: #fff;
  display: flex; align-items: center; gap: 8px;
  animation: signalPulse 2s ease-in-out infinite;
}
.map-panel:not(.is-open) h2 { font-size: 17px; font-weight: 800; }
@keyframes signalPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226,96,72,.55); }
  50% { box-shadow: 0 0 0 8px rgba(226,96,72,0); }
}
/* Hide the body until a line is chosen */
.map-panel:not(.is-open) .dir-switch,
.map-panel:not(.is-open) .line-stops { display: none; }

.line-stops { list-style: none; margin: 0; padding: 16px 0 24px; overflow-y: auto; flex: 1; }
.panel-empty { color: var(--text-dim); font-size: 16px; line-height: 1.5; padding: 18px 16px; }

/* Trip-save guidance banner + the chosen first stop's animated dotted ring */
.trip-banner { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 12px 6px; padding: 13px 14px; border-radius: 12px; font-size: 15px; line-height: 1.4; font-weight: 700;
  color: #fff; background: color-mix(in srgb, var(--signal) 30%, var(--bg-panel)); border: 1px solid var(--signal); }
.trip-banner.is-flash { background: color-mix(in srgb, var(--ok) 26%, var(--bg-panel)); border-color: var(--ok); }
.trip-banner span { flex: 1; min-width: 140px; }
.trip-cancel { flex: none; background: #fff; color: #14181f; border: none; border-radius: 9px; padding: 9px 14px; font-size: 14px; font-weight: 900; font-family: inherit; }
.stop-node.is-trip-pick .node-card { outline: 3px dashed var(--signal); outline-offset: 2px; border-radius: 12px; animation: tripPulse 1.1s ease-in-out infinite; }
@keyframes tripPulse { 0%,100% { outline-color: var(--signal); } 50% { outline-color: rgba(226,96,72,.25); } }

/* Each stop = a timeline node (colored rail + dot) plus an organized card. */
.stop-node { display: flex; gap: 12px; padding: 0 14px; cursor: pointer; }
.node-marker { position: relative; width: 18px; flex: none; }
.node-marker::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 4px; background: var(--c); }
.stop-node:first-child .node-marker::before { top: 20px; }
.stop-node:last-child .node-marker::before { bottom: calc(100% - 20px); }
.node-dot { position: absolute; left: 0; top: 13px; width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 3px solid var(--bg-panel); box-sizing: border-box; z-index: 1; }
.stop-node.is-end .node-dot { width: 20px; height: 20px; left: -1px; top: 12px; box-shadow: 0 0 0 2px var(--c); }
/* Request stops: hollow white dot, faint red card, italic note */
.stop-node.is-request .node-dot { background: #fff; }

.node-card { flex: 1; min-width: 0; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.stop-node.is-request .node-card { border-color: rgba(226,96,72,.6); }
.stop-node.is-request .node-info { background: color-mix(in srgb, #e26048 9%, var(--bg-raised)); }
/* Header band carries the stop name; tinted dark (matches the active direction
   pill), softer than pure black. Context follows below. */
.node-head { background: color-mix(in srgb, var(--c) 22%, #000); padding: 9px 12px; }
.node-name { font-size: 16px; font-weight: 800; line-height: 1.25; color: #fff; white-space: nowrap; overflow: hidden; }
/* White ORIGIN / DESTINATION band: a second header (origin) or footer (dest) */
.terminus-band { background: #fff; text-align: center; font-size: 16px; font-weight: 900; letter-spacing: .6px; padding: 7px 12px; }
.node-info { padding: 10px 12px; }
.node-city { font-size: 12px; font-weight: 800; color: var(--text-dim); }
.nc-city { text-transform: uppercase; letter-spacing: .5px; }
.node-ctx { font-style: italic; font-weight: 600; color: var(--text-dim); }
.node-request { font-size: 13px; font-style: italic; color: #ec9c8f; margin-top: 4px; }
.track-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

/* Connection chips: colored by transit mode; shuttle lines get the shuttle icon */
.node-conns { display: flex; flex-direction: column; gap: 8px; margin-top: 0; }
/* Each mode group: a kind label (Bus / Rail / Shuttles) then its chips. */
.conn-group { display: flex; gap: 9px; align-items: baseline; }
.conn-kind { flex: none; min-width: 54px; font-size: 11px; font-weight: 900; color: #fff;
  text-transform: uppercase; letter-spacing: .5px; padding-top: 3px; }
.conn-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: #fff;
  background: color-mix(in srgb, var(--cc) 28%, #0b0d11); border: 1px solid var(--cc); border-radius: 7px; padding: 4px 8px; }
.conn b { font-weight: 900; opacity: .95; }
.conn-shuttle { background: #0b0d11; color: #fff; }   /* dark so the colored shuttle icon pops */
.shuttle-ico { display: inline-block; width: 16px; height: 16px; background-color: var(--cc);
  -webkit-mask: url(shuttle_icon.png) center/contain no-repeat; mask: url(shuttle_icon.png) center/contain no-repeat; }

/* This stop's own departure times: a clear left-to-right row of time pills.
   Next upcoming departure today is flagged with the signal color. */
.dep-row { margin-top: 10px; }
.dep-label, .conn-label { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 9px; color: color-mix(in srgb, var(--c) 45%, #fff); }
.dep-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.dep-pills::-webkit-scrollbar { height: 0; }
.dep-pill { flex: none; font-size: 13px; font-weight: 900; color: #fff; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 32%, #0b0d11); border: 1px solid color-mix(in srgb, var(--c) 60%, #0b0d11);
  border-radius: 8px; padding: 5px 9px; }
.dep-pill.is-next { background: var(--signal); border-color: var(--signal); box-shadow: 0 2px 8px rgba(226,96,72,.4); }

/* "Connections" labelled block around the chips */
.conn-block { margin-top: 11px; }
.conn-block .node-conns { margin-top: 0; }
.conn-tappable { cursor: pointer; }
/* "PATCO times" call-to-action: a squared box so it stands out on the dark tile */
.cr-cta { display: inline-block; margin-top: 11px; font-size: 13px; font-weight: 900; color: #fff;
  background: color-mix(in srgb, var(--c) 30%, #0b0d11); border: 1.5px solid var(--c); border-radius: 0; padding: 8px 13px; }
/* Selected-service results group: blue left line + indent ties it to the choice above */
.connect-group { border-left: 3px solid var(--nav-active); padding-left: 14px; margin-top: 16px; }
.cg-head { font-size: 14px; font-weight: 900; color: var(--nav-active); margin: 0 0 12px; line-height: 1.3; }
/* Onward-by-PATCO cross-reference card in the trip planner */
.onward-card { background: var(--bg-raised); border: 1px solid var(--c); border-left: 5px solid var(--c); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.onward-head { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: color-mix(in srgb, var(--c) 45%, #fff); margin-bottom: 8px; }
.onward-row { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; }
.onward-dir { flex: 1; min-width: 0; font-size: 14px; font-weight: 800; color: #fff; }
.onward-time { font-size: 16px; font-weight: 900; color: #fff; }
.onward-gap { font-size: 12px; font-weight: 800; color: color-mix(in srgb, #fff 72%, var(--bg)); }
.conn-go { width: 13px; height: 13px; margin-left: 1px; flex: none;
  -webkit-mask: none; background: none; position: relative; }
.conn-go::before { content: ''; position: absolute; top: 3px; left: 2px; width: 5px; height: 5px;
  border-top: 2px solid #fff; border-right: 2px solid #fff; transform: rotate(45deg); opacity: .85; }

/* Connecting-route departures popup (rendered into the detail sheet) */
.dp-context { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; margin-bottom: 10px; background: var(--bg-raised); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 12px; }
.dpc-kicker { font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--text-dim); }
.dpc-from { font-size: 17px; font-weight: 900; color: #fff; line-height: 1.2; }
.dp-head { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--c) 30%, #0b0d11); border: 1px solid var(--c); }
.dp-line { font-size: 19px; font-weight: 900; color: #fff; line-height: 1.15; }
.dp-stop { font-size: 13px; font-weight: 700; color: #fff; opacity: .9; margin-top: 3px; }
.dp-days { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.dp-days::-webkit-scrollbar { height: 0; }
.dp-day { flex: none; background: var(--bg-raised); border: 1px solid var(--line); color: #fff;
  border-radius: 10px; padding: 9px 13px; font-size: 14px; font-weight: 800; font-family: inherit; white-space: nowrap; }
.dp-day.is-active { background: var(--signal); border-color: var(--signal); }
.dp-body { max-height: 52vh; overflow-y: auto; }
/* Each direction is a tile: a WHITE header (line-colored title + arrow), then
   AM and PM section headers over their time grids. */
.dp-dir { margin-bottom: 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.dp-dir-h { display: flex; align-items: center; gap: 8px; background: #fff; padding: 11px 13px; }
/* Darken the line color on the white header so light line colors stay legible. */
.dp-arrow { font-size: 20px; font-weight: 900; color: color-mix(in srgb, var(--c) 68%, #000); line-height: 1; }
.dp-dir-name { font-size: 16px; font-weight: 900; color: color-mix(in srgb, var(--c) 68%, #000); }
.dp-grid { background: rgba(255,255,255,.03); }
/* AM / PM section headers: full-width filled bands, cool for morning, warm for
   afternoon, so the split is unmistakable. */
.dp-per { display: block; font-size: 15px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; padding: 8px 13px; color: #0b0d11; }
.dp-per.am { background: var(--nav-active); }
.dp-per.pm { background: var(--text-dim); }
.dp-times { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 13px 13px; }
.dp-time { flex: 0 0 auto; min-width: 78px; text-align: center; font-size: 15px; font-weight: 900; color: #fff;
  background: color-mix(in srgb, var(--c) 26%, #0b0d11); border: 1px solid color-mix(in srgb, var(--c) 55%, #0b0d11);
  border-radius: 9px; padding: 9px 8px; }
.dp-time.is-past { opacity: .4; text-decoration: line-through; }
.dp-time.is-next { background: var(--signal); border-color: var(--signal); box-shadow: 0 2px 10px rgba(226,96,72,.45); }
.dp-empty { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.5; }
/* NJT bus line chooser (one stop serves several routes) */
.njt-pick { display: flex; flex-direction: column; gap: 8px; }
.njt-pick-row { display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: var(--bg-raised); border: 1px solid var(--line); color: #fff; border-radius: 11px;
  padding: 15px 14px; font-size: 17px; font-weight: 900; font-family: inherit; }
.njt-pick-row .rc-go { font-size: 22px; color: color-mix(in srgb, #fff 55%, var(--bg)); }
.dp-foot { color: color-mix(in srgb, #fff 70%, var(--bg)); font-size: 12px; font-weight: 600; margin-top: 12px; line-height: 1.4; }

/* Stop detail docked over the map area (left of the panel), so the stop list
   stays visible and you can hop stop to stop without losing the panel. */
.stop-dock {
  position: absolute; top: 0; bottom: 0; left: 0; right: clamp(250px, 44%, 380px); z-index: 540;
  background: var(--bg-panel); border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.stop-dock.is-open { transform: none; }
.dock-close {
  display: flex; align-items: center; gap: 6px; align-self: flex-end; margin: 12px;
  background: var(--bg-raised); border: 1px solid var(--line); color: var(--text);
  border-radius: 20px; padding: 8px 14px 8px 10px; font-size: 14px; font-weight: 900;
}
.dock-close .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.dock-body { flex: 1; overflow-y: auto; padding: 0 18px 24px; }
.dock-body h2 { font-size: 21px; margin: 4px 0 2px; }

/* ---------- Search / lists ---------- */
.search-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 15px 16px; font-size: 17px; margin: 14px; width: calc(100% - 28px);
}
.result-list, .browse-list { list-style: none; margin: 0; padding: 0 14px 14px; overflow-y: auto; }
.result-item { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; }
.result-item { padding: 15px 16px; }
.result-item .r-name { font-size: 17px; font-weight: 600; }
.result-item .r-sub { font-size: 15px; color: var(--text-dim); margin-top: 3px; }
.placeholder-note { color: var(--text-dim); font-size: 16px; padding: 18px; line-height: 1.55; }

/* Browse: county > line accordion. White header fill, near-black text for contrast. */
.browse-county { margin-bottom: 4px; }
.browse-county > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; color: #16191e; border-radius: 10px; margin: 8px 0;
  font-size: 19px; font-weight: 800; padding: 16px 14px; cursor: pointer; list-style: none;
}
.browse-county > summary::-webkit-details-marker { display: none; }
.browse-county[open] > summary { color: #16191e; }
.county-meta { display: flex; align-items: center; gap: 8px; color: #16191e; font-size: 14px; font-weight: 700; flex: none; }
.county-count { white-space: nowrap; }
.caret { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.browse-county[open] > summary .caret { transform: rotate(180deg); }

/* List view: mode switcher (by Route / by County) */
#lens-browse { flex-direction: column; }
.browse-switch { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.bsw-half { flex: 1; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px 8px; font-size: 15px; font-weight: 900; }
.bsw-half.is-active { background: var(--accent); border-color: #fff; color: #fff; }
.browse-list { flex: 1; }

/* Each line is expandable; its stops nest underneath. */
.line-group { border-top: 1px solid var(--line); }
/* "By route" view: the header is filled with the route color, lettering within. */
.line-group.by-route { border-top: none; margin: 8px 14px 0; border-radius: 10px; overflow: hidden; }
.line-group.by-route > summary.route-fill { background: var(--rc); padding: 14px; }
.line-group.by-route .browse-line-name { color: #fff; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.line-group.by-route .line-swatch { display: none; }
.line-group.by-route .caret { color: #fff; }
.line-group.by-route .lg-map { background: rgba(0,0,0,.28); }
.line-group.by-route .line-stops { background: var(--bg); }
.line-group > summary.browse-line { list-style: none; }
.line-group > summary::-webkit-details-marker { display: none; }
.browse-line {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px 10px 16px; background: none; border: none; text-align: left; cursor: pointer;
}
.browse-line-name { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; flex: 1; min-width: 0; }
/* Swatch framed: larger than the text it precedes, prominent per line */
.line-swatch { width: 30px; height: 30px; border-radius: 7px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.lg-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.lg-map { font-size: 12px; font-weight: 900; color: #fff; background: var(--accent); border-radius: 6px; padding: 5px 10px; }
/* Route-picker "+ Add" control: white with dark text so it stays legible on
   every route color (green-on-green was hard to read). */
.lg-add { font-size: 13px; font-weight: 900; color: #14181f; background: #fff; border-radius: 7px; padding: 7px 13px; box-shadow: 0 1px 5px rgba(0,0,0,.4); white-space: nowrap; }
.lg-add.is-have { background: #0b0d11; color: #fff; }
/* Route-picker title */
.rp-title { font-size: 18px; font-weight: 900; color: #fff; line-height: 1.35; text-align: left; margin: 2px 2px 14px; padding-right: 36px; }
.line-group[open] > summary .caret { transform: rotate(180deg); }

.lg-stops { list-style: none; margin: 0; padding: 0 0 8px; }
.lg-stop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 14px 9px 42px; border-top: 1px solid var(--line); cursor: pointer; }
.lg-stop-name { font-size: 15px; font-weight: 600; color: var(--text); }
.lg-stop-city { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }

/* ---------- Make a Connection ---------- */
.connect-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 24px; }
.connect-prompt { font-size: 20px; font-weight: 700; margin: 4px 4px 14px; color: var(--text); }
.connect-services { display: flex; flex-direction: column; gap: 10px; }
.connect-service {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer;
}
.connect-service.is-active { border-color: var(--nav-active); box-shadow: 0 0 0 1.5px var(--nav-active); background: color-mix(in srgb, var(--nav-active) 14%, var(--bg-raised)); }
.connect-service .cs-mode { font-size: 18px; font-weight: 700; color: var(--text); }
.connect-service .cs-sub { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-top: 2px; }
.connect-service .cs-badge { flex: none; width: 14px; height: 14px; border-radius: 4px; }
.connect-results { margin-top: 18px; }
.connect-note {
  font-size: 15px; line-height: 1.5; color: var(--text); background: color-mix(in srgb, var(--signal) 16%, var(--bg-raised));
  border: 1px solid color-mix(in srgb, var(--signal) 45%, var(--line)); border-radius: 12px; padding: 13px 14px; margin-bottom: 14px;
}
.connect-results .eyebrow { color: var(--text-dim); }
/* Connection result tiles: same header/body aesthetic as the route stop tiles */
/* Collapsible per-line grouping of connection results */
.cg-line { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg-raised); }
.cg-line > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.cg-line > summary::-webkit-details-marker { display: none; }
.cg-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.cg-line-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 800; color: #fff; }
.cg-count { font-size: 13px; font-weight: 900; color: var(--text-dim); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.cg-caret { font-size: 20px; font-weight: 900; color: var(--text-dim); transition: transform .18s; }
.cg-line[open] .cg-caret { transform: rotate(90deg); }
.cg-line-body { padding: 0 10px 10px; }
.cg-line-body .conn-result { margin-bottom: 8px; }
.cg-line-body .conn-result:last-child { margin-bottom: 0; }
.conn-result { display: block; width: 100%; text-align: left; padding: 0; margin-bottom: 8px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cr-head { background: color-mix(in srgb, var(--c) 22%, #000); color: #fff; font-size: 16px; font-weight: 800; padding: 9px 12px; }
.cr-body { padding: 10px 12px; }
.cr-route { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text); }
.cr-swatch { width: 13px; height: 13px; border-radius: 4px; flex: none; }
.cr-sub { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-top: 4px; }

/* ---------- Detail sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 900; }
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: var(--bg-sheet); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  /* Height follows content: a short stop card opens just tall enough; a long one
     grows up to just under the top bar (then the content scrolls inside). */
  max-height: calc(100dvh - 56px); display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet-grab { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); border: none; margin: 10px auto 4px; }
/* Obvious labelled X close (elderly riders may not know tap-off-to-dismiss) */
.sheet-x { position: absolute; top: 10px; right: 14px; display: flex; align-items: center; gap: 5px; background: color-mix(in srgb, #e26048 28%, var(--bg-raised)); border: 1px solid #e26048; color: #fff; border-radius: 20px; padding: 7px 13px 7px 9px; font-size: 14px; font-weight: 900; }
.sheet-x .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.sheet-content { overflow-y: auto; padding: 8px 20px 24px; }
.sheet-content h2 { font-size: 22px; margin: 6px 0 2px; }
.sheet-content .s-cross { color: var(--text-dim); font-size: 16px; margin: 0 0 14px; }
.s-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.s-pill { font-size: 14px; padding: 6px 12px; border-radius: 20px; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text-dim); }
.s-row { display: flex; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); font-size: 16px; }
.s-row .k { color: var(--text-dim); width: 120px; flex: none; }
.dir-toggle { display: flex; gap: 6px; margin: 8px 0 14px; }
.dir-toggle button { flex: 1; background: var(--bg-raised); border: 1px solid var(--line); color: var(--text); padding: 12px; border-radius: 9px; font-size: 15px; font-weight: 600; }
.dir-toggle button.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-save { background: var(--ok); color: #fff; border: none; border-radius: 14px; padding: 15px 10px; font-size: 15px; font-weight: 800; line-height: 1.2; width: 100%; margin-top: 18px; font-family: inherit; white-space: nowrap; overflow: hidden; }

/* Stop detail: the top of the card IS the line. Line-color fill, white frame,
   same bold name styling as the line headers. */
.sd-top { background: var(--c); border: 3px solid #fff; border-radius: 16px; padding: 14px; margin: 4px 0 18px; }
.sd-line { font-size: 23px; font-weight: 900; color: #fff; line-height: 1.12; letter-spacing: .2px; margin-bottom: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
/* Each section is a dark box for consistent stop-to-stop structure: a small
   line-tinted label header, then the value. */
.sd-box { background: #0e1116; border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; }
.sd-box:last-child { margin-bottom: 0; }
.sd-k { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px;
  color: color-mix(in srgb, var(--c) 42%, #fff); margin-bottom: 5px; }
.sd-val { font-size: 16px; font-weight: 800; color: #fff; line-height: 1.35; }
.sd-name { overflow: hidden; text-overflow: ellipsis; }
.sd-note { font-size: 13px; font-style: italic; color: #ec9c8f; margin-top: 5px; }
.sd-photo { margin-bottom: 10px; }
.sd-photo .sv-img, .sd-photo .sv-placeholder { margin: 0; }
.sd-photo .sv-placeholder { color: #fff; border-color: rgba(255,255,255,.55); background: rgba(0,0,0,.18); }
.sd-box .node-conns { margin-top: 0; }
.eyebrow-spaced { margin-top: 4px; }
.est-tag { margin-left: 9px; }
.s-cc { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cc-book { display: inline-flex; align-items: center; gap: 7px; background: var(--signal); color: #fff; border: none; border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 900; font-family: inherit; }
.cc-book .ic { width: 18px; height: 18px; flex: none; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h);
  display: flex; background: var(--bg-raised); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 800;
}
.nav-item { flex: 1; background: none; border: none; color: var(--text-dim); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 14px; font-weight: 800; padding-top: 6px; }
.nav-item .ic { width: 30px; height: 30px; }
.nav-item.is-active { color: var(--nav-active); }

/* ---------- Mobile pass ---------- */
.cs-mode { flex: 1; min-width: 0; }
.bsw-half { line-height: 1.15; }

@media (max-width: 600px) {
  .appbar .brand { display: none; }          /* give the search bar room */
  .nav-item { font-size: 11px; gap: 3px; }
  .nav-item .ic { width: 27px; height: 27px; }
  .nav-item span:last-child { white-space: nowrap; }

  /* Map line panel fills the screen; X sits top-right, clear of the title */
  .map-panel.is-open { width: 100%; }
  .map-panel.is-open .map-panel-head { padding-left: 58px; padding-right: 58px; }
  .stop-dock { right: 0; }
  .panel-close { left: auto; right: 12px; top: 12px; background: rgba(20,25,33,.92); }

  /* Text that was overflowing pills/boxes */
  .bsw-half { font-size: 13px; padding: 12px 6px; }
  .cs-mode { font-size: 15px; line-height: 1.25; }
  .connect-service { gap: 10px; }
  .mf-chip { font-size: 13px; padding: 8px 9px; }
  .lens-tab { font-size: 15px; }
  .schedule-cta { font-size: 18px; }
  .browse-line-name { font-size: 17px; }
  .county-name { font-size: 18px; }
  .sv-head, .cr-head, .node-name, .tp-leg-head { font-size: 15px; }
}

/* Trip option cards */
.tp-card { border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; background: var(--bg-raised); overflow: hidden; }
.tp-card-head { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 12px 14px; font-family: inherit; cursor: pointer; }
.tp-card-sum { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-card .tp-sum-time { font-size: 17px; }
.tp-card .tp-sum-meta { font-size: 13px; color: var(--text-dim); }
.tp-badge { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; border: 1px solid var(--line); color: var(--text-dim); white-space: nowrap; }
.tp-badge-sh { border-color: var(--accent); color: var(--accent); }
.tp-caret { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); transform: rotate(45deg); transition: transform .15s; }
.tp-card.is-open .tp-caret { transform: rotate(225deg); }
.tp-card-body { display: none; padding: 0 14px 14px; }
.tp-card.is-open .tp-card-body { display: block; }
.tp-est { font-style: normal; font-size: 11px; color: var(--text-dim); }
.tp-svc { margin: 0 0 16px; }
