/* ---------- panel tab strip ---------- */
.ptabs { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.ptabs[hidden] { display: none; }
.ptabs button { border: 0; background: none; padding: 8px 10px 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9em; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ptabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- interval schedule ---------- */
.sg { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.sg:first-child { padding-top: 0; }
.sg:last-child { border-bottom: 0; padding-bottom: 0; }
.sg-head { display: flex; gap: 10px; align-items: center; }
.sg-dir { font-weight: 700; }
.sg-span { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0; font-size: .85em; color: var(--muted); }
.sg-span b { color: var(--text); font-variant-numeric: tabular-nums; }
.segs { list-style: none; margin: 0 0 10px; padding: 0; background: var(--surface-2); border-radius: 10px; }
.segs li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: .92em; }
.segs li:last-child { border-bottom: 0; }
.seg-t { font-variant-numeric: tabular-nums; color: var(--muted); }
.seg-h { font-weight: 600; }
.hchart { margin-top: 4px; --bar: #2a78d6; }
.hbars { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-bottom: 16px; position: relative; border-bottom: 1px solid var(--border); }
.hb { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; cursor: pointer; min-width: 0; }
.hb-bar { width: 100%; background: var(--bar); border-radius: 3px 3px 0 0; transition: opacity .1s; }
:root[data-theme="dark"] .hchart { --bar: #3987e5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hchart { --bar: #3987e5; } }
.hchart:hover .hb-bar { opacity: .45; }
.hchart .hb.on .hb-bar, .hchart .hb:hover .hb-bar { opacity: 1; }
.hb-l { position: absolute; bottom: -16px; left: 0; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.htip { font-size: .8em; min-height: 1.3em; }
.tt { margin-top: 8px; font-size: .9em; }
.tt summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 4px 0; }
.tt table { border-collapse: collapse; width: 100%; margin-top: 4px; }
.tt th { text-align: right; padding: 3px 10px 3px 0; color: var(--muted); font-variant-numeric: tabular-nums; vertical-align: top; width: 2.5em; }
.tt td { padding: 3px 0; font-variant-numeric: tabular-nums; word-spacing: 4px; border-bottom: 1px solid var(--border); }

/* ---------- route planner ---------- */
.rform { position: relative; }
.rf-fields { position: relative; display: flex; flex-direction: column; gap: 6px; padding-right: 38px; }
.rf-row { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 0 4px 0 8px; }
.rf-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; height: 40px; }
.rf-row:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.rf-pick { border: 0; background: none; cursor: pointer; font-size: 18px; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); }
.rf-pick:hover { background: var(--border); color: var(--text); }
.rf-swap { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 15px; }
.rdot { width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; flex-shrink: 0; }
.rdot.from { background: #138a4a; }
.rdot.to { background: #d0021b; }
.rf-sugg { position: absolute; left: 14px; right: 14px; z-index: 5; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; margin-top: 4px; }
.rf-sugg:empty { display: none; }
.sg-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.sg-item:last-child { border-bottom: 0; }
.sg-item:hover { background: var(--surface-2); }
.sg-ic { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.sg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-item .lines { display: flex; gap: 2px; flex-shrink: 0; }
.sg-item .lines .badge { font-size: .68em; }
.rf-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.rf-opts input[type="datetime-local"] { font: inherit; font-size: .9em; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.rf-opts input[hidden] { display: none; }
#rf-results .more { margin: 10px 14px; }
.jlist { display: flex; flex-direction: column; }
.jcard { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.jcard:hover { background: var(--surface-2); }
.jcard.cancelled { opacity: .7; }
.jc-top { display: flex; justify-content: space-between; align-items: center; font-size: 1.05em; font-variant-numeric: tabular-nums; }
.jc-top b { display: inline-flex; align-items: center; gap: 4px; }
.jc-dur { font-weight: 600; }
.jc-legs { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; margin: 6px 0 4px; }
.jc-legs .chev { color: var(--faint); margin: 0 1px; }
.jc-meta { font-size: .82em; }
.jc-best { color: var(--ok); font-weight: 600; }
.chip-walk { display: inline-flex; align-items: center; gap: 1px; color: var(--muted); font-size: .85em; font-weight: 600; }
.icon.walk { width: 16px; height: 16px; stroke-width: 1.8; }
.badge.rail { border-radius: 4px; }
.legs { padding-top: 6px; }
.leg-end { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 6px 0; }
.leg { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 6px 0; }
.leg.walk { color: var(--muted); align-items: center; }
.leg.walk .leg-ic { display: grid; place-items: center; }
.leg-rail { width: 6px; justify-self: center; background: var(--c); border-radius: 3px; }
.leg-body { min-width: 0; }
.leg-stop { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.leg-t { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3em; }
.leg-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; font-size: .92em; }
.leg-stops { margin: 4px 0; font-size: .88em; }
.leg-stops summary { cursor: pointer; color: var(--muted); }
.leg-sub { display: flex; gap: 8px; padding: 2px 0; color: var(--muted); }
.leg.cancelled .leg-body > .leg-stop b { text-decoration: line-through; }
.act.small { padding: 4px 9px; font-size: .8em; margin-top: 6px; }
.rpin span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  color: #fff; font-weight: 800; font-size: 13px;
}
.rpin.from span { background: #138a4a; }
.rpin.to span { background: #d0021b; }
body.picking .leaflet-container { cursor: crosshair; }
.toast {
  position: fixed; z-index: 1300; left: 50%; top: 72px; transform: translateX(-50%);
  background: var(--text); color: var(--surface); border-radius: 12px; padding: 10px 12px 10px 14px;
  box-shadow: var(--shadow); font-size: .9em; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 24px);
}
.toast button { border: 0; background: color-mix(in srgb, var(--surface) 20%, transparent); color: inherit; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.ctx-popup .leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border-radius: 12px; padding: 0; box-shadow: var(--shadow); }
.ctx-popup .leaflet-popup-content { margin: 6px; }
.ctx-popup .leaflet-popup-tip { background: var(--surface); }
.ctx { display: flex; flex-direction: column; gap: 2px; }
.ctx button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: .92em; color: var(--text); }
.ctx button:hover { background: var(--surface-2); }

/* ---------- OSM tracks legend ---------- */
.osm-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8em; color: var(--muted); padding: 2px 0 6px; }
.osm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.osm-legend i { display: inline-block; width: 20px; height: 0; }

/* ---------- chain stores, saved places ---------- */
.poi-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 3px; border-radius: 6px;
  font: 800 10px/1 var(--font); letter-spacing: -.02em; border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); flex-shrink: 0;
}
.poi { display: grid; place-items: center; }
.saved-pin span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 15px;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(0,0,0,.35); color: var(--accent);
}
.place-popup .leaflet-popup-content-wrapper, .place-popup .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.place-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow); }
.place-popup .leaflet-popup-content { margin: 12px; }
.pl-pop { font-size: 13px; line-height: 1.4; min-width: 200px; }
.pl-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.pl-head .faint { font-size: 12px; }
.pl-ic { font-size: 18px; color: var(--accent); }
.pl-oh { font-size: 12px; margin-bottom: 8px; word-break: break-word; }
.pl-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.pl-acts button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 12px; }
.pl-acts button:hover { background: var(--surface-2); }
.pchip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 10px; cursor: pointer; font-size: .85em; color: var(--muted); }
.pchip.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); color: var(--text); font-weight: 600; }
.sg-sub { display: block; font-size: .78em; color: var(--faint); }
.saved-row .sg-ic { color: var(--accent); }
.save-form { display: flex; flex-direction: column; gap: 10px; }
.save-form input { font: inherit; font-size: 16px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }

