/* ════════════════════════════════════════════════════════════════
   eglinton.app — Design System v9
   Font: Lexend variable
   ════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Lexend';
  src: url('https://assets.eglinton.app/fonts/Lexend-VariableFont_wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Variables ─────────────────────────────────────────── */
:root {
  --font:   'Lexend', system-ui, -apple-system, sans-serif;
  --mono:   'SF Mono', 'Fira Code', ui-monospace, monospace;
  --bg:     #f4f5f8;
  --sfc:    #ffffff;
  --sfc2:   #f0f1f5;
  --brd:    #e4e5eb;
  --brd2:   #d0d1d8;
  --txt:    #111318;
  --txt2:   #3d4050;
  --txt3:   #7c7f8e;
  --acc:    #0052cc;
  --acc-bg: #e8f0ff;
  --grn:    #1a9e45;
  --grn-bg: #eaf7ee;
  --red:    #cc2222;
  --org:    #e07400;
  --nav-h:  46px;
  --r:      12px;
  --rsm:    8px;
  --rxs:    5px;
  --sh:     0 1px 4px rgba(0,0,0,.07),0 2px 10px rgba(0,0,0,.05);
  --shlg:   0 4px 24px rgba(0,0,0,.10),0 1px 6px rgba(0,0,0,.06);
  --tr:     background .15s,color .15s,border-color .15s,opacity .15s;
  --pad:    .75rem;
}

/* ── Reset ─────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
*{user-select:none;-webkit-user-select:none}
html{font-size:16px;-webkit-text-size-adjust:100%}
body{
  font-family:var(--font);
  font-weight:400;
  font-variation-settings:'wght' 400;
  background:var(--bg);
  color:var(--txt);
  line-height:1.5;
  min-height:100dvh;
  padding-top:var(--nav-h);
}
a{color:inherit;text-decoration:none}
button,select,input{font-family:var(--font)}
img{display:block;max-width:100%}

/* ── Nav ───────────────────────────────────────────────── */
.nav{
  height:var(--nav-h);
  background:var(--sfc);
  border-bottom:1px solid var(--brd);
  display:flex;align-items:center;gap:.6rem;
  padding:0 var(--pad);
  position:fixed;top:0;left:0;right:0;z-index:200;
}
.nav-logo{
  font-weight:700;font-variation-settings:'wght' 700;
  font-size:.95rem;letter-spacing:-.02em;
  color:var(--txt);
  white-space:nowrap;flex-shrink:0;
}
.nav-links{
  display:flex;align-items:center;gap:.1rem;
  list-style:none;flex:1;min-width:0;overflow:hidden;
}
.nav-links a{
  padding:.3rem .55rem;border-radius:var(--rxs);
  font-size:.8rem;font-weight:500;color:var(--txt3);
  transition:var(--tr);white-space:nowrap;
}
.nav-links a:hover,.nav-links a.active{background:var(--acc-bg);color:var(--acc)}

.nav-right{
  display:flex;align-items:center;gap:.45rem;
  flex-shrink:0;margin-left:auto;
}

.nav-status-desk{display:flex;align-items:center;line-height:1}
.nav-status-desk iframe{
  border:0 !important;
  outline:none !important;
  box-shadow:none !important;
  background:transparent !important;
  vertical-align:middle;
  width:190px;height:30px;
  display:block;
}
.nav-status-mob{display:none;align-items:center}
.nav-status-mob img{height:22px;display:block}

.nav-clock{
  font-family:var(--mono);font-size:.72rem;
  color:var(--txt3);white-space:nowrap;font-weight:500;
}

.btn-settings{
  display:inline-flex;align-items:center;justify-content:center;
  width:29px;height:29px;border-radius:var(--rxs);
  border:1px solid var(--brd);background:var(--sfc);
  cursor:pointer;transition:var(--tr);color:var(--txt3);
  flex-shrink:0;padding:0;
}
.btn-settings:hover{border-color:var(--acc);color:var(--acc)}
.btn-settings svg{width:15px;height:15px;display:block}

@media(max-width:640px){
  .nav{padding:0 var(--pad);gap:.4rem}
  .nav-links a[data-i="map"]{display:none}
  .nav-status-desk{display:none!important}
  .nav-status-mob{display:flex!important}
  .nav-clock{display:flex!important}
}

