/* SpeedTravel – aplikacja */
:root {
	--spt-primary: #0F2A44;
	--spt-accent: #F5A623;
	--bg: #f2f4f7;
	--card: #ffffff;
	--text: #17202b;
	--muted: #6b7785;
	--line: #e3e7ec;
	--good: #1e8e3e;
	--good-bg: #e6f6ea;
	--warn: #a15c00;
	--warn-bg: #fff3dc;
	--bad: #b42318;
	--bad-bg: #fdecea;
	--info: #0b57a4;
	--info-bg: #e3f0ff;
	--r: 16px;
	--top: 56px;
	--safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--spt-primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
.small { font-size: 14px; }
.muted, .t-muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 14px 0; }
.foot { text-align: center; font-size: 13px; margin: 26px 0 10px; }
.foot a { color: var(--muted); }
svg { vertical-align: -4px; }

/* Górny pasek */
.spt-top { position: sticky; top: 0; z-index: 1000; height: calc(var(--top) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); background: var(--spt-primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.spt-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--spt-accent); }
.spt-brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: .3px; display: flex; align-items: center; }
.spt-brand img { max-height: 34px; max-width: 180px; display: block; }
.spt-brand .spt-mark { height: 30px; width: auto; margin-right: 9px; }
.spt-top-btn { position: absolute; left: 6px; bottom: 6px; width: 44px; height: 44px; border: 0; background: transparent; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.spt-top-btn:active { background: rgba(255,255,255,.15); }

.spt-app { max-width: 720px; margin: 0 auto; min-height: calc(100vh - var(--top)); padding-bottom: calc(24px + var(--safe-b)); }
.pad { padding: 16px; }
.spt-loading { display: flex; align-items: center; justify-content: center; padding: 60px 0; }
.spt-loading.small { padding: 20px 0; }
.spt-spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid rgba(0,0,0,.08); border-top-color: var(--spt-accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Przyciski */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; background: var(--spt-primary); color: #fff; min-height: 46px; transition: transform .08s, filter .15s; }
.btn:active { transform: translateY(1px); filter: brightness(.95); }
.btn:disabled { opacity: .5; }
.btn-accent { background: var(--spt-accent); color: #1a1a1a; }
.btn-ghost { background: transparent; color: var(--spt-primary); box-shadow: inset 0 0 0 2px var(--spt-primary); }
.btn-text { background: transparent; color: var(--muted); font-weight: 600; }
.btn-text.danger { color: var(--bad); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-block { display: flex; width: 100%; margin-top: 10px; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }
.btn-lg { min-height: 54px; font-size: 17px; }
.btn-xl { min-height: 72px; font-size: 21px; border-radius: 16px; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,.55); } 50% { box-shadow: 0 0 0 8px rgba(245,166,35,0); } }

/* Karty */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08); }
.card.empty { text-align: center; color: var(--muted); }
.card-center { text-align: center; }
.big-emoji { font-size: 44px; margin: 0; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "▾"; float: right; color: var(--muted); }
details[open].card summary::after { content: "▴"; }
.h-sec { font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 8px 2px 10px; }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #eef1f4; color: var(--muted); vertical-align: middle; }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-info { background: var(--info-bg); color: var(--info); }

