/* Covoit' A41 — tableau de bord de péage pour 4 covoitureurs.
   Layout : application mobile une colonne, barre d'onglets en bas, feuilles qui montent du bas. */
:root {
  --bg: #EEF1F5;          /* asphalte clair */
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --ink: #12151C;
  --muted: #687082;
  --faint: #9AA1AF;
  --line: #E1E5EC;
  --sign: #C8102E;        /* rouge des panneaux d'autoroute */
  --good: #1E9E5A;
  --good-bg: #E3F6EB;
  --warn: #B86E00;
  --warn-bg: #FFF2DC;
  --off-bg: #E6E9EF;
  --ferie-bg: #FDE8EA;
  --conges-bg: #E5EEFF;
  --conges: #2F5FD0;
  --primary: #12151C;
  --on-primary: #FFFFFF;
  --shadow: 0 1px 2px rgba(18,21,28,.06), 0 8px 24px rgba(18,21,28,.06);
  --patou: #E2A93E; --matt: #4FA77C; --alex: #DC6E6E; --will: #5E8FE6;
  --route-A2: #6A4BD0; --route-A1: #3E4757; /* trajets : violet = Annecy ⇄ Genève, ardoise = Alby ⇄ Annecy (distincts des 4 couleurs de personnes) */
  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1015; --surface: #161A21; --surface-2: #1C212A; --ink: #EEF1F6; --muted: #9AA2B2; --faint: #6B7383;
    --line: #262C37; --sign: #F0485F; --good: #4CC98A; --good-bg: #13301F; --warn: #F2B154; --warn-bg: #352710;
    --off-bg: #1B2028; --ferie-bg: #3A1A20; --conges-bg: #172442; --conges: #8BB0FF;
    --primary: #EEF1F6; --on-primary: #0D1015; --shadow: 0 1px 2px rgba(0,0,0,.3);
    --patou: #EDC06A; --matt: #78C49C; --alex: #EC9090; --will: #8AAEF0;
    --route-A2: #8C74EE; --route-A1: #5F6A7D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1015; --surface: #161A21; --surface-2: #1C212A; --ink: #EEF1F6; --muted: #9AA2B2; --faint: #6B7383;
  --line: #262C37; --sign: #F0485F; --good: #4CC98A; --good-bg: #13301F; --warn: #F2B154; --warn-bg: #352710;
  --off-bg: #1B2028; --ferie-bg: #3A1A20; --conges-bg: #172442; --conges: #8BB0FF;
  --primary: #EEF1F6; --on-primary: #0D1015; --shadow: 0 1px 2px rgba(0,0,0,.3);
  --patou: #EDC06A; --matt: #78C49C; --alex: #EC9090; --will: #8AAEF0;
  --route-A2: #8C74EE; --route-A1: #5F6A7D;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--will); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }

/* ---------- Coquille ---------- */
.shell { max-width: 560px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px)); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); display: flex; align-items: center; gap: 10px; padding-block: 12px 10px; }
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; text-align: left; }
.topbar .who b { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.topbar .who small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.iconbtn:active { background: var(--surface); }
.iconbtn svg { width: 22px; height: 22px; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.sync.busy { background: var(--warn); }
.sync.err { background: var(--sign); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); }
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--ink); }
.nav button.on .dot { opacity: 1; }

/* ---------- Avatars ---------- */
.av { --c: var(--ink); width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; flex: none; }
.av svg { width: 58%; height: 58%; }
.av.sm { width: 26px; height: 26px; }
.av.xs { width: 20px; height: 20px; }
.av.lg { width: 56px; height: 56px; }
.av.xl { width: 72px; height: 72px; }