/* ── Modal paramètres ──────────────────────────────────── */
.settings-overlay{
  position:fixed;inset:0;z-index:600;
  background:rgba(0,0,0,.45);
  display:flex;align-items:flex-end;
  opacity:0;pointer-events:none;transition:opacity .2s;
}
.settings-overlay.open{opacity:1;pointer-events:all}
.settings-panel{
  width:100%;max-width:420px;margin:0 auto;
  background:var(--sfc);
  border-radius:var(--r) var(--r) 0 0;
  box-shadow:var(--shlg);
  transform:translateY(24px);
  transition:transform .22s cubic-bezier(.4,0,.2,1);
  padding-bottom:env(safe-area-inset-bottom,0px);
  max-height:80dvh;display:flex;flex-direction:column;
}
.settings-overlay.open .settings-panel{transform:translateY(0)}
@media(max-width:640px){
  .settings-panel{
    padding-bottom:calc(env(safe-area-inset-bottom,16px) + 1.5rem);
  }
}
@media(min-width:641px){
  .settings-overlay{align-items:center}
  .settings-panel{border-radius:var(--r);max-height:70vh}
}
.settings-hd{
  display:flex;align-items:center;justify-content:space-between;
  padding:.7rem var(--pad);border-bottom:1px solid var(--brd);flex-shrink:0;
}
.settings-hd-title{font-weight:700;font-size:.9rem;font-variation-settings:'wght' 700}
.settings-body{overflow-y:auto;flex:1;padding:var(--pad);display:flex;flex-direction:column;gap:1rem}
.setting-row{display:flex;align-items:center;justify-content:space-between;gap:.75rem}
.setting-label{font-size:.84rem;font-weight:500}
.setting-sub{font-size:.72rem;color:var(--txt3);margin-top:1px}
.toggle{position:relative;width:38px;height:22px;flex-shrink:0}
.toggle input{opacity:0;width:0;height:0;position:absolute}
.toggle-track{
  position:absolute;inset:0;border-radius:11px;
  background:var(--brd2);cursor:pointer;transition:background .2s;
}
.toggle input:checked~.toggle-track{background:var(--acc)}
.toggle-thumb{
  position:absolute;width:16px;height:16px;border-radius:50%;
  background:#fff;top:3px;left:3px;
  transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.25);
  pointer-events:none;
}
.toggle input:checked~.toggle-thumb{transform:translateX(16px)}
.setting-section{font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--txt3);padding-bottom:.3rem;border-bottom:1px solid var(--brd)}
.lang-select{
  padding:.28rem .6rem;border:1px solid var(--brd);border-radius:var(--rxs);
  background:var(--sfc);font-family:var(--font);font-size:.8rem;color:var(--txt);
  cursor:pointer;outline:none;transition:var(--tr);
}
.lang-select:focus{border-color:var(--acc)}

