:root {
  --fond: #f2f4fa;
  --surface: #ffffff;
  --surface-2: #eceff8;
  --encre: #141b3a;
  --encre-2: #4a5275;
  --encre-3: #7c84a3;
  --trait: #dde1ee;
  --nuit: #1d2b64;
  --menthe: #7cf0cf;
  --accent: #3949c7;
  --accent-fort: #2a37a3;
  --accent-doux: #e6e9fb;
  --ok: #18865a; --ok-doux: #dff4ea;
  --attention: #a35f00; --attention-doux: #fcefd9;
  --danger: #b4322f; --danger-doux: #fbe5e3;
  --rayon: 16px;
  --ombre: 0 1px 2px rgba(20, 27, 58, .05), 0 8px 24px rgba(20, 27, 58, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0e1226; --surface: #161b35; --surface-2: #1d2342; --encre: #e7e9f6; --encre-2: #aeb4d2; --encre-3: #7d84a6;
    --trait: #2a3157; --nuit: #0a0e20; --accent: #8a98ff; --accent-fort: #a9b4ff; --accent-doux: #252c5a;
    --ok: #57d39a; --ok-doux: #15352a; --attention: #f0b357; --attention-doux: #3a2c12; --danger: #f2837c; --danger-doux: #3f1d1c;
    --ombre: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0e1226; --surface: #161b35; --surface-2: #1d2342; --encre: #e7e9f6; --encre-2: #aeb4d2; --encre-3: #7d84a6;
  --trait: #2a3157; --nuit: #0a0e20; --accent: #8a98ff; --accent-fort: #a9b4ff; --accent-doux: #252c5a;
  --ok: #57d39a; --ok-doux: #15352a; --attention: #f0b357; --attention-doux: #3a2c12; --danger: #f2837c; --danger-doux: #3f1d1c;
  --ombre: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--encre); font: 16px/1.55 Figtree, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
.chargement { padding: 40px; text-align: center; color: var(--encre-3); }

/* en-tête */
.haut { background: var(--nuit); color: #fff; }
.haut .dedans { max-width: 1120px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.marque { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; text-decoration: none; }
.marque svg { width: 32px; height: 32px; }
.marque small { display: block; font-weight: 500; font-size: 12px; color: #b9c2ee; }
.haut nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.haut nav a, .haut nav button { color: #d7dcf7; text-decoration: none; padding: 8px 12px; border-radius: 10px; font: inherit; font-size: 15px; font-weight: 600; background: none; border: 0; cursor: pointer; }
.haut nav a:hover, .haut nav button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.haut nav a.actif { background: rgba(124, 240, 207, .16); color: var(--menthe); }

main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 60px; }
.pied { max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; color: var(--encre-3); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.pied a { color: var(--encre-2); }

.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); margin-bottom: 18px; min-width: 0; }
.grille { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.sous { color: var(--encre-2); margin: 0; }
.petit { font-size: 14px; color: var(--encre-2); }
.etiquette { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-3); margin-bottom: 4px; }
.gros { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.vide { color: var(--encre-3); padding: 14px 0; }

/* boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--trait); background: var(--surface); color: var(--encre); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.principal:hover { background: var(--accent-fort); }
.btn.danger { color: var(--danger); }
.btn.lien { border: 0; background: none; padding: 4px 0; color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.champ { margin-bottom: 14px; }
.champ label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.champ .aide { font-size: 13px; color: var(--encre-3); margin-top: 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 10px; background: var(--surface); color: var(--encre); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.case { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.case input { width: auto; margin-top: 4px; }
.message { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 15px; }
.message.err { background: var(--danger-doux); color: var(--danger); }
.message.ok { background: var(--ok-doux); color: var(--ok); }
.message.info { background: var(--accent-doux); color: var(--encre); }
.message.att { background: var(--attention-doux); color: var(--attention); }

.pastille { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.p-ok { background: var(--ok-doux); color: var(--ok); }
.p-att { background: var(--attention-doux); color: var(--attention); }
.p-err { background: var(--danger-doux); color: var(--danger); }
.p-neutre { background: var(--surface-2); color: var(--encre-2); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--trait); }
td { padding: 10px; border-bottom: 1px solid var(--trait); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.defile { overflow-x: auto; }

/* connexion / inscription */
.porte { max-width: 460px; margin: 30px auto; }
.accueil-heros { background: var(--nuit); color: #fff; border-radius: 22px; padding: 36px 32px; margin-bottom: 22px; position: relative; overflow: hidden; }
.accueil-heros h1 { font-size: 34px; max-width: 640px; }
.accueil-heros p { color: #c9d0f2; max-width: 600px; font-size: 17px; }
.accueil-heros .actions { margin-top: 18px; }
.accueil-heros .btn { border-color: transparent; }
.accueil-heros .btn.principal { background: var(--menthe); color: var(--nuit); }
.accueil-heros::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(124, 240, 207, .12); }

/* commande */
.commande { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
@media (max-width: 960px) { .commande { grid-template-columns: minmax(0, 1fr); } }
.recap { position: sticky; top: 16px; }
.bascule { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.bascule button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--encre-2); cursor: pointer; }
.bascule button.actif { background: var(--surface); color: var(--encre); box-shadow: var(--ombre); }
.choix { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .choix { grid-template-columns: minmax(0, 1fr); } }
.option-carte { border: 2px solid var(--trait); border-radius: 14px; padding: 16px; cursor: pointer; background: var(--surface); text-align: left; font: inherit; color: inherit; display: block; width: 100%; }
.option-carte:hover { border-color: var(--accent); }
.option-carte.choisi { border-color: var(--accent); background: var(--accent-doux); }
.option-carte.verrou { cursor: default; }
.option-carte[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.option-carte .prix { font-size: 22px; font-weight: 800; margin: 6px 0 2px; }
.option-carte .prix small { font-size: 14px; font-weight: 500; color: var(--encre-3); }
.modules { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .modules { grid-template-columns: minmax(0, 1fr); } }
.module-ligne { display: flex; gap: 12px; align-items: flex-start; }
.module-ligne .coche { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--trait); flex: none; margin-top: 2px; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800; }
.choisi .coche { background: var(--accent); border-color: var(--accent); }
.compteur { display: inline-flex; align-items: center; gap: 6px; }
.compteur button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--trait); background: var(--surface); color: var(--encre); font-size: 18px; cursor: pointer; }
.compteur input { width: 64px; text-align: center; }
.ligne-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--trait); flex-wrap: wrap; }
.ligne-option:last-child { border-bottom: 0; }
.recap-ligne { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; }
.recap-ligne .d { font-size: 12.5px; color: var(--encre-3); }
.recap-total { border-top: 2px solid var(--trait); margin-top: 8px; padding-top: 10px; }
.recap-total .recap-ligne { font-weight: 700; }
.notes { font-size: 13px; color: var(--encre-3); padding-left: 18px; margin: 10px 0 0; }

/* tableau de bord */
.module-etat { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--trait); flex-wrap: wrap; }
.module-etat:last-child { border-bottom: 0; }
.instance { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.instance .adresse { font-weight: 700; font-size: 18px; word-break: break-all; }
dl.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
dl.infos dt { color: var(--encre-3); }
dl.infos dd { margin: 0; }

dialog { border: 0; border-radius: 18px; padding: 24px; max-width: 520px; width: calc(100% - 32px); background: var(--surface); color: var(--encre); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(14, 18, 38, .55); }
.qr { background: #fff; padding: 8px; border-radius: 12px; display: inline-block; }
.texte-legal { white-space: pre-wrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
@media (max-width: 600px) { h1 { font-size: 25px; } .accueil-heros { padding: 26px 20px; } .accueil-heros h1 { font-size: 26px; } .carte { padding: 18px; } }

/* jauge de consommation de l'Assistant IA */
progress.jauge { display: block; width: 100%; height: 10px; margin: .4rem 0 .6rem; border: 0; border-radius: 99px; overflow: hidden; appearance: none; -webkit-appearance: none; background: var(--surface-2); }
progress.jauge::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress.jauge::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress.jauge::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
progress.jauge.haut::-webkit-progress-value { background: #c2410c; }
progress.jauge.haut::-moz-progress-bar { background: #c2410c; }
