/* Main levée · charte HEP-VS : fond blanc, rouge corporate, angles droits, pas d'ombre ni de dégradé */
:root {
  --rouge: #D7182A; --rouge-50: #EB8B94; --rouge-25: #F5C5CA;
  --fc: #006DB7; --fc-25: #BFDBED;
  --fp: #007553; --fp-50: #80BAA9; --fp-25: #BFDDD4;
  --postgrade: #F58220; --postgrade-25: #FDE0C7;
  --animation: #FFCB05;
  --rd: #808285; --rd-50: #C0C1C2; --rd-25: #DFE0E0; --rd-10: #F1F1F1;
  --encre: #231F20; --encre-50: #939598; --blanc: #FFFFFF;
  --font-din: "DIN Pro", DINPro, Barlow, Arial, sans-serif;
  --font-din-cond: "DIN Pro Condensed", "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --font-texte: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  --gouttiere: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--blanc); color: var(--encre);
  font-family: var(--font-texte); font-size: 18px; line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-din); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
p { margin: 0 0 .8em; }
a { color: var(--encre); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--rouge); }
:focus-visible { outline: 3px solid var(--fc); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muet { color: var(--encre); opacity: .72; }
.petit { font-size: 15px; }
.nowrap { white-space: nowrap; }

/* ---------- en-tête des pages d'application ---------- */
.entete {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gouttiere) 14px 0; border-bottom: 1px solid var(--rd-25);
  position: sticky; top: 0; background: var(--blanc); z-index: 20;
}
.marque { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--encre); }
.marque::before { content: ""; width: 10px; height: 34px; background: var(--rouge); flex: none; }
.marque b { font-family: var(--font-din); font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.marque span { font-size: 15px; opacity: .72; }
.logo { display: block; height: 22px; width: auto; flex: none; }
.entete .droite { display: flex; align-items: center; gap: 18px; }

/* ---------- boutons ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-din); font-weight: 700; font-size: 17px; line-height: 1.1;
  padding: 12px 18px; min-height: 46px; border: 2px solid var(--encre); border-radius: 0;
  background: var(--blanc); color: var(--encre); cursor: pointer; text-decoration: none;
  transition: background-color .12s, color .12s, border-color .12s;
}
.btn:hover { background: var(--encre); color: var(--blanc); }
.btn.primaire { background: var(--rouge); border-color: var(--rouge); color: var(--blanc); }
.btn.primaire:hover { background: var(--encre); border-color: var(--encre); }
.btn.discret { border-color: transparent; background: transparent; }
.btn.discret:hover { background: var(--rd-10); color: var(--encre); }
.btn.danger:hover { background: var(--rouge); border-color: var(--rouge); }
.btn.petit { font-size: 15px; padding: 7px 12px; min-height: 36px; }
.btn.grand { font-size: 22px; padding: 18px 28px; min-height: 64px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn svg { width: 1.15em; height: 1.15em; flex: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- formulaires ---------- */
label.champ { display: block; margin-bottom: 14px; }
label.champ > span { display: block; font-weight: 700; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=search], textarea, select {
  font: inherit; color: var(--encre); background: var(--blanc);
  border: 2px solid var(--rd-50); border-radius: 0; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--encre); outline: none; }
