/* ==========================================================================
   Départ — design tokens
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --surface-3: #e7e6e1;
  --border: rgba(20, 20, 18, 0.08);
  --border-strong: rgba(20, 20, 18, 0.16);
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #8a8984;
  --accent: #2a78d6;
  --accent-soft: #e6f0fc;
  --accent-ink: #1c5cab;

  /* séries catégorielles (ordre fixe, validé) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;

  /* statut (réservé, toujours avec icône + libellé) */
  --good: #0ca30c; --good-ink: #0a7a0a; --good-soft: #e3f4e3;
  --warn: #fab219; --warn-ink: #8a5d00; --warn-soft: #fdf2d6;
  --serious: #ec835a; --serious-ink: #a8481f; --serious-soft: #fce6dd;
  --crit: #d03b3b; --crit-ink: #b02a2a; --crit-soft: #f9e0e0;

  /* séquentiel bleu */
  --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #256abf; --q6: #184f95; --q7: #0d366b;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 15, 14, 0.04), 0 8px 24px -12px rgba(15, 15, 14, 0.12);
  --shadow-lg: 0 2px 6px rgba(15, 15, 14, 0.06), 0 24px 48px -16px rgba(15, 15, 14, 0.22);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gutter: 16px;
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #232321;
    --surface-3: #2d2d2a;
    --border: rgba(255, 255, 250, 0.08);
    --border-strong: rgba(255, 255, 250, 0.16);
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #3987e5;
    --accent-soft: #15253a;
    --accent-ink: #86b6ef;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --good-ink: #5fd35f; --good-soft: #13291a;
    --warn-ink: #fbc54f; --warn-soft: #2e2512;
    --serious-ink: #f2a587; --serious-soft: #31201a;
    --crit-ink: #ef8a8a; --crit-soft: #331a1a;
    --q1: #10233d; --q2: #104281; --q3: #184f95; --q4: #256abf; --q5: #3987e5; --q6: #6da7ec; --q7: #b7d3f6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0e;
  --surface: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2d2d2a;
  --border: rgba(255, 255, 250, 0.08);
  --border-strong: rgba(255, 255, 250, 0.16);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #8f8e86;
  --accent: #3987e5;
  --accent-soft: #15253a;
  --accent-ink: #86b6ef;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --good-ink: #5fd35f; --good-soft: #13291a;
  --warn-ink: #fbc54f; --warn-soft: #2e2512;
  --serious-ink: #f2a587; --serious-soft: #31201a;
  --crit-ink: #ef8a8a; --crit-soft: #331a1a;
  --q1: #10233d; --q2: #104281; --q3: #184f95; --q4: #256abf; --q5: #3987e5; --q6: #6da7ec; --q7: #b7d3f6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ==========================================================================
   Top bar / navigation
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(var(--gutter), env(safe-area-inset-left)) 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3987e5, #1c5cab); box-shadow: 0 4px 12px -4px rgba(42, 120, 214, 0.6);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.brand-mark svg circle { fill: #fff; stroke: none; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; }
.brand-mark.big svg { width: 36px; height: 36px; }

.tabs { display: flex; gap: 4px; margin-left: 12px; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  color: var(--text-2); font-weight: 500; font-size: 14px; transition: background .2s var(--ease), color .2s;
}
.tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-pill.ok .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, .5); animation: pulse 2.2s infinite; }
.live-pill.stale .dot { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, .45); } 70% { box-shadow: 0 0 0 7px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }

.bottombar { display: none; }

/* ==========================================================================
   Layout
   ========================================================================== */
.view { max-width: var(--maxw); margin: 0 auto; padding: 24px var(--gutter) 64px; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
h1.title { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; margin: 4px 0 0; font-weight: 750; }
h2.section { font-size: 18px; letter-spacing: -0.02em; margin: 36px 0 12px; font-weight: 700; display: flex; align-items: baseline; gap: 10px; }
h2.section .muted { font-weight: 500; font-size: 13.5px; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-weight: 650; letter-spacing: -0.01em; font-size: 15px; margin: 0 0 4px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

/* chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip.good { background: var(--good-soft); color: var(--good-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.serious { background: var(--serious-soft); color: var(--serious-ink); }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* segmented controls */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 13.5px;
  font-weight: 550; color: var(--text-2); white-space: nowrap; transition: background .2s var(--ease), color .2s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .15s var(--ease), background .2s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* ==========================================================================
   Aujourd'hui — cartes trajet
   ========================================================================== */
.day-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 550; margin-bottom: 18px; font-size: 14px;
}
.day-banner svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.trips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; }

