:root {
  --bg: #f6f6f4; --surface: #fff; --text: #1d1d1b; --muted: #6b6b66; --line: #e2e1dc;
  --accent: #b5643c; --accent-text: #fff; --ok: #2f7d4f; --warn: #a86b00; --err: #b3261e;
  --ok-bg: #e7f3ec; --warn-bg: #fbf1dc; --err-bg: #fbe9e7;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171716; --surface: #222220; --text: #ecebe6; --muted: #a09f98; --line: #3a3936;
    --accent: #e08a5e; --accent-text: #1d1d1b; --ok: #79c495; --warn: #e3b25a; --err: #f08b82;
    --ok-bg: #1f3227; --warn-bg: #3a2f17; --err-bg: #3d211e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
main { max-width: 1000px; margin: 0 auto; padding: 24px 16px 80px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
p.sous { color: var(--muted); margin: 0 0 20px; }
section { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 3px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px; }
button.primaire { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.pastille { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.p-ok { background: var(--ok-bg); color: var(--ok); } .p-warn { background: var(--warn-bg); color: var(--warn); } .p-err { background: var(--err-bg); color: var(--err); }
.carte { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 12px; }
.carte.envoye { opacity: .65; }
.entete { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.montant { font-size: 20px; font-weight: 700; color: var(--ok); white-space: nowrap; font-variant-numeric: tabular-nums; }
.libelle { font-size: 13px; color: var(--muted); white-space: pre-line; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; margin-top: 6px; }
td, th { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input, td select { padding: 4px 6px; }
.journal { font-size: 13px; margin-top: 8px; white-space: pre-wrap; }
.journal .err { color: var(--err); } .journal .ok { color: var(--ok); }
.colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 700px) { .colonnes { grid-template-columns: 1fr; } }
.barre { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 16px; }
.barre .contenu { max-width: 1000px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
details summary { cursor: pointer; }
.produits-choix { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.produits-choix label { display: flex; gap: 4px; align-items: center; color: var(--text); font-size: 14px; margin: 0; }
.produits-choix input { width: auto; }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); max-width: 480px; width: calc(100% - 32px); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
#boite-texte { white-space: pre-line; }
header.site { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
nav.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
nav.onglets button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--muted); font-weight: 600; }
nav.onglets button.actif { color: var(--text); border-bottom-color: var(--accent); }
.tableau { overflow-x: auto; }
.tableau table td, .tableau table th { white-space: nowrap; }
.tableau td.produits { white-space: normal; min-width: 140px; font-size: 13px; }
a { color: var(--accent); }
.connexion { max-width: 360px; margin: 12vh auto; }
.bouton-fichier { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.bouton-fichier input { display: none; }
