:root {
  --fond: #f5f6f8; --carte: #fff; --texte: #1c2330; --doux: #667085; --trait: #e2e5ea;
  --accent: #5b3fd6; --accent-texte: #fff; --vert: #17804a; --orange: #b96a00; --rouge: #c62f2f;
  --officiel: #e6f0ff; --officiel-t: #1d4fa3; --interne: #fff3d6; --interne-t: #8a5a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #12141a; --carte: #1b1e27; --texte: #e8eaf0; --doux: #98a1b3; --trait: #2c313d;
    --accent: #8f7bff; --accent-texte: #12141a; --vert: #4cc38a; --orange: #f0a84a; --rouge: #ff7b7b;
    --officiel: #1c2c4a; --officiel-t: #9fc2ff; --interne: #40330f; --interne-t: #ffd479;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.doux, small { color: var(--doux); }
code { font-size: .85em; word-break: break-word; }

.haut { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; padding: .6rem 1rem;
  background: var(--carte); border-bottom: 1px solid var(--trait); position: sticky; top: 0; z-index: 2; }
.marque { font-weight: 700; color: var(--texte); }
.marque span { color: var(--doux); font-weight: 500; }
.haut nav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .3rem; flex: 1; }
.haut nav a { padding: .3rem .6rem; border-radius: 6px; color: var(--texte); }
.haut nav a.actif { background: var(--accent); color: var(--accent-texte); }
.groupe { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--officiel-t);
  background: var(--officiel); padding: .1rem .45rem; border-radius: 4px; margin-left: .6rem; }
.groupe.interne { color: var(--interne-t); background: var(--interne); }
.droite { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.droite form { display: flex; align-items: center; gap: .3rem; margin: 0; }

main { max-width: 1250px; margin: 0 auto; padding: 1rem; }
main.etroit { max-width: 460px; padding-top: 8vh; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; padding: 1rem 1.1rem; margin: 0 0 1rem; }
.carte.interne { border-color: var(--interne-t); }
.carte.danger { border-color: var(--rouge); max-width: 640px; }
.carte.mini { display: flex; flex-direction: column; padding: .6rem .9rem; margin: 0; }
.carte.mini strong { font-size: 1.2rem; }
.centre { text-align: center; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grille .carte { margin: 0; }
.grille.resume { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.chiffre { font-size: 2rem; font-weight: 700; margin: 0; }
dl { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: 0; }
dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.badge { font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; vertical-align: middle;
  background: var(--trait); color: var(--doux); }
.badge.officiel { background: var(--officiel); color: var(--officiel-t); }
.badge.nonofficiel { background: var(--interne); color: var(--interne-t); }
.etat { font-weight: 600; }
.vert { color: var(--vert); } .orange { color: var(--orange); } .rouge { color: var(--rouge); }
.retard { color: var(--rouge); font-weight: 600; } .bientot { color: var(--orange); font-weight: 600; }

.jauge { height: 10px; background: var(--trait); border-radius: 99px; overflow: hidden; margin: .5rem 0; }
.jauge div { height: 100%; border-radius: 99px; background: var(--vert); width: 0; }
.jauge div.orange { background: var(--orange); } .jauge div.rouge { background: var(--rouge); }
.jauge .p1{width:5%}.jauge .p2{width:10%}.jauge .p3{width:15%}.jauge .p4{width:20%}.jauge .p5{width:25%}.jauge .p6{width:30%}.jauge .p7{width:35%}.jauge .p8{width:40%}
.jauge .p9{width:45%}.jauge .p10{width:50%}.jauge .p11{width:55%}.jauge .p12{width:60%}.jauge .p13{width:65%}.jauge .p14{width:70%}.jauge .p15{width:75%}
.jauge .p16{width:80%}.jauge .p17{width:85%}.jauge .p18{width:90%}.jauge .p19{width:95%}.jauge .p20{width:100%}

.defile { overflow-x: auto; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .45rem .6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
td.centre { text-align: center; }
td.note { font-size: .85rem; color: var(--doux); min-width: 220px; max-width: 420px; }
tr.fini td { opacity: .55; }
tr.attente td { background: var(--interne); }
table.donnees tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }

label { display: block; margin: .6rem 0; font-weight: 500; }
label.ligne { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .45rem .6rem; background: var(--fond);
  border: 1px solid var(--trait); border-radius: 7px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.zone { border: 1px solid var(--trait); border-radius: 8px; padding: .4rem .9rem; }
fieldset.zone.interne { border-color: var(--interne-t); }
.fiche { max-width: 640px; }
.pile { text-align: left; }
.aide { font-size: .85rem; color: var(--doux); margin: -.3rem 0 .6rem; }
.req { color: var(--rouge); }
.annee label { display: flex; align-items: center; gap: .3rem; margin: 0; }
.annee select { width: auto; margin: 0; padding: .2rem .4rem; }

button, .bouton { display: inline-block; cursor: pointer; padding: .5rem 1rem; border-radius: 7px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-texte); font-weight: 600; }
.bouton:hover { text-decoration: none; filter: brightness(1.08); }
.petit { padding: .25rem .6rem; font-size: .85rem; }
.discret { background: transparent; color: var(--accent); }
button.rouge { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.coche { background: transparent; color: var(--doux); border-color: var(--trait); padding: .15rem .5rem; font-size: .85rem; }
.coche.oui { color: var(--vert); border-color: var(--vert); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.ligne-form { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.ligne-form label { margin: 0; }
.ligne-form.serre input:not([type=checkbox]), .ligne-form.serre select { width: auto; margin: 0; padding: .25rem .4rem; }

.alerte { padding: .6rem .9rem; border-radius: 8px; border: 1px solid; }
.alerte.ok { color: var(--vert); } .alerte.ko { color: var(--rouge); }
.qr { background: #fff; border-radius: 8px; padding: 4px; }
.etapes { text-align: left; }
.pieces { padding-left: 1.1rem; }
