/* ============================================================
   Pôjdeme Vlakom? — design system
   ============================================================ */

:root {
  --topbar-h: 61px;
  --bg: #EEF2F8;
  --bg-soft: #E4EAF3;
  --card: #FFFFFF;
  --card-2: #F6F8FC;
  --ink: #14233D;
  --ink-2: #44546E;
  --muted: #8593A8;
  --line: #E2E8F1;
  --brand: #14377D;
  --brand-ink: #FFFFFF;
  --accent: #E5233D;
  --accent-soft: #FDEDEF;
  --ok: #189D57;
  --ok-soft: #E6F6EE;
  --warn: #D98C0F;
  --warn-soft: #FCF3E1;
  --bad: #DC2638;
  --bad-soft: #FBE9EB;
  --gold: #B8860B;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 8px 24px rgba(16, 32, 64, .07);
  --shadow-lg: 0 12px 40px rgba(16, 32, 64, .18);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --seat-free: #34C16B;
  --seat-taken: #E5414F;
  --seat-unknown: #97A3B4;
  --wagon-surface: #EEF3FA;
  --wagon-edge: #D5DEEC;
}

html[data-theme="dark"] {
  --bg: #0D1320;
  --bg-soft: #111927;
  --card: #18212F;
  --card-2: #1F2A3B;
  --ink: #E9EEF7;
  --ink-2: #B9C4D6;
  --muted: #7C8BA1;
  --line: #2A3648;
  --brand: #3D67C4;
  --accent: #F0445C;
  --accent-soft: #3A1B22;
  --ok: #2FBF71;
  --ok-soft: #15301F;
  --warn: #E8A83C;
  --warn-soft: #322713;
  --bad: #F0445C;
  --bad-soft: #371B20;
  --gold: #D9A52B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  --seat-free: #2FAF63;
  --seat-taken: #D8404E;
  --seat-unknown: #5C6B80;
  --wagon-surface: #141d2e;
  --wagon-edge: #2A3648;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
}
button { font-family: inherit; }
a { color: var(--brand); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 10px calc(16px + env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 10px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  min-width: 0;
}
.brand img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand .q { color: var(--accent); }
.brand-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.topbar-spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; color: var(--ink-2);
  cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 21px; height: 21px; }

/* ---------- layout ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 16px 14px 90px; }
.page.wide { max-width: 1060px; }

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.h-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.title-lg { font-size: 22px; font-weight: 800; }
.hero-claim {
  margin: 6px 2px 16px;
  color: var(--ink-2); font-size: 15px;
}

/* ---------- forms ---------- */
.field { position: relative; margin-bottom: 10px; }
.field label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  margin: 0 0 5px 4px;
}
.input, select.input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input::placeholder { color: var(--muted); }
select.input {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238593A8'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 38px;
}
input[type="date"].input, input[type="time"].input { min-height: 50px; }

.station-pair { position: relative; }
.swap-btn {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--brand);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: transform .25s;
}
.swap-btn:active { transform: translateY(-50%) rotate(180deg); }
.swap-btn svg { width: 20px; height: 20px; }
.station-pair .field input { padding-right: 64px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; }
@media (max-width: 560px) {
  .row-3 { grid-template-columns: 1fr 1fr; }
  .row-3 .span-2 { grid-column: span 2; }
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card-2);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
}
.chip svg { width: 15px; height: 15px; flex: none; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .x { opacity: .6; }
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  border-radius: var(--r-md);
  font-size: 16.5px; font-weight: 700;
  padding: 15px 22px;
  transition: filter .15s, transform .05s;
  text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: #fff; width: 100%; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-secondary { background: var(--brand); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { border-color: var(--brand); }
.btn-sm { font-size: 14px; padding: 9px 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }

.link-btn {
  background: none; border: none; color: var(--brand);
  font-size: 14px; font-weight: 700; cursor: pointer; padding: 6px 4px;
}

/* ---------- autocomplete ---------- */
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  max-height: 290px; overflow-y: auto;
  display: none;
}
.suggest.open { display: block; }
.suggest-item {
  padding: 12px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  font-size: 15.5px;
  border-bottom: 1px solid var(--line);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item.hl, .suggest-item:hover { background: var(--card-2); }
.suggest-item .tag { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; }
.suggest-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* ---------- collapsible ---------- */
.collapse-head {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--brand); font-size: 14px; font-weight: 700;
  padding: 8px 4px;
}
.collapse-head svg { width: 16px; height: 16px; transition: transform .2s; }
.collapse-head.open svg { transform: rotate(180deg); }
.collapse-body { display: none; padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 6px; }
.collapse-body.open { display: block; }