/* ---------- Blocs ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; }
.section-title h2 { font-size: 17px; font-weight: 700; }
.section-title span { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-block: 4px; }
.monthbar h1 { font-size: 26px; font-weight: 700; text-transform: capitalize; }
.monthbar .arrows { display: flex; gap: 4px; }
.monthbar .arrows button { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.monthbar .arrows svg { width: 18px; height: 18px; }

/* Panneau d'autoroute */
.sign { display: inline-flex; align-items: center; justify-content: center; background: var(--sign); color: #fff; font: 700 11px/1 var(--font-display); padding: 3px 6px 2px; border-radius: 4px; letter-spacing: .02em; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.85); }

/* ---------- Solde ---------- */
.balance { padding: 22px 20px 18px; position: relative; overflow: hidden; }
.balance .big { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.02em; margin: 8px 0 6px; }
.balance .lead { font-size: 15px; color: var(--muted); font-weight: 600; }
.balance .lines { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 7px; }
.line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.line span:first-child { color: var(--muted); min-width: 0; }
.line.total { font-weight: 700; font-size: 15px; padding-top: 6px; border-top: 1px solid var(--line); }
.line.total span:first-child { color: var(--ink); }
.balance .stripe { position: absolute; inset: 0 0 auto; height: 5px; background: var(--c); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.red { background: var(--ferie-bg); color: var(--sign); }
.chip.blue { background: var(--conges-bg); color: var(--conges); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 700; background: var(--primary); color: var(--on-primary); }
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--ferie-bg); color: var(--sign); }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Bascules aller / retour ---------- */
.toggles { display: flex; gap: 6px; }
.tg { height: 34px; padding: 0 11px; border-radius: 10px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--faint); border: 1.5px dashed var(--line); display: inline-flex; align-items: center; gap: 5px; }
.tg svg { width: 14px; height: 14px; }
.tg.on { background: var(--c, var(--ink)); color: #fff; border: 1.5px solid transparent; }
.wheel { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--faint); border: 1.5px dashed var(--line); }
.wheel svg { width: 19px; height: 19px; }
.wheel.on { color: var(--on-primary); background: var(--primary); border: 1.5px solid transparent; }

/* ---------- Liste de jours (espace perso) ---------- */
.days { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.dayrow { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); text-align: left; width: 100%; }
.dayrow:first-child { border-top: 0; }
.dayrow.off { background: var(--surface-2); padding-block: 7px; }
.dayrow.today { box-shadow: inset 3px 0 0 var(--ink); }
.dnum { display: flex; flex-direction: column; line-height: 1.05; }
.dnum b { font-family: var(--font-display); font-size: 20px; }
.dnum small { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dayrow.off .dnum b { font-size: 15px; color: var(--faint); }
.legs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.leg .lbl { width: 46px; }
.amt { font-weight: 700; font-size: 14px; text-align: right; }
.amt small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.weekhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-top: 1px solid var(--line); width: 100%; text-align: left; }
.weekhead:first-child { border-top: 0; }
.weekhead .eyebrow { font-size: 11px; }

/* Demi-pilules aller/retour */
.ar { display: inline-flex; width: 34px; height: 18px; border-radius: 999px; overflow: hidden; background: var(--off-bg); position: relative; flex: none; }
.ar i { flex: 1; display: block; }
.ar i + i { border-left: 2px solid var(--surface); }
.ar i.on { background: var(--c, var(--ink)); }
.ar.big { width: 44px; height: 24px; }

