:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #0f1b2d;
  --muted: #5d6b80;
  --line: #e2e7ee;
  --accent: #0b5cd5;
  --accent-soft: #e6effc;
  --head: #0b1f3a;
  --ok: #138a4b;
  --warn: #c25a00;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c121b;
    --card: #151d29;
    --text: #e8edf5;
    --muted: #93a1b5;
    --line: #253142;
    --accent: #5b9bff;
    --accent-soft: #1b2a42;
    --head: #070c13;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.top {
  background: var(--head);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.top h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.top .sub { opacity: .7; font-size: 13px; }
.tabs {
  position: sticky; top: 0; z-index: 1100;
  display: flex; background: var(--head); padding: 0 16px; gap: 4px;
}
.tab {
  flex: 1; max-width: 220px; background: none; border: 0; color: #fff; opacity: .65;
  padding: 10px 8px 12px; font-weight: 600; border-bottom: 3px solid transparent;
}
.tab[aria-selected="true"] { opacity: 1; border-bottom-color: #5b9bff; }
.panel { display: grid; gap: 12px; }
.panel[hidden] { display: none; }
.swap-row { display: flex; justify-content: flex-end; margin: -4px 0 6px; }
.swap { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.swap:hover { color: var(--text); border-color: var(--accent); }
.fav .pick { background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; padding: 0 6px; }
.fav .pick:hover { color: var(--text); border-color: var(--accent); }
.fav .name { font-weight: 600; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 40px; display: grid; gap: 12px; }
main > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }

.field { position: relative; margin-bottom: 10px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.opt { font-weight: 400; }
.input-row { display: flex; gap: 6px; }
input[type=text] {
  flex: 1; min-width: 0;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { font: inherit; cursor: pointer; }
.icon {
  width: 42px; flex: none; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); border-radius: 10px; font-size: 18px;
}
.icon:hover { border-color: var(--accent); }
.star.on { color: #e0a800; }

.suggest {
  list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; z-index: 1000;
  left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.suggest:empty { display: none; }
.suggest li { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }
.suggest small { color: var(--muted); display: block; }

.favs { display: flex; flex-wrap: wrap; gap: 6px; }
.fav {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--accent-soft); color: var(--text); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px;
}
.fav .use { background: none; border: 0; color: inherit; padding: 0; }
.fav .x { background: none; border: 0; color: var(--muted); padding: 0 4px; font-size: 14px; }
.fav .to { background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; padding: 0 6px; }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.head-row h2 { margin: 0; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ----- Autour de moi : carte ----- */
.map-card { padding: 10px; }
.map-card .filters { margin-bottom: 8px; }
#map { height: max(380px, calc(100dvh - 300px)); border-radius: 10px; }
.map-card .status { font-size: 13px; margin: 6px 2px 0; }

.stop-pin {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
  color: #fff; font-weight: 800; font-family: system-ui, sans-serif; line-height: 1;
}
.stop-pin.metro { background: #003ca6; font-size: 13px; }
.stop-pin.rer { background: #e3051c; font-size: 9px; border-radius: 7px; }
.stop-pin.tram { background: #00814f; font-size: 12px; }
.stop-pin.bus { background: #6e6e6e; font-size: 10px; }
.stop-pin.other { background: #6e6e6e; }
.me-pin { width: 18px; height: 18px; border-radius: 50%; background: #0b5cd5; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(11,92,213,.25); }

.leaflet-popup-content { margin: 10px 12px; min-width: 230px; font: 14px/1.4 system-ui, sans-serif; }
.pop h3 { margin: 0 0 2px; font-size: 15px; }
.pop .walk { color: #555; font-size: 13px; margin-bottom: 8px; }
.pop .walk b { color: #0b5cd5; }
.pop .rows { display: grid; gap: 5px; max-height: 260px; overflow-y: auto; }
.pop .row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.pop .row .dir { font-size: 13px; color: #333; line-height: 1.25; }
.pop .row .t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop .row .t small { font-weight: 400; color: #777; margin-left: 4px; }
.pop .row .t.soon { color: #138a4b; }
.pop .none { font-size: 12px; color: #777; margin-top: 8px; }
.pop .none summary { cursor: pointer; margin-bottom: 4px; }
.pop .none .badge { opacity: .55; transform: scale(.85); }
.pop .upd { font-size: 11px; color: #999; margin-top: 8px; }
.pop .rt-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #138a4b; margin-left: 3px; vertical-align: middle; }
.here-pop button { font: inherit; border: 0; background: #0b5cd5; color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.status { color: var(--muted); margin: 6px 0; }
.status.err { color: #c62828; }

.stop { border-top: 1px solid var(--line); padding: 10px 0; }
.stop:first-child { border-top: 0; }
.stop-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.stop-name { font-weight: 600; }
.dist { color: var(--muted); font-size: 13px; white-space: nowrap; }
.deps { margin-top: 6px; display: grid; gap: 4px; }
.dep { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.dep.hl { background: var(--accent-soft); border-radius: 8px; margin: 0 -6px; padding: 2px 6px; }
.dir { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.times { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.times .next2 { color: var(--muted); font-weight: 400; margin-left: 6px; }
.times .rt::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-left: 4px; vertical-align: middle; }
.times .imminent { color: var(--ok); }
.empty { color: var(--muted); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px;
  padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 13px; color: #fff; background: #555;
}
.badge.metro { border-radius: 50%; min-width: 26px; width: 26px; height: 26px; }
.badge.rer { border-radius: 6px; }
.mode-ic { font-size: 11px; color: var(--muted); text-transform: uppercase; margin-right: 2px; }

.journey { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.journey-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.journey-head .dur { color: var(--accent); }
.sections { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.sections .walk { color: var(--muted); }
.sections .arrow { color: var(--muted); }
.jdetail { font-size: 13px; margin-top: 8px; line-height: 2; }
.jdetail .badge { height: 20px; min-width: 22px; font-size: 12px; }
.jdetail .badge.metro { width: 20px; min-width: 20px; height: 20px; }
.muted { color: var(--muted); }
.pop .row .t.sched { color: #777; font-weight: 600; }
.pop .row .dir { white-space: normal; overflow: visible; }
.fav-form { margin-top: 6px; }
.fav-add { display: flex; gap: 6px; }
.fav-add input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; }
.fav-add .ok { border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 0 12px; font-weight: 600; }
.fav-add .cancel { border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 10px; width: 38px; }
.fav-msg { font-size: 13px; color: var(--muted); }
.favs:empty { display: none; }
.leg { margin-bottom: 4px; }
.board {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 2px 0 6px 28px; padding: 3px 8px; border-radius: 8px;
  background: var(--accent-soft); font-size: 12.5px; line-height: 1.5;
}
.board .train { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; color: var(--accent); white-space: nowrap; }
.board .train .head { font-size: 10px; margin-right: 1px; }

/* ----- onglet Favoris ----- */
.tab { padding-left: 4px; padding-right: 4px; font-size: 14px; }
.btn { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.form-actions { display: flex; gap: 8px; }
.fav-msg { min-height: 1.2em; margin: 2px 0 8px; }
.fav-msg.err { color: #c62828; }
.fav-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.fav-item:first-child { border-top: 0; }
.fav-item.editing { background: var(--accent-soft); border-radius: 10px; padding: 10px 8px; }
.fav-main { flex: 1; min-width: 0; }
.fav-name { font-weight: 600; }
.fav-addr { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.fav-actions { display: flex; gap: 4px; flex: none; }
.mini { min-width: 32px; height: 32px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; padding: 0 6px; }
.mini:disabled { opacity: .35; cursor: default; }
.mini.danger.confirm { background: #c62828; border-color: #c62828; color: #fff; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.favs .manage { background: none; border: 0; color: var(--accent); font-size: 13px; padding: 4px 6px; }
#favname { width: 100%; }

/* ----- bouton de géolocalisation ----- */
.loc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.locate-btn {
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600;
}
.locate-btn:hover { background: var(--accent); color: #fff; }
.locate-btn:disabled { opacity: .6; cursor: progress; }
.loc-msg { font-size: 12.5px; color: var(--muted); }
.loc-msg.err { color: #c62828; }

/* ----- bouton « 📍 Ici » dans les raccourcis ----- */
.fav.ici { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; padding: 4px 10px; cursor: pointer; }
.fav.ici:hover { background: var(--accent); color: #fff; }
.fav.ici:disabled { opacity: .6; cursor: progress; }
div.loc-msg { margin-top: 4px; }
div.loc-msg:empty { display: none; }
.map-card .status:empty { display: none; }

/* ----- bouton × dans les champs ----- */
.clearable { position: relative; flex: 1; min-width: 0; display: flex; }
.clearable input[type=text] { width: 100%; padding-right: 36px; }
.clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: var(--line); color: var(--muted); font-size: 17px; line-height: 1; padding: 0;
}
.clear-btn:hover { background: var(--muted); color: var(--card); }
.clear-btn[hidden] { display: none; }

/* ----- 4 onglets ----- */
.tab { position: relative; }
.tab-dot { position: absolute; top: 8px; margin-left: 3px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a4f; }
@media (max-width: 480px) { .tab { font-size: 12px; padding: 10px 2px 12px; } .tabs { padding: 0 6px; } }

/* ----- lignes favorites ----- */
.line-sug { display: flex; align-items: center; gap: 8px; }
.line-sug small { color: var(--muted); }
.line-sug em { margin-left: auto; font-size: 12px; color: var(--muted); }
#line-list .fav-item .badge { flex: none; }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* ----- onglet Infos ----- */
.line-card { border: 1px solid var(--line); border-left: 4px solid #2e9d5b; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.line-card.info { border-left-color: #2d7fd3; }
.line-card.disturbed { border-left-color: #ef8a17; }
.line-card.blocking { border-left-color: #d93025; }
.line-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.line-name { font-weight: 700; }
.state { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e3f4e9; color: #1e7a45; white-space: nowrap; }
.state.info { background: #e3eefb; color: #1f5fa8; }
.state.disturbed { background: #fdeedb; color: #a85a00; }
.state.blocking { background: #fbe1df; color: #b3261e; }
.state.err { background: none; color: #c62828; font-weight: 400; }
.disr { border-top: 1px solid var(--line); padding: 6px 0; }
.disr summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; list-style: none; }
.disr summary::-webkit-details-marker { display: none; }
.disr summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.disr[open] summary::after { content: '▴'; }
.disr-title { font-weight: 600; font-size: 14px; }
.pill { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: #fff; background: #2d7fd3; }
.pill.disturbed { background: #ef8a17; }
.pill.blocking { background: #d93025; }
.pill.future { background: var(--line); color: var(--muted); }
.disr-when { font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.disr-text { font-size: 13.5px; line-height: 1.5; }
.extra { margin-top: 6px; font-size: 13px; }
.extra summary { cursor: pointer; color: var(--muted); }
.extra-item { padding: 6px 0; border-top: 1px solid var(--line); }
.lifts { margin-top: 6px; font-size: 13px; color: var(--muted); }
.tabs { padding-top: env(safe-area-inset-top); }

/* =====================================================================
   Responsive
   ===================================================================== */
.panel > * { min-width: 0; }
img, svg { max-width: 100%; }
input, button { touch-action: manipulation; }

/* ----- téléphone ----- */
@media (max-width: 600px) {
  main { padding: 8px 10px 28px; gap: 10px; }
  .panel { gap: 10px; }
  .card { padding: 12px; border-radius: 12px; }
  input[type=text] { font-size: 16px; } /* évite le zoom automatique d'iOS */
  .tabs { padding: 0 4px; gap: 0; }
  .tab { font-size: 12px; padding: 9px 2px 10px; line-height: 1.25; max-width: none; }
  .tab-dot { top: 6px; }
  #map { height: calc(100dvh - 230px); min-height: 320px; border-radius: 8px; }
  .map-card { padding: 8px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 5px 12px; }
  .favs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .favs::-webkit-scrollbar { display: none; }
  .fav { flex: none; }
  .fav-item { flex-wrap: wrap; }
  .fav-main { flex: 1 1 60%; }
  .fav-actions { margin-left: auto; }
  .mini { min-width: 36px; height: 36px; }
  .journey { padding: 9px; }
  .board { margin-left: 0; }
  .line-head { flex-wrap: wrap; }
  .head-row h2 { font-size: 15px; }
  .leaflet-popup-content { min-width: 220px !important; max-width: calc(100vw - 70px); }
}

/* ----- tablette / ordinateur : plus de place ----- */
@media (min-width: 900px) {
  main { max-width: 1100px; }
  .tabs { justify-content: center; }
  .tab { max-width: 220px; }
  /* Autour de moi : champ + favoris à gauche, carte à droite */
  #tab-around:not([hidden]) { display: grid; grid-template-columns: 320px 1fr; align-items: start; }
  #tab-around .map-card { position: sticky; top: 56px; }
  #tab-around #map { height: calc(100dvh - 140px); }
  #tab-around .favs { flex-wrap: wrap; }
  /* Mon trajet et Favoris : formulaire à gauche, résultats à droite */
  #tab-trip:not([hidden]), #tab-favs:not([hidden]) { display: grid; grid-template-columns: 380px 1fr; align-items: start; }
  #tab-favs:not([hidden]) > section:nth-child(1) { grid-column: 1; grid-row: 1; }
  #tab-favs:not([hidden]) > section:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
  #tab-favs:not([hidden]) > section:nth-child(3) { grid-column: 1; grid-row: 2; }
  #tab-trip .card:first-child { position: sticky; top: 56px; }
  #tab-infos { max-width: 820px; margin: 0 auto; width: 100%; }
}
.tab { display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab-lb { position: relative; }
.tab-lb .tab-dot { top: -2px; right: -10px; margin: 0; }
@media (max-width: 600px) {
  .tab { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 7px 2px 8px; white-space: nowrap; }
  .tab-ic { font-size: 17px; line-height: 1; }
}

/* ----- smartphone : textes plus grands ----- */
@media (max-width: 600px) {
  body { font-size: 17px; line-height: 1.45; }
  h2 { font-size: 18px; }
  label { font-size: 15px; }
  input[type=text] { font-size: 17px; padding: 12px 12px; }
  .clearable input[type=text] { padding-right: 40px; }
  .clear-btn { width: 30px; height: 30px; font-size: 20px; }
  .tab { font-size: 13px; }
  .tab-ic { font-size: 20px; }
  .chip { font-size: 15px; padding: 6px 14px; }
  .fav { font-size: 15px; padding: 6px 8px 6px 12px; }
  .fav .pick { font-size: 13px; padding: 2px 8px; }
  .fav.ici { padding: 6px 12px; }
  .suggest li { padding: 10px 12px; font-size: 16px; }
  .suggest small { font-size: 14px; }
  .status, .map-card .status, .fav-msg, .loc-msg { font-size: 15px; }
  .badge { min-width: 32px; height: 28px; font-size: 15px; }
  .badge.metro { width: 30px; min-width: 30px; height: 30px; }
  .btn { font-size: 16px; padding: 11px 18px; }
  .btn.small { font-size: 15px; padding: 6px 12px; }
  .swap { font-size: 15px; padding: 4px 12px; }
  .locate-btn { font-size: 15px; padding: 7px 14px; }

  /* bulle d'arrêt sur la carte */
  .leaflet-popup-content { font-size: 16px; }
  .pop h3 { font-size: 18px; }
  .pop .walk { font-size: 15px; }
  .pop .row .dir { font-size: 15px; }
  .pop .row .t { font-size: 16px; }
  .pop .row .t small { font-size: 13px; }
  .pop .none, .pop .upd { font-size: 13px; }
  .pop .rows { max-height: 45vh; }

  /* itinéraires */
  .journey-head { font-size: 17px; }
  .sections { font-size: 15px; }
  .jdetail { font-size: 15px; line-height: 1.9; }
  .jdetail .badge { height: 24px; min-width: 26px; font-size: 14px; }
  .jdetail .badge.metro { width: 24px; min-width: 24px; height: 24px; }
  .board { font-size: 14.5px; padding: 5px 10px; }

  /* favoris */
  .fav-name { font-size: 17px; }
  .fav-addr { font-size: 14.5px; }
  .tag { font-size: 12px; }
  .mini { min-width: 40px; height: 40px; font-size: 16px; }

  /* infos trafic */
  .line-name { font-size: 18px; }
  .state { font-size: 13.5px; padding: 3px 10px; }
  .disr-title { font-size: 16px; }
  .pill { font-size: 12.5px; padding: 2px 8px; }
  .disr-when { font-size: 14px; }
  .disr-text { font-size: 15.5px; line-height: 1.55; }
  .extra, .lifts { font-size: 14.5px; }
  .empty { font-size: 15px; }
}

/* ----- smartphone : encore plus grand (v2) ----- */
@media (max-width: 600px) {
  body { font-size: 19px; }
  h2 { font-size: 20px; }
  label { font-size: 16px; }
  input[type=text] { font-size: 19px; padding: 14px 14px; border-radius: 12px; }
  .clearable input[type=text] { padding-right: 48px; }
  .clear-btn { width: 36px; height: 36px; font-size: 24px; right: 7px; }
  .tab { font-size: 14px; padding: 8px 2px 9px; }
  .tab-ic { font-size: 24px; }
  .chip { font-size: 17px; padding: 9px 16px; }
  .filters { gap: 6px; }
  .fav { font-size: 17px; padding: 9px 10px 9px 14px; gap: 8px; }
  .fav .pick { font-size: 15px; padding: 5px 11px; }
  .fav.ici { padding: 9px 16px; font-size: 17px; }
  .favs { gap: 8px; }
  .suggest li { padding: 13px 14px; font-size: 18px; }
  .suggest small { font-size: 15px; }
  .status, .map-card .status, .fav-msg, .loc-msg { font-size: 16px; }
  .badge { min-width: 36px; height: 32px; font-size: 17px; }
  .badge.metro { width: 34px; min-width: 34px; height: 34px; }
  .btn { font-size: 18px; padding: 14px 22px; border-radius: 12px; }
  .btn.small { font-size: 16px; padding: 8px 14px; }
  .swap { font-size: 16px; padding: 7px 14px; }
  .locate-btn { font-size: 17px; padding: 10px 16px; }

  .pop h3 { font-size: 20px; }
  .leaflet-popup-content { font-size: 18px; min-width: 250px !important; }
  .pop .walk { font-size: 17px; }
  .pop .row { gap: 10px; }
  .pop .row .dir { font-size: 17px; }
  .pop .row .t { font-size: 18px; }
  .pop .row .t small { font-size: 15px; }
  .pop .none, .pop .upd { font-size: 15px; }
  .here-pop button { font-size: 18px; padding: 10px 14px; }

  .journey-head { font-size: 19px; }
  .sections { font-size: 17px; gap: 8px; }
  .jdetail { font-size: 17px; }
  .jdetail .badge { height: 28px; min-width: 30px; font-size: 16px; }
  .jdetail .badge.metro { width: 28px; min-width: 28px; height: 28px; }
  .board { font-size: 16px; padding: 7px 12px; }

  .fav-name { font-size: 19px; }
  .fav-addr { font-size: 16px; }
  .mini { min-width: 46px; height: 46px; font-size: 19px; border-radius: 10px; }
  .mini.danger.confirm { font-size: 14px; }

  .line-name { font-size: 20px; }
  .state { font-size: 15px; }
  .disr-title { font-size: 18px; }
  .pill { font-size: 14px; padding: 2px 9px; }
  .disr-when { font-size: 15.5px; }
  .disr-text { font-size: 17px; }
  .extra, .lifts, .empty { font-size: 16px; }

  /* contrôles de la carte */
  .leaflet-touch .leaflet-bar a, .leaflet-bar a { width: 48px !important; height: 48px !important; line-height: 48px !important; font-size: 28px !important; }
  .leaflet-touch .leaflet-bar { border-width: 2px; }
  .leaflet-container a.leaflet-popup-close-button { width: 40px; height: 40px; font: 30px/40px system-ui, sans-serif; }
  .leaflet-popup-content-wrapper { border-radius: 14px; }
  .leaflet-tooltip { font-size: 16px; padding: 6px 10px; }
  .me-pin { width: 24px; height: 24px; }
}

/* =====================================================================
   Paramètres (sous-pages) + trajets favoris
   ===================================================================== */
.subtabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 5px; }
.subtab { flex: 1; border: 0; background: none; color: var(--muted); border-radius: 9px; padding: 9px 6px; font-weight: 600; }
.subtab[aria-selected="true"] { background: var(--accent); color: #fff; }
.subpanel { display: grid; gap: 12px; }
.subpanel[hidden] { display: none; }
.subpanel > * { min-width: 0; }

select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
.days { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0 0 12px; }
.days legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.day-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; margin: 0; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; }
.day-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.day-name { flex: 1; }
.day-row input[type=time] { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; color-scheme: light dark; }
.day-row:has(input[type=checkbox]:not(:checked)) input[type=time] { opacity: .45; }
#copy-weekdays { margin-top: 6px; }
.notif-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }

/* Mon trajet : trajets du jour */
.today-trip { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.today-trip:hover { border-color: var(--accent); }
.today-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.today-head .muted { font-size: 13px; }
.today-leave { font-size: 17px; margin: 4px 0; }
.today-leave b { font-size: 22px; color: var(--accent); }
.today-leave .in { color: var(--muted); font-size: 15px; margin-left: 4px; }
.today-leave.soon b, .today-leave.soon .in { color: #ef8a17; font-weight: 700; }
.today-leave.late b { color: #d93025; }
.today-trip .sections .badge { height: 22px; min-width: 24px; font-size: 12px; }
.today-trip .sections .badge.metro { width: 22px; min-width: 22px; height: 22px; }

/* bandeau « il faut partir » */
.leave-banner { position: sticky; top: 52px; z-index: 1050; max-width: 1100px; margin: 8px auto 0; padding: 0 16px; display: grid; gap: 6px; }
.leave-banner[hidden] { display: none; }
.leave-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; font: inherit; border: 0; border-radius: 12px; padding: 10px 14px; background: #ef8a17; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; animation: pp-pulse 2s ease-in-out infinite; }
.leave-item small { display: block; opacity: .9; }
.leave-ic { font-size: 24px; }
@keyframes pp-pulse { 50% { transform: scale(1.01); box-shadow: 0 6px 24px rgba(239,138,23,.6); } }
@media (prefers-reduced-motion: reduce) { .leave-item { animation: none; } }

/* ordinateur : sous-pages en deux colonnes (remplace l'ancienne grille des favoris) */
@media (min-width: 900px) {
  #tab-favs:not([hidden]) { display: block; }
  #tab-favs .subtabs { max-width: 560px; margin: 0 auto 12px; }
  #tab-favs .subpanel:not([hidden]) { display: grid; grid-template-columns: 380px 1fr; align-items: start; }
  #tab-favs .subpanel > section { grid-column: auto !important; grid-row: auto !important; position: static; }
  #sub-lines:not([hidden]) { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; }
}

/* smartphone */
@media (max-width: 600px) {
  .subtab { font-size: 16px; padding: 11px 4px; }
  .day-row { font-size: 18px; padding: 8px 0; }
  .day-row input[type=checkbox] { width: 26px; height: 26px; }
  .day-row input[type=time] { font-size: 18px; padding: 8px 10px; }
  .days legend { font-size: 16px; }
  select { font-size: 18px; padding: 12px; }
  .today-head b { font-size: 19px; }
  .today-head .muted { font-size: 15px; }
  .today-leave { font-size: 18px; }
  .today-leave b { font-size: 26px; }
  .today-leave .in { font-size: 17px; }
  .leave-banner { top: 64px; padding: 0 10px; }
  .leave-item { font-size: 18px; }
}

/* ----- compte ----- */
input[type=email], input[type=password] {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input[type=email]:focus, input[type=password]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.subtab { display: flex; align-items: center; justify-content: center; gap: 6px; }
.acc-intro { margin: -4px 0 12px; font-size: 14px; }
.acc-links { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 12px; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; text-align: left; }
.acc-who { margin: 0 0 4px; overflow-wrap: anywhere; }
.danger-zone { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.danger-zone summary { cursor: pointer; color: #d93025; font-weight: 600; }
.danger-btn { background: #d93025; border-color: #d93025; color: #fff; }
#del-form { margin-top: 8px; }
@media (max-width: 600px) {
  .subtabs { gap: 2px; padding: 4px; }
  .subtab { flex-direction: column; gap: 1px; font-size: 14px; padding: 8px 2px; }
  .sub-ic { font-size: 20px; line-height: 1.1; }
  input[type=email], input[type=password] { font-size: 19px; padding: 14px; border-radius: 12px; }
  .acc-intro { font-size: 16px; }
  .linkbtn { font-size: 17px; padding: 8px 0; }
}

/* =====================================================================
   Écran de connexion + Mon compte
   ===================================================================== */
body.logged-out > .tabs, body.logged-out > main, body.logged-out > .leave-banner { display: none !important; }
body:not(.logged-out) > .auth-screen { display: none; }
.auth-screen { min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center; padding: max(6vh, 24px) 16px 32px; }
.auth-box { width: 100%; max-width: 420px; display: grid; gap: 14px; }
.auth-logo { display: block; margin: 0 auto; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.auth-name { margin: 4px 0 0; text-align: center; font-size: 26px; }
.auth-tag { margin: 0 0 6px; text-align: center; color: var(--muted); }
.auth-box .btn.primary { width: 100%; }
.auth-box .acc-links { align-items: center; }

.acc-home { display: grid; gap: 12px; max-width: 640px; margin: 0 auto; width: 100%; }
.acc-home[hidden] { display: none; }
.profile { display: flex; align-items: center; gap: 14px; }
.avatar { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 24px; font-weight: 700; }
.profile-main { min-width: 0; }
.profile-email { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.profile .hint { margin: 2px 0 0; }
.menu { padding: 4px 0; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.menu-item:first-child { border-top: 0; }
.menu-item:hover { background: var(--accent-soft); }
.mi-ic { font-size: 20px; width: 26px; text-align: center; }
.mi-lb { flex: 1; font-weight: 600; }
.mi-count { min-width: 24px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; text-align: center; }
.mi-count:empty { display: none; }
.mi-go { color: var(--muted); font-size: 22px; line-height: 1; }
.menu-item.logout .mi-lb { color: #d93025; }

.sub-head { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.back-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 26px; line-height: 1; padding-bottom: 3px; }
.back-btn:hover { border-color: var(--accent); }
.sub-title { margin: 0; font-size: 20px; }
.set-title { margin: 0 0 4px; font-size: 16px; }
#sub-settings:not([hidden]) { max-width: 640px; margin: 0 auto; width: 100%; grid-template-columns: 1fr !important; }
#sub-settings .btn { margin-top: 4px; }

@media (max-width: 600px) {
  .auth-name { font-size: 28px; }
  .auth-tag { font-size: 17px; }
  .avatar { width: 60px; height: 60px; font-size: 26px; }
  .profile-email { font-size: 19px; }
  .menu-item { padding: 17px 16px; font-size: 19px; }
  .mi-ic { font-size: 24px; width: 30px; }
  .mi-count { font-size: 15px; }
  .back-btn { width: 46px; height: 46px; font-size: 30px; }
  .sub-title { font-size: 22px; }
  .set-title { font-size: 19px; }
}
/* Visual system — compact, touch-first transit interface. */
:root { color-scheme: light; --bg:#f3f5f3; --card:#fff; --text:#172e32; --muted:#627575; --line:#dfe7e3; --accent:#126957; --accent-soft:#e8f4ed; --head:#102d32; --ok:#18774d; --radius:22px; }
body { font:15px/1.55 'Segoe UI',system-ui,sans-serif; background:var(--bg); }
[hidden] { display:none !important; }
button,a,input,select { -webkit-tap-highlight-color:transparent; }
button { transition:background .18s,border-color .18s,box-shadow .18s; }
button:focus-visible,a:focus-visible,summary:focus-visible { outline:3px solid #16856a; outline-offset:4px; }
button:disabled { cursor:wait; opacity:.55; }
.skip-link { position:fixed; top:-100px; left:16px; z-index:3000; background:var(--head); color:white; padding:12px; border-radius:12px; }
.skip-link:focus { top:12px; }
.app-header { height:88px; max-width:1200px; margin:auto; padding:0 32px; display:flex; align-items:center; justify-content:space-between; }
.brand { display:flex; gap:12px; align-items:center; color:var(--text); text-decoration:none; font-weight:750; letter-spacing:-.7px; font-size:23px; }
.brand-light { font-weight:400; }
.brand-mark { width:42px; height:42px; background:var(--head); color:white; border-radius:14px; display:grid; place-content:center; font-size:32px; line-height:1; position:relative; padding-bottom:5px; }
.brand-mark span { position:absolute; color:#b6ef89; right:7px; bottom:3px; }
.region-label { font-size:10px; font-weight:700; letter-spacing:2px; display:flex; align-items:center; gap:12px; }
.live-dot { width:7px; height:7px; background:#26835c; border-radius:50%; display:inline-block; }
.tabs { position:relative; top:auto; max-width:1136px; margin:0 auto; padding:5px; gap:5px; background:#e7ece7; border-radius:16px; z-index:1100; }
.tab { max-width:none; min-height:48px; border:0; border-radius:12px; opacity:1; color:var(--muted); font-size:13px; padding:10px 16px; gap:9px; }
.tab[aria-selected="true"] { color:var(--text); background:var(--card); box-shadow:0 2px 7px #18342b0b; }
.tab-ic { display:flex; }
.tab-ic svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
main { max-width:1200px; padding:30px 32px 60px; gap:26px; }
.page-intro { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.eyebrow { font-size:10px; letter-spacing:1.8px; font-weight:750; margin:0 0 9px; color:var(--accent); }
.page-intro h1 { font-size:clamp(28px,4vw,42px); line-height:1.15; letter-spacing:-1.6px; margin:0 0 10px; font-weight:700; }
#page-description { color:var(--muted); margin:0; font-size:15px; }
.intro-symbol { display:grid; place-items:center; flex:none; background:#dfeecc; border-radius:50%; width:64px; height:64px; font-size:38px; font-weight:300; }
.panel,.subpanel,.acc-home { gap:20px; }
.card { padding:24px; border-radius:var(--radius); border:1px solid var(--line); box-shadow:0 3px 16px #17352b03; }
h2 { font-size:19px; letter-spacing:-.45px; margin-bottom:18px; }
label { font-size:12px; margin-bottom:8px; }
input[type=text],input[type=email],input[type=password],select { min-height:52px; border-radius:12px; font-size:16px; background:#f6f8f5; padding:13px 14px; border-color:var(--line); }
.field { margin-bottom:18px; }
.clearable { min-width:0; }
.clearable input[type=text] { padding-right:48px; }
.clear-btn { width:44px; height:44px; right:4px; font-size:22px; }
.btn { min-height:46px; border-radius:12px; font-size:14px; padding:11px 16px; font-weight:650; }
.btn.primary { background:var(--head); border-color:var(--head); color:#fff; }
.btn.primary:hover { background:#20504a; }
.main-locate { width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.main-locate span:first-child { font-size:24px; line-height:1; }
.shortcut-label { font-size:10px; letter-spacing:1.5px; font-weight:700; color:var(--muted); margin:25px 0 12px; }
.favs { gap:8px; }
.fav { min-height:44px; border-radius:12px; background:var(--accent-soft); font-size:13px; padding:5px 12px; }
.fav .use,.fav .pick { min-height:34px; }
.fav .pick { padding:0 7px; }
.search-tip { border-top:1px solid var(--line); margin-top:24px; padding-top:18px; display:flex; gap:12px; color:var(--muted); font-size:13px; }
.search-tip > span { font-size:26px; color:var(--accent); }
.search-tip p { margin:0; }
.search-tip strong { color:var(--text); font-weight:650; }
.map-card { padding:20px; overflow:hidden; }
.map-heading { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:16px; }
.map-heading h2 { margin:0; font-size:18px; }
.map-heading .eyebrow { margin-bottom:5px; }
.map-caption { color:var(--muted); font-size:11px; white-space:nowrap; }
.filters { gap:6px; margin-bottom:14px !important; }
.chip { font-size:12px; min-height:40px; padding:8px 15px; border-radius:11px; background:#f6f8f5; }
.chip.on { background:var(--head); border-color:var(--head); }
#map { height:400px; min-height:280px; border-radius:15px; background:#e9eee5; }
.map-card .status:empty { display:none; }
.map-card .status { margin-top:12px; font-size:12px; }
.nearby-card { padding:20px 24px; }
.nearby-stop { width:100%; border:0; border-top:1px solid var(--line); background:none; color:var(--text); padding:15px 0; display:flex; align-items:center; justify-content:space-between; text-align:left; gap:12px; }
.nearby-stop:hover { background:var(--accent-soft); }
.nearby-stop strong { display:block; font-size:14px; margin-bottom:5px; }
.nearby-stop .badge { transform:scale(.85); transform-origin:left; margin-right:2px; }
.nearby-stop .dist { font-size:12px; text-align:right; }
.nearby-stop .dist small { display:block; color:var(--accent); }
.empty { font-size:14px; padding:12px 0; line-height:1.7; }
.journey { padding:20px; border-radius:16px; background:#f8faf7; margin-bottom:14px; }
.journey-head { font-size:18px; }
.jdetail { line-height:1.8; }
.swap,.mini,.back-btn { min-height:44px; min-width:44px; }
.menu-item { min-height:64px; font-size:15px; padding:16px 20px; }
.profile-email { font-size:16px; }
.profile .avatar { background:var(--head); }
.acc-home { max-width:740px; }
.leave-banner { top:12px; }
.auth-screen { padding:38px 20px 60px; min-height:calc(100dvh - 88px); align-items:center; background:radial-gradient(ellipse at 15% 50%,#dfeaDA 0,transparent 55%); }
.auth-box { max-width:440px; gap:14px; }
.auth-logo { width:64px; height:64px; border-radius:18px; box-shadow:none; margin-bottom:8px; }
.auth-eyebrow { text-align:center; margin:0; }
.auth-name { font-size:34px; letter-spacing:-1.3px; line-height:1.15; }
.auth-tag { font-size:15px; line-height:1.6; max-width:340px; margin:0 auto 12px; }
.auth-box .card { padding:28px; }
.acc-intro { font-size:13px; margin-bottom:22px; }
.linkbtn { font-size:13px; min-height:44px; }
.auth-box .acc-links { gap:0; }
body.logged-out .page-intro { display:none; }
.suggest { max-height:280px; overflow:auto; border-radius:14px; z-index:1200; }
.suggest li { min-height:52px; padding:12px; }
@media(min-width:900px) {
 #tab-around:not([hidden]) { grid-template-columns:340px minmax(0,1fr); gap:20px; }
 #tab-around .search-card { grid-column:1; grid-row:1; }
 #tab-around .map-card { grid-column:2; grid-row:1 / span 2; top:20px; }
 #tab-around .nearby-card { grid-column:1; grid-row:2; }
 #tab-around #map { height:480px; }
 #tab-trip:not([hidden]) { grid-template-columns:360px minmax(0,1fr); }
 #today-card { grid-column:1 / -1; position:static !important; }
}
@media(max-width:899px) {
 .app-header { height:72px; padding:0 20px; }
 .brand { font-size:20px; gap:9px; }
 .brand-mark { width:36px; height:36px; font-size:28px; border-radius:11px; }
 .region-label { font-size:8px; letter-spacing:1px; gap:6px; }
 main { padding:20px 18px calc(110px + env(safe-area-inset-bottom)); gap:24px; }
 .tabs { position:fixed; top:auto; bottom:0; left:0; right:0; max-width:none; border-radius:22px 22px 0 0; border:1px solid var(--line); border-bottom:0; background:#fffffff5; padding:10px 10px calc(10px + env(safe-area-inset-bottom)); gap:4px; box-shadow:0 -8px 30px #17352b09; backdrop-filter:blur(16px); }
 .tab { flex-direction:column; min-width:0; font-size:11px; gap:5px; padding:8px 3px; min-height:58px; }
 .tab[aria-selected="true"] { background:var(--accent-soft); color:var(--accent); box-shadow:none; }
 .tab-ic svg { width:22px; height:22px; }
 .intro-symbol { width:47px; height:47px; font-size:29px; }
 .page-intro h1 { font-size:30px; letter-spacing:-1.1px; }
 .page-intro .eyebrow { font-size:9px; letter-spacing:1.3px; }
 #page-description { font-size:13px; }
 .panel { gap:16px; }
 .card { padding:20px; border-radius:20px; }
 .search-card h2 { font-size:22px; margin-bottom:20px; }
 .search-tip { display:none; }
 .shortcut-label { margin-top:20px; }
 .favs { flex-wrap:nowrap; overflow-x:auto; }
 .fav { font-size:13px; flex:none; }
 .map-card { padding:16px; }
 .map-heading h2 { font-size:16px; }
 .map-caption { display:none; }
 #map { height:330px; min-height:260px; }
 .filters { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
 .chip { flex:none; font-size:12px; padding:8px 12px; }
 .nearby-card { padding:20px; }
 label { font-size:12px; }
 .head-row h2,h2 { font-size:18px; }
 .day-row,.menu-item { font-size:16px; }
 select,.day-row input[type=time] { font-size:16px; }
 .sub-title { font-size:21px; }
 .auth-screen { min-height:calc(100dvh - 72px); padding-top:20px; }
 .auth-name { font-size:30px; }
 .auth-box .card { padding:22px; }
 .auth-tag { font-size:14px; }
 .acc-intro { font-size:13px; }
 .leave-banner { top:8px; padding:0 18px; }
 .leave-item { font-size:14px; }
 .profile-email { font-size:15px; }
 .fav-add { flex-wrap:wrap; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; } }