.check-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; cursor: pointer; color: var(--ink-2);
  min-height: 32px;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- recents ---------- */
.section-label {
  font-size: 12.5px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin: 18px 4px 8px;
}
.recent-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: none; border-bottom: 1px solid var(--line);
  text-align: left; padding: 13px 16px; cursor: pointer;
  color: var(--ink); font-size: 15px;
}
.recent-list { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--card-2); }
.recent-item svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.recent-item .meta { margin-left: auto; color: var(--muted); font-size: 12.5px; flex: none; }
.recent-item .route { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- banners & toasts ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: 14px; font-weight: 550;
}
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

#toast-root { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 10px 20px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s;
  max-width: calc(100vw - 40px);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- results ---------- */
.results-head {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 2px 14px;
}
.results-head .route-line { min-width: 0; flex: 1; }
.results-head .route-line b { font-size: 16.5px; display: block; line-height: 1.25; }
.results-head .route-line span { color: var(--muted); font-size: 13px; }

.day-nav { display: flex; gap: 8px; margin-bottom: 12px; }
.day-nav .btn { flex: 1; }

.conn-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1.5px solid transparent;
  transition: border-color .15s;
}
.conn-card.expanded { border-color: var(--brand); }
.conn-main {
  width: 100%; border: none; background: none; text-align: left;
  padding: 15px 16px 13px; cursor: pointer; color: var(--ink);
  display: block;
}
.conn-times { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.conn-times .t { font-size: 21px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.conn-times .arrow { color: var(--muted); }
.conn-times .dur { color: var(--muted); font-size: 13.5px; font-weight: 600; margin-left: auto; white-space: nowrap; }
.conn-sub {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 9px;
}
.train-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 800;
  border-radius: 7px; padding: 3.5px 9px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.train-chip.t-ic { background: #7A1FA0; }
.train-chip.t-ec, .train-chip.t-rj { background: #0E7490; }
.train-chip.t-os, .train-chip.t-rr { background: #5B6B84; }
.train-chip.t-en { background: #3B3B6E; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 800;
  border-radius: 6px; padding: 3px 7px;
  white-space: nowrap;
}
.badge.res { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.delay { background: var(--bad-soft); color: var(--bad); }
.badge.ontime { background: var(--ok-soft); color: var(--ok); }
.badge.transfers { background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }

.price-chip {
  margin-left: auto;
  font-size: 15px; font-weight: 800;
  border-radius: 9px; padding: 5px 11px;
  white-space: nowrap;
}
.price-chip.normal { background: var(--card-2); color: var(--ink); border: 1px solid var(--line); }
.price-chip.free { background: var(--ok-soft); color: var(--ok); }
.price-chip.quota-out { background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }
.price-chip.err { background: var(--card-2); color: var(--muted); }
.price-skeleton {
  margin-left: auto;
  width: 74px; height: 28px; border-radius: 9px;
  background: linear-gradient(90deg, var(--card-2) 25%, var(--line) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.conn-detail { border-top: 1px solid var(--line); padding: 14px 16px; display: none; }
.conn-card.expanded .conn-detail { display: block; }

.seg-timeline { margin: 4px 0 10px; }
.seg-row { display: flex; gap: 12px; position: relative; padding: 3px 0; }
.seg-row .time { width: 48px; flex: none; font-weight: 700; font-size: 14px; text-align: right; color: var(--ink); }
.seg-row .time.muted { color: var(--muted); font-weight: 500; }
.seg-rail { width: 14px; flex: none; display: flex; flex-direction: column; align-items: center; }
.seg-rail .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2.5px solid var(--brand); margin-top: 5px; flex: none; }
.seg-rail .dot.hollow { background: var(--card); }
.seg-rail .bar { width: 3.5px; flex: 1; background: var(--brand); border-radius: 2px; margin: 2px 0; min-height: 14px; }
.seg-rail .bar.walk { background: repeating-linear-gradient(var(--muted) 0 4px, transparent 4px 8px); width: 2.5px; }
.seg-row .station { font-size: 14.5px; padding-bottom: 2px; min-width: 0; }
.seg-row .station b { font-size: 15px; }
.seg-row .station .plat { color: var(--muted); font-size: 12px; margin-left: 6px; }
.seg-train-label {
  font-size: 13px; color: var(--ink-2); padding: 4px 0 6px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.action-row .btn { flex: 1 1 auto; min-width: 150px; }

.price-breakdown { font-size: 13.5px; color: var(--ink-2); margin: 2px 0 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.price-breakdown b { color: var(--ink); }

/* ---------- occupancy view ---------- */
.train-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.train-head .title-lg { display: flex; align-items: center; gap: 10px; }
.scan-meta { color: var(--muted); font-size: 12.5px; }

.occ-bar {
  height: 14px; border-radius: 999px; overflow: hidden;
  display: flex; margin: 12px 0 8px;
  background: var(--card-2);
}
.occ-bar div { height: 100%; }
.occ-bar .f { background: var(--seat-free); }
.occ-bar .p { background: var(--warn); }
.occ-bar .o { background: var(--seat-taken); }
.occ-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.occ-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 10px 0; }
.legend .it { display: inline-flex; align-items: center; gap: 6px; }
.legend .sq { width: 13px; height: 13px; border-radius: 4px; }

.seat-filter-sticky {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 1px);
  z-index: 50; padding: 10px 14px; margin-bottom: 10px;
}
.wagon-card { margin-bottom: 14px; }
.wagon-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 2px solid var(--line);
}
.wagon-head .num { font-size: 17px; font-weight: 800; }
.wagon-head .free-count { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.wagon-scroll {
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  background: var(--card-2);
  border: 1px solid var(--line);
  padding: 10px;
}
.wagon-scroll svg { display: block; }
.svgPlace { cursor: pointer; }
.svgPlace:hover rect { filter: brightness(.85); }
.scroll-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 6px; display: none; }
@media (max-width: 760px) { .scroll-hint { display: block; } }

/* seatfinder */
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stepper {
  display: flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--card-2);
  overflow: hidden;
}
.stepper button {
  width: 44px; height: 48px; border: none; background: none;
  font-size: 22px; color: var(--brand); cursor: pointer; font-weight: 700;
  flex: none;
}
.stepper button:disabled { color: var(--muted); }
.stepper .val { flex: 1; text-align: center; font-weight: 800; font-size: 17px; }
.sf-result { margin-top: 12px; font-size: 14.5px; }
.sf-result .leg-plan {
  display: flex; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--card-2); margin-top: 6px; align-items: center;
  flex-wrap: wrap;
}
.sf-result .leg-plan .seats { font-weight: 800; margin-left: auto; color: var(--brand); overflow-wrap: anywhere; text-align: right; }
.sf-result .leg-plan .seats.standing { color: var(--warn); }

/* ---------- quota view ---------- */
.quota-stop { display: flex; gap: 12px; align-items: stretch; }
.quota-stop .rail { width: 16px; flex: none; display: flex; flex-direction: column; align-items: center; }
.quota-stop .rail .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--card); border: 3px solid var(--brand); flex: none; margin-top: 3px; z-index: 2; }
.quota-stop .rail .bar { width: 5px; flex: 1; border-radius: 3px; background: var(--line); min-height: 30px; }
.quota-stop .rail .bar.free { background: var(--seat-free); }
.quota-stop .rail .bar.exhausted { background: var(--seat-taken); }
.quota-stop .rail .bar.paidOnly { background: var(--seat-taken); }
.quota-stop .rail .bar.past { background: var(--muted); opacity: .4; }
.quota-stop .rail .bar.pending { background: repeating-linear-gradient(180deg, var(--line) 0 6px, transparent 6px 12px); }
.quota-stop .body { padding-bottom: 14px; min-width: 0; flex: 1; }
.quota-stop .stop-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.quota-leg-state { font-size: 13px; font-weight: 600; margin: 6px 0 0; display: inline-flex; align-items: center; gap: 6px; border-radius: 7px; padding: 3px 9px; }
.quota-leg-state.free { background: var(--ok-soft); color: var(--ok); }
.quota-leg-state.exhausted, .quota-leg-state.paidOnly { background: var(--bad-soft); color: var(--bad); }
.quota-leg-state.unknown { background: var(--card-2); color: var(--muted); }
.quota-leg-state.past { background: var(--card-2); color: var(--muted); }
.quota-leg-state.pending { background: var(--card-2); color: var(--muted); }

.quota-summary .big-line { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.quota-summary ul { margin: 8px 0; padding-left: 20px; font-size: 14.5px; }
.savings-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ok-soft); color: var(--ok);
  font-weight: 800; font-size: 14px;
  padding: 6px 14px; border-radius: 999px;
}

/* ---------- progress / loaders ---------- */
.loader-box { text-align: center; padding: 34px 18px; }
.spinner {
  width: 38px; height: 38px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track {
  max-width: 420px; margin: 14px auto 0;
  background: var(--card-2); border-radius: 999px; height: 9px; overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); width: 0; transition: width .3s; border-radius: 999px; }
.loader-msg { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

.skeleton-card {
  height: 92px; border-radius: var(--r-lg); margin-bottom: 12px;
  background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

/* ---------- modal / bottom sheet ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 14, 26, .55);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  width: min(480px, calc(100vw - 28px));
  max-height: 84vh; overflow-y: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
@media (max-width: 560px) {
  .modal-overlay.open { align-items: flex-end; }
  .modal {
    width: 100vw; border-radius: 20px 20px 0 0;
    max-height: 86vh;
    animation: sheet-up .22s ease-out;
  }
  .modal-body { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .6; } }
.modal-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 18px; flex: 1; min-width: 0; }
.modal-body { padding: 14px 18px 22px; }
.leg-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.leg-row:last-child { border-bottom: none; }
.leg-row .st { font-weight: 800; white-space: nowrap; }
.leg-row .st.free { color: var(--ok); }
.leg-row .st.taken { color: var(--bad); }
.leg-row .st.unknown { color: var(--muted); }
.attr-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.attr-tags span {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--card-2); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px;
}

/* ---------- misc ---------- */
.empty-box { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-box svg { width: 44px; height: 44px; margin-bottom: 10px; opacity: .5; }
.footnote { color: var(--muted); font-size: 12.5px; margin: 14px 4px; text-align: center; }
.footnote a { color: var(--muted); }

.back-fab { display: inline-flex; align-items: center; gap: 6px; }

::-webkit-scrollbar { height: 8px; width: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 560px) {
  .page { padding: 12px 10px 80px; }
  .card { padding: 15px 14px; }
  .conn-times .t { font-size: 19px; }
  .title-lg { font-size: 19px; }
}

/* ============================================================
   v2 — occupancy overhaul, composition, seatfinder, helpers
   ============================================================ */

/* tiny pulsing dot for live/loading states */
.dotpulse { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--accent); margin-right:6px; vertical-align:middle; animation:pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:.3; } 50% { opacity:1; } }

/* autocomplete states */
.suggest-empty { padding:14px; color:var(--muted); font-size:14.5px; display:flex; align-items:center; }
.suggest-skeleton { display:flex; align-items:center; gap:10px; padding:13px 14px; border-bottom:1px solid var(--line); }
.suggest-skeleton:last-child { border-bottom:none; }
.sk-dot { width:16px; height:16px; border-radius:50%; flex:none; }
.sk-bar { height:12px; border-radius:6px; }
.sk-shimmer { background:linear-gradient(90deg, var(--card-2) 25%, var(--line) 50%, var(--card-2) 75%); background-size:200% 100%; animation:shimmer 1.2s infinite; }

/* connection detail: per-train action group */
.seg-train-block { padding: 2px 0; }
.seg-actions { display:flex; gap:8px; flex-wrap:wrap; margin:9px 0 2px; }
.seg-actions .btn { flex:1 1 auto; min-width:140px; }
.plat.changed { color:var(--bad); font-weight:700; }

/* SeatFinder card (collapsed by default, low barrier) */
.sf-card .collapse-head { width:100%; }
.collapse-head .grow { flex:1; }
.mini-label { font-size:11.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin:0 0 6px 2px; }
.sf-grid { display:grid; grid-template-columns:1fr 1.4fr; gap:14px; align-items:start; }
@media (max-width:520px) { .sf-grid { grid-template-columns:1fr; } }

/* train composition strip */
.train-map-card { padding:12px 14px; }
.tm-title { font-size:12.5px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:9px; }
.tm-hint { font-weight:600; text-transform:none; letter-spacing:0; color:var(--muted); }
.train-map { display:flex; gap:7px; overflow-x:auto; padding-bottom:4px; }
.tm-wagon { position:relative; flex:0 0 auto; width:42px; height:48px; border-radius:10px; border:2px solid var(--line); background:var(--card-2); cursor:pointer; overflow:hidden; display:flex; align-items:center; justify-content:center; transition:transform .1s; }
.tm-wagon:hover { transform:translateY(-2px); }
.tm-wagon .tm-fill { position:absolute; left:0; right:0; bottom:0; height:0; background:color-mix(in srgb, var(--seat-free) 42%, transparent); transition:height .35s; }
.tm-wagon .tm-num { position:relative; font-weight:800; font-size:14px; color:var(--ink); }
.tm-wagon .tm-r { position:absolute; top:2px; right:4px; font-size:9px; font-weight:800; color:var(--accent); line-height:1; }
.tm-wagon.cls-1, .tm-wagon.cls-mix { border-color:var(--gold); }
.tm-wagon.active { outline:3px solid color-mix(in srgb, var(--brand) 55%, transparent); border-color:var(--brand); }

/* sticky class/legend toolbar */
.seat-toolbar { position:sticky; top:calc(var(--topbar-h) + env(safe-area-inset-top,0px) + 1px); z-index:50; display:flex; align-items:center; gap:12px; padding:10px 14px; margin-bottom:10px; flex-wrap:wrap; }
.sq-gold { background:transparent !important; border:2px solid var(--gold); width:11px !important; height:11px !important; }

/* wagon drawing holder (fit-to-width, no horizontal scroll) */
.wagon-holder { overflow:hidden; border-radius:var(--r-md); background:var(--card-2); border:1px solid var(--line); padding:8px; }
.wagon-holder svg { display:block; margin:0 auto; }
.badge-gold { background:var(--gold); color:#fff; }
.svgPlace rect { transition: stroke .15s; }

.wagon-loading { display:flex; align-items:center; gap:8px; padding:30px 18px; color:var(--muted); font-size:14px; justify-content:center; }

/* ============================================================
   v3 — occupancy redesign, scanning clues, composition direction
   ============================================================ */

/* occupancy page uses (almost) the whole display so the wagon is large */
.occ-page { max-width: min(1500px, 97vw); margin: 0 auto; padding: 16px 14px 90px; }

/* wagon drawing on a theme-aware "blueprint" surface (recoloured for dark mode) */
.wagon-holder {
  position: relative;
  overflow-x: hidden; overflow-y: hidden;
  border-radius: var(--r-md);
  background: var(--wagon-surface);
  border: 1px solid var(--wagon-edge);
  box-shadow: inset 0 1px 4px rgba(16,32,64,.08);
  padding: 10px;
}
.wagon-dir {
  position: absolute; top: 8px; right: 10px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  background: color-mix(in srgb, var(--brand) 92%, #000); color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  text-transform: uppercase;
}
.wagon-dir-arrow { font-size: 15px; line-height: 1; }
.sq-chair { background: rgba(8,18,38,.42); border: 1px solid var(--line); width: 13px !important; height: 13px !important; }
html[data-theme="dark"] .sq-chair { background: rgba(174,187,212,.5); }
.wagon-holder.scrolls { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wagon-card { background: var(--card); }

/* per-seat loading pulse while a train is still being scanned */
@keyframes seatpulse { 0%,100% { opacity: .85; } 50% { opacity: .35; } }
.svgPlace .seat-pending { animation: seatpulse 1.1s ease-in-out infinite; }

/* prominent scanning banner inside the summary / quota card */
.scan-banner {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 10px;
  align-items: center;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 12px; margin: 10px 0;
}
.scan-banner .dotpulse { grid-row: 1 / span 2; width: 11px; height: 11px; }
.scan-banner .scan-text { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.scan-track { grid-column: 2; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.scan-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .35s; }

/* train composition: direction of travel */
.tm-dir { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); margin: 2px 0 10px; flex-wrap: wrap; }
.tm-dir svg { width: 18px; height: 18px; color: var(--brand); }
.tm-dir b { color: var(--ink); }
.tm-arrow { color: var(--accent); font-weight: 800; font-size: 16px; }
.tm-foot { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* seatfinder intro line */
.sf-intro { font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; }

/* pulse the search button when a route is prefilled from favourites/recents */
@keyframes btnpulse { 0%,100% { box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); } }
.btn-primary.pulse { animation: btnpulse .7s ease-in-out 2; }

/* ============================================================
   v4 — mobile occupancy: sticky switcher, compact controls, sheets
   ============================================================ */
.occ-stickynav {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top,0px)); z-index: 55;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  margin: -4px -10px 10px; padding: 8px 10px 0;
  border-bottom: 1px solid var(--line);
}
.strip-row { display: flex; align-items: stretch; gap: 6px; }
.strip-row .train-map { flex: 1; min-width: 0; margin: 0; }
.navarrow {
  flex: none; width: 34px; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 10px; font-size: 22px; line-height: 1; font-weight: 700; color: var(--brand);
  cursor: pointer;
}
.navarrow:disabled { opacity: .35; }
.ctrl-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.ctrl-row .chips .chip { padding: 6px 11px; font-size: 13px; }
.pill-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); background: var(--card-2); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.pill-btn svg { width: 15px; height: 15px; }
.mini-occ { display: inline-flex; width: 40px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line); }
.mini-occ i { height: 100%; display: block; }
.scan-line { height: 3px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 2px 0 8px; }
.scan-line-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .35s; }