/* ---------- Vue mensuelle ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 4px; border: 1px solid var(--line); }
.seg button { height: 38px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.grid { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; overflow: clip; }
.ghead, .grow2 { display: grid; align-items: center; gap: 6px; padding: 8px 12px; }
.ghead { background: var(--surface-2); position: sticky; top: calc(env(safe-area-inset-top, 0px) + 66px); z-index: 5; border-bottom: 1px solid var(--line); }
.ghead .pc { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.grow2 { border-top: 1px solid var(--line); width: 100%; text-align: left; min-height: 48px; }
.grow2.off { min-height: 0; padding-block: 6px; background: var(--surface-2); }
.grow2 .cell { display: flex; justify-content: center; position: relative; }
.grow2 .cell .drv { position: absolute; top: -9px; right: calc(50% - 26px); width: 17px; height: 17px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.grow2 .cell .drv svg { width: 12px; height: 12px; }
.grow2 .daylbl { display: flex; align-items: baseline; gap: 5px; }
.grow2 .daylbl b { font-family: var(--font-display); font-size: 17px; }
.grow2 .daylbl small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.edited { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); display: inline-block; margin-left: 3px; vertical-align: middle; }
.grow2 .nodrv { font-size: 10.5px; font-weight: 700; color: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Calendrier ---------- */
.cal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px; }
.cal-h, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-h span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 6px; }
.cal-d { aspect-ratio: 1 / 1.08; max-width: 100%; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 3px; font-weight: 700; font-size: 14px; position: relative; }
.cal-d.we { color: var(--faint); }
.cal-d.ferie { background: var(--ferie-bg); color: var(--sign); }
.cal-d.conges { background: var(--conges-bg); color: var(--conges); }
.cal-d.today::after { content: ""; position: absolute; inset: 2px; border: 2px solid var(--ink); border-radius: 10px; }
.cal-d .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; padding: 0 2px; }
.cal-d .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); display: block; }
.cal-d.empty { visibility: hidden; }
.evlist { display: flex; flex-direction: column; gap: 8px; }
.ev { display: flex; align-items: center; gap: 12px; background: var(--surface); padding: 12px 14px; border-radius: var(--r-md); box-shadow: var(--shadow); }
.ev .tag { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ev .tag svg { width: 19px; height: 19px; }

/* ---------- Comptes ---------- */
.debt { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.debt:first-child { border-top: 0; }
.debt .val { font-family: var(--font-display); font-size: 20px; font-weight: 700; text-align: right; }
.debt .sub { font-size: 12.5px; color: var(--muted); }
.settle { height: 32px; padding: 0 11px; border-radius: 10px; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; background: var(--warn-bg); color: var(--warn); margin-top: 4px; }
.settle.done { background: var(--good-bg); color: var(--good); }
.settle svg { width: 14px; height: 14px; }
.invoice { display: grid; gap: 8px; }
.invoice .head { display: flex; align-items: center; gap: 8px; }
.meter { height: 8px; border-radius: 99px; background: var(--off-bg); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }
.adj { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.adj:first-child { border-top: 0; }
.adj .val { font-weight: 800; }
.plus { color: var(--sign); } .minus { color: var(--good); }

/* ---------- Année ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); }
.kpi.wide { grid-column: 1 / -1; }
.kpi b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.1; margin-top: 4px; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.duel .side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.duel .side b { font-family: var(--font-display); font-size: 40px; line-height: 1; }
.duel .vs { color: var(--faint); font-weight: 800; font-size: 13px; }
.balancebar { height: 10px; border-radius: 99px; display: flex; overflow: hidden; margin-top: 14px; background: var(--off-bg); }
.balancebar i { display: block; height: 100%; }
.tablewrap { overflow-x: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 10px 10px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 0; font-weight: 700; }
th:first-child, td:first-child { text-align: left; }
td .row { gap: 8px; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; height: 140px; padding-top: 8px; }
.bars .b { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.bars .b i { display: block; border-radius: 4px 4px 2px 2px; min-height: 0; }
.bars-l { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; margin-top: 6px; font-size: 10.5px; color: var(--muted); text-align: center; font-weight: 700; text-transform: uppercase; }

/* ---------- Feuilles ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(8,10,14,.45); z-index: 40; opacity: 0; transition: opacity .2s; }
.backdrop.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding-top: 8px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); max-width: 560px; margin: 0 auto; }
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.sheet-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-h h2 { font-size: 22px; }
.sheet-h p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.who-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.who-row:first-of-type { border-top: 0; }
.who-row .nm { font-weight: 700; }
.who-row .nm small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.ctrls { display: flex; gap: 6px; align-items: center; }
.bsec { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); margin-bottom: 12px; }
.bsec h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bsec h3 .chip { margin-left: auto; }
.bsec .who-row { border-color: var(--line); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea { height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 12px; width: 100%; min-width: 0; }
.field textarea { height: 76px; padding: 10px 12px; resize: vertical; }
.fields { display: grid; gap: 12px; }
.fields.two { grid-template-columns: 1fr 1fr; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button { height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.pick button.on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.pick .av { width: 22px; height: 22px; }

/* ---------- Écrans plein ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding-block: 32px; max-width: 460px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 30px; font-weight: 800; }
.hero-t { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.person { background: var(--surface); border-radius: var(--r-lg); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); text-align: left; border: 2px solid transparent; }
.person b { font-family: var(--font-display); font-size: 22px; }
.person small { color: var(--muted); font-size: 12.5px; display: block; margin-top: -8px; }
.person.on { border-color: var(--c); }

.banner { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 14px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--primary); color: var(--on-primary); padding: 11px 16px; border-radius: 14px; font-weight: 700; font-size: 14px; z-index: 60; opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--muted); padding: 22px 12px; font-size: 14px; }
.confirm { display: flex; gap: 8px; }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.settings-group { display: grid; gap: 12px; }
.price { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.price:first-child { border-top: 0; }

@media (prefers-reduced-motion: reduce) { .sheet, .backdrop, .toast { transition: none; } }
@media (max-width: 380px) {
  .balance .big { font-size: 38px; }
  .stats { gap: 7px; }
  .stat b { font-size: 20px; }
  .tg { padding: 0 8px; }
}

/* Couleurs des covoitureurs (en dernier pour primer) */
.c-patou { --c: var(--patou); } .c-matt { --c: var(--matt); } .c-alex { --c: var(--alex); } .c-will { --c: var(--will); }
.seg button svg, .pick button svg, .weekhead svg { width: 16px; height: 16px; flex: none; }
.legend i { box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Verrouillage ---------- */
.lockchip { margin-top: 4px; }
.monthbar > button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.lockcard { display: grid; gap: 12px; border: 1.5px solid var(--good); }
.lockcard.warn { border-color: var(--warn); }
.lockcard > .row > svg { width: 22px; height: 22px; color: var(--good); flex: none; }
.lockcard.warn > .row > svg { color: var(--warn); }
.settle.is-locked { opacity: .75; }
.banner.ok { background: var(--good-bg); color: var(--good); }
.locked .tg, .locked .wheel, .locked .pick button, .locked .btn { opacity: .4; }
.iconbtn.on { color: var(--ink); background: var(--surface); }

/* ---------- Historique ---------- */
.hist { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.hist:first-child { border-top: 0; }
.hist.mini { padding: 8px 0; gap: 10px; }
.hist .av { margin-top: 1px; }

/* Couleurs des covoitureurs (en dernier pour primer) */
.c-patou { --c: var(--patou); } .c-matt { --c: var(--matt); } .c-alex { --c: var(--alex); } .c-will { --c: var(--will); }
.lockcard .btn { height: auto; min-height: 40px; padding-block: 8px; }
.lockcard .row.wrap { gap: 8px; }

/* Rectifications à plusieurs */
.avs { display: flex; flex-direction: column; gap: 0; }
.avs .av + .av { margin-top: -8px; box-shadow: 0 0 0 2px var(--surface); }
.adj-split { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; }

/* ---------- Installation sur l'écran d'accueil ---------- */
.install-card { display: grid; gap: 12px; }
.install-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.install-ic svg { width: 22px; height: 22px; }
.isteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.istep { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.istep:first-child { border-top: 0; padding-top: 4px; }
.istep b { font-size: 15px; }
.inum { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.ikey { width: 40px; height: 40px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--will); flex: none; }
.ikey svg { width: 22px; height: 22px; }
.hint-art { display: flex; gap: 14px; align-items: center; font-size: 15px; }
.hint-icon { flex: none; width: 64px; height: 64px; border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); }
.hint-icon img { display: block; width: 100%; height: 100%; }
.banner.ok svg { color: var(--good); }
@keyframes flashring { 0%, 100% { box-shadow: var(--shadow); } 30%, 70% { box-shadow: 0 0 0 3px var(--will), var(--shadow); } }
.install-card.flash { animation: flashring 1.2s ease 2; }
@media (prefers-reduced-motion: reduce) { .install-card.flash { animation: none; box-shadow: 0 0 0 3px var(--will); } }

/* ---------- Clins d'œil (profil Patou) ---------- */
.wink { display: flex; gap: 7px; align-items: baseline; margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.wink i { font-style: italic; font-weight: 700; color: var(--patou); }
.wink-note { color: var(--patou); font-weight: 800; flex: none; }
.wink.on-card { margin: -2px 0 2px; }
.wink.small-w { margin-top: 10px; font-size: 12px; }
.wink-row { display: flex; flex-direction: column; gap: 2px; margin-top: -4px; }
.wink-row .wink { margin: 0; }
.switch-row { display: flex; gap: 14px; align-items: center; width: 100%; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--off-bg); position: relative; flex: none; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--good); }
.switch.on i { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } }
.wink-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: -4px; }
.wink-top .wink { margin: 0; min-width: 0; }
.wink-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: var(--surface); color: var(--muted); box-shadow: var(--shadow); }
.wink-btn span { color: var(--patou); font-weight: 800; }
.wink-btn:not(.on) { background: var(--patou); color: #fff; }
.wink-btn:not(.on) span { color: #fff; }

/* ---------- Badge oublié ---------- */
.forgot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fr-l { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.fr-l svg { width: 18px; height: 18px; }
.tg.nbtg.on { --c: var(--warn); }
.fr-who { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pick.sm button { height: 34px; padding: 0 10px; font-size: 13px; }
.pick.sm .av { width: 20px; height: 20px; }
.nb { display: inline-flex; width: 16px; height: 16px; color: var(--warn); }
.nb svg { width: 16px; height: 16px; }
.nodrv.nbt { color: var(--warn); }
.forgot-box { display: grid; gap: 6px; padding: 12px; border-radius: var(--r-md); background: var(--warn-bg); margin-top: 4px; }
.forgot-box svg { width: 18px; height: 18px; color: var(--warn); flex: none; }
.forgot-box .line span:first-child { color: var(--ink); }
.nb-btn { margin-top: 10px; background: var(--surface) !important; border: 1.5px solid var(--line); }
.nb-set { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; text-align: left; }
.nb-set svg { width: 18px; height: 18px; flex: none; }
.nb-set .small { font-weight: 700; text-decoration: underline; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg button:disabled { opacity: .35; }

/* ---------- Mes trajets : une ligne par trajet ---------- */
.dayrow.v2 { grid-template-columns: 52px 1fr; align-items: center; }
.legstack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.legline { display: grid; grid-template-columns: 64px auto 1fr auto; align-items: center; gap: 10px; }
.legline + .legline { padding-top: 8px; border-top: 1px dashed var(--line); }
.tag { display: inline-flex; justify-content: center; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 0; border-radius: 6px; }
.tag-A2 { background: var(--route-A2); color: #fff; }
.tag-A1 { background: var(--route-A1); color: #fff; }
.lmarks { display: inline-flex; align-items: center; gap: 6px; }
.lcost { font-weight: 700; font-size: 14px; text-align: right; }
.lcost small { color: var(--muted); font-weight: 600; }

/* Petit volant posé sur la pastille ou l'avatar du conducteur */
.arw, .drvwho { position: relative; display: inline-flex; flex: none; }
.drv-mini { position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.drv-mini svg { width: 11px; height: 11px; }
.ar.big + .drv-mini { top: -8px; right: -8px; width: 18px; height: 18px; }
.ar.big + .drv-mini svg { width: 12px; height: 12px; }
.drvwho .drv-mini { top: -5px; right: -6px; }

/* ---------- Calendrier maison ---------- */
.dp { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; }
.dp-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-h b { font-family: var(--font-display); font-size: 16px; }
.dp-nav { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }
.dp-nav svg { width: 18px; height: 18px; }
.dp-w, .dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dp-w span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.dp-d { height: 40px; border-radius: 10px; font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; color: var(--ink); position: relative; }
.dp-d.empty { visibility: hidden; }
.dp-d.we { color: var(--faint); }
.dp-d.offd { color: var(--sign); background: var(--ferie-bg); }
.dp-d.today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.dp-d.on { background: var(--primary); color: var(--on-primary); }
.dp-d:disabled { opacity: .35; cursor: default; }
.dp-sum { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.datebtn { display: flex; align-items: center; gap: 10px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 12px; width: 100%; font-weight: 600; text-align: left; }
.datebtn svg { width: 18px; height: 18px; color: var(--muted); flex: none; }

/* ---------- Rotation ---------- */
.rotrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px; border-top: 1px solid var(--line); }
.rotrow:first-child { border-top: 0; }
.rotrow.cur { background: var(--surface-2); }
.rotrow > svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.order { display: flex; flex-direction: column; gap: 6px; }
.ord-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--surface-2); }
.ord-n { width: 22px; text-align: center; font-weight: 800; color: var(--muted); }
.ord-row .iconbtn { width: 34px; height: 34px; }
.ord-row .iconbtn:disabled { opacity: .3; }
.rot-up, .rot-down { display: inline-flex; }
.rot-up svg { transform: rotate(90deg); }
.rot-down svg { transform: rotate(-90deg); }
details.adv summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::after { content: "+"; font-weight: 800; color: var(--muted); margin-left: 8px; }
details.adv[open] summary::after { content: "–"; }
details.adv summary .small { margin-left: auto; }
.legend .arw { margin-right: 6px; }

/* ---------- Guide ---------- */
.guide-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.guide-card > svg { width: 18px; height: 18px; color: var(--faint); }
.g-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--ink); }
.g-ic svg { width: 24px; height: 24px; }
.g-body { font-size: 15px; line-height: 1.5; min-height: 190px; }
.g-body p { margin: 0 0 10px; }
.g-demo { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.g-demo .tag { width: 64px; }
.g-dots { display: flex; justify-content: center; gap: 6px; margin: 6px 0 14px; }
.g-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.g-dots i.on { background: var(--ink); width: 18px; border-radius: 4px; }

/* ---------- Bandeau aux couleurs du covoitureur (même teinte que ses pastilles) ---------- */
:root { --me: var(--will); --me-band: var(--me); --on-me: #FFFFFF; }
:root[data-me="patou"] { --me: var(--patou); --on-me: #2A1D05; }
:root[data-me="matt"]  { --me: var(--matt); }
:root[data-me="alex"]  { --me: var(--alex); }
:root[data-me="will"]  { --me: var(--will); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --on-me: #0D1015; } }
:root[data-theme="dark"] { --on-me: #0D1015; }
:root[data-me] body::before { background: var(--me-band); }
.topbar {
  background: var(--me-band); color: var(--on-me); border-radius: 0 0 20px 20px; margin-bottom: 14px;
  margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar .who small { color: color-mix(in srgb, var(--on-me) 78%, transparent); }
.topbar .iconbtn { color: var(--on-me); }
.topbar .iconbtn.on, .topbar .iconbtn:active { background: color-mix(in srgb, var(--on-me) 16%, transparent); }
.topbar .av { background: var(--on-me); color: var(--me); }
.topbar .sync { box-shadow: 0 0 0 2px var(--on-me); }
.ghead { top: calc(env(safe-area-inset-top, 0px) + 64px); }

/* ---------- Réglages : groupes ---------- */
.group-h { font-family: var(--font-display); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 -4px; padding-top: 14px; border-top: 1px solid var(--line); }
.monthbar + .group-h { border-top: 0; padding-top: 0; margin-top: 4px; }

/* ---------- Tuto interactif : téléphone dessiné ---------- */
.inst { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; }
.inst-txt h3 { font-size: 17px; margin: 4px 0 6px; }
.inst-txt p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
@media (max-width: 380px) { .inst { grid-template-columns: 150px 1fr; gap: 12px; } }
.ph { position: relative; width: 100%; max-width: 100%; aspect-ratio: 9 / 17; border-radius: 26px; background: #12151C; padding: 7px; box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.ph-notch { position: absolute; top: 10px; left: 50%; width: 46px; height: 10px; margin-left: -23px; border-radius: 6px; background: #000; z-index: 3; }
.ph-screen { position: relative; height: 100%; border-radius: 20px; overflow: hidden; background: #F4F5F8; color: #12151C; font-size: 9.5px; display: flex; flex-direction: column; }
.ph-page { flex: 1; padding: 26px 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.ph-page i { display: block; height: 8px; border-radius: 4px; background: #DDE1E8; }
.ph-page i.w60 { width: 60%; } .ph-page i.w40 { width: 40%; }
.ph-band { height: 30px; border-radius: 8px; background: var(--me-band); margin-bottom: 4px; }
.ph-iosbar { background: #fff; border-top: 1px solid #E3E6EC; padding: 6px 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ph-tools { display: flex; justify-content: space-between; align-items: center; color: #2F6FE4; font-size: 14px; padding: 0 4px; }
.ph-tools svg, .ph-ic svg { width: 14px; height: 14px; }
.ph-url { display: block; text-align: center; background: #ECEEF2; border-radius: 8px; padding: 5px 4px; color: #555; flex: 1; }
.ph-chrome { display: flex; align-items: center; gap: 6px; padding: 24px 8px 6px; background: #fff; border-bottom: 1px solid #E3E6EC; }
.ph-ic { display: inline-flex; color: #444; }
.ph-sbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 10px; background: #fff; border-top: 1px solid #E3E6EC; color: #444; font-size: 13px; }
.ph-sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 14px 14px 0 0; padding: 8px; box-shadow: 0 -6px 18px rgba(0,0,0,.15); display: flex; flex-direction: column; }
.ph-menu { position: absolute; top: 46px; right: 6px; width: 72%; background: #fff; border-radius: 10px; padding: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.ph-row { padding: 7px 8px; border-bottom: 1px solid #EEF0F3; color: #333; }
.ph-dialog { flex: 1; background: #F4F5F8; padding: 26px 0 0; }
.ph-dh { display: flex; justify-content: space-between; align-items: center; padding: 8px; background: #fff; border-bottom: 1px solid #E3E6EC; color: #2F6FE4; }
.ph-dh b { color: #12151C; font-size: 9px; }
.ph-dapp { display: flex; align-items: center; gap: 8px; padding: 10px 8px; }
.ph-dapp img { width: 34px; height: 34px; border-radius: 8px; }
.ph-dapp span { display: flex; flex-direction: column; font-weight: 700; }
.ph-dapp small { font-weight: 400; color: #666; }
.ph-modal { position: absolute; left: 8px; right: 8px; top: 34%; background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.ph-mbtn { display: flex; justify-content: flex-end; gap: 10px; align-items: center; color: #2F6FE4; font-weight: 700; }
.ph-home { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; padding: 30px 10px; align-content: start; background: linear-gradient(160deg, #3B4A6B, #1C2233); }
.ph-home i { display: block; aspect-ratio: 1; border-radius: 9px; background: rgba(255,255,255,.22); }
.ph-app { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ph-app img { width: 100%; aspect-ratio: 1; border-radius: 9px; }
.ph-app small { color: #fff; font-size: 7.5px; }
/* l'élément à toucher clignote */
.tgt { position: relative; font: inherit; color: inherit; border-radius: 8px; animation: tgtPulse 1.4s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(47,111,228,.6); outline: 2px solid #2F6FE4; outline-offset: 1px; cursor: pointer; }
.tgt.pill { flex: 1; background: #ECEEF2; padding: 5px 4px; color: #333; text-align: center; }
.tgt.ic { display: inline-flex; padding: 3px; color: #2F6FE4; }
.tgt.row { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 7px 8px; background: #EAF1FF; color: #12151C; font-weight: 700; text-align: left; }
.tgt.row svg { width: 12px; height: 12px; }
.tgt.txt { padding: 2px 6px; color: #2F6FE4; font-weight: 700; }
.tgt-done { animation: tgtPulse 1.4s ease-in-out infinite; border-radius: 10px; outline: 2px solid #4FD18B; outline-offset: 2px; }
@keyframes tgtPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47,111,228,.55); } 50% { box-shadow: 0 0 0 7px rgba(47,111,228,0); } }
@media (prefers-reduced-motion: reduce) { .tgt, .tgt-done { animation: none; } }
/* ---------- Bandeau compact ---------- */
.topbar { padding-block: 6px 6px; gap: 8px; border-radius: 0 0 14px 14px; margin-bottom: 10px; }
.topbar .who { gap: 8px; }
.topbar .who .av { width: 28px; height: 28px; }
.topbar .who b { font-size: 16px; line-height: 1.15; }
.topbar .who small { font-size: 11px; margin-top: 0; }
.topbar .iconbtn { width: 34px; height: 34px; border-radius: 10px; }
.topbar .iconbtn svg { width: 19px; height: 19px; }
.ghead { top: calc(env(safe-area-inset-top, 0px) + 46px); }

/* ---------- Choix du trajet (onglet Équipe) ---------- */
.routesel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.routesel button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 52px; border-radius: 14px; font: 700 15px/1 var(--font-display); border: 2px solid var(--line); background: var(--surface); color: var(--muted); }
.routesel button svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.routesel button.on { color: #fff; border-color: transparent; box-shadow: var(--shadow); }
.routesel button.r-A2.on { background: var(--route-A2); }
.routesel button.r-A1.on { background: var(--route-A1); }
.routesel button:not(.on).r-A2 { border-color: color-mix(in srgb, var(--route-A2) 35%, var(--line)); }
.routesel button:not(.on).r-A1 { border-color: color-mix(in srgb, var(--route-A1) 35%, var(--line)); }
.routetitle { display: flex; align-items: center; gap: 8px; align-self: start; padding: 8px 14px; border-radius: 12px; color: #fff; font: 700 15px/1 var(--font-display); }
.routetitle svg { width: 16px; height: 16px; }
.routetitle.r-A2 { background: var(--route-A2); }
.legend-foot { justify-content: center; padding: 4px 0 8px; }
.sheet .monthbar h1 { margin: 0; }
.legend .ar { gap: 0; align-items: stretch; }
.legline .tag { margin-right: 10px; }
