:root {
  --fond: #f6f7f9; --carte: #ffffff; --texte: #1b2430; --discret: #5d6b7a; --bord: #dde2e8;
  --accent: #1f5f8b; --accent-texte: #ffffff; --surligne: #fff1a8; --surligne-sem: #dcefff;
  --forte: #1e7a46; --moyenne: #a66a00; --faible: #7a8591; --erreur: #b3261e; --avert: #fff5e0;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11161c; --carte: #1a2129; --texte: #e6ebf0; --discret: #9aa7b4; --bord: #2c3742;
    --accent: #5aa7d8; --accent-texte: #0b1116; --surligne: #6b5a00; --surligne-sem: #17405e;
    --forte: #5fc48b; --moyenne: #e0a640; --faible: #8a96a2; --erreur: #f28b82; --avert: #3a2f12;
    --ombre: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
[hidden] { display: none !important; }
.discret { color: var(--discret); }
button { font: inherit; cursor: pointer; }
.principal { background: var(--accent); color: var(--accent-texte); border: 0; border-radius: 8px; padding: .6rem 1.1rem; font-weight: 600; }
.principal:disabled { opacity: .6; cursor: progress; }
.lien { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; }

.bandeau { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.25rem; background: var(--carte); border-bottom: 1px solid var(--bord); }
.marque { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; }
.etiquette { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--discret); border: 1px solid var(--bord); border-radius: 99px; padding: .05rem .5rem; }
.compte { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; font-size: .92rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.connexion { display: grid; place-items: center; min-height: 60vh; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; box-shadow: var(--ombre); padding: 1.5rem; }
#form-connexion { width: min(420px, 100%); display: grid; gap: .8rem; }
#form-connexion h1 { margin: 0; font-size: 1.35rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
input { font: inherit; color: var(--texte); background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: .6rem .7rem; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.erreur { color: var(--erreur); margin: 0; }
.note { font-size: .82rem; color: var(--discret); margin: 0; }

.recherche { display: flex; gap: .6rem; }
.recherche input { flex: 1; font-size: 1.05rem; padding: .75rem .9rem; background: var(--carte); }
.exemples { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 1.1rem; }
.exemples button { background: var(--carte); color: var(--texte); border: 1px solid var(--bord); border-radius: 99px; padding: .25rem .7rem; font-size: .84rem; }
.exemples button:hover { border-color: var(--accent); }

.disposition { display: grid; grid-template-columns: 250px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 760px) {
  .disposition { grid-template-columns: 1fr; }
  .disposition > section { order: 1; }          /* resultats d'abord, filtres ensuite */
  .disposition > aside { order: 2; position: static; }
  .recherche { flex-direction: column; }
}

.facettes { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: .9rem; font-size: .88rem; position: sticky; top: 1rem; }
.facettes:empty { display: none; }
.facettes h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin: .9rem 0 .35rem; }
.facettes h3:first-child { margin-top: 0; }
.facettes button { display: flex; justify-content: space-between; gap: .5rem; width: 100%; text-align: left;
  background: none; border: 0; color: var(--texte); padding: .22rem .35rem; border-radius: 6px; }
.facettes button:hover { background: var(--fond); }
.facettes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-texte); }
.facettes .compte-valeur { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }

.filtres-actifs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.filtres-actifs button { background: var(--accent); color: var(--accent-texte); border: 0; border-radius: 99px; padding: .15rem .65rem; font-size: .82rem; }
.etat { color: var(--discret); font-size: .88rem; margin-bottom: .6rem; min-height: 1.3em; }
.avertissement { background: var(--avert); border: 1px solid var(--bord); border-radius: 8px; padding: .5rem .75rem; margin-bottom: .6rem; font-size: .88rem; }
.vide { background: var(--carte); border: 1px dashed var(--bord); border-radius: 12px; padding: 1.4rem; text-align: center; }
.vide strong { display: block; font-size: 1.05rem; margin-bottom: .3rem; }

