/*
  Kilometráž – mapa | osa | detail. Hodnoty převzaté z tabulí designového plátna (docs/DESIGN-WEB.md):
  Navrh-Reka-Desktop, Navrh-Reka-Tablet, Navrh-Reka-Mobil, Navrh-Kilometraz-Stavy, Navrh-Detail-Varianty.
  Načítá se jen na stránkách řeky a místa.
*/
:root {
  --km-col: 68px;
  /* velikosti písma – oproti návrhu o 1 px větší (čitelnost, 13. 11. 2026); na monitorech od 1920 px ještě o 1 px u hlavních textů */
  --fs-title: 16px;          /* název místa v seznamu (návrh 15) */
  --fs-title-compact: 15px;  /* kompaktní řádek (návrh 14) */
  --fs-sub: 13px;            /* druhý řádek karty, popisky (návrh 12) */
  --fs-pill: 12px;           /* štítky, kicker, drobné popisky (návrh 11) */
  --fs-km: 16px;             /* kilometr (návrh 15) */
  --fs-unit: 12px;           /* jednotka km (návrh 11) */
  --fs-text: 15px;           /* souvislý text v detailu (návrh 14) */
  --fs-action: 14px;         /* tlačítka, akce, filtry (návrh 13) */
}
@media (min-width: 1920px) {
  :root { --fs-title: 17px; --fs-text: 16px; --fs-action: 15px; }
}
body.app-page { height: 100vh; height: 100dvh; overflow: hidden; }
body.app-page .site-footer { display: none; }
body.app-page main { display: flex; min-height: 0; flex: 1 1 auto; }

.river-app {
  flex: 1 1 auto; min-height: 0; width: 100%; position: relative;
  display: grid; grid-template-columns: minmax(420px, 1fr) var(--list-w) var(--detail-w); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "band band panel" "map axis panel"; /* pás přes mapu i seznam, detail od hlavičky dolů (Navrh-Funkce-Navrh) */
  /* do 1440 px šířky přesně podle návrhu (440 | 420), nad ní plynule roste až do 560 | 600 px (cca 1920 px okna); zbytek dostane mapa */
  --list-w: clamp(440px, 440px + (100vw - 1440px) * .25, 560px);
  --detail-w: clamp(420px, 420px + (100vw - 1440px) * .375, 600px);
}

/* ---------- mapa ---------- */
.ra-map { grid-area: map; position: relative; background: var(--c-map); min-height: 0; overflow: hidden; }
.ra-map-canvas { position: absolute; inset: 0; }
.ra-map-note { padding: 24px; color: var(--c-secondary); }

.map-legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 500; background: #fff; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .16); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  font-size: var(--fs-sub); color: var(--c-text); line-height: 1.3;
}
.map-legend strong { font-size: var(--fs-sub); font-weight: 700; }
.map-legend > span { display: flex; align-items: center; gap: 10px; }
.map-legend .l-short { display: none; }
.sw { display: inline-block; flex-shrink: 0; width: 28px; height: 12px; }
/* v legendě teče proud vodorovně */
.sw.w-lower { background: linear-gradient(180deg, var(--c-dry) 0 4px, var(--c-water) 4px 8px, var(--c-dry) 8px); }
.sw.w-higher { background: linear-gradient(180deg, var(--c-high) 0 4px, var(--c-water) 4px 8px, var(--c-high) 8px); }

/* bod v mapě: ikona v bílém kruhu s černobílým obrysem (tmavý prstenec + bílý lem – vynikne na každém podkladu);
   vybraný: obrys v barvě výběru. Ikona je ve vlastním kruhu .mk – Leaflet obrázkům v mapě ruší padding i šířku. */
