:root {
  --fond: #0b1016; --carte: #131b24; --carte2: #18222d; --trait: #223040; --texte: #e6edf3; --doux: #8b9bab;
  --vert: #34d399; --rouge: #f87171; --orange: #fbbf24; --bleu: #60a5fa;
  --prudent: #60a5fa; --medium: #34d399; --offensif: #fbbf24; --mercenaire: #f87171;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
[hidden] { display: none !important; }
.chiffre { font-variant-numeric: tabular-nums; }
.vert { color: var(--vert); } .rouge { color: var(--rouge); } .doux { color: var(--doux); }

/* connexion */
.connexion { max-width: 380px; margin: 0 auto; padding: 14vh 20px 40px; }
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.logo img { width: 52px; height: 52px; border-radius: 12px; }
.logo h1 { margin: 0; font-size: 26px; }
form label, .fenetre label:not(.choix) { display: block; color: var(--doux); font-size: 13px; margin-bottom: 14px; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 13px 14px; font-size: 16px; color: var(--texte);
  background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; }
.btn { padding: 13px 18px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte2); color: var(--texte);
  font-size: 15px; font-weight: 600; }
.btn.plein { background: var(--vert); color: #04150e; border-color: var(--vert); width: 100%; }
.boutons .btn.plein { width: auto; }
.btn.rouge { background: var(--rouge); color: #200; border-color: var(--rouge); }
.erreur { color: var(--rouge); min-height: 1.2em; }
.aide { color: var(--doux); font-size: 13px; }

/* en-tête */
.entete { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--fond); border-bottom: 1px solid var(--trait); }
.titre { font-weight: 700; font-size: 18px; }
.sous { color: var(--doux); font-size: 12px; }
.btn-arret { background: transparent; color: var(--rouge); border: 1.5px solid var(--rouge); border-radius: 8px;
  padding: 8px 12px; font-weight: 800; font-size: 13px; letter-spacing: .04em; }
.bandeau { background: #2a2310; color: var(--orange); font-size: 12px; text-align: center; padding: 6px 12px; }
.bandeau.hors { background: #2a1414; color: var(--rouge); }

main { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
h2 { font-size: 15px; margin: 22px 0 10px; color: var(--doux); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* total */
.total { background: var(--carte); border: 1px solid var(--trait); border-radius: 16px; padding: 16px; }
.total .lib { color: var(--doux); font-size: 13px; }
.total .val { font-size: 32px; font-weight: 750; margin: 2px 0; }
.total .lignes { display: flex; gap: 18px; font-size: 14px; flex-wrap: wrap; }

/* cartes enveloppes */
.env { display: block; width: 100%; text-align: left; color: inherit; background: var(--carte); border: 1px solid var(--trait);
  border-left: 4px solid var(--c); border-radius: 14px; padding: 14px; margin-top: 10px; font: inherit; }
.env .haut { display: flex; justify-content: space-between; align-items: baseline; }
.env .nom { font-weight: 700; font-size: 16px; }
.env .val { font-size: 20px; font-weight: 700; }
.env .bas { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-top: 6px; }
.env .info { font-size: 13px; color: var(--doux); }
.env svg { width: 46%; height: 40px; flex: none; }
.pastille { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.pastille.actif { background: #0f2a20; color: var(--vert); }
.pastille.pause { background: #2a2310; color: var(--orange); }
.pastille.arretee { background: #2a1414; color: var(--rouge); }

/* détail */
.retour { background: none; border: 0; color: var(--bleu); font-size: 15px; padding: 4px 0 10px; }
.courbe { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; padding: 10px; }
.courbe svg { width: 100%; height: 180px; display: block; }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.case { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 10px 12px; }
.case .l { color: var(--doux); font-size: 12px; } .case .v { font-weight: 700; font-size: 16px; }
.liste { background: var(--carte); border: 1px solid var(--trait); border-radius: 14px; overflow: hidden; }
.ligne { padding: 11px 14px; border-top: 1px solid var(--trait); display: flex; justify-content: space-between; gap: 10px; }
.ligne:first-child { border-top: 0; }
.ligne .g { min-width: 0; }
.ligne .t { font-weight: 600; } .ligne .s { color: var(--doux); font-size: 12.5px; }
.ligne .d { text-align: right; white-space: nowrap; font-weight: 700; }
.vide { padding: 16px; color: var(--doux); text-align: center; }
.actions-env { display: flex; gap: 8px; margin-top: 12px; }
.actions-env .btn { flex: 1; }

/* journal */
.j { padding: 10px 14px; border-top: 1px solid var(--trait); font-size: 14px; }
.j:first-child { border-top: 0; }
.j .m { color: var(--doux); font-size: 12px; }
.j.alerte, .j.perte { box-shadow: inset 3px 0 var(--rouge); } .j.gain { box-shadow: inset 3px 0 var(--vert); }
.j.refus { box-shadow: inset 3px 0 var(--orange); } .j.ordre { box-shadow: inset 3px 0 var(--bleu); }
.filtres { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.filtres button { flex: none; background: var(--carte); color: var(--doux); border: 1px solid var(--trait); border-radius: 99px;
  padding: 6px 12px; font-size: 13px; }
.filtres button.actif { color: var(--texte); border-color: var(--texte); }

/* onglets */
.onglets { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #0e151d; border-top: 1px solid var(--trait);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); z-index: 5; }
.onglets button { flex: 1; background: none; border: 0; color: var(--doux); font-size: 11.5px; padding: 4px 0; display: flex;
  flex-direction: column; align-items: center; gap: 2px; }
.onglets button span { font-size: 19px; line-height: 1; }
.onglets button.actif { color: var(--vert); }

/* fenêtres */
.fond { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; }
.fenetre { background: var(--carte); width: 100%; max-width: 520px; margin: 0 auto; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--trait); }
.fenetre h2 { margin-top: 0; color: var(--texte); text-transform: none; font-size: 19px; letter-spacing: 0; }
.fenetre p { color: var(--doux); }
.choix { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.choix input { width: 20px; height: 20px; margin: 0; }
.boutons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