.trip {
  position: relative; overflow: hidden; padding: 0;
}
.trip-head { display: flex; align-items: center; gap: 8px; padding: 18px 22px 0; flex-wrap: wrap; }
.trip-stops { display: flex; align-items: center; gap: 6px; padding: 10px 22px 0; font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; flex-wrap: wrap; }
.trip-stops svg { width: 14px; height: 14px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.trip-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 14px 22px 6px; }
.depart-label { font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.depart-time {
  font-size: clamp(56px, 13vw, 76px); font-weight: 800; letter-spacing: -0.055em; line-height: .95;
  font-variant-numeric: tabular-nums; margin: 4px 0 6px;
}
.countdown { font-size: 14px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.countdown.soon { color: var(--serious-ink); }
.countdown.past { color: var(--muted); }
.countdown svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .val { transition: stroke-dashoffset 1s var(--ease); stroke-linecap: round; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-label b { font-size: 26px; font-weight: 750; letter-spacing: -0.04em; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 11px; color: var(--muted); font-weight: 550; }

.route-line { display: flex; flex-direction: column; gap: 8px; padding: 10px 22px 16px; }
.route-step { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.route-step .pin {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}
.route-step b { font-weight: 600; }

.trip-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); }
.trip-stats > div { padding: 14px 22px; }
.trip-stats > div + div { border-left: 1px solid var(--border); }
.stat-k { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-v { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-s { font-size: 12.5px; color: var(--text-2); }

.trip-chart { padding: 14px 14px 6px 8px; border-top: 1px solid var(--border); }
.trip-chart-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 8px 4px 14px; gap: 8px; }
.trip-notes { display: flex; flex-direction: column; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--border); }
.note { display: flex; gap: 10px; font-size: 13.5px; color: var(--text-2); align-items: flex-start; }
.note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.note b { color: var(--text); font-weight: 600; }

.trip.infeasible .depart-time { color: var(--crit-ink); }
.alert {
  margin: 4px 22px 4px; padding: 10px 14px; border-radius: 12px; background: var(--crit-soft); color: var(--crit-ink);
  font-size: 13.5px; font-weight: 550; display: flex; gap: 10px; align-items: flex-start;
}
.alert svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert.info { background: var(--accent-soft); color: var(--accent-ink); }

.empty {
  padding: 32px 24px; text-align: center; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
}
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 15px; }

/* ==========================================================================
   Semaine
   ========================================================================== */
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.week-day h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; display: flex; justify-content: space-between; align-items: baseline; }
.week-day h3 .muted { font-weight: 500; font-size: 12px; }
.week-day.today h3 { color: var(--accent-ink); }
.wcard {
  display: block; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  border-radius: 16px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s;
}
.wcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.wcard .period { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.wcard .period svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.wcard .period .chip { text-transform: none; letter-spacing: 0; padding: 2px 8px; }
.wcard .t { font-size: 32px; font-weight: 800; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; margin: 8px 0 2px; line-height: 1; }
.wcard .stops { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.wcard .r { font-size: 13.5px; color: var(--text); font-weight: 600; margin-top: 8px; min-height: 2.7em; line-height: 1.35; }
.wcard .r .chip svg { width: 12px; height: 12px; }
.wcard .arr { font-size: 12.5px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.pbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.pbar > i { display: block; height: 100%; border-radius: 99px; }
.wcard.off { opacity: .55; box-shadow: none; cursor: default; }

/* ==========================================================================
   Bouchons — carte, frise, heatmap
   ========================================================================== */
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.map-wrap { position: relative; height: min(62vh, 560px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface-2); }
.map { position: absolute; inset: 0; }
.map-overlay {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.map-overlay .time { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; min-width: 82px; }
.map-overlay input[type=range] { flex: 1; }
.map-legend {
  position: absolute; top: 12px; left: 12px; z-index: 2; padding: 10px 12px; border-radius: 14px; font-size: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; color: var(--text-2);
}
.map-legend .lg { display: flex; align-items: center; gap: 8px; }
.map-legend .dotc { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.play {
  width: 40px; height: 40px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none;
  box-shadow: 0 6px 16px -6px var(--accent);
}
.play svg { width: 16px; height: 16px; fill: currentColor; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--surface-3); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--surface-3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: var(--shadow); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }

.maplibregl-popup-content { background: var(--surface) !important; color: var(--text); border-radius: 12px !important; box-shadow: var(--shadow-lg) !important; padding: 10px 12px !important; font-family: var(--font); font-size: 13px; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--border); box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--border) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maplibregl-ctrl-icon { filter: invert(1); } }
.maplibregl-ctrl-attrib { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }

.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--border); }
.chart .axis { stroke: var(--border-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); padding: 4px 8px 6px 14px; }
.legend .li { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.legend .li.off { opacity: .4; }
.legend .ln { width: 16px; height: 3px; border-radius: 2px; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 150px; max-width: 280px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 12.5px; line-height: 1.4; transform: translate(-50%, calc(-100% - 14px));
}
.tooltip .tt-h { font-weight: 700; font-size: 13px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.tooltip .tt-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tooltip .tt-r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .tt-r b { font-weight: 650; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-size: 32px; font-weight: 800; letter-spacing: -0.045em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; line-height: 1; }
.tile .s { font-size: 12.5px; color: var(--text-2); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.quota-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.quota-row:last-child { border-bottom: 0; }

/* formulaires */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .login input {
  padding: 11px 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 500; color: var(--text); width: 100%;
}
.field input:focus, .field select:focus, .login input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

/* sheet (détail d'un trajet) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 9, .35); backdrop-filter: blur(2px); animation: fade .2s; }
.sheet {
  position: fixed; z-index: 61; right: 0; top: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg);
  box-shadow: var(--shadow-lg); overflow-y: auto; padding: 20px 20px 40px; animation: slidein .28s var(--ease);
  border-left: 1px solid var(--border);
}
.sheet .close { position: sticky; top: 0; float: right; z-index: 2; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; padding: 32px 28px; background: var(--surface); border-radius: 24px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.login-card p { margin: 0 0 8px; }
.login-err { color: var(--crit-ink); font-size: 13px; min-height: 1em; margin: 0; }

/* skeleton */
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.fade-in { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .week { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .tabs { display: none; }
  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px max(8px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--border);
  }
  .bottombar .tab { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10.5px; border-radius: 12px; justify-content: center; }
  .bottombar .tab svg { width: 22px; height: 22px; }
  .bottombar .tab[aria-current="page"] { background: transparent; box-shadow: none; color: var(--accent); }
  .view { padding: 18px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
  h1.title { font-size: 26px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .trip-head, .trip-stops, .trip-hero, .route-line, .trip-notes { padding-left: 18px; padding-right: 18px; }
  .trip-stats > div { padding: 12px 14px; }
  .stat-v { font-size: 18px; }
  .ring { width: 92px; height: 92px; }
  .ring-label b { font-size: 22px; }
  .week { grid-template-columns: 1fr; gap: 6px; }
  .week-day { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .week-day h3 { grid-column: 1 / -1; margin: 10px 0 0; }
  .wcard { margin: 0; }
  .map-wrap { height: 58vh; border-radius: 16px; }
  .map-overlay { left: 8px; right: 8px; bottom: 8px; padding: 8px 10px; }
  .map-legend { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; right: 52px; left: 8px; top: 8px; padding: 6px 10px; font-size: 11px; }
  .map-legend .dotc { width: 9px; height: 9px; }
  .map-overlay .time { font-size: 22px; min-width: 66px; }
  .form { grid-template-columns: 1fr; }
  .quota-row { grid-template-columns: 1fr; gap: 6px; }
  .live-pill .txt { display: none; }
  .live-pill { padding: 8px; }
  .sheet { width: 100vw; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