/* ---------- multi-point routes ---------- */
.rdot.via { background: #2563eb; }
.rpin.via span { background: #2563eb; }
.rf-del { border: 0; background: none; cursor: pointer; font-size: 18px; width: 28px; height: 34px; color: var(--faint); border-radius: 8px; }
.rf-del:hover { color: var(--bad); background: var(--border); }
.rf-stay { display: flex; align-items: center; gap: 8px; font-size: .82em; padding: 0 0 2px 36px; }
.rf-stay select { font: inherit; font-size: .95em; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.rf-tools { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.itin { padding: 4px 0 10px; }
.it-pt { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 10px 14px 4px; }
.it-pt .faint { font-size: .85em; }
.it-leg { margin: 0 14px 0 23px; border-left: 3px dotted var(--border); padding-left: 10px; }
.it-leg .jcard { border: 1px solid var(--border); border-radius: 12px; margin: 4px 0; }
.it-leg .it-alt { margin: 2px 0 6px; }
.it-alts { border-left: 2px solid var(--border); margin: 0 0 8px 4px; padding-left: 8px; }
.it-alts .jcard { padding: 8px 10px; }

/* ---------- account, spotter ---------- */
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.acc-form { display: flex; flex-direction: column; gap: 8px; }
.acc-form input, .spot-form input, .spot-form textarea {
  font: inherit; font-size: 16px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 100%;
}
.acc-form .act.on { align-self: flex-start; }
.acc-err, .spot-msg.err { color: var(--bad); font-size: .85em; }
.spot-msg.ok { color: var(--ok); font-size: .85em; font-weight: 600; }
.spot h3 { margin-bottom: 6px; }
.spot-known { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: .9em; }
.board { display: inline-block; font-weight: 800; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 6px; background: var(--text); color: var(--surface); }
.spot-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.spot-form[hidden] { display: none; }
.spot-num { display: flex; align-items: center; gap: 10px; }
.spot-num input { width: 9em; flex-shrink: 0; font-weight: 700; }
.spot-model { font-size: .82em; }

/* ---------- S-Bahn ---------- */
.badge.sbahn { border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.veh.sbahn .body { border-radius: 6px; min-width: 32px; font-size: 11px; }
.veh.small.sbahn .body { border-radius: 2px; }

/* ---------- mobile "more" menu ---------- */
.show-m { display: none; }
.more { position: relative; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200; min-width: 220px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column;
}
.more-menu[hidden] { display: none; }
.more-menu a, .more-menu button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 0; background: none;
  text-decoration: none; color: var(--text); font: inherit; font-size: .95em; text-align: left; cursor: pointer;
}
.more-menu a:hover, .more-menu button:hover { background: var(--surface-2); }
@media (max-width: 720px) {
  .show-m { display: block; }
}

/* own history next to the board number */
.spot-mine { font-size: .85em; min-height: 1.2em; }
.spot-mine .mine { font-weight: 600; }
.spot-mine .mine.ride { color: var(--ok); }
.spot-mine .mine.seen { color: var(--warn); }
.spot-mine .mine.new { color: #2563eb; }

/* ---------- account button ---------- */
.acc-btn { position: relative; }
.acc-initial {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px;
}
.acc-initial[hidden] { display: none; }
@media (max-width: 720px) {
  .topbar, .tools { gap: 5px; }
  .btn { width: 40px; height: 40px; }
  .search-row { height: 40px; }
}

/* ---------- route button under the search box ---------- */
.left-col { flex: 1; max-width: 400px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.left-col > * { pointer-events: auto; }
.left-col .search { width: 100%; max-width: none; flex: none; }
.route-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border: 0; cursor: pointer;
  border-radius: 99px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font: inherit; font-weight: 600; font-size: .95em;
}
.route-pill:hover { background: var(--surface-2); }
.route-pill.on { background: var(--accent); color: #fff; }
.route-pill .icon { width: 18px; height: 18px; }
.left-col:has(.results:not(:empty)) .route-pill { display: none; }
@media (min-width: 721px) {
  body.panel-open .route-pill { display: none; }
}
@media (max-width: 720px) {
  .left-col { max-width: none; gap: 6px; }
  .route-pill { height: 36px; font-size: .9em; }
}

/* ---------- bottom-left: locate + filters ---------- */
.bottom-left {
  position: fixed; z-index: 900; left: 12px; bottom: 24px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.filter-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 14px; border: 0; cursor: pointer;
  border-radius: 99px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  font: inherit; font-weight: 600; font-size: .95em;
}
.filter-pill:hover { background: var(--surface-2); }
.filter-pill.on { background: var(--accent); color: #fff; }
.filter-pill .icon { width: 18px; height: 18px; }
.filter-pill .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; flex-shrink: 0; }
.filter-pill .pulse.schedule { background: var(--warn); animation: none; }
.filter-pill .pulse.error { background: var(--bad); animation: none; }
.filter-pill.on .pulse { box-shadow: 0 0 0 2px #fff; }
.live-status { font-size: .88em; font-weight: 600; padding: 6px 10px; border-radius: 10px; margin-bottom: 6px; }
.live-status.live { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.live-status.schedule { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.live-status.error { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
@media (max-width: 720px) {
  .bottom-left { left: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); gap: 6px; }
  .filter-pill { height: 40px; font-size: .9em; }
}

/* ---------- language switch ---------- */
.lang-seg button { min-width: 36px; font-weight: 700; }
.m-lang { padding: 4px 6px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
#lang-head .seg { background: var(--surface-2); }

/* ---------- vehicle icon styles ---------- */
/* circle */
.veh.st-circle .body { border-radius: 50%; min-width: 28px; height: 28px; line-height: 24px; padding: 0 3px; }
/* arrow: teardrop pointing in the direction of travel, number upright on top */
.veh.st-arrow .arrow { display: none; }
.veh.st-arrow .pin { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; }
.veh.st-arrow .pin svg { width: 100%; height: 100%; display: block; }
.veh.st-arrow .pin path { fill: var(--c); stroke: var(--surface); stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.veh.st-arrow .body { background: none; border: 0; box-shadow: none; min-width: 0; padding: 0; margin-top: 2px; text-shadow: 0 0 2px rgba(0,0,0,.35); }
/* vehicle pictogram with line tag */
.veh.st-vehicle .body { width: 28px; min-width: 28px; height: 28px; padding: 3px; border-radius: 8px; }
.veh.st-vehicle .body svg { width: 100%; height: 100%; display: block; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.veh.st-vehicle .body svg circle { fill: #fff; stroke: none; }
.veh.st-vehicle .tag {
  position: absolute; left: 50%; top: 50%; margin: 6px 0 0 4px; padding: 0 4px; min-width: 16px; height: 15px; line-height: 13px;
  border-radius: 5px; background: var(--surface); color: var(--c); border: 1.5px solid var(--c); font: 800 10px/13px var(--font); text-align: center; white-space: nowrap;
}
.veh.st-vehicle .ring { margin-top: -18px; }
/* dot: compact marker without number */
.veh.st-dot .body { min-width: 14px; width: 14px; height: 14px; padding: 0; border-radius: 50%; border-width: 2px; }
.veh.st-dot .arrow::before { top: -17px; left: -5px; border-width: 0 5px 7px; }
.veh.small.st-arrow .pin { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
.veh.small.st-arrow .body, .veh.small.st-vehicle .tag, .veh.small.st-vehicle .body svg { display: none; }
.veh.small.st-vehicle .body { width: 12px; min-width: 12px; height: 12px; padding: 0; border-radius: 3px; }
.veh.sel.st-arrow .pin path { stroke: var(--text); stroke-width: 2.5; }
.veh.sel.st-arrow .body { box-shadow: none; }
.veh.sched.st-arrow .pin path { stroke-dasharray: 3 2; }

/* pickers in the filters panel */
.icon-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.icon-picks button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 6px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: .78em;
}
.icon-picks button:hover { background: var(--surface-2); }
.icon-picks button.on { border-color: var(--accent); color: var(--text); font-weight: 600; background: var(--accent-soft); }
.vpv { position: relative; display: block; width: 40px; height: 40px; }
.vpv .veh { position: absolute; left: 5px; top: 5px; width: 30px; height: 30px; }

/* delay shown as a coloured outline instead of a dot */
.veh .vw.ol .body { border-color: var(--dl); border-width: 3px; }
.veh .vw.ol .body { display: flex; align-items: center; justify-content: center; }
.veh.st-arrow .vw.ol .pin path { stroke: var(--dl); stroke-width: 3; }
.veh.st-arrow .vw.ol .body { border: 0; }
.veh.st-dot .vw.ol .body { border-width: 3px; width: 16px; min-width: 16px; height: 16px; }
.veh.st-vehicle .vw.ol .body { padding: 2px; }
.veh.small .vw.ol .body { border-width: 2px; }
.icon-picks button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- my location ---------- */
.me-pin { position: relative; }
.me-dot { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 2px 6px rgba(0,0,0,.35); }
.me-cone {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-origin: 0 0;
}
.me-cone::before {
  content: ""; position: absolute; left: -14px; top: -30px; width: 28px; height: 30px;
  background: radial-gradient(ellipse at 50% 100%, rgba(37,99,235,.45), rgba(37,99,235,0) 70%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* bottom sheet: the part hidden below the screen edge stays reachable by scrolling */
@media (max-width: 720px) {
  .panel-body { padding-bottom: calc(var(--sheet-y, 0px) + 24px + env(safe-area-inset-bottom)); }
}

/* ---------- line variants ---------- */
.variants { display: flex; flex-direction: column; gap: 6px; }
.variant {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.variant:hover { background: var(--surface-2); }
.variant.on { border-color: var(--accent); background: var(--accent-soft); }
.variant .v-main { font-weight: 700; }
.variant .v-sub { grid-column: 1; font-size: .82em; color: var(--muted); }
.variant .v-n { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: .85em; font-weight: 600; white-space: nowrap; text-align: right; }

/* ---------- navigator ---------- */
.nav-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.nav-ic { font-size: 28px; line-height: 1; min-width: 36px; display: grid; place-items: center; }
.nav-ic .badge { font-size: 1.1em; }
.nav-main { flex: 1; min-width: 0; }
.nav-title { font-size: 1.15em; font-weight: 800; line-height: 1.25; }
.nav-sub { margin-top: 4px; color: var(--muted); font-size: .95em; }
.nav-sub b { color: var(--text); }
.nav-hint { margin-top: 6px; font-size: .8em; color: var(--faint); }
.nav-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nav-actions .act[disabled] { opacity: .4; cursor: default; }
.nav-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.nav-steps li { cursor: pointer; font-size: .9em; }
.nav-steps li .badge { font-size: .75em; }
.nav-steps li.done { color: var(--faint); text-decoration: line-through; }
.nav-steps li.cur { font-weight: 700; }

/* ---------- coupling / livery ---------- */
.spot-pair { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.spot-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spot-row .lbl { font-size: .85em; color: var(--muted); min-width: 7.5em; }
.spot-row input { flex: 1; min-width: 7em; max-width: 14em; }
.spot-form .spot-row input, .sp-form .spot-row input { font-size: 16px; padding: 7px 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.spot-row input:disabled { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chips[hidden], .spot-row[hidden] { display: none; }
.pair-sugg { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: .85em; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 3px 10px; cursor: pointer; font: inherit; font-size: .85em; }
.chip-btn:hover { border-color: var(--accent); }
.chip-note { font-size: .8em; }
.spot-mine2 { font-size: .85em; }

/* ---------- chain store pins ---------- */
.poi { display: block; }
.poi-pin {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 6px;
  border-radius: 50% 50% 50% 0; transform: translateX(-50%) rotate(-45deg);
  background: var(--bg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.poi-pin .poi-badge { transform: rotate(45deg); background: none; border: 0; box-shadow: none; color: var(--fg); min-width: 0; height: auto; padding: 0; font-size: 10px; }
.poi.hl .poi-pin { width: 34px; height: 34px; border-width: 2.5px; box-shadow: 0 0 0 3px rgba(208,2,27,.35), 0 3px 8px rgba(0,0,0,.4); }
.poi.hl .poi-pin .poi-badge { font-size: 12px; }
.poi-label {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap;
  font: 700 11px/1.2 var(--font); color: var(--text); background: var(--surface); padding: 1px 6px; border-radius: 6px; box-shadow: var(--shadow);
}

/* ---------- icon size, places panel, bottom pills ---------- */
.veh .vw { transform: scale(var(--vscale, 1)); transform-origin: 50% 50%; }
.vpv .veh .vw { transform: none; }
.size-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .9em; }
.size-row input { flex: 1; accent-color: var(--accent); }
.size-row b { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.brand-search { width: 100%; font: inherit; font-size: 16px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); margin-bottom: 6px; }
.brand-list { display: flex; flex-direction: column; max-height: 46vh; overflow: auto; }
.brand-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .92em; }
.brand-row.on { background: var(--accent-soft); }
.brand-row input { accent-color: var(--accent); width: 16px; height: 16px; }
.brand-row .b-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-row .faint { font-size: .82em; white-space: nowrap; }
.pchip .faint { font-size: .85em; margin-left: 2px; }

/* ---------- vehicle panel: model statistics ---------- */
.models h3 { margin: 0 0 6px; }
.m-known { font-size: .88em; margin-bottom: 8px; }
.m-bars { display: flex; flex-direction: column; gap: 6px; }
.m-row { display: grid; grid-template-columns: minmax(90px, 1.2fr) 2fr 3em; align-items: center; gap: 8px; font-size: .88em; }
.m-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-bar { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.m-bar i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.m-row b { text-align: right; font-variant-numeric: tabular-nums; }
.m-note { font-size: .8em; margin: 8px 0; }
.m-add { display: inline-block; }

/* ---------- mobile: tool buttons stacked in the top-right corner ---------- */
@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .tools { flex-direction: column; gap: 6px; }
}
/* ---------- lines panel ---------- */
.lg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lg-head h3 { margin: 0; flex: 1; }
.lg-head h3 .faint { font-weight: 500; text-transform: none; letter-spacing: 0; }
.lines-group.type-off .grid { opacity: .4; }
/* ---------- independent places ---------- */
.poi-dot {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); font-size: 11px; line-height: 1;
}
/* ---------- search results on the map ---------- */
.sr-stop { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font: 800 12px/1 var(--font); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.sr-list .result { border-bottom: 1px solid var(--border); }
.sr-list .num { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 12px; }
.sr-list .dist { flex: 0 0 auto; margin-left: auto; color: var(--faint); font-size: .82em; white-space: nowrap; }

/* bottom pills always in one row */
.pill-row { flex-wrap: nowrap; }
@media (max-width: 720px) {
  .pill-row { gap: 6px; }
  .filter-pill { padding: 0 12px 0 10px; gap: 6px; }
}
/* trip planner started on board a vehicle */
.chip-on { font-size: .75em; font-weight: 600; color: var(--ok); border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; margin-right: 2px; }
/* opening hours */
.oh-open { color: var(--ok); font-weight: 600; }
.oh-closed { color: var(--bad); font-weight: 600; }
/* the same lines at other times, inside one option */
.jc-more { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; font-size: .82em; }
.jc-time { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 6px; padding: 2px 7px; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