/* ── Boutons ────────────────────────────────────────────── */
.btn{
  display:inline-flex;align-items:center;gap:.3rem;
  padding:.3rem .65rem;border:1px solid var(--brd);border-radius:var(--rxs);
  background:var(--sfc);font-size:.78rem;font-weight:500;color:var(--txt2);
  cursor:pointer;transition:var(--tr);white-space:nowrap;
}
.btn:hover{border-color:var(--acc);color:var(--acc)}
.btn-sm{padding:.22rem .5rem;font-size:.72rem}
.btn-primary{background:var(--acc);border-color:var(--acc);color:#fff}
.btn-primary:hover{background:#003fa3;border-color:#003fa3;color:#fff}
.btn-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;padding:0;
  border:1px solid var(--brd);border-radius:var(--rxs);background:var(--sfc);
  cursor:pointer;transition:var(--tr);color:var(--txt3);
}
.btn-icon:hover{border-color:var(--acc);color:var(--acc)}

.pills{display:flex;flex-wrap:wrap;gap:.3rem}
.pill{
  padding:.26rem .6rem;border:1px solid var(--brd);border-radius:20px;
  background:var(--sfc);font-size:.74rem;font-weight:500;
  cursor:pointer;transition:var(--tr);color:var(--txt2);white-space:nowrap;
}
.pill:hover{border-color:var(--acc);color:var(--acc)}
.pill.active{background:var(--acc);border-color:var(--acc);color:#fff}

/* ── Layout ─────────────────────────────────────────────── */
.container{max-width:960px;margin:0 auto;padding:0 var(--pad)}
.page-wrap{padding-top:1rem;padding-bottom:2rem}
.page-title{font-size:1.1rem;font-weight:700;font-variation-settings:'wght' 700;letter-spacing:-.02em}
.page-sub{font-size:.72rem;color:var(--txt3);margin-top:2px}

/* ── Cards ──────────────────────────────────────────────── */
.card{background:var(--sfc);border:1px solid var(--brd);border-radius:var(--r);overflow:hidden}
.card-head{
  display:flex;align-items:center;gap:.5rem;
  padding:.55rem var(--pad);border-bottom:1px solid var(--brd);
  background:var(--sfc);flex-shrink:0;
}
.card-label{font-size:.7rem;font-weight:600;font-variation-settings:'wght' 600;text-transform:uppercase;letter-spacing:.04em;color:var(--txt3)}
.card-body{padding:var(--pad)}

/* ── Recherche ──────────────────────────────────────────── */
.search-wrap{position:relative}
.search-icon{position:absolute;left:.7rem;top:50%;transform:translateY(-50%);color:var(--txt3);pointer-events:none;display:flex}
.search-clear{
  position:absolute;right:.55rem;top:50%;transform:translateY(-50%);
  background:none;border:none;cursor:pointer;padding:.15rem;
  color:var(--txt3);display:none;line-height:1;
  transition:color var(--tr);border-radius:3px;
}
.search-clear:hover{color:var(--txt)}
.search-clear.visible{display:block}
.search-input{
  width:100%;padding:.52rem .8rem .52rem 2.1rem;
  border:1px solid var(--brd);border-radius:var(--rsm);
  background:var(--sfc);font-family:var(--font);font-size:.85rem;
  color:var(--txt);outline:none;transition:var(--tr);-webkit-appearance:none;
}
.search-input::placeholder{color:var(--txt3)}
.search-input:focus{border-color:var(--acc);box-shadow:0 0 0 3px rgba(0,82,204,.1)}
.search-input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none; appearance:none; display:none;}

/* ── Stop header ────────────────────────────────────────── */
.stop-hd{background:var(--sfc);border:1px solid var(--brd);border-radius:var(--r);padding:var(--pad);margin-bottom:var(--pad)}
.stop-hd-top{display:flex;align-items:flex-start;justify-content:space-between;gap:.65rem}
.stop-hd-name{font-size:1rem;font-weight:700;font-variation-settings:'wght' 700}
.stop-hd-loc{font-size:.72rem;color:var(--txt3);margin-top:2px}
.stop-hd-net{
  display:flex;align-items:center;justify-content:flex-end;
  gap:.6rem;flex-shrink:0;
}
.stop-hd-net img{height:22px;width:auto;object-fit:contain}
.stop-hd-routes{display:flex;align-items:center;flex-wrap:wrap;gap:.3rem;margin-top:.55rem;padding-top:.55rem;border-top:1px solid var(--brd)}
.routes-label{font-size:.68rem;color:var(--txt3);font-weight:500;margin-right:.15rem}

/* ── Départs ────────────────────────────────────────────── */
.dep-controls{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:var(--pad)}
.dep-controls .pills{flex:1;min-width:0}
.dep-meta{display:flex;align-items:center;gap:.4rem;flex-shrink:0}

.dep-row{
  display:flex;align-items:center;gap:.55rem;
  /* Espacement réduit */
  padding:.28rem var(--pad);
  border-bottom:1px solid var(--brd);
  transition:background var(--tr);cursor:pointer;
  text-decoration:none;color:inherit;
}
.dep-row:last-child{border-bottom:none}
.dep-row:hover{background:var(--sfc2)}
.dep-row.cancelled{opacity:.45}

.dep-line{
  flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
}
.dep-info{flex:1;min-width:0}
.dep-dest{
  font-size:.78rem;font-weight:600;font-variation-settings:'wght' 600;
  white-space:normal;word-break:break-word;overflow:visible;
}

.dep-sub{
  font-size:.64rem;
  color:var(--txt3);
  margin-top:0;
}

/* Times */
.dep-times{display:flex;flex-direction:column;align-items:flex-end;gap:1px;flex-shrink:0}
.t-base{font-family:var(--mono);font-size:.86rem;font-weight:600;color:var(--txt);font-variation-settings:'wght' 600;line-height:1.1}
.t-base.has-rt{font-size:.72rem;text-decoration:line-through;color:var(--txt3);font-weight:400}
/* À l'heure = vert */
.t-base.ontime{color:var(--grn)!important;font-weight:700}
/* RT affiché = vert par défaut (sur les .t-base qui sont RT sans délai notable) */
.t-base.rt-live{color:var(--grn)!important;font-weight:700}
.t-rt{font-family:var(--mono);font-size:.86rem;font-weight:700;line-height:1.1}
/* Retard = orange */
.t-rt.late{color:var(--org)}
/* Avance = rouge */
.t-rt.early{color:var(--red)}
.t-cd{font-size:.7rem;color:var(--txt3);font-family:var(--mono);font-weight:500;letter-spacing:-.01em;line-height:1.1}
.t-cd.now{color:var(--acc);font-weight:700}

.hour-sep{
  padding:.2rem var(--pad) .1rem;
  font-size:.65rem;font-family:var(--mono);font-weight:600;color:var(--txt3);
  background:var(--bg);border-bottom:1px solid var(--brd);letter-spacing:.05em;
}

/* ── Stop items sidebar/carte ───────────────────────────── */
.si{
  display:flex;align-items:center;justify-content:space-between;gap:.5rem;
  padding:.4rem var(--pad);
  border-bottom:1px solid var(--brd);
  cursor:pointer;transition:background var(--tr);
}
.si:last-child{border-bottom:none}
.si:hover{background:var(--sfc2)}
.si.sel{background:var(--acc-bg);border-left:3px solid var(--acc);padding-left:calc(var(--pad) - 3px)}
.si-left{min-width:0;flex:1}
.si-name{font-weight:600;font-variation-settings:'wght' 600;font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.si-sub{font-size:.65rem;color:var(--txt3);margin-top:1px}
.si-dist{font-family:var(--mono);font-size:.65rem;color:var(--txt3);white-space:nowrap;flex-shrink:0}

/* ── Logos ──────────────────────────────────────────────── */
.network-logo{height:20px;width:auto;object-fit:contain}
.line-logo{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.line-logo img{display:block;object-fit:contain}
.line-badge{
  display:inline-flex;align-items:center;justify-content:center;
  border-radius:4px;font-weight:700;font-variation-settings:'wght' 700;
  line-height:1;flex-shrink:0;white-space:nowrap;
  min-width:22px;height:22px;padding:0 5px;font-size:.7rem;
}
.ll-xs .line-badge,.lb-xs{min-width:18px;height:18px;padding:0 4px;font-size:.6rem}
.ll-sm .line-badge,.lb-sm{min-width:22px;height:22px;padding:0 5px;font-size:.7rem}
.ll-md .line-badge,.lb-md{min-width:28px;height:28px;padding:0 6px;font-size:.75rem}
.ll-lg .line-badge,.lb-lg{min-width:36px;height:36px;padding:0 8px;font-size:.9rem}
.ll-xs img{width:auto;height:18px;max-width:40px}
.ll-sm img{width:auto;height:22px;max-width:48px}
.ll-md img{width:auto;height:28px;max-width:60px}
.ll-lg img{width:auto;height:36px;max-width:72px}

.mode-icon{width:13px;height:13px;object-fit:contain;flex-shrink:0}
.sec-label{
  display:flex;align-items:center;gap:.35rem;
  padding:.5rem var(--pad) .3rem;
  font-size:.68rem;font-weight:600;font-variation-settings:'wght' 600;
  text-transform:uppercase;letter-spacing:.06em;color:var(--txt3);
  background:var(--bg);border-bottom:1px solid var(--brd);
}

/* ── Grille lignes ──────────────────────────────────────── */
.lines-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(105px,1fr));
  gap:.4rem;padding:.6rem var(--pad);
}
.line-card{
  display:flex;align-items:center;gap:.55rem;
  padding:.55rem .65rem;
  border:1px solid var(--brd);border-radius:var(--rsm);
  background:var(--sfc);cursor:pointer;transition:border-color .15s,background .15s;
  text-align:left;min-width:0;
}
.line-card:hover{
  border-color:var(--lc-color,var(--acc));
  background:var(--sfc2);
}
.line-card-info{min-width:0;flex:1}
.line-card-name{
  font-weight:600;font-variation-settings:'wght' 600;font-size:.8rem;
  white-space:normal;word-break:break-word;overflow:visible;line-height:1.2;
}
.line-card-type{font-size:.62rem;color:var(--txt3);margin-top:2px;white-space:normal;word-break:break-word}

/* ── Fiche ligne header ─────────────────────────────────── */
.line-hd{
  display:flex;align-items:center;gap:.8rem;
  padding:var(--pad);
  padding-top:calc(var(--pad) + 1.4rem);
  border:1px solid var(--brd);border-radius:var(--r);background:var(--sfc);
  margin-bottom:var(--pad);position:relative;overflow:hidden;
}
.line-hd-back{
  position:absolute;top:.5rem;left:var(--pad);
  font-size:.68rem;color:var(--txt3);font-weight:500;
  transition:color var(--tr);display:flex;align-items:center;gap:.2rem;
}
.line-hd-back:hover{color:var(--acc)}
.line-hd-info{flex:1;min-width:0}
.line-hd-num{display:none}
.line-hd-name{font-size:.9rem;font-weight:600;font-variation-settings:'wght' 600;white-space:normal;word-break:break-word}
.line-hd-type{display:flex;align-items:center;gap:.3rem;font-size:.7rem;color:var(--txt3);margin-top:.2rem}
.line-hd-right{flex-shrink:0}

/* ── Timeline arrêts ────────────────────────────────────── */
.timeline{display:flex;flex-direction:column}
.tl-row{
  display:flex;align-items:center;gap:.55rem;
  /* Espacement réduit */
  padding:.3rem var(--pad);
  border-bottom:1px solid var(--brd);
  cursor:pointer;transition:background var(--tr);position:relative;
}
.tl-row:last-child{border-bottom:none}
.tl-row:hover{background:var(--sfc2)}
.tl-row.current{background:var(--acc-bg)}
.tl-row.passed{opacity:.42}
.tl-dot{
  width:8px;height:8px;border-radius:50%;
  border:2px solid var(--brd2);background:var(--sfc);
  flex-shrink:0;transition:var(--tr);
}
.tl-row.current .tl-dot{border-color:var(--acc);background:var(--acc)}
.tl-row:hover .tl-dot{border-color:var(--acc)}
.tl-name{font-size:.82rem;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tl-corr{display:flex;flex-wrap:wrap;gap:.15rem;margin-top:.2rem}
.tl-times{display:flex;flex-direction:column;align-items:flex-end;gap:0;flex-shrink:0}
.tl-base{font-family:var(--mono);font-size:.78rem;color:var(--txt);font-weight:500}
.tl-base.has-rt{font-size:.67rem;text-decoration:line-through;color:var(--txt3);font-weight:400}
/* À l'heure RT = vert */
.tl-base.rt-live{color:var(--grn)!important;font-weight:600}
.tl-rt{font-family:var(--mono);font-size:.78rem;font-weight:700}
/* Retard = orange */
.tl-rt.late{color:var(--org)}
/* Avance = rouge */
.tl-rt.early{color:var(--red)}

/* Trip items */
.trip-item{
  display:flex;align-items:center;gap:.5rem;padding:.35rem .65rem;
  border-radius:var(--rxs);cursor:pointer;transition:background var(--tr);font-size:.8rem;
}
.trip-item:hover{background:var(--sfc2)}
.trip-item.past{opacity:.4}
.trip-dest{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.trip-t{font-family:var(--mono);font-size:.72rem;color:var(--txt3);white-space:nowrap}

/* ── Alertes ────────────────────────────────────────────── */
.alert-card{border:1px solid #e8a020;border-radius:var(--rsm);overflow:hidden;margin-bottom:.5rem}
.alert-card-head{padding:.25rem .6rem;background:#e8a02018;border-bottom:1px solid #e8a02030}
.alert-card-label{font-size:.7rem;font-weight:700;color:#b87010;text-transform:uppercase;letter-spacing:.03em}
.alert-row{display:flex;align-items:center;padding:.38rem 0;border-bottom:1px solid var(--brd);cursor:pointer;transition:background var(--tr);justify-content:space-between;gap:.5rem}
.alert-row:first-child{padding-top:0}
.alert-row:last-child{border-bottom:none;padding-bottom:0}
.alert-row:hover{background:transparent}
.alert-title{font-size:.75rem;font-weight:500;line-height:1.25;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.alert-arrow{color:var(--txt3);font-size:1rem;margin-left:.5rem;flex-shrink:0}
.alert-html{font-size:.82rem;line-height:1.55;color:var(--txt2);padding:var(--pad)}
.alert-html p{margin:.15rem 0}
.alert-html ul{margin:.25rem 0 .25rem 1.1rem}
.alert-html li{margin:.1rem 0}
.alert-html a{color:var(--acc);text-decoration:underline}
.alert-inline{margin-top:.55rem;padding-top:.55rem;border-top:1px solid var(--brd)}
.alert-inline .alert-row{padding:.32rem 0}
.alert-inline .alert-row:first-child{padding-top:0}
.alert-inline .alert-row:last-child{padding-bottom:0;border-bottom:none}
.alert-inline .alert-row:hover{background:transparent}
.alert-title{font-size:.75rem;font-weight:500;line-height:1.3;flex:1;min-width:0;white-space:normal;word-break:break-word}
#line-alerts-slot{order:99;flex-basis:100%}
#line-alerts-slot .alert-row,#net-alerts-slot .alert-row{border-bottom:none;padding:.28rem 0}
#line-alerts-slot .alert-row+.alert-row,#net-alerts-slot .alert-row+.alert-row{border-top:1px solid rgba(0,0,0,.07)}
#stop-alerts-hd .alert-row{border-bottom:none;padding:.28rem 0}
#stop-alerts-hd .alert-row+.alert-row{border-top:1px solid var(--brd)}

/* ── Modal ──────────────────────────────────────────────── */
.overlay{
  position:fixed;inset:0;z-index:500;
  background:rgba(0,0,0,.42);
  display:flex;align-items:flex-end;
  opacity:0;pointer-events:none;transition:opacity .22s;
}
.overlay.open{opacity:1;pointer-events:all}
.modal{
  width:100%;max-width:540px;margin:0 auto;
  background:var(--sfc);border-radius:var(--r) var(--r) 0 0;
  max-height:82dvh;display:flex;flex-direction:column;
  box-shadow:var(--shlg);
  transform:translateY(20px);
  transition:transform .22s cubic-bezier(.4,0,.2,1);
  padding-bottom:env(safe-area-inset-bottom,0px);
}
.overlay.open .modal{transform:translateY(0)}
.modal-hd{
  display:flex;align-items:center;gap:.6rem;
  padding:.55rem var(--pad);border-bottom:1px solid var(--brd);flex-shrink:0;
}
/* Badge dans le modal-hd : aligné verticalement avec le titre */
.modal-hd .line-logo,
.modal-hd .line-badge,
#modal-badge{
  display:inline-flex;
  align-items:center;
  align-self:center;
  flex-shrink:0;
  vertical-align:middle;
}
.modal-title{flex:1;font-weight:600;font-variation-settings:'wght' 600;font-size:.9rem;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2}
.modal-x{background:none;border:none;cursor:pointer;color:var(--txt3);font-size:.9rem;padding:.2rem;line-height:1;transition:color var(--tr);flex-shrink:0}
.modal-x:hover{color:var(--txt)}
.modal-body{overflow-y:auto;flex:1;padding:var(--pad);padding-bottom:1.75rem}
.modal-body-np{overflow-y:auto;flex:1;min-height:0}
@media(max-width:640px){
  .modal{max-height:86dvh;border-radius:16px 16px 0 0}
  .modal-body{padding-bottom:calc(1.75rem + env(safe-area-inset-bottom,20px))}
  .modal-body-np .timeline:last-child .tl-row:last-child,
  .modal-body-np>*:not(.status-grid-wrap):last-child{padding-bottom:calc(1rem + env(safe-area-inset-bottom,20px))}
  .modal-body-np .status-grid-wrap{padding-bottom:calc(2rem + env(safe-area-inset-bottom,20px))}
}
@media(min-width:641px){
  .overlay{align-items:center}
  .modal{border-radius:var(--r);max-height:80vh}
}

/* ── Loader / Empty ─────────────────────────────────────── */
.loader{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.6rem;padding:2.5rem 1rem;font-size:.8rem;color:var(--txt3)}
.loader-dots{display:flex;gap:.3rem}
.loader-dots span{width:6px;height:6px;border-radius:50%;background:var(--brd2);animation:ldpulse 1.2s ease-in-out infinite}
.loader-dots span:nth-child(2){animation-delay:.18s}
.loader-dots span:nth-child(3){animation-delay:.36s}
@keyframes ldpulse{0%,80%,100%{opacity:.3}40%{opacity:1}}
.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.4rem;padding:2.5rem 1rem;text-align:center}
.empty h3{font-size:.9rem;font-weight:600;color:var(--txt2)}
.empty p{font-size:.76rem;color:var(--txt3)}

/* ── Page Réseaux ───────────────────────────────────────── */
.networks-page{padding-top:1.2rem;padding-bottom:2.5rem}
.networks-hero{padding:.25rem 0 1.25rem}
.networks-hero h1{font-size:1.35rem;font-weight:700;font-variation-settings:'wght' 700;letter-spacing:-.03em;color:var(--txt)}
.networks-hero p{font-size:.82rem;color:var(--txt3);margin-top:.3rem}

.geo-section{margin-bottom:1.75rem}
.geo-continent-label{
  font-size:.68rem;font-weight:700;font-variation-settings:'wght' 700;
  text-transform:uppercase;letter-spacing:.09em;color:var(--txt3);
  padding:.35rem 0 .5rem;border-bottom:2px solid var(--brd);margin-bottom:.85rem;
}
.geo-country{margin-bottom:1rem}
.geo-country-name{font-size:.78rem;font-weight:600;font-variation-settings:'wght' 600;color:var(--txt2);display:flex;align-items:center;gap:.4rem;margin-bottom:.5rem}
.geo-region{margin-bottom:.65rem;padding-left:.7rem}
.geo-region-name{font-size:.68rem;font-weight:500;color:var(--txt3);margin-bottom:.38rem;display:flex;align-items:center;gap:.35rem}
.geo-region-name::before{content:'';display:inline-block;width:10px;height:1px;background:var(--brd2)}

.network-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:.55rem}
.network-card{
  display:flex;align-items:center;gap:.75rem;padding:.65rem .85rem;
  border:1px solid var(--brd);border-radius:var(--rsm);background:var(--sfc);
  cursor:pointer;transition:var(--tr);text-decoration:none;color:inherit;
  position:relative;overflow:hidden;
}
.network-card::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--nc-c,var(--brd2))}
.network-card:hover{border-color:var(--nc-c,var(--acc));background:var(--sfc2);transform:translateY(-1px);box-shadow:var(--sh)}
.nc-logo{width:32px;height:32px;object-fit:contain;flex-shrink:0}
.nc-info{min-width:0;flex:1}
.nc-name{font-size:.8rem;font-weight:600;font-variation-settings:'wght' 600;white-space:normal;word-break:break-word;overflow:visible}
.nc-city{font-size:.64rem;color:var(--txt3);margin-top:1px;white-space:normal;word-break:break-word}
.nc-badge{width:6px;height:6px;border-radius:50%;background:var(--grn);flex-shrink:0;margin-left:auto}

@media(max-width:640px){
  .network-cards{grid-template-columns:1fr 1fr}
  .networks-hero h1{font-size:1.15rem}
}

/* ── Animations liste ───────────────────────────────────── */
@keyframes slideUp{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:translateY(0)}
}
.stagger>*{
  animation:slideUp .22s ease both;
}
.stagger>*:nth-child(1){animation-delay:0s}
.stagger>*:nth-child(2){animation-delay:.035s}
.stagger>*:nth-child(3){animation-delay:.07s}
.stagger>*:nth-child(4){animation-delay:.105s}
.stagger>*:nth-child(5){animation-delay:.14s}
.stagger>*:nth-child(6){animation-delay:.175s}
.stagger>*:nth-child(7){animation-delay:.21s}
.stagger>*:nth-child(8){animation-delay:.245s}
.stagger>*:nth-child(9){animation-delay:.28s}
.stagger>*:nth-child(10){animation-delay:.315s}
.stagger>*:nth-child(11){animation-delay:.35s}
.stagger>*:nth-child(12){animation-delay:.385s}
.stagger>*:nth-child(13){animation-delay:.40s}
.stagger>*:nth-child(14){animation-delay:.415s}
.stagger>*:nth-child(15){animation-delay:.43s}
.stagger>*:nth-child(16){animation-delay:.445s}
.stagger>*:nth-child(17){animation-delay:.46s}
.stagger>*:nth-child(18){animation-delay:.475s}
.stagger>*:nth-child(19){animation-delay:.49s}
.stagger>*:nth-child(20){animation-delay:.505s}
.stagger>*:nth-child(n+21){animation-delay:.52s}

/* Stagger horizontal (logos, badges en ligne) */
@keyframes fadeScale{
  from{opacity:0;transform:scale(.7)}
  to{opacity:1;transform:scale(1)}
}

.fade-in{animation:slideUp .22s ease}

/* ── MapLibre overrides ──────────────────────────────────── */
.maplibregl-ctrl-attrib{font-size:.58rem!important;background:rgba(255,255,255,.8)!important;border-radius:4px!important;padding:1px 5px!important}
.maplibregl-ctrl-logo{display:none!important}

/* Contrôles MapLibre : collés en haut à droite, aucun gap */
.maplibregl-ctrl-top-right{
  top:.75rem !important;
  right:.75rem !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
}
.maplibregl-ctrl-top-right .maplibregl-ctrl{
  margin:0 !important;
}
/* Supprimer tout margin-top hérité */
.maplibregl-ctrl-top-right .maplibregl-ctrl + .maplibregl-ctrl{
  margin-top:0 !important;
}

.maplibregl-popup-content{font-family:var(--font)!important;font-size:.78rem!important;border-radius:9px!important;padding:.5rem .75rem!important;box-shadow:var(--shlg)!important;border:1px solid var(--brd)!important}
.maplibregl-popup-tip{display:none!important}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--brd2);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--txt3)}

