/* Système visuel : une couleur d'action, une d'alerte, une de danger. Tailles et espacements en variables. */
:root {
  --fond: #f6f7f5; --carte: #ffffff; --texte: #18201d; --discret: #5d6b66; --trait: #e1e6e3;
  --action: #0f6e5a; --sur-action: #ffffff; --action-pale: #e3f1ec;
  --alerte: #a15c00; --alerte-pale: #fff3df; --danger: #b42318;
  --rayon: 14px; --esp: 16px; --t-petit: 14px; --t-normal: 16px; --t-titre: 20px;
  --bas-sur: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #0f1513; --carte: #18201d; --texte: #e8eeeb; --discret: #9aaaa4; --trait: #2a3531;
    --action: #3fbf9b; --sur-action: #062a20; --action-pale: #173a30; --alerte: #f0b35a; --alerte-pale: #3a2a12; --danger: #f97066; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: var(--t-normal)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
.haut { position: sticky; top: 0; z-index: 2; background: var(--fond); padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--esp) 8px; }
.haut h1 { margin: 0; font-size: var(--t-titre); }
main { padding: 0 var(--esp) calc(96px + var(--bas-sur)); max-width: 720px; margin: 0 auto; }

.bas { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--carte); border-top: 1px solid var(--trait); padding-bottom: var(--bas-sur); z-index: 3; }
.bas button { position: relative; border: 0; background: none; color: var(--discret); font: inherit; font-size: 12px; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; }
.bas button span { font-size: 22px; line-height: 1; }
.bas button[aria-current="page"] { color: var(--action); font-weight: 600; }
.pastille { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--alerte); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; }

.btn { display: block; width: 100%; min-height: 48px; border: 0; border-radius: var(--rayon); background: var(--action); color: var(--sur-action); font: inherit; font-weight: 600; padding: 12px var(--esp); cursor: pointer; text-align: center; }
.btn.grand { min-height: 64px; font-size: 18px; margin: 8px 0 20px; }
.btn.second { background: var(--action-pale); color: var(--action); }
.btn.danger { background: none; color: var(--danger); }
.btn.lien { background: none; color: var(--action); min-height: 40px; padding: 8px; width: auto; display: inline-block; }
.rangee { display: flex; gap: 8px; } .rangee > * { flex: 1; }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: var(--esp); margin-bottom: 12px; }
.ligne { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; font: inherit; color: inherit; text-align: left; }
.ligne:last-child { border-bottom: 0; }
.ligne .ico { font-size: 22px; width: 32px; text-align: center; }
.ligne .milieu { flex: 1; min-width: 0; }
.ligne .milieu b, .ligne .milieu small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .montant { font-weight: 600; white-space: nowrap; }
small, .discret { color: var(--discret); font-size: var(--t-petit); }
h2 { font-size: var(--t-petit); text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin: 24px 0 8px; }
h3 { margin: 0 0 4px; font-size: 18px; }
.point { width: 8px; height: 8px; border-radius: 50%; background: var(--alerte); display: inline-block; margin-left: 6px; vertical-align: middle; }

.dep .chiffres { display: flex; gap: 16px; margin: 8px 0; font-size: var(--t-petit); color: var(--discret); }
.dep .chiffres b { color: var(--texte); }
.alerte { background: var(--alerte-pale); color: var(--alerte); border-radius: 10px; padding: 8px 12px; font-size: var(--t-petit); margin: 8px 0; }
.trajet { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: var(--t-petit); border-bottom: 1px dashed var(--trait); }

details { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); margin-bottom: 12px; }
details > summary { padding: 14px var(--esp); cursor: pointer; font-weight: 600; list-style: none; }
details > summary::after { content: "›"; float: right; transform: rotate(90deg); color: var(--discret); }
details[open] > summary::after { transform: rotate(-90deg); }
details > .contenu { padding: 0 var(--esp) var(--esp); }

label { display: block; font-size: var(--t-petit); color: var(--discret); margin: 12px 0 4px; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--trait); border-radius: 10px; background: var(--fond); color: var(--texte); font: inherit; padding: 8px 12px; }
input[type="checkbox"] { width: auto; min-height: 0; margin-right: 8px; }
.case { display: flex; align-items: center; color: var(--texte); font-size: var(--t-normal); }

.voile { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.feuille { background: var(--carte); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: var(--esp) var(--esp) calc(var(--esp) + var(--bas-sur)); }
.feuille .entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.feuille .fermer { border: 0; background: none; font-size: 28px; color: var(--discret); min-width: 44px; min-height: 44px; }
.photo-ticket { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--fond); }

.message { position: fixed; left: var(--esp); right: var(--esp); bottom: calc(76px + var(--bas-sur)); background: var(--texte); color: var(--fond); border-radius: 12px; padding: 12px var(--esp); z-index: 20; display: flex; gap: 12px; align-items: center; max-width: 688px; margin: 0 auto; }
.message button { background: none; border: 0; color: var(--action-pale); font: inherit; font-weight: 600; margin-left: auto; }

.total { display: flex; justify-content: space-between; padding: 8px 0; }
.total.fort { font-size: 20px; font-weight: 700; border-top: 2px solid var(--texte); margin-top: 8px; padding-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-petit); }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--trait); vertical-align: top; }
td.n, th.n { text-align: right; white-space: nowrap; }
.vide { text-align: center; color: var(--discret); padding: 32px 8px; }

@media print {
  body * { visibility: hidden; }
  #impression, #impression * { visibility: visible; }
  #impression { position: absolute; left: 0; top: 0; width: 100%; color: #000; }
  .voile { background: none; position: static; }
  .feuille { max-height: none; overflow: visible; box-shadow: none; }
}