.map-marker .mk {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 2px #1c2b2a, 0 0 0 3.5px #fff, 0 1px 6px 2px rgba(0, 0, 0, .3);
}
.leaflet-container .map-marker .mk img { width: 22px; height: 22px; }
.map-marker.hover .mk { box-shadow: 0 0 0 2px var(--c-primary), 0 0 0 3.5px #fff, 0 2px 8px 2px rgba(0, 0, 0, .3); }
.map-marker.selected .mk { width: 38px; height: 38px; box-shadow: 0 0 0 3px var(--c-selected-ring), 0 0 0 4.5px #fff, 0 2px 8px 2px rgba(0, 0, 0, .3); }
.leaflet-container .map-marker.selected .mk img { width: 26px; height: 26px; }
.markers-hidden .map-marker:not(.selected):not(.hover) { display: none; }
.img-missing { visibility: hidden; }


/* ---------- pás nad mapou i seznamem (tabule „Návrh 1 – Funkce nad seznamem“, Navrh-Funkce-Navrh) ---------- */
.ra-band {
  grid-area: band; position: relative; z-index: 1050; min-height: 60px; box-sizing: border-box; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 10px; background: var(--c-band); border-bottom: 1px solid var(--c-band-line); color: #fff;
}
.rb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.rb-tools { margin-left: auto; display: flex; align-items: center; flex-shrink: 0; }
.rb-pop { position: relative; min-width: 0; }
.rb-pop > summary { list-style: none; cursor: pointer; }
.rb-pop > summary::-webkit-details-marker { display: none; }
.rb-range {
  min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 8px; color: #fff;
}
.rb-ico, .rb-chev { display: flex; flex-shrink: 0; }
.rb-range-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-range-km { font-size: 15px; font-weight: 600; white-space: nowrap; }
.rb-range-pop[open] .rb-chev { transform: rotate(180deg); }
.rb-tool { height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 8px; color: #fff; font-size: 15px; font-weight: 700; white-space: nowrap; }
.rb-tool-icon { width: 44px; padding: 0; justify-content: center; }
.rb-range:hover, .rb-tool:hover, .rb-pop[open] > summary { background: rgba(255, 255, 255, .18); }
.rb-tag { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: var(--r-pill); background: #fff4e5; color: #4a3200; font-size: 13px; white-space: nowrap; }
.rb-tag a { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #8a4b00; }
.rb-tag a:hover { background: #ffe6c2; color: #8a4b00; }

/* panel pod položkou (desktop, tablet) – není modální, zavře se klepnutím mimo / Esc (site.js) */
.rb-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 310px; box-sizing: border-box; padding: 8px;
  display: flex; flex-direction: column; gap: 4px; background: #fff; color: var(--c-text); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22), 0 0 0 1px var(--c-line-2); font-size: 15px;
}
.rb-panel-range { left: -10px; right: auto; width: 330px; }
.rb-panel-show:has(.rb-types[open]) { width: 380px; }
.rb-grip, .rb-sheet-title, .rb-close { display: none; }
.rb-panel-head { display: flex; align-items: center; }
.rb-panel-title { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c-muted); }
.rb-form { display: flex; flex-direction: column; gap: 4px; }
.rb-field { display: flex; flex-direction: column; gap: 4px; padding: 4px 10px; }
.rb-field > span { font-size: 13px; color: var(--c-muted); }
.rb-field select {
  height: 44px; padding: 0 10px; border: 1px solid var(--c-node-ring); border-radius: 8px; background: #fff; color: var(--c-text); font: 400 15px var(--font);
}
.rb-field select:focus { outline: none; border: 2px solid var(--c-primary); padding: 0 9px; }
.rb-submit {
  align-self: flex-start; margin: 6px 10px 2px; height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--c-primary); color: #fff; font: 500 14px var(--font); cursor: pointer;
}
html.js .rb-submit { display: none; } /* s JavaScriptem platí volba hned */
.rb-foot-link, .rb-more { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 12px 10px 6px; border-top: 1px solid var(--c-line-card); font-weight: 500; color: var(--c-primary); }
.rb-opt { display: flex; gap: 12px; padding: 10px; border-radius: 8px; color: var(--c-text); }
.rb-opt:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.rb-opt.is-on { background: #e6f2ef; }
.rb-radio { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; border-radius: 50%; box-sizing: border-box; border: 2px solid #9aa8a5; }
.rb-opt.is-on .rb-radio { border-color: var(--c-primary); background: var(--c-primary); box-shadow: inset 0 0 0 3px #fff; }
.rb-opt-text { display: flex; flex-direction: column; gap: 2px; }
.rb-opt-label { font-weight: 500; }
.rb-opt.is-on .rb-opt-label { font-weight: 700; }
.rb-opt-hint { font-size: 13px; color: var(--c-muted); }
.rb-types > summary { list-style: none; cursor: pointer; }
.rb-types > summary::-webkit-details-marker { display: none; }
.rb-types[open] > summary svg { transform: rotate(90deg); }
.rb-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; padding: 4px 10px; }
.rb-check { min-height: 36px; display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.rb-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--c-primary); }
.rb-check-links { display: flex; gap: 20px; padding: 4px 10px 6px; }
.rb-check-links button { padding: 0; border: 0; background: none; color: var(--c-primary); font: 500 14px var(--font); cursor: pointer; }
html:not(.js) .rb-check-links { display: none; }
.rb-link { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 8px; color: var(--c-text); }
.rb-link svg { color: var(--c-primary); flex-shrink: 0; }
.rb-link:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.rb-sep { height: 1px; margin: 4px 8px; border: 0; background: var(--c-line-card); }
.ra-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 3000; padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--c-text); color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}


/* ---------- seznam (osa) ---------- */
.ra-list { display: contents; }
.axis {
  grid-area: axis; border-left: 1px solid var(--c-line); min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 10px 0 96px 4px;
  background: var(--c-list); scrollbar-width: none; /* vybraná karta sahá až k detailu (návrh) – posuvník by ji oddělil */
}
.axis::-webkit-scrollbar { display: none; }
.axis-empty { padding: 24px 12px; color: var(--c-muted); }
.ax-group { position: relative; margin-right: 8px; padding: 0 6px; }
.ax-items { list-style: none; margin: 0; padding: 0; }
.stop { list-style: none; }

/* obec: plocha, název svisle vpravo (víc karet) nebo vodorovně nad kartou (jedna karta) */
.ax-town { background: var(--c-municipality-bg); border-radius: 12px; padding: 6px; }
.ax-town:not(.ax-single) .stop-card { margin-right: 20px; }
.ax-town-name { position: absolute; right: 0; top: 0; bottom: 0; width: 26px; display: flex; align-items: center; justify-content: center; z-index: 3; }
/* u dlouhé obce zůstane název při posunu vidět (sticky), u krátké je uprostřed plochy jako v návrhu */
.ax-town-name span { position: sticky; top: 12px; bottom: 12px; writing-mode: vertical-rl; font-size: var(--fs-sub); font-weight: 700; letter-spacing: .3px; color: var(--c-municipality); white-space: nowrap; }
.ax-single { padding-top: 2px; }
.ax-town-head { height: 24px; display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding-right: 6px; font-size: var(--fs-sub); font-weight: 700; letter-spacing: .3px; color: var(--c-municipality); }
.ax-town-head img { width: 14px; height: 14px; }

/* mezera mezi zastávkami */
.ax-gap { display: grid; grid-template-columns: var(--km-col) 44px minmax(0, 1fr); height: 30px; }
.ax-line { position: relative; }
.ax-line i { position: absolute; top: -4px; bottom: -4px; left: 16px; width: 12px; z-index: 1; }
.ax-dist { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sub); font-weight: 500; color: var(--c-secondary); }

/* karta zastávky: řádek = jedno místo (kilometr · osa s ikonou · obsah) */
.stop-card { display: flex; flex-direction: column; background: #fff; border-radius: var(--r-card); box-shadow: var(--shadow-card); }
/* řádek o 4 px vyšší a s větším odsazením než návrh (56 / 44 px) – kvůli většímu písmu, 13. 11. 2026 */
.pt { display: grid; grid-template-columns: var(--km-col) 44px minmax(0, 1fr); height: 60px; color: inherit; }
.pt:hover { text-decoration: none; color: inherit; }
.pt + .pt { border-top: 1px solid var(--c-line-card); }
.pt.compact { height: 48px; }
.pt-km { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding-right: 8px; }
.pt-km b { font-size: var(--fs-km); font-weight: 700; color: var(--c-text); line-height: 1.15; }
.pt-km small { font-size: var(--fs-unit); color: var(--c-muted); line-height: 1.2; }
.pt-axis { position: relative; }
.ln-in, .ln-out { position: absolute; left: 16px; width: 12px; z-index: 1; }
.ln-in { top: -8px; height: calc(50% + 8px); }
.ln-out { top: 50%; bottom: -8px; }
/* obec s jednou kartou: čára vede i přes vodorovný název nad kartou (odsazení 2 px + název 24 px) */
.ax-single .pt:first-child .ln-in { top: -34px; height: calc(50% + 34px); }
.pt-node {
  position: absolute; z-index: 2; left: 5px; top: 50%; margin-top: -17px; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px var(--c-node-ring); display: flex; align-items: center; justify-content: center;
}
.pt-node img { width: 28px; height: 28px; }
.pt.compact .pt-node { left: 8px; margin-top: -14px; width: 28px; height: 28px; }
.pt.compact .pt-node img { width: 22px; height: 22px; }
.pt-main { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; min-width: 0; }
.pt-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex-grow: 1; }
.pt-title { font-size: var(--fs-title); font-weight: 500; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.pt.compact .pt-title { font-size: var(--fs-title-compact); font-weight: 400; }
.pt-meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sub); color: var(--c-muted); line-height: 1.4; min-width: 0; overflow: hidden; }
.pt-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pt-icons { display: flex; gap: 6px; color: var(--c-icon); flex-shrink: 0; }

