@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/space-grotesk-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/space-grotesk-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4; }
@font-face { font-family: 'Work Sans'; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/work-sans-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Work Sans'; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/work-sans-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4; }

/* --navy et --amber : couleurs de marque fixes. --surface / --text / --card... : s'adaptent au thème (clair ou sombre). */
:root { color-scheme: light; --navy: #10213B; --amber: #E8A33D; --red: #D64545;
  --bg: #F6F7F9; --card: #fff; --surface: #10213B; --text: #10213B; --muted: #8B93A3; --sub: #6B7280; --body: #565F70; --body2: #2B3748;
  --line: #E3E6EC; --shadow: var(--shadow); --err: #B13434;
  --ok-bg: #E3F5EA; --ok-fg: #1F7A4D; --late-bg: #FCEEE0; --late-fg: #B5781E; --cx-bg: #FBE6E6; --cx-fg: #B13434; }
:root[data-theme="dark"] { color-scheme: dark;
  --bg: #0A1220; --card: #14233A; --surface: #1B3358; --text: #E8EDF5; --muted: #8F9DB3; --sub: #A3B0C4; --body: #B9C4D6; --body2: #D5DDEA;
  --line: #2A3B57; --shadow: #00000066; --err: #FF8A8A;
  --ok-bg: #143B2B; --ok-fg: #5FD39A; --late-bg: #40300F; --late-fg: #F2B65C; --cx-bg: #4A2020; --cx-fg: #FF9A9A; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; overscroll-behavior: none; }
body { font-family: 'Work Sans', system-ui, sans-serif; color: var(--text); }
h1, h2, .grotesk { font-family: 'Space Grotesk', sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
svg:not(.leaflet-zoom-animated) { width: 17px; height: 17px; fill: none; stroke: var(--text); stroke-width: 2; }  /* icônes ; pas la couche de dessin de Leaflet */

#app { max-width: 480px; height: 100dvh; margin: 0 auto; position: relative; overflow: hidden; background: var(--bg); }
.screen { height: 100%; display: flex; flex-direction: column; padding-top: calc(env(safe-area-inset-top) + var(--o, 0px) + var(--a, 0px)); }
body.off { --o: 26px; } body.al { --a: 62px; }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; padding: 18px 20px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }

.dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.star { font-size: calc(22px * var(--fs, 1)); color: var(--amber); line-height: 1; padding: 4px; }

.search-card { background: var(--surface); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.field { position: relative; display: flex; align-items: center; gap: 12px; background: #ffffff14; border-radius: 14px; padding: 12px 14px; }
.field input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: 600 calc(14px * var(--fs, 1)) 'Work Sans', sans-serif; }
.field input::placeholder { color: #ffffff80; font-weight: 400; }
.pt { width: 8px; height: 8px; border-radius: 50%; background: #fff; flex-shrink: 0; }
.pt.sq { border-radius: 2px; background: var(--amber); }
.clear { display: none; width: 22px; height: 22px; border-radius: 50%; background: #ffffff2e; color: #fff; font-size: calc(15px * var(--fs, 1)); line-height: 1; align-items: center; justify-content: center; flex-shrink: 0; }
.field input:not(:placeholder-shown) ~ .clear { display: flex; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; margin: 0; padding: 4px; list-style: none; background: var(--card); color: var(--text); border-radius: 14px; box-shadow: 0 10px 30px #10213b55; max-height: 240px; overflow-y: auto; }
.suggest li { padding: 11px 12px; border-radius: 10px; font-size: calc(14px * var(--fs, 1)); font-weight: 600; }
.suggest li:active, .suggest li.on { background: var(--bg); }
.suggest li small { display: block; font-weight: 400; color: var(--muted); font-size: calc(11.5px * var(--fs, 1)); }
.fields { position: relative; display: flex; flex-direction: column; gap: 12px; }
.fields .field { padding-right: 52px; }
.swap { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: var(--navy); font-size: calc(17px * var(--fs, 1)); font-weight: 700; box-shadow: 0 0 0 4px var(--surface); }
.when { display: flex; gap: 8px; align-items: center; }
.when .field { flex: 1; min-width: 0; padding: 10px 12px; }
.when input { color-scheme: dark; width: 100%; }
.now { color: var(--amber); font-size: calc(12px * var(--fs, 1)); font-weight: 700; padding: 6px 2px; flex-shrink: 0; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.cta { background: var(--amber); color: var(--navy); padding: 12px; border-radius: 14px; font-weight: 700; font-size: calc(14px * var(--fs, 1)); margin-top: 2px; }

.block { display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; justify-content: space-between; align-items: center; }
.block h2 { margin: 0; font: 700 calc(13px * var(--fs, 1)) 'Work Sans', sans-serif; }
.block-head .star { font-size: calc(20px * var(--fs, 1)); }
.label { font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: var(--sub); letter-spacing: .03em; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border-radius: 16px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px var(--shadow); text-align: left; width: 100%; }
.card.cancel .dest { text-decoration: line-through; opacity: .6; }
.time { font: 700 calc(16px * var(--fs, 1)) 'Space Grotesk', sans-serif; min-width: 52px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.mid { flex: 1; min-width: 0; }
.dest { font-weight: 600; font-size: calc(13.5px * var(--fs, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); margin-top: 1px; }
.badge { font-size: calc(11px * var(--fs, 1)); font-weight: 700; padding: 4px 8px; border-radius: 8px; flex-shrink: 0; }
.ok { background: var(--ok-bg); color: var(--ok-fg); } .late { background: var(--late-bg); color: var(--late-fg); } .cx { background: var(--cx-bg); color: var(--cx-fg); }

.res { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 4px var(--shadow); text-align: left; width: 100%; }
.res .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.res .big { font: 700 calc(17px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.res .small { font-size: calc(12.5px * var(--fs, 1)); color: var(--muted); } .res .tr { font-size: calc(11.5px * var(--fs, 1)); color: var(--sub); }
.late-t { color: var(--late-fg); font-size: calc(12px * var(--fs, 1)); }

.alert { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: 0 1px 3px var(--shadow); border-left: 4px solid var(--red); }
.alert b { font-size: calc(13.5px * var(--fs, 1)); display: block; }
.alert p { margin: 4px 0 0; font-size: calc(13px * var(--fs, 1)); color: var(--body); line-height: 1.4; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

.fav { justify-content: space-between; } .fav .name { font-weight: 600; font-size: calc(14px * var(--fs, 1)); flex: 1; text-align: left; }
.x { width: 28px; height: 28px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: calc(16px * var(--fs, 1)); }
.empty { color: var(--muted); font-size: calc(13px * var(--fs, 1)); padding: 6px 2px; }
.err { color: var(--err); font-size: calc(13px * var(--fs, 1)); padding: 6px 2px; }

.stops { background: var(--card); border-radius: 18px; padding: 18px; box-shadow: 0 1px 4px var(--shadow); }
.stop { display: flex; gap: 14px; }
.rail { display: flex; flex-direction: column; align-items: center; width: 14px; }
.rail i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; margin-top: 3px; }
.rail i.first { background: var(--text); }
.rail u { width: 2px; flex: 1; background: var(--line); margin-top: 2px; }
.stop .body { padding-bottom: 20px; flex: 1; }
.stop .body b { font-weight: 600; font-size: calc(13.5px * var(--fs, 1)); } .stop .body div { font-size: calc(12px * var(--fs, 1)); color: var(--muted); margin-top: 2px; }
.stop.cancel b { text-decoration: line-through; }
.stop .body .tr-note { color: var(--ok-fg); font-weight: 600; }
.stop .body .train { color: var(--text); font-weight: 600; }

.ver { text-align: center; color: var(--muted); font-size: calc(11px * var(--fs, 1)); }
.ver a { color: var(--muted); }
.suggest li.info { color: var(--muted); font-weight: 400; }
.suggest li.retry { color: var(--err); }

.search-card .cta { margin-top: 2px; }

.route-alerts { display: flex; flex-direction: column; gap: 10px; }
.route-alerts .label { color: var(--late-fg); }
.route-alerts .none { font-size: calc(12px * var(--fs, 1)); color: var(--muted); }
.route-alerts .alert { display: block; text-align: left; width: 100%; background: var(--card); }
.route-alerts .alert p { -webkit-line-clamp: 2; }
.route-alerts .alert small { display: block; margin-top: 6px; color: var(--muted); font-size: calc(11px * var(--fs, 1)); }
.res-head { display: flex; justify-content: space-between; align-items: center; }
.res-head .star { font-size: calc(20px * var(--fs, 1)); }

/* détail en pleine page */
.back { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: calc(14px * var(--fs, 1)); align-self: flex-start; }
.back svg { width: 16px; height: 16px; stroke-width: 2.4; }
.d-title { font: 700 calc(21px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.d-sub { font-size: calc(13px * var(--fs, 1)); color: var(--muted); margin-top: 2px; }
.d-badge { align-self: flex-start; font-size: calc(12px * var(--fs, 1)); padding: 5px 10px; }
.stop .body b { font-size: calc(14px * var(--fs, 1)); }

/* barre d'onglets */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 20; background: var(--surface); box-shadow: 0 -4px 18px #10213b40; border-radius: 18px 18px 0 0; display: flex; padding: 10px 4px calc(12px + env(safe-area-inset-bottom)); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #ffffff99; font-size: calc(10.5px * var(--fs, 1)); font-weight: 600; position: relative; }
.tab svg { width: 21px; height: 21px; stroke: currentColor; }
.tab.active { color: var(--amber); }
.tab .dot { top: -2px; right: calc(50% - 20px); width: 7px; height: 7px; box-shadow: 0 0 0 2px var(--surface); }

.cta[disabled] { opacity: .6; }

/* tirer pour actualiser */
#ptr { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; z-index: 30; transform: translate(-50%, -60px); opacity: 0; pointer-events: none;
  background: var(--amber); color: var(--navy); font-size: calc(12px * var(--fs, 1)); font-weight: 700; padding: 8px 14px; border-radius: 999px; box-shadow: 0 4px 14px #10213b59; white-space: nowrap; }
#ptr.anim { transition: transform .2s, opacity .2s; }

/* filtre et « voir plus » des départs */
.filter { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 14px; box-shadow: 0 1px 3px var(--shadow); }
.filter svg { width: 16px; height: 16px; stroke: var(--muted); flex-shrink: 0; }
.filter input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 500 calc(14px * var(--fs, 1)) 'Work Sans', sans-serif; }
.filter input::placeholder { color: var(--muted); }
.fclear { display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: calc(15px * var(--fs, 1)); line-height: 1; align-items: center; justify-content: center; flex-shrink: 0; }
.filter input:not(:placeholder-shown) ~ .fclear { display: flex; }
.more { background: var(--card); color: var(--text); font-weight: 700; font-size: calc(14px * var(--fs, 1)); padding: 13px; border-radius: 14px; box-shadow: 0 1px 3px var(--shadow); border: 1.5px solid var(--text); }
.more[disabled] { opacity: .6; }
.hint { text-align: center; color: var(--muted); font-size: calc(11.5px * var(--fs, 1)); }

.geo-msg { font-size: calc(12.5px * var(--fs, 1)); line-height: 1.45; color: #FFE2B0; background: #ffffff14; border-radius: 12px; padding: 10px 12px; }
.geo-msg.err { color: #FFD0D0; background: #D6454540; }

/* cadre de recherche figé en haut (Départs et Itinéraire) : seule la liste dessous défile */
.pinned { position: relative; z-index: 6; flex-shrink: 0; padding: 18px 20px 12px; background: var(--bg); }
.pinned + .scroll { padding-top: 6px; }

/* carte */
.map-wrap { position: relative; flex: 1; margin-bottom: calc(60px + env(safe-area-inset-bottom)); }
#map { position: absolute; inset: 0; background: #E8ECF1; }
.leaflet-container { font-family: 'Work Sans', sans-serif; position: relative; z-index: 0; isolation: isolate; }   /* les couches Leaflet (z-index jusqu'à 1000) restent sous le tiroir */
.map-chip { position: absolute; top: 12px; left: 12px; right: 64px; z-index: 5; background: var(--surface); color: #fff; border-radius: 14px; padding: 10px 14px; font-size: calc(13px * var(--fs, 1)); font-weight: 600; text-align: left; box-shadow: 0 4px 14px #10213b50; }
.map-chip small { font-weight: 400; opacity: .75; }
.map-btn { position: absolute; top: 12px; right: 12px; z-index: 5; width: 42px; height: 42px; border-radius: 14px; background: var(--card); font-size: calc(20px * var(--fs, 1)); box-shadow: 0 4px 14px #10213b40; }
.tm { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 8px #0006; color: #fff; font: 700 calc(10px * var(--fs, 1)) 'Space Grotesk', sans-serif; display: flex; align-items: center; justify-content: center; }
.st-pin { width: 16px; height: 16px; border-radius: 4px; background: var(--amber); border: 3px solid var(--surface); box-shadow: 0 2px 6px #0005; }
.st-tip { background: var(--surface); color: #fff; border: 0; font-weight: 700; font-size: calc(12px * var(--fs, 1)); box-shadow: none; }
.st-tip::before { display: none; }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 12px 14px; font-size: calc(13px * var(--fs, 1)); line-height: 1.5; color: var(--text); }
.pop-st { display: inline-block; font-size: calc(11px * var(--fs, 1)); font-weight: 700; padding: 2px 8px; border-radius: 8px; margin: 2px 0; }
.pop-btn { margin-top: 8px; background: var(--surface); color: #fff; font-weight: 700; font-size: calc(12px * var(--fs, 1)); padding: 8px 12px; border-radius: 10px; width: 100%; }
.dmap { height: 260px; border-radius: 18px; overflow: hidden; box-shadow: 0 1px 4px var(--shadow); flex-shrink: 0; }

/* sous-onglets Départs / Arrivées */
.seg { display: flex; gap: 4px; background: var(--card); border-radius: 14px; padding: 4px; box-shadow: 0 1px 3px var(--shadow); }
.seg-btn { flex: 1; padding: 10px; border-radius: 11px; font-weight: 700; font-size: calc(14px * var(--fs, 1)); color: var(--muted); }
.seg-btn.active { background: var(--surface); color: #fff; }

/* alertes : résumé dans la liste, détail en page */
.chip { display: inline-block; font-size: calc(11px * var(--fs, 1)); font-weight: 700; padding: 4px 10px; border-radius: 8px; }
.chip.cur { background: var(--cx-bg); color: var(--cx-fg); } .chip.plan { background: var(--late-bg); color: var(--late-fg); }
#alerts-list .alert { display: block; width: 100%; text-align: left; }
#alerts-list .alert p { -webkit-line-clamp: 2; }
.al-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.al-top .chip { padding: 3px 8px; font-size: calc(10.5px * var(--fs, 1)); }
.al-date { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.al-more { display: block; margin-top: 8px; font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: var(--text); }
.ad-body { padding: 18px; }
.ad-body p { margin: 0 0 14px; font-size: calc(14px * var(--fs, 1)); line-height: 1.55; white-space: pre-line; color: var(--body2); }
.ad-body p:last-child { margin-bottom: 0; }
.ad-links { display: flex; flex-direction: column; gap: 10px; }
.ad-links a { display: block; text-align: center; background: var(--surface); color: #fff; font-weight: 700; font-size: calc(14px * var(--fs, 1)); padding: 13px 14px; border-radius: 14px; text-decoration: none; }
.ad-links a.alt { background: var(--card); color: var(--text); border: 1.5px solid var(--text); }

/* indicateur « mis à jour il y a … » */
.upd { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); margin-top: 2px; }
.upd:empty { display: none; }
.scroll > .upd { margin: -8px 0 -8px; }

/* réglages (langue, thème) */
.settings { background: var(--card); border-radius: 16px; padding: 6px 14px; box-shadow: 0 1px 3px var(--shadow); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: calc(14px * var(--fs, 1)); font-weight: 600; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.seg.seg-sm { background: var(--bg); padding: 3px; border-radius: 11px; box-shadow: none; gap: 2px; }
.seg-sm button { padding: 7px 13px; border-radius: 9px; font-weight: 700; font-size: calc(12.5px * var(--fs, 1)); color: var(--muted); }
.seg-sm button.active { background: var(--surface); color: #fff; }

/* carte et fenêtres en thème sombre */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.92); }
:root[data-theme="dark"] #map, :root[data-theme="dark"] .dmap { background: #1B2432; }
:root[data-theme="dark"] .leaflet-control-attribution { background: #0A1220cc; color: #8F9DB3; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #B9C4D6; }

/* Favoris : titres de section aux couleurs du cadre bleu */
.fav-h { background: var(--surface); color: #fff; padding: 11px 14px; border-radius: 14px; font-size: calc(13px * var(--fs, 1)); letter-spacing: .05em; display: flex; align-items: center; gap: 10px; }
.fav-h::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; flex-shrink: 0; }
.fav-h.trip::before { border-radius: 2px; background: var(--amber); }

/* menu tiroir (bouton « Menu » en bas à droite de la barre d'onglets) */
.drawer-bg { position: absolute; inset: 0; z-index: 35; background: #000a; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(88%, 360px); z-index: 40; background: var(--bg); display: flex; flex-direction: column;
  border-radius: 22px 0 0 22px; box-shadow: -10px 0 40px #0006; overflow: hidden; transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility .25s; }
.drawer.open { transform: none; visibility: visible; }
.dr-head { background: var(--surface); color: #fff; display: flex; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 16px 18px; flex-shrink: 0; }
.dr-logo { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; box-shadow: 0 2px 8px #0005; }
.dr-title b { display: block; font: 700 calc(21px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.dr-title small { display: block; font-size: calc(12px * var(--fs, 1)); opacity: .75; margin-top: 1px; }
.dr-close { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: #ffffff1f; color: #fff; font-size: calc(20px * var(--fs, 1)); line-height: 1; flex-shrink: 0; }
.dr-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }
.dr-scroll::-webkit-scrollbar { display: none; }
.dr-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--card); color: var(--text); text-decoration: none; border-radius: 16px; padding: 14px; font-weight: 700; font-size: calc(14.5px * var(--fs, 1)); box-shadow: 0 1px 3px var(--shadow); }
.dr-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.dr-item > span { flex: 1; }
.dr-item small { display: block; font-weight: 400; color: var(--muted); font-size: calc(12px * var(--fs, 1)); margin-top: 1px; }
.dr-go { color: var(--muted); font-style: normal; font-size: calc(18px * var(--fs, 1)); }
.dr-about { margin-top: 6px; }
.dr-about p { margin: 8px 0; font-size: calc(13.5px * var(--fs, 1)); line-height: 1.55; color: var(--body); }
.dr-about .dr-author { font-weight: 700; color: var(--text); font-size: calc(14px * var(--fs, 1)); }
.dr-list { margin: 8px 0; padding-left: 18px; font-size: calc(13px * var(--fs, 1)); line-height: 1.5; color: var(--body); }
.dr-list li { margin-bottom: 6px; }
.dr-about .dr-data { font-size: calc(12px * var(--fs, 1)); color: var(--muted); }
.dr-copy { flex-shrink: 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); text-align: center; font-size: calc(12px * var(--fs, 1)); color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); }

/* À propos : bloc repliable */
.dr-chev { display: inline-block; transition: transform .2s; }
.dr-fold[aria-expanded="true"] .dr-chev { transform: rotate(90deg); }
.dr-about-body { padding: 6px 4px 0; }
.dr-about-body > :first-child { margin-top: 6px; }

/* affluence dans le train : 3 barres (1 = faible, 2 = moyenne, 3 = élevée) */
.occ { display: inline-flex; align-items: flex-end; gap: 1px; height: 14px; margin-left: 7px; vertical-align: -2px; }
.occ i { display: block; width: 9px; height: 14px; background: var(--line);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Ccircle cx='5' cy='3' r='2.7'/%3E%3Cpath d='M.6 14v-4.2C.6 7.5 2.4 6.2 5 6.2s4.4 1.3 4.4 3.6V14z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Ccircle cx='5' cy='3' r='2.7'/%3E%3Cpath d='M.6 14v-4.2C.6 7.5 2.4 6.2 5 6.2s4.4 1.3 4.4 3.6V14z'/%3E%3C/svg%3E") center / contain no-repeat; }
.occ-low i:nth-child(-n+1) { background: var(--ok-fg); }
.occ-medium i:nth-child(-n+2) { background: var(--late-fg); }
.occ-high i { background: var(--cx-fg); }
.occ-line { display: flex !important; align-items: center; gap: 6px; font-size: calc(12px * var(--fs, 1)); color: var(--muted); }
.occ-line .occ { margin: 0; }
.occ-chip { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; background: var(--card); border-radius: 10px; padding: 6px 12px; box-shadow: 0 1px 3px var(--shadow); }
.occ-chip .occ { margin: 0; }
.occ-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.occ-legend .occ { margin: 0 5px 0 0; }
.occ-legend span.it { display: inline-flex; align-items: center; }

/* arabe : lecture de droite à gauche, sauf cartes, heures et champs de saisie de gares (noms latins) */
:root[dir="rtl"] .leaflet-container, :root[dir="rtl"] #map { direction: ltr; }
:root[dir="rtl"] input[type="time"], :root[dir="rtl"] input[type="date"] { direction: ltr; text-align: right; }
:root[dir="rtl"] .dr-chev { transform: scaleX(-1); }
:root[dir="rtl"] .dr-fold[aria-expanded="true"] .dr-chev { transform: rotate(90deg); }
:root[dir="rtl"] .big { direction: ltr; unicode-bidi: isolate; }   /* heures toujours lues 10:34 → 10:38 */

/* trajets favoris : prochain train + retour */
.fav .ft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.fav .ft .name { flex: none; }
.fav .next { font-size: calc(12.5px * var(--fs, 1)); color: var(--muted); text-align: left; padding: 2px 0; }
.fav .next b { color: var(--text); }
.fav .next .late-t { color: var(--late-fg); font-weight: 700; }
.fav .next.cx { color: var(--cx-fg); }
.x.ret { margin-right: 6px; color: var(--amber); font-size: calc(15px * var(--fs, 1)); }
.head-btns { display: flex; align-items: center; gap: 2px; }
.res-head .head-btns .star { font-size: calc(20px * var(--fs, 1)); }
/* alertes : filtres */
.al-seg { align-self: flex-start; }
.al-seg button { padding: 7px 14px; }
#alerts .filter { margin-bottom: 2px; }
/* écran de démarrage */
#splash { position: fixed; inset: 0; z-index: 100; background: #10213B; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .4s; }
#splash img { border-radius: 22px; box-shadow: 0 6px 24px #0007; }
#splash b { font: 700 calc(28px * var(--fs, 1)) 'Space Grotesk', sans-serif; letter-spacing: .02em; }
#splash.hide { opacity: 0; pointer-events: none; }

/* partager un trajet / un train */
.share-btn { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--fs, 1)); font-weight: 700; color: var(--text); background: var(--card); border-radius: 10px; padding: 8px 14px; box-shadow: 0 1px 3px var(--shadow); }
.share-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--amber); stroke-width: 2; stroke-linecap: round; }

/* détail : boutons d'action */
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn.alt { color: var(--cx-fg); }
.share-btn:disabled { opacity: .6; }
/* alarme d'arrivée */
.stop .body { position: relative; }
.bell { position: absolute; right: 0; top: -2px; width: 30px; height: 30px; border-radius: 10px; background: var(--card); font-size: calc(14px * var(--fs, 1)); box-shadow: 0 1px 3px var(--shadow); opacity: .75; }
.bell.on { background: var(--amber); opacity: 1; }
.alarm-bar { position: fixed; top: calc(8px + env(safe-area-inset-top) + var(--o, 0px)); left: 10px; right: 10px; max-width: 460px; margin: 0 auto; z-index: 45; background: var(--surface); color: #fff; border-radius: 14px; padding: 10px 12px 10px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px #10213b70; }
.alarm-bar > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: calc(13.5px * var(--fs, 1)); font-weight: 600; }
.alarm-bar small { font-weight: 400; font-size: calc(11.5px * var(--fs, 1)); opacity: .75; }
.alarm-bar button { width: 30px; height: 30px; border-radius: 9px; background: #ffffff2e; color: #fff; font-size: calc(17px * var(--fs, 1)); flex-shrink: 0; }
.alarm-bar.fire { background: var(--amber); color: #10213B; animation: pulse 1s infinite; }
.alarm-bar.fire button { background: #10213b26; color: #10213B; }
@keyframes pulse { 50% { transform: scale(1.025); } }
/* correspondances à risque */
.res .risk { margin-top: 6px; font-size: calc(12px * var(--fs, 1)); font-weight: 600; color: var(--late-fg); background: var(--late-bg); border-radius: 8px; padding: 5px 9px; text-align: left; }
.res .risk.miss { color: var(--cx-fg); background: var(--cx-bg); }
.stop .body .tr-note.warn { color: var(--late-fg); }
/* composition du train */
.comp { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 3px var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.comp .c-t { font-size: calc(12px * var(--fs, 1)); font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.comp .c-s { font-size: calc(13px * var(--fs, 1)); font-weight: 600; }
.strip { display: flex; gap: 2px; height: 30px; }
.cu { min-width: 6px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: calc(11px * var(--fs, 1)); font-weight: 700; overflow: hidden; line-height: 1; }
.cu.c2 { background: var(--line); color: var(--text); }
.cu.c1 { background: var(--amber); color: #10213B; }
.cu.mix { background: linear-gradient(90deg, var(--amber) 50%, var(--line) 50%); color: #10213B; }
.cu.loco { background: var(--surface); color: #fff; }
.c-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.c-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.c-leg i.c1 { background: var(--amber); } .c-leg i.c2 { background: var(--line); }
.comp .c-n { font-size: calc(11px * var(--fs, 1)); color: var(--muted); }
/* accès rapide Maison / Travail */
.quick { display: flex; gap: 8px; }
.q-btn { flex: 1; min-width: 0; text-align: left; background: var(--card); color: var(--text); border-radius: 14px; padding: 10px 12px; box-shadow: 0 1px 3px var(--shadow); display: flex; flex-direction: column; gap: 2px; border: 2px solid transparent; }
.q-btn.main { border-color: var(--amber); }
.q-btn b { font-size: calc(13.5px * var(--fs, 1)); font-weight: 700; }
.q-btn small { font-size: calc(11px * var(--fs, 1)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-fields { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.dr-fields .set-h { font-size: calc(14px * var(--fs, 1)); font-weight: 600; }
.dr-fields .field { background: var(--bg); padding: 10px 12px; }
.dr-fields .field input { color: var(--text); font-size: calc(13.5px * var(--fs, 1)); }
.dr-fields .field input::placeholder { color: var(--muted); }
.dr-fields .clear { background: var(--line); color: var(--muted); }
.dr-fields .fi { font-size: calc(16px * var(--fs, 1)); }
.set-hint { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }

/* fiche gare */
.star.ico { font-size: calc(18px * var(--fs, 1)); }
.si-addr { font-size: calc(13px * var(--fs, 1)); color: var(--body); }
#station-info .label { margin-top: 4px; }
/* récents */
.recent { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.recent .r-t { font-size: calc(11px * var(--fs, 1)); font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.recent .r-c { font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; background: var(--card); border-radius: 999px; padding: 6px 12px; box-shadow: 0 1px 3px var(--shadow); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .r-x { font-size: calc(12px * var(--fs, 1)); color: var(--muted); text-decoration: underline; padding: 4px; }
/* hors-ligne */
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: calc(26px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); background: #5b6475; color: #fff; font-size: calc(12px * var(--fs, 1)); font-weight: 600; display: flex; align-items: center; justify-content: center; }
/* taille du texte */
.fs-seg button:nth-child(1) { font-size: calc(11px * var(--fs, 1)) !important; } .fs-seg button:nth-child(2) { font-size: calc(14px * var(--fs, 1)) !important; } .fs-seg button:nth-child(3) { font-size: calc(17px * var(--fs, 1)) !important; }
/* statistiques */
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.st-tile { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 3px var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.st-tile.wide { grid-column: span 2; }
.st-tile b { font: 700 calc(19px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.st-tile.wide b { font-size: calc(14px * var(--fs, 1)); }
.st-tile small { font-size: calc(11px * var(--fs, 1)); color: var(--muted); }
.st-empty, .st-note { font-size: calc(12px * var(--fs, 1)); color: var(--muted); margin: 6px 0 0; }
.st-reset { margin-top: 8px; font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; color: var(--cx-fg); text-decoration: underline; }

.recent { flex-direction: column; align-items: stretch; gap: 8px; }
.recent .r-h { display: flex; align-items: center; gap: 6px; align-self: flex-start; padding: 2px 0; }
.recent .r-chev { display: inline-block; font-style: normal; color: var(--muted); font-weight: 700; transition: transform .2s; }
.recent .r-h[aria-expanded="true"] .r-chev { transform: rotate(90deg); }
.recent .r-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* jeu d'icônes unique (trait arrondi, comme la barre du bas) */
svg.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex-shrink: 0; }
.star svg.ic { width: 1em; height: 1em; vertical-align: middle; }
.star.on svg.ic { fill: currentColor; }
.star.ico svg.ic { width: 1.15em; height: 1.15em; }
.share-btn svg.ic { width: 16px; height: 16px; stroke: var(--amber); }
.fi svg.ic { width: 18px; height: 18px; stroke: var(--muted); }
.q-btn b { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 5px; }
.q-btn b svg.ic { width: 15px; height: 15px; stroke: var(--amber); }
.bell svg.ic { width: 15px; height: 15px; }
.bell.on svg.ic { stroke: #10213B; }
.al-i { display: flex; flex-shrink: 0; } .al-i svg.ic { width: 20px; height: 20px; stroke: #fff; }
.alarm-bar.fire .al-i svg.ic { stroke: #10213B; }
.cu svg.ic { width: 13px; height: 13px; }
.c-leg svg.ic { width: 13px; height: 13px; }
.risk svg.ic, .tr-note svg.ic { width: 13px; height: 13px; margin-right: 4px; }
.label svg.ic { width: 14px; height: 14px; margin-right: 4px; vertical-align: -.18em; }
.cta svg.ic, .geo-btn svg.ic, #geo svg.ic { width: 16px; height: 16px; stroke: currentColor; margin-right: 4px; }
.res-head .head-btns svg.ic, .x.ret svg.ic { width: 17px; height: 17px; }
.x.ret svg.ic { stroke: var(--amber); }

/* Maison / Travail : le trajet affiché est mis en évidence */
.q-btn.sel { border-color: var(--amber); }   /* fond de carte inchangé, contour jaune */

/* alarme armée : bleu plus clair que le bleu marine du haut ; déclenchée : jaune */
.alarm-bar { background: #2F66A8; }
.alarm-bar.fire { background: var(--amber); }

/* cartes : départ (cible), terminus (drapeau jaune), changement */
.mk-start { width: 22px; height: 22px; box-sizing: border-box; margin: 1px; border-radius: 50%; background: #10213B; border: 5px solid #fff; box-shadow: 0 0 0 2.5px #10213B, 0 2px 8px #0006; }
.mk-end { width: 28px; height: 28px; box-sizing: border-box; border-radius: 6px; background: #E8A33D; border: 2.5px solid #10213B; box-shadow: 0 2px 8px #0006; display: flex; align-items: center; justify-content: center; }
.mk-end svg { width: 20px; height: 20px; }
.mk-change { width: 16px; height: 16px; margin: 4px; box-sizing: border-box; border-radius: 50%; background: #E8A33D; border: 3px solid #10213B; box-shadow: 0 2px 6px #0005; }

/* petites cartes : boutons recentrer / agrandir */
.map-tools { display: flex; flex-direction: column; gap: 8px; margin: 10px 10px 0 0; }
.map-tools button { width: 36px; height: 36px; border-radius: 11px; background: var(--card); color: var(--text); box-shadow: 0 2px 8px #10213b50; display: flex; align-items: center; justify-content: center; }
.map-tools svg.ic { width: 19px; height: 19px; stroke: var(--text); }
.dmap.map-full { position: fixed !important; inset: 0; z-index: 70; height: auto !important; border-radius: 0; box-shadow: none; }
.dmap.map-full .map-tools { margin: calc(10px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 0 0; }

/* prochain train */
.nextbar { width: 100%; text-align: left; background: var(--card); border-radius: 14px; padding: 11px 14px; box-shadow: 0 1px 3px var(--shadow); display: flex; flex-direction: column; gap: 3px; border-left: 5px solid var(--amber); }
.nextbar .nx-h { font-size: calc(11px * var(--fs, 1)); font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 4px; }
.nextbar .nx-h svg.ic { width: 13px; height: 13px; stroke: var(--amber); }
.nextbar .nx-b { font-size: calc(14px * var(--fs, 1)); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.nextbar .nx-b b { font: 700 calc(19px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.nextbar .nx-b .late-t { color: var(--late-fg); font-weight: 700; }
.nextbar .nx-b small { color: var(--muted); font-size: calc(12px * var(--fs, 1)); }
/* comparaison */
.cmp-bar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); color: #fff; border-radius: 12px; padding: 8px 8px 8px 14px; font-size: calc(13px * var(--fs, 1)); font-weight: 600; }
.cmp-go { background: var(--amber); color: #10213B; border-radius: 9px; padding: 7px 14px; font-weight: 700; font-size: calc(13px * var(--fs, 1)); }
.cmp-go:disabled { opacity: .4; }
.res.cmp-sel { outline: 3px solid var(--amber); }
.star.on-mode svg.ic { stroke: var(--text); }
.cmp-grid { display: grid; grid-template-columns: 104px 1fr 1fr; gap: 6px; align-items: stretch; }
.cmp-grid > div { background: var(--card); border-radius: 10px; padding: 9px 10px; font-size: calc(13px * var(--fs, 1)); box-shadow: 0 1px 3px var(--shadow); display: flex; align-items: center; }
.cmp-grid .cl { background: none; box-shadow: none; padding-left: 2px; font-size: calc(11.5px * var(--fs, 1)); font-weight: 700; color: var(--muted); }
.cmp-grid .ch { font-weight: 700; justify-content: center; text-align: center; flex-direction: column; gap: 2px; }
.cmp-grid .best { background: var(--ok-bg); color: var(--ok-fg); font-weight: 700; }
/* suivi de voyage */
.f-card { background: var(--surface); color: #fff; border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.f-card .f-eta { font: 700 calc(28px * var(--fs, 1)) 'Space Grotesk', sans-serif; }
.f-card .f-s { font-size: calc(13px * var(--fs, 1)); opacity: .85; }
.f-card .badge { align-self: flex-start; }
/* alerte : carte */
.ad-maptip { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); margin-top: -6px; }
.mk-alert { width: 18px; height: 18px; margin: 1px; box-sizing: border-box; border-radius: 50%; background: #D64545; border: 3px solid #fff; box-shadow: 0 2px 6px #0006; }

.cmp-grid .cl { overflow-wrap: anywhere; }

/* infobulles */
.tip { position: fixed; z-index: 80; max-width: 240px; background: #10213B; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.3; padding: 7px 11px; border-radius: 9px; box-shadow: 0 4px 14px #0006; pointer-events: none; }
:root[data-theme="dark"] .tip { background: #E8ECF1; color: #10213B; }
button, .bell, .star, .x { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* aide détaillée */
.help-g { background: var(--card); border-radius: 12px; margin-top: 8px; box-shadow: 0 1px 3px var(--shadow); overflow: hidden; }
.help-g summary { list-style: none; cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: calc(13.5px * var(--fs, 1)); display: flex; justify-content: space-between; align-items: center; }
.help-g summary::-webkit-details-marker { display: none; }
.help-g summary::after { content: "›"; color: var(--muted); transition: transform .2s; }
.help-g[open] summary::after { transform: rotate(90deg); }
.help-g ul { margin: 0; padding: 0 14px 12px 30px; font-size: calc(12.5px * var(--fs, 1)); line-height: 1.5; color: var(--body); }
.help-g li { margin-bottom: 6px; }

/* menu tiroir : titres en bleu marine, sous-titres dans une nuance de bleu plus claire */
:root { --dr-sub: #4F7DB4; }
:root[data-theme="dark"] { --dr-sub: #8FB4E6; }
.dr-item small, .dr-fields .set-hint, .dr-about .dr-data { color: var(--dr-sub); }
.dr-item, .dr-fields .set-h { color: var(--text); }

/* copyright en évidence (bas du menu tiroir) */
.dr-copy { font-weight: 500; font-size: calc(13px * var(--fs, 1)); color: var(--text); border-top: 3px solid var(--amber); background: var(--card); }

/* écrire à l'auteur */
.fb-in { width: 100%; box-sizing: border-box; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font: 500 calc(14px * var(--fs, 1)) 'Work Sans', sans-serif; resize: vertical; outline: none; }
.fb-in:focus { border-color: var(--amber); }
.fb-in::placeholder { color: var(--muted); }
.fb-count { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); text-align: right; margin-top: -6px; }
.fb-attach { display: flex; align-items: center; gap: 10px; font-size: calc(13px * var(--fs, 1)); color: var(--body); }
.fb-attach input { width: 18px; height: 18px; accent-color: var(--amber); }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-send:disabled { opacity: .6; }
.fb-status { font-size: calc(13px * var(--fs, 1)); font-weight: 600; min-height: 18px; }
.fb-status.ok { color: var(--ok-fg); } .fb-status.err { color: var(--cx-fg); }
#fb-type button { flex: 1; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: calc(13px * var(--fs, 1)); color: var(--muted); }
#fb-type button.active { background: var(--surface); color: #fff; }

/* « Une idée ? » en évidence en haut du menu tiroir */
.dr-item.dr-hl { border-left: 5px solid var(--amber); background: var(--card); }
.dr-item.dr-hl svg { stroke: var(--amber); }

/* départ / arrivée du formulaire d'itinéraire : mêmes pictogrammes que sur les cartes */
.mk-sm { flex-shrink: 0; box-shadow: none; margin: 0; }
.mk-start.mk-sm { width: 20px; height: 20px; border-width: 5px; margin: 0 1px; }   /* même largeur (22 px) que le drapeau, pour aligner les deux champs */
.mk-end.mk-sm { width: 22px; height: 22px; border-radius: 5px; border-width: 2px; }
.mk-end.mk-sm svg { width: 16px; height: 16px; }

/* train : glissement fluide d'une position à l'autre (pas pendant un zoom) */
.leaflet-map-pane:not(.leaflet-zoom-anim) .leaflet-marker-icon.tm-live { transition: transform 1s linear; }