/* ── Corrections supplémentaires ────────────────────────── */

@media(max-width:640px){
  .modal-body-np .timeline .tl-row:last-child,
  .modal-body-np .dep-list .dep-row:last-child{padding-bottom:calc(1rem + env(safe-area-inset-bottom,20px))}
}

.nav-status-desk iframe{
  border:none !important;
  outline:none !important;
  box-shadow:none !important;
  background:transparent !important;
}

.stop-hd-net{
  display:flex;flex-direction:column;align-items:flex-end;
  gap:.45rem;flex-shrink:0;
}
.stop-hd-net img{height:22px;width:auto;object-fit:contain}

.line-hd{
  padding-top:2rem !important;
}
.line-hd-back{
  top:.55rem;
  font-size:.7rem;
  font-weight:500;
  display:inline-flex;align-items:center;gap:.2rem;
}

.lines-grid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}
.line-card{flex-direction:row;text-align:left}

.line-badge{
  min-width:0 !important;
  width:auto !important;
  max-width:none !important;
  padding:0 5px !important;
}

body,html{max-width:100%;overflow-x:hidden}
.container{overflow-x:hidden}
.lines-grid{overflow-x:hidden}

.lb-xs,.ll-xs .line-badge{min-width:18px !important;aspect-ratio:unset}
.lb-sm,.ll-sm .line-badge{min-width:22px !important;aspect-ratio:unset}
.lb-md,.ll-md .line-badge{min-width:28px !important;aspect-ratio:unset}
.lb-lg,.ll-lg .line-badge{min-width:36px !important;aspect-ratio:unset}

