:root {
  --bg: #f5f6f4; --panel: #ffffff; --panel-2: #f0f2ee; --line: #dfe3dc; --text: #1c211c; --muted: #5f675f;
  --accent: #1f6f4a; --accent-2: #0f4c81; --accent-bg: rgba(31, 111, 74, .09);
  --ok: #1f8a54; --ok-bg: rgba(31, 138, 84, .12); --warn: #b26b00; --warn-bg: rgba(178, 107, 0, .13);
  --ko: #c0392b; --ko-bg: rgba(192, 57, 43, .11); --off: #6b7280; --off-bg: rgba(107, 114, 128, .12);
  --encours: #2563eb; --encours-bg: rgba(37, 99, 235, .11);
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 20, .05), 0 4px 16px rgba(20, 30, 20, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1311; --panel: #161b18; --panel-2: #1c231f; --line: #2a332d; --text: #e6ebe7; --muted: #9aa69d;
    --accent: #4cc38a; --accent-2: #6aa9e9; --accent-bg: rgba(76, 195, 138, .1);
    --ok: #4cc38a; --ok-bg: rgba(76, 195, 138, .14); --warn: #f0ad3c; --warn-bg: rgba(240, 173, 60, .14);
    --ko: #f2776a; --ko-bg: rgba(242, 119, 106, .13); --off: #9ca3af; --off-bg: rgba(156, 163, 175, .13);
    --encours: #6aa9e9; --encours-bg: rgba(106, 169, 233, .14); --shadow: none;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--panel-2); padding: 2px 6px; border-radius: 5px; }

.barre { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.barre .contenu { display: flex; align-items: center; gap: 22px; min-height: 56px; }
.marque { font-weight: 750; letter-spacing: .2px; color: var(--text); font-size: 17px; }
.marque span { color: var(--accent); }
.barre nav { display: flex; gap: 4px; flex-wrap: wrap; }
.barre nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: 14px; }
.barre nav a:hover, .barre nav a.actif { background: var(--panel-2); color: var(--text); text-decoration: none; }
.barre .droite { margin-left: auto; }
.contenu { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
main.contenu { padding-top: 26px; padding-bottom: 80px; }

.carte { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.carte + .carte { margin-top: 14px; }
.carte h3 { font-size: 15px; margin-bottom: 10px; }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grille-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.muted { color: var(--muted); }
.petit { font-size: 13px; }
.vide { color: var(--muted); font-style: italic; }

.formulaire { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=url], input[type=password], input[type=number], select {
  font: inherit; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); min-width: 0;
}
input[type=url] { flex: 1 1 360px; }
button, .bouton {
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
button.secondaire, .bouton.secondaire { background: transparent; color: var(--accent); }
button:disabled { opacity: .55; cursor: wait; }
label.option { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.ok { color: var(--ok); background: var(--ok-bg); } .st.partiel { color: var(--accent-2); background: var(--encours-bg); }
.st.warn { color: var(--warn); background: var(--warn-bg); } .st.ko { color: var(--ko); background: var(--ko-bg); }
.st.off { color: var(--off); background: var(--off-bg); } .st.encours { color: var(--encours); background: var(--encours-bg); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); margin: 2px 4px 2px 0; }
.badge.accent { background: var(--accent-bg); border-color: transparent; color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .35px; }
tr:last-child td { border-bottom: none; }
.tableau { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.entete-rapport { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.entete-rapport h1 { font-size: 28px; letter-spacing: -.3px; }
.entete-rapport .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sommaire { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.sommaire a { font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.sommaire a:hover { color: var(--text); text-decoration: none; }
section.bloc { margin-top: 34px; scroll-margin-top: 70px; }
section.bloc > h2 { font-size: 20px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
section.bloc > h2 .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-bg); color: var(--accent); font-size: 14px; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 22px; font-weight: 720; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }

.indispo { border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); background: var(--panel); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.produits { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.produit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.produit .visuel { aspect-ratio: 1 / 1; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.produit .visuel img { width: 100%; height: 100%; object-fit: cover; }
.produit .infos { padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.produit .rang { font-weight: 700; color: var(--accent); font-size: 12px; }
.produit .titre { font-weight: 600; line-height: 1.3; }
.produit .prix { font-variant-numeric: tabular-nums; }
.barre-prix s { color: var(--muted); margin-left: 6px; }

.barres { display: flex; align-items: flex-end; gap: 4px; height: 90px; padding-top: 6px; }
.barres .b { flex: 1; background: var(--accent); opacity: .8; border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.barres-legende { display: flex; gap: 4px; font-size: 10px; color: var(--muted); }
.barres-legende span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }

.verdict { border-left: 0; background: linear-gradient(0deg, var(--panel), var(--panel)); }
.verdict .resume { font-size: 16px; line-height: 1.6; }
.liste-points { margin: 0; padding-left: 18px; }
.liste-points li { margin: 6px 0; }
.ref { font-size: 11px; color: var(--muted); margin-left: 4px; }

.captures { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.captures figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.captures img { width: 100%; height: 320px; object-fit: cover; object-position: top; display: block; }
.captures figcaption { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.palette { display: flex; gap: 8px; flex-wrap: wrap; }
.couleur { width: 92px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 12px; background: var(--panel); }
.couleur .pastille { height: 46px; }
.couleur div:last-child { padding: 6px 8px; }

.fil li { list-style: none; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.fil { margin: 0; padding: 0; }
.alerte { padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--text); border: 1px solid transparent; }
.alerte.ko { background: var(--ko-bg); }
.connexion { max-width: 380px; margin: 12vh auto; }
.connexion form { display: grid; gap: 12px; }
footer.pied { color: var(--muted); font-size: 12px; text-align: center; padding: 30px 0; }

@media (max-width: 720px) {
  .barre .contenu { gap: 10px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .entete-rapport h1 { font-size: 23px; }
  .grille-2 { grid-template-columns: 1fr; }
  .captures img { height: 240px; }
  main.contenu { padding-left: 16px; padding-right: 16px; }
}
@media print {
  .barre, .actions, .sommaire, form { display: none !important; }
  body { background: #fff; color: #111; }
  .carte, .kpi, .produit { box-shadow: none; break-inside: avoid; }
  section.bloc { break-inside: auto; }
}
