/* rideut — planner app */
body { background: var(--bg-alt); }

/* Auth gate */
.auth-gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg,#F5F8FB,#E8EFF6); overflow-y: auto; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--hair); border-radius: 22px; padding: 34px 30px; box-shadow: 0 30px 70px -34px rgba(20,40,70,0.5); display: flex; flex-direction: column; }
.auth-title { font-size: 24px; margin: 14px 0 6px; letter-spacing: -0.02em; }
.auth-sub { font-size: 14px; color: var(--body); line-height: 1.5; margin: 0 0 20px; }
.auth-err { background: rgba(220,60,60,0.08); color: #b3261e; font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.auth-google { width: 100%; background: #fff; border: 1.5px solid rgba(20,40,70,0.18); color: var(--ink); font-size: 15px; padding: 12px; }
.auth-google:hover { background: #f7fafc; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 700; margin: 18px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.auth-field em { color: var(--muted); font-weight: 500; font-style: normal; }
.auth-field input { border: 1.5px solid rgba(20,40,70,0.14); border-radius: 12px; padding: 12px 14px; font-family: inherit; font-size: 15px; color: var(--ink); outline: none; }
.auth-field input:focus { border-color: var(--blue); }
.auth-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--body); line-height: 1.45; cursor: pointer; margin-top: 2px; }
.auth-consent input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--blue); flex: none; }
.auth-submit { width: 100%; margin-top: 6px; padding: 13px; font-size: 15px; }
.auth-toggle { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 18px; font-size: 13.5px; color: var(--body); }
.auth-toggle .auth-forgot { font-size: 13px; font-weight: 600; }
.auth-legal { font-size: 11.5px; color: var(--muted); line-height: 1.5; text-align: center; margin: 18px 0 0; }

/* App shell */
.app-bar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.9); backdrop-filter: blur(14px); border-bottom: 1px solid var(--hair); }
.app-bar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.app-bar .word { font-size: 21px; }
.tabs { display: flex; gap: 4px; background: var(--chip); padding: 4px; border-radius: 999px; }
.tab { border: none; background: transparent; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--nav-link); padding: 8px 16px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tab.active { background: #fff; color: var(--blue); box-shadow: 0 2px 8px -4px rgba(20,40,70,0.3); }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hair); background: #fff; border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.user-btn .av { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.menu { position: absolute; right: 20px; top: 60px; background: #fff; border: 1px solid var(--hair); border-radius: 14px; box-shadow: 0 20px 50px -24px rgba(20,40,70,0.5); padding: 8px; min-width: 200px; z-index: 45; }
.menu[hidden] { display: none; }
.menu .who { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--hair-soft); margin-bottom: 6px; word-break: break-all; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: none; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--chip); opacity: 1; }