/* user-select global */
input, textarea { user-select:text !important; -webkit-user-select:text !important; }

svg { vertical-align:middle; display:inline-block; }
button svg, a svg, .btn svg { display:block; }

.search-clear { display:none !important; }
.search-clear.visible { display:block !important; }

.stop-hd-top {
  align-items:center;
}
.stop-hd-top > img {
  align-self:center;
  margin-top:0;
}

/* Véhicules RT — popup info */
.veh-popup {
  min-width:220px;max-width:280px;
}
.veh-popup-hd {
  display:flex;align-items:center;gap:.55rem;margin-bottom:.5rem;
  padding-bottom:.45rem;border-bottom:1px solid var(--brd);
}
.veh-popup-logo { height:20px;width:auto;object-fit:contain;flex-shrink:0 }
.veh-popup-name { font-weight:700;font-size:.85rem;flex:1;min-width:0 }
.veh-popup-dest { font-size:.72rem;color:var(--txt3);margin-top:1px;white-space:normal;word-break:break-word }
.veh-popup-meta { display:flex;flex-wrap:wrap;gap:.3rem .5rem;margin-bottom:.45rem }
.veh-popup-tag {
  font-size:.65rem;padding:.15rem .4rem;border-radius:3px;
  background:var(--sfc2);border:1px solid var(--brd);font-family:var(--mono);
}
.veh-popup-stops { display:flex;flex-direction:column;gap:.2rem;margin-top:.3rem }
.veh-popup-stop {
  display:flex;align-items:center;justify-content:space-between;gap:.4rem;
  font-size:.72rem;padding:.2rem .35rem;border-radius:3px;
  cursor:pointer;transition:background var(--tr);
}
.veh-popup-stop:hover { background:var(--acc-bg) }
.veh-popup-stop-name { flex:1;min-width:0;white-space:normal;word-break:break-word }
.veh-popup-stop-t { font-family:var(--mono);font-size:.68rem;color:var(--txt3);white-space:nowrap;flex-shrink:0 }
.veh-popup-stop-t.late { color:var(--org) }
.veh-popup-stop-t.ontime { color:var(--grn) }