.bar { height: 8px; background: #e7ebf0; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; background: var(--spt-accent); border-radius: 99px; transition: width .6s; }
.bar-lg { height: 12px; }

/* Ekran główny */
.hero { background: var(--spt-primary); color: #fff; padding: 22px 16px 26px; border-radius: 0 0 26px 26px; }
.hero h1 { font-size: 24px; margin-bottom: 14px; }
.track-form { display: flex; gap: 8px; background: #fff; border-radius: 14px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.track-form input { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 17px; padding: 10px 8px; outline: none; text-transform: uppercase; background: transparent; color: var(--text); }
.track-form input::placeholder { text-transform: none; color: #98a2ad; }
.track-form .btn { min-width: 52px; padding: 0 14px; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin: 10px 0; background: var(--card); border-radius: var(--r); text-decoration: none; color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.link-row svg { color: var(--spt-primary); flex: 0 0 auto; }
.link-driver { justify-content: center; color: var(--muted); background: transparent; box-shadow: none; }

.trip-card { padding: 0; overflow: hidden; }
.trip-link { display: block; padding: 14px 16px; color: inherit; text-decoration: none; }
.trip-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.trip-date { font-size: 13px; color: var(--muted); }
.trip-card h3 { margin: 2px 0 4px; }
.trip-card .muted { font-size: 14px; margin: 0; }
.trip-cta { padding: 0 16px 14px; display: flex; justify-content: flex-end; }

/* Szczegóły wycieczki */
.trip-hero { background: var(--spt-primary) center / cover no-repeat; color: #fff; padding: 46px 16px 18px; }
.trip-hero h1 { font-size: 24px; text-shadow: 0 1px 6px rgba(0,0,0,.3); }
.trip-hero p { margin: 0; opacity: .95; }
.status-box { border-radius: var(--r); padding: 18px 16px; margin-bottom: 12px; }
.status-box h2 { display: flex; align-items: center; gap: 8px; }
.tone-good { background: var(--good-bg); color: #14532d; }
.tone-warn { background: var(--warn-bg); color: #6b3d00; }
.tone-bad { background: var(--bad-bg); color: #7a1a12; }
.tone-info { background: var(--info-bg); color: #0b3c70; }
.tone-muted, .tone-neutral { background: #e9edf1; color: #2e3a46; }
.status-box .btn-ghost { color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 600; }
.code { letter-spacing: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Oś przystanków */
.tl { list-style: none; margin: 6px 0 0; padding: 0; }
.tl li { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 0 9px 28px; min-height: 40px; }
.tl li::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 3px; background: var(--spt-primary); opacity: .25; }
.tl li:first-child::before { top: 50%; }
.tl li:last-child::before { bottom: 50%; }
.tl .tl-dot { position: absolute; left: 2px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; border-radius: 50%; background: #fff; border: 3px solid var(--spt-primary); }
.tl .tl-name { flex: 1; font-weight: 600; }
.tl .tl-time { text-align: right; white-space: nowrap; font-size: 15px; }
.tl li.is-mine { background: linear-gradient(90deg, rgba(245,166,35,.16), rgba(245,166,35,0)); border-radius: 10px; }
.tl li.is-mine .tl-dot { border-color: var(--spt-accent); background: var(--spt-accent); }
.tl-live li { cursor: pointer; }
.tl-live li.st-passed { color: var(--muted); }
.tl-live li.st-passed::before { opacity: .15; }
.tl-live li.st-passed .tl-dot { border-color: #aab4be; background: #aab4be; }
.tl-live li.st-next .tl-dot, .tl-live li.st-at_stop .tl-dot { border-color: var(--spt-accent); box-shadow: 0 0 0 4px rgba(245,166,35,.25); }

/* Śledzenie: mapa + panel */
.v-track .spt-app { max-width: none; padding-bottom: 0; }
.track { position: relative; }
.map-wrap { position: sticky; top: calc(var(--top) + env(safe-area-inset-top, 0px)); height: 52vh; min-height: 280px; z-index: 1; }
.map { position: absolute; inset: 0; background: #e8ecf0; }
.map-err { padding: 40px 16px; text-align: center; color: var(--muted); }
.map-btns { position: absolute; left: 12px; bottom: 30px; display: flex; flex-direction: column; gap: 10px; z-index: 500; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: var(--spt-primary); box-shadow: 0 2px 10px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sheet { position: relative; z-index: 2; background: var(--bg); border-radius: 22px 22px 0 0; margin-top: -18px; padding: 8px 16px calc(28px + var(--safe-b)); min-height: 50vh; box-shadow: 0 -4px 18px rgba(0,0,0,.12); max-width: 720px; margin-left: auto; margin-right: auto; }
.grab { width: 44px; height: 5px; border-radius: 99px; background: #cfd6de; margin: 2px auto 12px; }
.summary { border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; }
.summary-title { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.summary-text { margin-top: 4px; font-size: 15px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex: 0 0 auto; box-shadow: 0 0 0 0 rgba(30,142,62,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 10px rgba(30,142,62,0); } 100% { box-shadow: 0 0 0 0 rgba(30,142,62,0); } }
.driver-msg { background: #fff8e6; border-left: 4px solid var(--spt-accent); padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; font-size: 15px; }
.my-stop { background: var(--spt-primary); color: #fff; border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; }
.my-stop-label { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; opacity: .75; }
.my-stop-name { font-size: 19px; font-weight: 800; margin: 2px 0 4px; }
.my-stop-eta { font-size: 17px; }
.my-stop-eta strong { font-size: 22px; color: var(--spt-accent); }
.my-stop-sub { margin-top: 4px; opacity: .95; }
.my-stop .chip-good { background: rgba(255,255,255,.18); color: #b9f5c9; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); margin: 6px 0 16px; }
.pick select { flex: 1; max-width: 70%; font: inherit; font-size: 15px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.trip-title { margin-top: 6px; }
.upd { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }
.upd .warn { color: var(--warn); }

/* Znaczniki mapy */
.spt-divicon { background: none; border: 0; }
.spt-gm-marker { transform: translate(-50%, -50%); }
.spt-tiles { filter: grayscale(.82) contrast(1.04) brightness(1.03); }
.spt-bus { position: relative; width: 44px; height: 44px; }
.spt-bus-ico { position: absolute; inset: 4px; border-radius: 50%; background: var(--spt-accent); color: #1a1a1a; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 2; }
.spt-bus-ico svg { vertical-align: 0; }
/* Radar: fale rozchodzące się od autokaru */
.spt-radar { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 0; pointer-events: none; }
.spt-radar i { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--spt-accent); background: radial-gradient(circle, rgba(245,166,35,.28) 0%, rgba(245,166,35,.08) 60%, rgba(245,166,35,0) 72%); opacity: 0; animation: radar 2.7s cubic-bezier(.2,.6,.35,1) infinite; }
.spt-radar i:nth-child(2) { animation-delay: .9s; }
.spt-radar i:nth-child(3) { animation-delay: 1.8s; }
@keyframes radar { 0% { transform: scale(.45); opacity: .95; } 75% { opacity: .25; } 100% { transform: scale(3.6); opacity: 0; } }
.spt-bus.is-stale .spt-radar i { border-color: #9aa6b2; background: none; animation-duration: 4s; }
@media (prefers-reduced-motion: reduce) { .spt-radar i { animation: none; opacity: .35; transform: scale(1.6); } }
.spt-bus-dir { position: absolute; inset: -9px; z-index: 1; }
.spt-bus-dir::before { content: ""; position: absolute; left: 50%; top: 0; margin-left: -7px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 11px solid var(--spt-primary); }
.spt-bus.is-stale .spt-bus-ico { background: #aab4be; }
.spt-gm-marker, .leaflet-marker-icon.spt-divicon { overflow: visible; }

/* Tryb "na kliknięcie" */
.radar-cta { padding: 16px 16px 4px; max-width: 720px; margin: 0 auto; }
.radar-cta .btn svg { width: 26px; height: 26px; }
.radar-note { text-align: center; color: var(--muted); font-size: 14px; margin: 10px 4px 4px; min-height: 1em; }
.track-click .map-wrap { position: relative; top: auto; height: 58vh; min-height: 300px; max-width: 720px; margin: 8px auto 12px; border-radius: var(--r); overflow: hidden; box-shadow: 0 2px 12px rgba(16,24,40,.15); }
.track-click .map-wrap[hidden] { display: none; }
.track-click .sheet { margin-top: 0; border-radius: 0; box-shadow: none; min-height: 0; background: transparent; }
@media (max-width: 760px) { .track-click .map-wrap { margin-left: 12px; margin-right: 12px; } }
.spt-stop-m { position: relative; width: 22px; height: 22px; }
.spt-stop-dot { position: absolute; inset: 0; border-radius: 50%; background: #fff; border: 3px solid var(--spt-primary); color: var(--spt-primary); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.spt-stop-m.is-passed .spt-stop-dot { border-color: #9aa6b2; color: #9aa6b2; }
.spt-stop-m.is-next .spt-stop-dot { border-color: var(--spt-accent); }
.spt-stop-m.is-mine .spt-stop-dot { background: var(--spt-accent); border-color: #fff; color: #1a1a1a; transform: scale(1.25); }
.spt-stop-label { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); white-space: nowrap; background: var(--spt-primary); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }

/* Kierowca */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.stack input, .row input { font: inherit; font-size: 18px; padding: 13px 14px; border-radius: 12px; border: 1px solid #cdd5de; background: #fff; color: var(--text); width: 100%; }
.stack input:focus, .row input:focus { outline: 2px solid var(--spt-accent); border-color: transparent; }
.row { display: flex; gap: 8px; margin: 10px 0 4px; }
.row input { font-size: 15px; padding: 9px 12px; flex: 1; min-width: 0; }
.list-btn { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; gap: 2px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; margin-top: 8px; font: inherit; cursor: pointer; }
.list-btn span { color: var(--muted); font-size: 14px; }
.checklist { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.checklist li { margin: 4px 0; }
.gps-state { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 12px 14px; border-radius: 12px; }
.gps-state.good { background: var(--good-bg); color: var(--good); }
.gps-state.warn { background: var(--warn-bg); color: var(--warn); }
.gps-state.bad { background: var(--bad-bg); color: var(--bad); }
.gps-dot { width: 12px; height: 12px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.gps-state.good .gps-dot { animation: livepulse 1.6s infinite; }
.gps-next { margin: 12px 2px; }
.gps-next-title { font-weight: 800; font-size: 18px; }
.gps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.gps-grid div { background: #f4f6f8; border-radius: 10px; padding: 8px 10px; }
.gps-grid span { display: block; font-size: 12px; color: var(--muted); }
.gps-grid strong { font-size: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pax { list-style: none; margin: 0 0 8px; padding: 0; }
.pax li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.driver h4 { margin: 14px 0 4px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

.spt-toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); background: #1d2733; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 3000; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: 15px; text-align: center; }

@media (min-width: 900px) {
	.v-track .track:not(.track-click) { display: grid; grid-template-columns: 1fr 420px; height: calc(100vh - var(--top)); }
	.v-track .track:not(.track-click) .map-wrap { position: relative; top: 0; height: 100%; }
	.v-track .track:not(.track-click) .sheet { margin: 0; border-radius: 0; max-width: none; overflow-y: auto; height: 100%; box-shadow: -4px 0 18px rgba(0,0,0,.08); }
	.v-track .grab { display: none; }
}

.link-native { border: 2px solid var(--spt-accent); }
.link-native small { color: var(--muted); }