.view { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.view[hidden] { display: none; }

/* Plan view */
.plan-search { background: #fff; border: 1.5px solid rgba(11,107,203,0.22); border-radius: 18px; padding: 8px 8px 8px 18px; display: flex; align-items: center; gap: 12px; box-shadow: 0 16px 40px -26px rgba(11,107,203,0.5); max-width: 720px; margin: 0 auto; }
.plan-search:focus-within { border-color: var(--blue); }
.plan-search input { flex: 1; border: none; outline: none; font-family: inherit; font-size: 16px; color: var(--ink); font-weight: 500; background: transparent; min-width: 0; }
.plan-search .go { background: var(--blue); color: #fff; font-weight: 700; font-size: 14.5px; padding: 12px 22px; border-radius: 12px; border: none; white-space: nowrap; }
.plan-search .go[disabled] { opacity: .6; cursor: default; }
.plan-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 14px auto 0; max-width: 720px; }
.plan-chips .chip { cursor: pointer; }
.plan-hint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }

.results { max-width: 720px; margin: 28px auto 0; display: flex; flex-direction: column; gap: 14px; }
.ai-summary { background: linear-gradient(135deg, rgba(11,107,203,0.06), rgba(18,165,148,0.06)); border: 1px solid rgba(11,107,203,0.15); border-radius: 16px; padding: 16px 18px; font-size: 15px; line-height: 1.55; color: var(--ink-2); display: flex; gap: 12px; }
.ai-summary .ai-badge { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: flex; align-items: center; justify-content: center; }
.itin { background: #fff; border: 1px solid var(--hair); border-radius: 16px; padding: 18px; cursor: pointer; transition: box-shadow .12s ease, transform .12s ease; }
.itin:hover { box-shadow: 0 16px 36px -24px rgba(20,40,70,0.4); transform: translateY(-1px); }
.itin-top { display: flex; justify-content: space-between; align-items: baseline; }
.itin-dur { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; color: var(--ink); }
.itin-tag { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.itin-tag.fastest { color: var(--teal-dark); background: rgba(18,165,148,0.14); }
.itin-tag.cheapest { color: var(--blue); background: rgba(11,107,203,0.12); }
.itin-tag.fewest { color: #7a5a1a; background: rgba(220,160,40,0.16); }
.itin-meta { font-size: 13px; color: var(--phone-sub); font-weight: 600; margin-top: 4px; }
.legs { display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 8px; }
.leg.walk { background: var(--chip); color: var(--ink-2); }
.leg.bus { background: rgba(11,107,203,0.12); color: var(--blue); }
.leg.rail { background: rgba(18,165,148,0.14); color: var(--teal-dark); }
.leg-arrow { color: var(--muted); font-size: 12px; }
.itin-detail { margin-top: 14px; border-top: 1px dashed var(--hair); padding-top: 14px; display: none; }
.itin.open .itin-detail { display: block; }
.step-row { display: flex; gap: 12px; padding: 8px 0; }
.step-row .rail-line { width: 12px; display: flex; flex-direction: column; align-items: center; }
.step-row .rail-line .rc { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--blue); background: #fff; flex: none; margin-top: 3px; }
.step-row .rail-line .rl { flex: 1; width: 2px; background: var(--hair); margin: 2px 0; }
.step-row .sc { flex: 1; }
.step-row .st { font-size: 14px; font-weight: 700; color: var(--ink); }
.step-row .ss { font-size: 12.5px; color: var(--body); margin-top: 2px; }

.sponsored { background: #fff; border: 1px solid rgba(18,165,148,0.3); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 28px -20px rgba(18,165,148,0.5); cursor: pointer; }
.map-sponsor { margin-top: 12px; }
.plan-note { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 2px 12px; }
.maps-handoff { display: flex; margin-top: 14px; font-size: 14px; }

/* Rideshare deep links */
.ride-card { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ride-card.prominent { margin-top: 16px; padding: 14px; background: var(--bg-alt); border: 1px solid var(--hair); border-radius: 14px; }
.ride-tag { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ride-btns { display: flex; gap: 8px; }
.ride-btn { border-radius: 999px; font-weight: 700; font-size: 13px; padding: 9px 18px; color: #fff; }
.ride-btn.uber { background: #000; }
.ride-btn.lyft { background: #EA0B8C; }
.ride-btn:hover { opacity: 0.85; }

/* Sponsor bubble — offset to the right, set apart from the directions list. */
.sponsor-bubble { position: relative; width: 86%; margin: 12px 0 4px auto; background: rgba(18,165,148,0.06); border: 1px solid rgba(18,165,148,0.3); border-radius: 16px 16px 4px 16px; padding: 12px 14px; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.sponsor-bubble:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -16px rgba(18,165,148,0.6); }
.sponsor-bubble .sb-tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--teal-dark); margin-bottom: 8px; }
.sponsor-bubble .sb-body { display: flex; align-items: center; gap: 11px; }
.sponsor-bubble .sb-av { width: 40px; height: 40px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; color: #fff; background: var(--grad); object-fit: cover; }
.sponsor-bubble .sb-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.sponsor-bubble .sb-offer { font-size: 12.5px; color: var(--body); }
.sponsor-bubble .sb-near { font-size: 11.5px; color: var(--teal-dark); font-weight: 600; margin-top: 2px; }

/* Cross-link affordances */
.route-badge[data-open-route], .sn[data-open-stop] { cursor: pointer; }
.sn[data-open-stop] { text-decoration: underline; text-decoration-color: rgba(20,40,70,0.2); text-underline-offset: 3px; }
.pop-route { margin-top: 8px; border: none; background: var(--blue); color: #fff; font-weight: 700; font-size: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; width: 100%; }
.step-route { display: inline-block; background: var(--blue); color: #fff; font-weight: 700; border-radius: 6px; padding: 1px 8px; cursor: pointer; }
.step-stop { color: var(--blue); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(11,107,203,0.35); text-underline-offset: 2px; }

/* Detail sheet (bottom drawer) */
.sheet { position: fixed; inset: 0; z-index: 3000; } /* above Leaflet panes/controls (~1000) */
.sheet .sheet-backdrop { position: absolute; inset: 0; background: rgba(16,35,58,0.35); opacity: 0; transition: opacity .2s ease; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet .sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 20px 20px 0 0; max-height: 82vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .22s ease; box-shadow: 0 -20px 50px -24px rgba(16,35,58,0.5); }
.sheet.open .sheet-panel { transform: translateY(0); }
@media (min-width: 640px) { .sheet .sheet-panel { left: 50%; right: auto; bottom: 5vh; width: 460px; transform: translate(-50%, 120%); border-radius: 20px; } .sheet.open .sheet-panel { transform: translate(-50%, 0); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 0; }
.sheet-back, .sheet-close { background: none; border: none; font-size: 14px; font-weight: 700; color: var(--nav-link); cursor: pointer; padding: 6px; }
.sheet-close { font-size: 18px; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 4px 20px 28px; }
.sd-kind { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.sd-title { font-size: 22px; letter-spacing: -0.02em; margin: 4px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sd-live { font-size: 13px; font-weight: 600; color: var(--teal-dark); margin-bottom: 6px; }
.sd-sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--col-head); margin: 18px 0 10px; }
.sd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.route-chip, .rd-badge { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: #fff; border: none; border-radius: 8px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.rd-badge { cursor: default; }
.rd-stops { display: flex; flex-direction: column; }
.rd-stop { display: flex; align-items: center; gap: 10px; background: none; border: none; text-align: left; padding: 9px 2px; font-size: 14px; color: var(--ink-2); cursor: pointer; border-top: 1px solid var(--hair-soft); }
.rd-stop:first-child { border-top: none; }
.rd-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.map-sponsor .sponsored:hover { border-color: var(--teal); }
.sponsored .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sponsored .sp { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--teal-dark); background: rgba(18,165,148,0.14); padding: 3px 8px; border-radius: 5px; }
.sponsored .near { font-size: 11px; color: var(--muted); font-weight: 600; }
.sponsored .biz { display: flex; align-items: center; gap: 12px; }
.sponsored .avatar { width: 44px; height: 44px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; color: #fff; background: var(--grad); object-fit: cover; }
.sponsored .name { font-size: 15px; font-weight: 700; color: var(--ink); }
.sponsored .offer { font-size: 12.5px; color: var(--body); }

/* Trip handoff to Google Maps (free deep link) */
.handoff { background: #fff; border: 1px solid var(--hair); border-radius: 16px; padding: 20px; }
.handoff-route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.handoff-route .hr-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.handoff-route .hr-dot.origin { background: #fff; border: 3px solid var(--blue); }
.handoff-route .hr-dot.dest { background: var(--teal); }
.handoff-route .hr-line { flex: 1; min-width: 20px; height: 2px; background: repeating-linear-gradient(90deg, var(--blue) 0 6px, transparent 6px 12px); }
.handoff-route .hr-text { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); }
.handoff-when { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 8px; }
.handoff-btn { margin-top: 16px; padding: 13px 22px; font-size: 15px; }
.handoff-note { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; }
.handoff-note a { color: var(--blue); font-weight: 600; }

.empty, .loading { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 15px; }
.spinner { width: 26px; height: 26px; border: 3px solid rgba(11,107,203,0.2); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Map view */
#map-canvas { height: calc(100vh - 200px); min-height: 420px; border-radius: 18px; overflow: hidden; border: 1px solid var(--hair); box-shadow: 0 20px 50px -30px rgba(20,40,70,0.4); }
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); align-items: center; }
.map-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.map-legend .sw { width: 12px; height: 12px; border-radius: 50%; }
.veh-count { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 700; }
.leaflet-popup-content { font-family: 'Manrope', sans-serif; }
.veh-pop .vt { font-weight: 800; color: var(--ink); font-size: 14px; }
.veh-pop .vs { font-size: 12px; color: var(--body); margin-top: 2px; }
.veh-pop .vm { font-size: 12px; color: var(--ink-2); margin-top: 4px; font-weight: 600; }
.veh-pop .vu { font-size: 11px; color: var(--muted); margin-top: 4px; }
.leaflet-div-icon.veh-mark { background: transparent; border: 0; }
.veh-arrow { display: block; width: 22px; height: 22px; transform-origin: 50% 50%; filter: drop-shadow(0 1px 1.5px rgba(20,40,70,0.35)); }
.veh-dot { display: block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 1px 2px rgba(20,40,70,0.35); }

/* Nearby view */
.nearby-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stop-card { background: #fff; border: 1px solid var(--hair); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.stop-card .sh { display: flex; justify-content: space-between; align-items: baseline; }
.stop-card .sn { font-size: 16px; font-weight: 700; color: var(--ink); }
.stop-card .sd { font-size: 12px; color: var(--muted); font-weight: 600; }
.arr-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hair-soft); }
.arr-row:first-of-type { border-top: none; padding-top: 12px; }
.route-badge { min-width: 40px; text-align: center; font-size: 12px; font-weight: 800; color: #fff; padding: 4px 8px; border-radius: 7px; background: var(--blue); }
.arr-dest { flex: 1; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.arr-min { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; color: var(--teal-dark); }
.arr-min small { font-size: 11px; color: var(--muted); font-weight: 600; }

.attribution { max-width: 1180px; margin: 30px auto 0; padding: 0 20px; font-size: 11.5px; color: var(--muted); line-height: 1.6; text-align: center; }
.attribution a { color: var(--muted); text-decoration: underline; }