/* Modal status système */
.status-grid-wrap { padding:var(--pad);display:flex;flex-direction:column;gap:.75rem }
.status-tz-note {
  font-size:.7rem;color:var(--txt3);margin:0;padding:.35rem .5rem;
  background:var(--sfc2);border-radius:var(--rxs);border:1px solid var(--brd);
}

.status-grid { display:flex;flex-direction:column;gap:.55rem }
.status-feed {
  border:1px solid var(--brd);border-radius:var(--rsm);overflow:hidden;
  padding:0;
}
.status-feed-hd {
  display:flex;align-items:center;gap:.55rem;padding:.45rem .65rem;
  background:var(--sfc);border-bottom:1px solid var(--brd);
}
.status-feed-name { font-weight:600;font-size:.82rem;flex:1;min-width:0 }
.status-feed-city { font-size:.68rem;color:var(--txt3) }
.status-feed-bar { display:flex;gap:.3rem;padding:.4rem .65rem;flex-wrap:wrap }
.status-rt-pill {
  display:inline-flex;align-items:center;gap:.25rem;
  font-size:.65rem;padding:.18rem .45rem;border-radius:12px;border:1px solid;
  font-family:var(--mono);white-space:nowrap;
}
.status-rt-pill.ok { border-color:#b7dfb8;background:#f0faf0;color:#1a7f40 }
.status-rt-pill.err { border-color:#f5c6c6;background:#fff5f5;color:#cc2222 }
.status-rt-pill.na { border-color:var(--brd);background:var(--sfc2);color:var(--txt3) }
.status-update {
  font-size:.62rem;color:var(--txt3);padding:.25rem .65rem .45rem;
  font-family:var(--mono);line-height:1.35;word-break:break-all;
}
.status-update-lbl { font-weight:600;color:var(--txt2);margin-right:.25rem }
.status-update-static { padding-top:.15rem }
.status-update-rt { padding-top:.1rem }

/* FAB locate */
.fab-locate{
  position:absolute;z-index:110;
  top:.5rem;right:.85rem;
  width:34px;height:34px;border-radius:8px;
  background:#fff;border:1px solid var(--brd);box-shadow:var(--sh);
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;transition:var(--tr);color:var(--txt);
}
.fab-locate:hover{border-color:var(--acc);color:var(--acc)}
.fab-locate svg{width:16px;height:16px;stroke:currentColor;stroke-width:2.2;fill:none;flex-shrink:0}

/* Mobile : ajustement position contrôles */
@media(max-width:640px){
  .maplibregl-ctrl-top-right{top:.75rem !important;right:.75rem !important}
}

.mob-nav-inner{justify-content:space-evenly !important;padding:0 8px !important}
.mob-nav a{max-width:90px !important}

.stop-hd-net{
  display:flex;align-items:center;flex-direction:row;gap:0;
  flex-shrink:0;border:none;background:none;padding:0;
}
.stop-hd-net img{height:24px;width:auto;object-fit:contain}
.stop-hd-net .btn{display:none !important}

.line-hd{padding-top:2.1rem !important}
.line-hd-back{top:.5rem;left:var(--pad)}

.line-card-name{white-space:normal !important;overflow:visible !important;text-overflow:unset !important;word-break:break-word}
.line-card-type{white-space:normal !important;overflow:visible !important;text-overflow:unset !important;word-break:break-word}
.tl-name{white-space:normal !important;overflow:visible !important;text-overflow:unset !important;word-break:break-word}

@media(max-width:640px){
  .mob-nav-inner { justify-content:space-around !important; padding:0 !important; }
  .mob-nav a { flex:0 0 80px !important; max-width:80px !important; }
}

/* Prevent auto-zoom on input focus on iOS */
@media (max-width: 768px) {
  input {
    font-size: 16px !important;
  }
}

@media(hover:none){
  .dep-row:hover,
  .si:hover,
  .tl-row:hover,
  .trip-item:hover,
  .line-card:hover,
  .network-card:hover,
  .sr-item:hover,
  .line-drop-item:hover,
  .veh-card:hover,
  .log-result:hover{ background:transparent !important; transform:none !important; box-shadow:none !important; }
  .tl-row:hover .tl-dot{ border-color:var(--brd2) !important; }

  .dep-row:active{ background:var(--sfc2) !important; }
  .si:active{ background:var(--sfc2) !important; }
  .tl-row:active{ background:var(--sfc2) !important; }
  .trip-item:active{ background:var(--sfc2) !important; }
  .line-card:active{ background:var(--sfc2) !important; border-color:var(--lc-color,var(--acc)) !important; }
  .network-card:active{ background:var(--sfc2) !important; border-color:var(--nc-c,var(--acc)) !important; }
  .sr-item:active{ background:var(--sfc2) !important; }
  .line-drop-item:active{ background:var(--sfc2) !important; }
  .veh-card:active{ border-color:var(--vc-c,var(--acc)) !important; }
  .log-result:active{ background:var(--sfc2) !important; }
}