.resultats { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.resultat { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 1rem 1.1rem; box-shadow: var(--ombre); }
.resultat-tete { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.resultat h2 { font-size: 1.02rem; margin: 0 0 .15rem; }
.meta { font-size: .82rem; color: var(--discret); display: flex; flex-wrap: wrap; gap: .25rem .8rem; }
.pastilles { display: flex; gap: .35rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.pastille { font-size: .74rem; font-weight: 600; border-radius: 99px; padding: .1rem .55rem; border: 1px solid var(--bord); white-space: nowrap; }
.niveau-forte { color: var(--forte); border-color: currentColor; }
.niveau-moyenne { color: var(--moyenne); border-color: currentColor; }
.niveau-faible { color: var(--faible); border-color: currentColor; }
.extrait { margin: .6rem 0 0; padding: .45rem .7rem; border-left: 3px solid var(--bord); font-size: .92rem; }
.extrait .origine { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin-bottom: .1rem; }
mark { background: var(--surligne); color: inherit; border-radius: 3px; padding: 0 .1em; }
mark.sens { background: var(--surligne-sem); }
.chargement::after { content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .5em; border: 2px solid var(--discret);
  border-top-color: transparent; border-radius: 50%; animation: tourne .8s linear infinite; vertical-align: -.1em; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chargement::after { animation: none; } }

.pied { max-width: 1180px; margin: 0 auto; padding: 0 1rem 2rem; font-size: .8rem; }
.trouve { font-size: .78rem; color: var(--discret); white-space: nowrap; align-self: center; }
.compte a { color: var(--accent); }
.legende { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: .5rem .8rem; margin-bottom: .7rem; font-size: .88rem; }
.legende summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.legende p { margin: .5rem 0 0; }
.ouvrir { font-size: .82rem; color: var(--accent); }
.modes { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; border: 0; padding: 0; margin: .7rem 0 0; font-size: .88rem; }
.modes legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin-bottom: .2rem; }
.modes label { display: flex; align-items: center; gap: .35rem; font-weight: 400; cursor: pointer; }
.modes strong { font-weight: 600; }
.note-mode { background: var(--surligne-sem); border-radius: 8px; padding: .5rem .75rem; margin-bottom: .6rem; font-size: .88rem; }
.exigence { margin-left: auto; gap: .45rem; }
.exigence select { font: inherit; color: var(--texte); background: var(--carte); border: 1px solid var(--bord); border-radius: 6px; padding: .2rem .35rem; }
.exigence select:disabled { opacity: .5; }
@media (max-width: 760px) { .exigence { margin-left: 0; } }
.numero { color: var(--discret); font-weight: 600; margin-right: .2rem; }
.secondaire { background: var(--carte); color: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: .55rem 1rem; font-weight: 600; }
.secondaire:disabled, .principal:disabled { opacity: .5; cursor: not-allowed; }
.assistant { background: var(--carte); border: 1px solid var(--accent); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .9rem; }
.assistant-tete { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.assistant-commandes { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.assistant-commandes select, .sortie-actions select { font: inherit; color: var(--texte); background: var(--fond); border: 1px solid var(--bord); border-radius: 6px; padding: .35rem .4rem; max-width: 100%; }
.sorties:empty { display: none; }
.sorties { margin-top: .8rem; display: grid; gap: .7rem; }
.comparaison { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 900px) { .comparaison { grid-template-columns: 1fr; } }
.sortie { border-left: 3px solid var(--accent); padding: .3rem .8rem; background: var(--fond); border-radius: 0 8px 8px 0; margin-bottom: .5rem; }
.sortie-tete { display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; font-size: .88rem; }
.sortie-etat { color: var(--discret); font-size: .82rem; margin-left: auto; }
.comparaison .sortie-etat { flex-basis: 100%; margin-left: 0; }
.sortie-etat.erreur { color: var(--erreur); }
.sortie-texte { margin-top: .4rem; line-height: 1.55; }
.sortie-texte .ref { font-weight: 600; text-decoration: none; color: var(--accent); }
.sortie-actions { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; font-size: .86rem; }
.sortie-note { font-size: .75rem; margin: .4rem 0 .2rem; }
.zone-resume { margin-top: .6rem; }
.resultat:target { outline: 2px solid var(--accent); }