/* bottom sheets */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,14,26,.5);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; max-height: 82vh; overflow-y: auto;
  padding: 0 18px calc(22px + env(safe-area-inset-bottom,0px));
  box-shadow: var(--shadow-lg); animation: sheet-up .22s ease-out;
}
.sheet-grab { position: sticky; top: 0; background: var(--card); padding: 12px 0 8px; cursor: pointer; }
.sheet-grab::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto; }
.sheet-body { padding-bottom: 8px; }
.pill-btn.icon-only { padding: 7px 10px; }
.pill-btn.icon-only svg { width: 17px; height: 17px; }
.sheet-body h3 svg { width: 22px; height: 22px; vertical-align: -4px; }
.ctrl-row .chips { flex-wrap: nowrap; }

/* compact occupancy/quota header on phones — the From→To line was too tall */
@media (max-width: 760px) {
  .occ-page .results-head, .page .results-head { margin-bottom: 8px; gap: 6px; }
  .occ-page .results-head .route-line b { font-size: 15.5px; line-height: 1.2; }
  .occ-page .results-head .route-line span {
    font-size: 12px; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .occ-page .results-head .icon-btn { width: 34px; height: 34px; }
  .occ-page .results-head .icon-btn svg { width: 19px; height: 19px; }
}

/* SeatFinder result bar (mobile) + highlighted seats */
.sf-bar { position: relative; }
.sf-bar-close { position: absolute; top: 8px; right: 8px; border: none; background: var(--card-2); border-radius: 50%; width: 28px; height: 28px; font-size: 15px; cursor: pointer; color: var(--ink-2); }
.svgPlace .seat-shape.sf-hit { filter: drop-shadow(0 0 3px rgba(124,58,237,.9)); }

/* ============================================================
   v5 — rebrand hero (train.sk) + help link
   ============================================================ */
.hero { text-align: center; margin: 6px 2px 18px; }
.hero-graphic { max-width: 460px; margin: 0 auto 6px; }
.hero-h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.hero-h1 .q { color: var(--accent); }
.hero-sub { color: var(--ink-2); font-size: 15px; margin: 7px auto 14px; max-width: 540px; }
.hero-sub b { color: var(--ink); }
.hero-feats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.feat {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--shadow);
}
.feat-link { text-decoration: none; color: var(--brand); }
.feat-link svg { width: 15px; height: 15px; }
.feat-link:hover { border-color: var(--brand); }
@media (max-width: 560px) {
  .hero-h1 { font-size: 22px; }
  .hero-sub { font-size: 14px; }
  .hero-graphic { max-width: 320px; }
}
/* hide the playful tagline in the topbar on very narrow screens */
@media (max-width: 380px) { .brand-tag { display: none; } }