.pill { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: var(--fs-pill); font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); line-height: 1.45; white-space: nowrap; }
.pill-ok { color: var(--c-ok-text); background: var(--c-ok-bg); }
.pill-no { color: var(--c-bad-text); background: var(--c-bad-bg); }
.pill-start, .pill-end { color: #fff; background: var(--c-primary); }
.pill-danger { color: #fff; background: var(--c-danger); }

/* najetí myší zvýrazní jen řádek jednoho místa – stejně jako výběr (kliknutí) */
.pt:not(.sel):hover { background: var(--c-hover); box-shadow: inset 0 0 0 2px var(--c-hover-outline); }
.pt:not(.sel):hover .pt-node { box-shadow: 0 0 0 2px var(--c-hover-ring); }
.pt:first-child:hover { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.pt:last-child:hover { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
/* vybrané je jen místo otevřené v detailu – u zastávky s více místy jen jeho řádek */
.pt.sel { position: relative; z-index: 2; background: var(--c-selected); }
.pt.sel:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.pt.sel:last-child { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
.pt.sel + .pt, .pt + .pt.sel { border-top-color: var(--c-selected-line); }
.pt.sel .pt-node { box-shadow: 0 0 0 3px var(--c-selected-ring); }
.stop-card:has(> .pt.sel:only-child) { box-shadow: none; }
/* desktop: vybraná karta přechází do rámečku detailu */
/* (řádek přetéká až k okraji seznamu, obsah zůstává zarovnaný s ostatními kartami – nepřekryje název obce) */
.has-detail .pt.sel { margin-right: -14px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.has-detail .pt.sel .pt-main { padding-right: 26px; }
.has-detail .ax-town:not(.ax-single) .pt.sel { margin-right: -34px; }
.has-detail .ax-town:not(.ax-single) .pt.sel .pt-main { padding-right: 46px; }

/* ---------- pravý panel: detail místa (oranžový rámeček) nebo přehled řeky ---------- */
.ra-panel { grid-area: panel; background: var(--c-page); padding: 10px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.has-detail .ra-panel { background: var(--c-selected); }
.detail { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: #fff; border-radius: 12px; overflow: hidden; }
.d-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.d-scroll > * { flex-shrink: 0; }

.rb {
  width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--c-text); box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
  display: flex; align-items: center; justify-content: center;
}
.rb:hover { color: var(--c-text); background: var(--c-hover); text-decoration: none; }
.d-nav { display: flex; gap: 6px; flex-shrink: 0; }

.d-photo { aspect-ratio: 400 / 236; position: relative; overflow: hidden; background: var(--c-map); }
.d-photo > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.d-photo .d-nav { position: absolute; right: 12px; top: 12px; }
.d-3d {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  background: #fff; border-radius: var(--r-pill); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); color: var(--c-text); font-size: var(--fs-sub); font-weight: 500;
}
.d-3d:hover, .d-3d-link:hover { color: var(--c-text); text-decoration: none; }

.d-head { padding: 14px 20px 4px; display: flex; gap: 10px; align-items: flex-start; }
.detail[data-photo="0"] .d-head { padding: 16px 12px 4px 20px; }
.d-head-text { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.d-kicker { font-size: var(--fs-pill); font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c-primary); }
.d-title { display: flex; align-items: center; gap: 10px; }
.d-title img { width: 34px; height: 34px; flex-shrink: 0; }
.d-title h2 { margin: 0; font-size: 24px; font-weight: 500; color: var(--c-heading); line-height: 1.15; }
.d-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: var(--fs-action); color: var(--c-secondary); }
.d-km { display: flex; align-items: baseline; gap: 4px; }
.d-km strong { font-size: 17px; font-weight: 700; color: var(--c-heading); }
.d-meta .pill { padding: 2px 8px; }

.d-pills { display: none; }
.d-pill {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  background: #fff; color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-line-input); font-size: var(--fs-action); font-weight: 500;
}
.d-pill:hover { color: var(--c-text); text-decoration: none; background: var(--c-hover); }
.d-pill.primary { background: var(--c-primary); color: #fff; box-shadow: none; }

.d-add-photo {
  margin: 14px 16px 0; border: 1.5px dashed var(--c-node-ring); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 14px;
  color: var(--c-label); font-size: var(--fs-sub);
}
.d-add-photo:hover { text-decoration: none; color: var(--c-label); }
.d-add-photo-ico { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--c-input); color: var(--c-muted); display: flex; align-items: center; justify-content: center; }
.d-add-photo > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.d-add-photo strong { font-size: var(--fs-text); font-weight: 500; color: var(--c-text); }
.d-add-photo .link { color: var(--c-primary); font-weight: 500; }
.d-3d-link {
  align-self: flex-start; margin: 12px 16px 0; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r-pill); box-shadow: 0 0 0 1px var(--c-line-input); color: var(--c-text); font-size: var(--fs-sub); font-weight: 500;
}

.d-body { padding: 16px 20px 4px; display: flex; flex-direction: column; gap: 18px; }
.d-body h3, .d-photos h3 { margin: 0; font-size: 17px; font-weight: 500; color: var(--c-heading); }
.d-how { display: flex; flex-direction: column; gap: 12px; }
.d-how-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: start; }
.d-how-grid.no-sketch { grid-template-columns: minmax(0, 1fr); }
.d-sketch { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sub); }
.d-sketch-img { display: block; width: 150px; height: 124px; overflow: hidden; border-radius: 10px; background: #f6f8f7; }
.d-sketch-img img { width: 100%; height: 100%; object-fit: contain; }
.d-pass-list { display: flex; flex-direction: column; gap: 14px; }
.d-pass { display: flex; gap: 10px; }
.d-pass-ico { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.d-pass-ico.down { background: var(--c-ok-bg); color: var(--c-ok-text); }
.d-pass-ico.carry { background: var(--c-carry-bg); color: var(--c-carry-text); }
.d-pass p { margin: 0; font-size: var(--fs-text); line-height: 1.45; color: var(--c-paragraph); }
.d-pass strong { font-weight: 700; color: var(--c-heading); }
.d-about { display: flex; flex-direction: column; gap: 8px; }
.d-text { font-size: var(--fs-text); line-height: 1.55; color: var(--c-paragraph); }
.d-text p { margin: 0 0 .5em; }
.d-text > :last-child { margin-bottom: 0; }
.d-contacts { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-text); }
.d-contacts a { display: flex; align-items: center; gap: 10px; height: 36px; color: var(--c-text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.d-contacts svg { color: var(--c-primary); flex-shrink: 0; }

.d-photos { padding: 14px 16px 0; display: flex; flex-direction: column; gap: 8px; }
.d-photos h3 { margin-left: 4px; }
.d-strip { display: flex; gap: 6px; height: 100px; overflow-x: auto; scrollbar-width: thin; }
.d-strip a { flex-shrink: 0; height: 100%; }
.d-strip img { height: 100%; width: auto; border-radius: 8px; object-fit: cover; }
.d-strip a:has(.img-missing) { display: none; }
.d-photos-foot { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sub); color: var(--c-muted); }
.d-photos-foot a { font-weight: 500; }

.d-actions { display: flex; flex-wrap: wrap; gap: 0 14px; padding: 8px 18px 10px; border-top: 1px solid var(--c-line-card); margin-top: 12px; }
.d-actions a { display: flex; align-items: center; gap: 5px; height: 32px; font-size: var(--fs-action); color: var(--c-label); }
.d-actions a:hover { color: var(--c-primary); text-decoration: none; }

/* lišta úseku dole – stav vody slovy (D4: bez rozlišení lodí) */
.d-section { flex-shrink: 0; border-top: 1px solid var(--c-line); background: var(--c-section-bar); color: var(--c-text); }
.d-section-head { list-style: none; cursor: pointer; padding: 10px 14px 10px 18px; display: flex; align-items: center; gap: 12px; }
.d-section-head::-webkit-details-marker { display: none; }
.d-section-head:hover { background: #eef4f2; }
.d-section-bar { flex-shrink: 0; width: 12px; height: 36px; }
.d-section-name { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.d-section-name small { font-size: var(--fs-pill); color: var(--c-muted); }
.d-section-name span, .d-section-name .d-section-diff { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-section-name span { font-size: var(--fs-text); font-weight: 500; }
.d-section-state { flex-shrink: 0; text-align: right; white-space: nowrap; }
.d-section-state b { font-size: var(--fs-action); font-weight: 700; }
.d-section-chev { flex-shrink: 0; display: flex; color: var(--c-muted); transition: transform .15s; }
.d-section[open] .d-section-chev { transform: rotate(180deg); }
/* rozbalený popis úseku – lišta roste nahoru, detail nad ní se zmenší */
.d-section-more { max-height: min(45vh, 360px); overflow-y: auto; padding: 0 18px 14px 42px; display: flex; flex-direction: column; gap: 8px; }
.d-section-meta { margin: 0; font-size: var(--fs-action); line-height: 1.45; color: var(--c-label); }
.d-section-text { font-size: var(--fs-action); line-height: 1.5; color: var(--c-paragraph); }
.d-section-text p { margin: 0 0 .5em; }
.d-section-text > :last-child { margin-bottom: 0; }
.d-section-graph { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: var(--fs-action); font-weight: 500; }

/* ---------- přehled úseku, dokud není vybrané místo (Navrh-Reka-Tablet, obrazovka 1; i desktop) ---------- */
.overview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: #fff; border-radius: 12px; overflow: hidden; }
.ov-box { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 20px; }
.ov-head { display: flex; flex-direction: column; gap: 4px; }
.ov-head h2 { margin: 0; font-size: 24px; font-weight: 500; color: var(--c-heading); line-height: 1.2; }
.ov-range { display: inline; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ov-range-end { white-space: nowrap; }
.ov-range svg { margin-left: 6px; vertical-align: -1px; color: var(--c-primary); }
.ov-range:hover { color: var(--c-primary); }
.ov-facts { font-size: var(--fs-text); color: var(--c-label); }
.ov-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ov-tile { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 2px 8px; padding: 12px 14px; border-radius: 10px; background: var(--c-page); min-width: 0; }
.ov-tile img { width: 28px; height: 28px; }
a.ov-tile { color: inherit; border: 2px solid transparent; transition: background-color .15s, border-color .15s; }
a.ov-tile:hover { background: var(--c-primary-soft); text-decoration: none; }
a.ov-tile.is-active { border-color: var(--c-primary); background: var(--c-primary-soft); }
.ov-cta { display: flex; align-items: center; gap: 14px; }
.ov-cta .btn { flex-shrink: 0; height: 44px; padding: 0 20px; font-size: 16px; background: #00796b; } /* barva tlačítka starého webu (SaveButton) */
.ov-cta .btn:hover { background: #11907c; }
.ov-cta span { font-size: var(--fs-sub); color: var(--c-muted); line-height: 1.35; }
.ov-tile span, .ov-tile small { grid-column: 1 / -1; }
.ov-tile strong { font-size: 22px; font-weight: 500; color: var(--c-heading); line-height: 1.2; }
.ov-tile span { font-size: var(--fs-sub); color: var(--c-label); overflow: hidden; text-overflow: ellipsis; }
.ov-tile small { font-size: 12px; color: var(--c-ok-text); line-height: 1.3; }
.ov-water { display: flex; flex-direction: column; gap: 12px; }
.ov-water h3 { margin: 0; font-size: 17px; font-weight: 500; color: var(--c-heading); }
.ov-links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: var(--fs-text); }
.ov-links a { display: inline-flex; align-items: center; gap: 6px; }

/* přepínače Seznam | Mapa: tablet nahoře v levém sloupci, mobil plovoucí dole */
.ra-lswitch, .ra-switch { display: none; }
.ra-lswitch { grid-area: lswitch; gap: 2px; margin: 8px 10px; padding: 3px; background: var(--c-list); border-radius: var(--r-pill); }
.ra-lswitch button {
  flex: 1 1 0; height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--c-text); font: 500 14px var(--font); cursor: pointer;
}
.ra-switch button {
  height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 18px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--c-text); font: 500 14px var(--font); cursor: pointer;
}
.ra-lswitch button.active, .ra-switch button.active { background: var(--c-primary); color: #fff; }

/* lišta detailu (tablet, mobil – Navrh-Chovani-Spec); na desktopu tlačítka přes fotku podle Navrh-Reka-Desktop */
.d-bar { display: none; }
.d-arrow {
  width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-line-input); border-radius: 10px; background: #fff; color: var(--c-heading);
}
a.d-arrow:hover { background: var(--c-hover); color: var(--c-heading); text-decoration: none; }
.d-arrow[aria-disabled], .rb[aria-disabled] { color: #b9c4c1; background: #f6f8f7; cursor: default; }
.d-bar-space { flex-grow: 1; }
.d-pill-back, .d-pill-close {
  height: 44px; display: flex; align-items: center; gap: 4px; padding: 0 16px 0 10px; flex-shrink: 0; border-radius: var(--r-pill);
  background: var(--c-list); color: var(--c-heading); font: 500 15px var(--font);
}
.d-pill-back:hover, .d-pill-close:hover { background: #e2ebe8; color: var(--c-heading); text-decoration: none; }

/* ---------- tablet 768–1279 (Navrh-Reka-Tablet): vlevo seznam ⇄ mapa, vpravo detail / přehled úseku ---------- */
@media (max-width: 1279.98px) {
  :root { --km-col: 56px; }
  .river-app { grid-template-columns: 400px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "band panel" "lswitch panel" "view panel"; }
  .axis { border-left: 0; }
  .ra-map, .axis { grid-area: view; }
  .river-app[data-view="map"] .axis, .river-app:not([data-view="map"]) .ra-map { display: none; }
  .ra-panel { border-left: 1px solid var(--c-line); }
  .ra-lswitch { display: flex; }

  .axis { padding-left: 0; }
  .ax-group { margin-right: 0; padding: 0 14px 0 6px; }
  .ax-town { margin-right: 8px; padding: 6px 32px 6px 6px; }
  .ax-town.ax-single { padding: 2px 6px 6px; }
  .ax-town-name { width: 28px; }
  .ax-town:not(.ax-single) .stop-card { margin-right: 0; }
  .has-detail .pt.sel, .has-detail .ax-town:not(.ax-single) .pt.sel { margin-right: 0; }
  .has-detail .pt.sel .pt-main, .has-detail .ax-town:not(.ax-single) .pt.sel .pt-main { padding-right: 12px; }
  .has-detail .pt.sel:first-child { border-top-right-radius: 10px; }
  .has-detail .pt.sel:last-child { border-bottom-right-radius: 10px; }

  .d-bar { display: flex; height: 60px; flex-shrink: 0; align-items: center; gap: 8px; padding: 0 10px; background: #fff; border-bottom: 1px solid var(--c-line-2); }
  .d-pill-back { display: none; }
  .d-nav { display: none; }
  .d-photo { aspect-ratio: auto; height: 190px; }
  .d-head, .detail[data-photo="0"] .d-head { padding: 14px 22px 4px; }
  .d-title h2 { font-size: 22px; }
  .d-pills { display: flex; gap: 8px; padding: 10px 22px 0; overflow-x: auto; scrollbar-width: none; }
  .d-body { padding: 16px 22px 4px; }
  .d-how-grid { grid-template-columns: 130px minmax(0, 1fr); gap: 14px; }
  .d-sketch-img { width: 130px; height: 108px; }
  .d-pass-list { gap: 12px; }
  .d-pass-ico { width: 26px; height: 26px; }
  .d-strip { height: 90px; }
  .d-actions { display: none; }
  .d-section-head { padding: 10px 14px; }
}

/* ---------- mobil < 768 (Navrh-Reka-Mobil): vždy jedna věc; detail přes celou obrazovku ---------- */
@media (max-width: 767.98px) {
  :root { --km-col: 48px; }
  .river-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "band" "view"; }
  .ra-panel { display: none; border-left: 0; }
  .river-app.has-detail .ra-panel { display: flex; grid-area: 1 / 1 / -1 / -1; z-index: 900; padding: 0; background: #fff; } /* pod hlavičkou, ta zůstává (Návrh 1 – Řeka, mobil) */
  .ra-lswitch { display: none; }
  .ra-map .leaflet-control-zoom { display: none; }

  .detail { border-radius: 0; }
  .d-pill-back { display: flex; }
  .d-pill-close { display: none; }
  .d-bar-space { order: 1; }
  .d-arrow { order: 2; }
  .d-photo { height: 170px; }
  .d-head, .detail[data-photo="0"] .d-head { padding: 14px 16px 4px; }
  .d-pills { padding: 10px 16px 0; }
  .d-body { padding: 16px 16px 4px; }
  .d-section { border-radius: 0; }

  .map-legend {
    left: 12px; right: 12px; top: 12px; bottom: auto; box-shadow: 0 2px 10px rgba(0, 0, 0, .16); padding: 10px 12px 8px;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px 2px;
  }
  .map-legend strong { grid-column: 1 / -1; font-size: var(--fs-pill); }
  .map-legend > span { flex-direction: column; gap: 4px; }
  .map-legend .sw { width: 100%; }
  .map-legend .l-long { display: none; }
  .map-legend .l-short { display: block; font-size: 11px; line-height: 1.15; text-align: center; color: var(--c-muted); }

  .ra-switch {
    display: flex; position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 800; gap: 2px;
    padding: 4px; background: #fff; border-radius: var(--r-pill); box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
  }
  .river-app.has-detail .ra-switch { display: none; }
}

/* ---------- pás: tablet a mobil – dvouřádkový (úsek, pod ním Zobrazit · Vzdálenost · ⋮) ---------- */
@media (max-width: 1279.98px) {
  .ra-band { flex-direction: column; align-items: stretch; gap: 0; padding: 8px 6px 2px 14px; }
  .rb-range { margin-left: -10px; }
  .rb-tools { margin-left: -10px; }
  .rb-more-pop { margin-left: auto; }
  .rb-panel { top: calc(100% + 4px); }
  .rb-panel-range { left: 0; }
  .rb-panel-show, .rb-panel-distance { left: 0; right: auto; }
  .ra-lswitch { margin: 8px 10px 6px; }
}
@media (max-width: 767.98px) {
  .ra-band { z-index: 1200; }
  .river-app.has-detail .ra-band { display: none; } /* v detailu pás není (Navrh-Funkce-Navrh) */
  .rb-range-name { font-size: 16px; }
  /* s JavaScriptem panel zespodu se ztmaveným pozadím (pozadí = <details>, klepnutí ho zavře – site.js) */
  html.js .rb-pop[open]::before { content: ""; position: fixed; inset: 0; z-index: 2000; background: rgba(16, 32, 30, .45); }
  html.js .rb-panel, html.js .rb-panel-range, html.js .rb-panel-show:has(.rb-types[open]) {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 2001; width: auto; max-height: 85dvh; overflow-y: auto;
    padding: 8px 8px calc(24px + env(safe-area-inset-bottom)); gap: 2px; border-radius: 18px 18px 0 0; box-shadow: none; font-size: 16px;
  }
  html.js .rb-grip { display: block; align-self: center; flex-shrink: 0; width: 40px; height: 5px; margin-bottom: 6px; border-radius: 3px; background: var(--c-node-ring); }
  html.js .rb-panel-head { padding: 0 4px 6px 12px; }
  html.js .rb-panel-title { display: none; }
  html.js .rb-sheet-title { display: block; flex-grow: 1; font-size: 18px; font-weight: 500; }
  html.js .rb-close {
    height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 14px 0 8px; border: 0; border-radius: var(--r-pill);
    background: var(--c-list); color: var(--c-heading); font: 500 14px var(--font); cursor: pointer;
  }
  html.js .rb-opt { padding: 13px 10px; }
  html.js .rb-link { min-height: 52px; }
  .rb-field select { font-size: 16px; } /* iOS nezvětšuje stránku při výběru */
}

/* ---------- tisk: zobrazený úsek se zvoleným filtrem a vzdáleností (⋮ → Tisk) ---------- */
@media print {
  body.app-page { height: auto; overflow: visible; }
  body.app-page .site-header, .ra-band, .ra-lswitch, .ra-map, .ra-panel, .ra-switch { display: none !important; }
  .river-app { display: block; }
  .axis { overflow: visible; padding: 0; background: none; border: 0; }
  .stop-card { box-shadow: 0 0 0 1px #ccc; break-inside: avoid; }
}