textarea { resize: vertical; min-height: 80px; }
.interrupteur { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.interrupteur input { width: 22px; height: 22px; accent-color: var(--rouge); margin: 0; }

/* ---------- blocs ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px var(--gouttiere) 80px; }
.titre-barre { position: relative; padding-left: 18px; }
.titre-barre::before { content: ""; position: absolute; left: 0; top: .12em; bottom: .12em; width: 8px; background: var(--rouge); }
.carte-bloc { border: 1px solid var(--rd-25); padding: 18px; background: var(--blanc); }
.encart { background: var(--rd-10); border-left: 8px solid var(--rouge); padding: 16px 18px; }
.encart.info { border-left-color: var(--fc); }
.encart.ok { border-left-color: var(--fp); }
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.vide { padding: 40px 20px; text-align: center; border: 2px dashed var(--rd-50); }

.onglets { display: flex; gap: 0; border-bottom: 2px solid var(--encre); margin: 0 0 24px; overflow-x: auto; }
.onglets button {
  appearance: none; border: 0; background: none; font-family: var(--font-din); font-weight: 700; font-size: 18px;
  padding: 12px 18px; cursor: pointer; color: var(--encre); border-bottom: 6px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.onglets button[aria-selected=true] { border-bottom-color: var(--rouge); }
.onglets button:hover { background: var(--rd-10); }

table.tableau { width: 100%; border-collapse: collapse; font-size: 16px; }
.tableau th { background: var(--rouge); color: var(--blanc); text-align: left; font-family: var(--font-din); padding: 10px; white-space: nowrap; }
.tableau td { padding: 9px 10px; border-bottom: 1px solid var(--rd-25); vertical-align: top; }
.tableau tbody tr:nth-child(even) td { background: #FBF0F1; }
.table-defile { overflow-x: auto; }

/* ---------- toasts et dialogues ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; width: min(92vw, 520px); }
.toast { background: var(--encre); color: var(--blanc); padding: 12px 16px; font-size: 16px; }
.toast.erreur { background: var(--rouge); }
dialog { border: 0; padding: 0; max-width: min(94vw, 640px); width: 100%; color: var(--encre); }
dialog::backdrop { background: rgba(35, 31, 32, .55); }
.dialogue { padding: 26px; border-top: 8px solid var(--rouge); }
.dialogue h2 { margin-top: 0; }

/* ---------- lettres d'options ---------- */
.lettre {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.8em; height: 1.8em; background: var(--rouge); color: var(--blanc);
  font-family: var(--font-din); font-weight: 700;
}

/* ---------- résultats (communs projection, stats, téléphones) ---------- */
.res-qcm { display: grid; gap: .45em; }
.res-ligne { display: grid; grid-template-columns: auto 1fr auto; gap: .2em .6em; align-items: center; }
.res-ligne .txt { font-weight: 700; overflow-wrap: anywhere; }
.res-ligne .val { font-family: var(--font-din); font-weight: 700; white-space: nowrap; }
.res-ligne .barre { grid-column: 2 / 4; height: .5em; background: var(--rd-25); position: relative; }
.res-ligne .barre i { position: absolute; inset: 0 auto 0 0; background: var(--rouge); transition: width .5s ease; }
.res-ligne.bonne .lettre { background: var(--fp); }
.res-ligne.bonne .barre i { background: var(--fp); }
.res-ligne.mauvaise .lettre { background: var(--rd); }
.res-ligne.mauvaise .barre i { background: var(--rd-50); }
.res-ligne .coche { color: var(--fp); font-weight: 700; }

.res-echelle { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .4em; align-items: end; }
.res-echelle .col { display: grid; grid-template-rows: auto 1fr auto; text-align: center; height: 100%; }
.res-echelle .col .b { background: var(--rouge); align-self: end; min-height: 2px; transition: height .5s ease; }
.res-echelle .col .n { font-weight: 700; font-family: var(--font-din); }
.res-echelle .col .v { font-family: var(--font-din); font-weight: 700; border-top: 2px solid var(--encre); padding-top: .15em; }
.res-echelle-legende { display: flex; justify-content: space-between; gap: 1em; margin-top: .3em; }

.res-nuage { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .1em .55em; line-height: 1.05; text-align: center; }
.res-nuage span { font-family: var(--font-din); font-weight: 700; display: inline-block; }

.res-libre { columns: 3 280px; column-gap: 14px; }
.res-libre .bulle { break-inside: avoid; border: 1px solid var(--rd-25); border-left: 6px solid var(--rouge); padding: .5em .7em; margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; position: relative; }
.res-libre .bulle.masque { opacity: .35; border-left-color: var(--rd-50); }
.res-libre .bulle button { margin-top: .4em; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .marque span { display: none; }
  .marque b { white-space: nowrap; font-size: 20px; }
  .entete .droite { gap: 10px; }
  .entete .lien-txt { display: none; }
  .page { padding-top: 20px; }
}
