@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Semi+Condensed:wght@600;700&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  /* Sombre par défaut : une console d'administration réseau. */
  --fond: #0f1318;
  --carte: #161b22;
  --carte-2: #1d242d;
  --texte: #e3e8ee;
  --texte-2: #93a0ae;
  --bord: #29313b;
  --accent: #4c8dff;
  --accent-texte: #06132b;
  --ok: #3fb950;
  --ok-fond: #12261a;
  --warn: #e3a008;
  --warn-fond: #2e2410;
  --ko: #f2555a;
  --ko-fond: #34171a;
  --neutre: #93a0ae;
  --neutre-fond: #222a33;
  --code-fond: #0b0e12;
  --code-texte: #d6dde6;
  --chassis: #1f252d;
  --port-libre: #5c6672;
  --port-ok: #3fb950;
  --lien: #8a98a8;
  --propose: #e3a008;
  --etiquette: #e9c23a;
  --etiquette-texte: #1c1a10;
  --ombre: none;
  color-scheme: dark;
  --rayon: 6px;
  --police: "Barlow", "Segoe UI", system-ui, sans-serif;
  --police-titre: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
  --police-mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
}

/* Thème clair, choisi par la personne (bouton soleil) ou par le lecteur claude.ai. */
:root[data-theme="light"] {
  --fond: #e4e8ec;
  --carte: #fbfcfd;
  --carte-2: #edf0f3;
  --texte: #17202b;
  --texte-2: #4f5b69;
  --bord: #c9d0d8;
  --accent: #1c5fc7;
  --accent-texte: #ffffff;
  --ok: #1e8a45;
  --ok-fond: #ddf1e3;
  --warn: #a86200;
  --warn-fond: #fbefd6;
  --ko: #c2352e;
  --ko-fond: #f9e2e0;
  --neutre: #5c6774;
  --neutre-fond: #e2e6ea;
  --code-fond: #12161c;
  --code-texte: #dde3ea;
  --chassis: #2b3038;
  --port-libre: #59626e;
  --port-ok: #2bb24c;
  --lien: #33404f;
  --propose: #d27a00;
  --etiquette: #f2cc3d;
  --etiquette-texte: #1c1a10;
  --ombre: 0 1px 0 rgb(23 32 43 / 6%);
  color-scheme: light;
}

* { box-sizing: border-box; }

/* Garde le contenu hors de l'encoche et de la barre du bas des téléphones. */
:root { padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16.5px/1.5 var(--police);
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; font-family: var(--police-titre); font-weight: 700; letter-spacing: -0.005em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }

button { font: inherit; color: inherit; cursor: pointer; }

/* Barre du haut */
.barre {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bord);
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 4px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.btn-icone {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--carte);
}

/* Accueil */

.capture { display: grid; gap: 10px; margin-bottom: 16px; }

.btn-photo:active { transform: scale(0.99); }

/* ---------- Navigation : en haut sur ordinateur, barre du bas sur téléphone ---------- */
.navigation { display: flex; gap: 4px; }
.navigation button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--texte-2);
  font-weight: 600;
  font-size: 0.92rem;
}
.navigation button:hover { background: var(--carte-2); color: var(--texte); }
.navigation button[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

@media (max-width: 719px) {
  /* Le flou de l'en-tête retiendrait la barre fixe : on le retire sur téléphone. */
  .barre { backdrop-filter: none; background: var(--fond); }
  .navigation {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--fond) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--bord);
  }
  .navigation button { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 0.72rem; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Accueil ---------- */
.hero { margin: 6px 0 26px; }

/* Façade de switch : les LED des ports s'allument une fois, au chargement. */
.facade {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 18px;
  padding: 12px 12px 9px;
  border-radius: 4px;
  background: var(--chassis);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%), 0 1px 0 rgb(0 0 0 / 25%);
}
/* Oreilles de fixation vissées, comme sur un équipement de baie. */
.facade::before, .facade::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle, #8a929c 0 1.5px, #5a626c 2px 100%);
}
.facade-ports { display: grid; grid-template-columns: repeat(8, 22px); gap: 5px; }
.rj { position: relative; display: block; width: 22px; height: 17px; border-radius: 2px; background: #0e1014; box-shadow: inset 0 0 0 1px #3a414b; }
.rj::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 0; height: 4px; background: #2b3038; }
.rj i { position: absolute; top: -6px; left: 2px; width: 5px; height: 3px; border-radius: 1px; background: #3d444e; animation: led 0.18s steps(1) forwards; }
.rj:nth-child(1) i { animation-delay: 0.25s; } .rj:nth-child(2) i { animation-delay: 0.35s; }
.rj:nth-child(3) i { animation-delay: 0.45s; } .rj:nth-child(4) i { animation-delay: 0.55s; }
.rj:nth-child(5) i { animation-delay: 0.65s; } .rj:nth-child(7) i { animation-delay: 0.85s; }
.rj.orange i { animation-name: led-orange; animation-delay: 1s; }
@keyframes led { to { background: #3ddc6a; box-shadow: 0 0 5px #3ddc6a; } }
@keyframes led-orange { to { background: #ffb21e; box-shadow: 0 0 5px #ffb21e; } }
@media (prefers-reduced-motion: reduce) {
  .rj i { animation-duration: 0s; animation-delay: 0s !important; }
}
.hero h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; margin-bottom: 12px; max-width: 18ch; }
.hero-texte { color: var(--texte-2); max-width: 60ch; }
.lien-exemple { background: none; border: 0; padding: 0; margin-top: 4px; color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hero-texte { margin-bottom: 10px; }
.comment { margin: 34px 0 8px; }
.comment > h2 { font-size: 1.1rem; }
.parcours { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.parcours li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--carte); border: 1px solid var(--bord); font-size: 0.9rem; line-height: 1.3; }
.parcours-num {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 2px;
  background: var(--etiquette);
  color: var(--etiquette-texte);
  font: 700 0.95rem var(--police-titre);
  box-shadow: 0 1px 0 rgb(0 0 0 / 18%);
}

/* Aperçu cliquable d'un vrai résultat (ouvre l'exemple). */
.apercu {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--bord);
  background: var(--carte);
  box-shadow: var(--ombre);
}
.apercu:hover { border-color: var(--accent); }
.apercu-tete { display: flex; gap: 10px; align-items: center; }
.apercu-pastille { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ko); color: #fff; font-weight: 800; }
.apercu-sous { display: block; font-size: 0.82rem; color: var(--ko); font-weight: 600; }
.apercu-schema { display: block; max-height: 190px; overflow: hidden; }
.apercu-schema svg { display: block; margin: 0 auto; max-height: 190px; width: auto; max-width: 100%; }
.apercu-action { color: var(--accent); font-weight: 700; }

/* Étapes du formulaire */
.etape-form { margin-bottom: 22px; }
.etape-form > h2 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin-bottom: 12px; }
.etape-form > h2 em { font-weight: 400; color: var(--texte-2); font-size: 0.9rem; }
.num {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  padding: 0 7px;
  border-radius: 2px;
  background: var(--etiquette);
  color: var(--etiquette-texte);
  font: 700 1rem var(--police-titre);
  box-shadow: 0 1px 0 rgb(0 0 0 / 18%);
  transform: rotate(-1.5deg);
}
.choix-source { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-bottom: 10px; }
.tuile {
  font-family: var(--police-titre);
  font-size: 1.08rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  min-height: 128px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--carte);
  cursor: pointer;
  font-weight: 700;
}
.tuile small { font: 500 0.85rem var(--police); color: var(--texte-2); }
.tuile svg { margin-bottom: auto; color: var(--accent); }
.tuile-principale { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); min-height: 128px; box-shadow: var(--ombre); }
.tuile-principale svg, .tuile-principale small { color: var(--accent-texte); opacity: 0.95; }
.tuile:hover { border-color: var(--accent); }
.tuile:active { transform: scale(0.99); }
.resume-option { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.resume-option svg { color: var(--accent); }

.zone-analyser { padding: 12px; margin: 0 -12px; border-radius: 16px; }
/* Dès qu'il y a quelque chose à analyser, le bouton reste visible en bas de l'écran. */
.zone-analyser.prete { position: sticky; bottom: 12px; z-index: 4; background: color-mix(in srgb, var(--fond) 90%, transparent); backdrop-filter: blur(8px); }
.btn-analyser { margin-top: 0; padding: 15px; font-size: 1.05rem; }
.btn-analyser:not(:disabled) { background: var(--accent); color: var(--accent-texte); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.indice { text-align: center; font-size: 0.88rem; color: var(--texte-2); margin: 8px 0 0; }
.zone-analyser .aide { margin-top: 4px; }

@media (max-width: 719px) {
  .zone-analyser.prete { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
  .choix-source { grid-template-columns: 1fr 1fr; }
  .tuile { min-height: 112px; padding: 14px; }
}
.btn-secondaire, .btn-principal {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondaire { border: 1px solid var(--bord); background: var(--carte); }
.btn-principal { border: 0; background: var(--texte); color: var(--fond); margin-top: 8px; }
.btn-principal:disabled { opacity: 0.4; cursor: not-allowed; }
.lien {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.aide { color: var(--texte-2); font-size: 0.9rem; text-align: center; margin-top: 8px; }

.miniatures { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.miniature { position: relative; width: 84px; height: 84px; }
.miniature img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1px solid var(--bord); }
.miniature button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--fond);
  background: var(--texte);
  color: var(--fond);
  font-size: 15px;
  line-height: 1;
}

.champ { display: grid; gap: 6px; margin: 16px 0 8px; font-weight: 600; }
.champ em { font-weight: 400; color: var(--texte-2); }
.champ textarea, .champ input, .champ select {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  font: inherit;
  font-weight: 400;
}

.barre-actions { display: flex; gap: 8px; }
.actions-ligne { display: flex; gap: 10px; margin: 4px 0 10px; }
.actions-ligne > * { flex: 1; margin-top: 0; }
.aide a, .lien-texte { color: var(--accent); font-weight: 600; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.vue > h2 { margin: 8px 0 14px; }
.carte-sans-cle { border: 2px solid var(--accent); }
.carte-sans-cle .btn-principal { text-decoration: none; box-sizing: border-box; margin: 4px 0 8px; }
.petit { font-size: 0.82rem; }
.solde { font-size: 1rem; }
.solde strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; color: var(--accent); }
.mon-code { display: grid; gap: 6px; margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--carte-2); }
.ligne-code { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ligne-code code { font: 700 0.95rem var(--police-mono); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.case-cgv { align-items: flex-start; margin: 8px 0 4px; }
.case-cgv input { margin-top: 3px; }
.case-cgv a { color: var(--accent); }

/* Configuration collée */
.bloc-config-texte { margin: 4px 0 8px; }
.bloc-config-texte summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--texte); }
.bloc-config-texte[open] summary { margin-bottom: 8px; }
.bloc-config-texte code { font: 500 0.85em var(--police-mono); }
.bloc-config-texte textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--code-fond);
  color: var(--code-texte);
  font: 13px/1.55 var(--police-mono);
  margin-bottom: 8px;
}

/* Mon matériel */
.materiel { margin: 4px 0 8px; }
.materiel summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--texte); }
.materiel[open] summary { margin-bottom: 8px; }
.liste-materiel { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.liste-materiel li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--carte-2);
}
.liste-materiel .nom { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.liste-materiel .qte { font-variant-numeric: tabular-nums; font-weight: 700; }
.liste-materiel button {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--bord);
  background: var(--carte);
}
.ajout-materiel { display: flex; gap: 8px; }
.ajout-materiel input {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  font: inherit;
}
.ajout-materiel #nom-materiel { flex: 1; }
.ajout-materiel #quantite-materiel { width: 64px; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.raccourcis button {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px dashed var(--bord);
  background: none;
  font-size: 0.82rem;
  color: var(--texte-2);
}
.case { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.a-prevoir li { margin-bottom: 8px; }

/* Calcul IP */
.champs-calcul { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.champs-calcul .champ, #outil-vlsm .champ { margin: 0 0 8px; }
.champ input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  font: 500 0.95rem var(--police-mono);
}
.champ-titre { font-weight: 600; margin: 12px 0 6px; }
.table-calcul th { width: 48%; font-weight: 500; }
.table-calcul code, .table-vlsm code { font: 500 0.88em var(--police-mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-vlsm td, .table-vlsm th { white-space: nowrap; }
.binaire { margin: 0; font: 13px/1.7 var(--police-mono); white-space: pre; }
.bit-reseau { color: var(--accent); font-weight: 700; }
.bit-hote { color: var(--warn); }
.binaire .point { color: var(--texte-2); }
.legende-bits { font-size: 0.85rem; color: var(--texte-2); display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 0; }
.calcul-etapes .etape { padding-bottom: 14px; }
.erreur-calcul { border-left: 4px solid var(--ko); color: var(--texte); }
.besoin { display: grid; grid-template-columns: 1fr 90px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.besoin input {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--carte);
  color: var(--texte);
  font: inherit;
}
.besoin .btn-icone { width: 36px; height: 36px; font-size: 18px; }

/* Export du compte rendu */
.export { margin-bottom: 14px; }
.export summary { color: var(--texte); }
.export[open] summary { margin-bottom: 8px; }
.export .champ { margin: 0 0 8px; }
.rapport { display: none; }

/* Compte rendu (mise en page de l'impression) */
.rapport { font-size: 11pt; line-height: 1.45; color: #142033; }
.rapport h1 { font-size: 20pt; margin: 2px 0 4px; }
.rapport h2 { font-size: 14pt; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #1c5fc7; }
.rapport h3 { font-size: 11.5pt; margin: 12px 0 4px; }
.rapport h4 { font-size: 10.5pt; margin: 8px 0 4px; }
.rapport .r-entete { border-bottom: 1px solid #d9dfe9; padding-bottom: 8px; }
.rapport .r-sur-titre { text-transform: uppercase; letter-spacing: 0.08em; font-size: 9pt; color: #1c5fc7; font-weight: 700; margin: 0; }
.rapport .r-muted { color: #55627a; }
.rapport .r-verdict { padding: 6px 10px; border-left: 4px solid #5f6b80; background: #eef1f6; }
.rapport .r-verdict.r-fonctionnel { border-color: #1a8f4c; }
.rapport .r-verdict.r-incomplet { border-color: #b26b00; }
.rapport .r-verdict.r-non_fonctionnel { border-color: #c4302b; }
.rapport .r-note { font-style: italic; color: #55627a; }
.rapport .r-figure { margin: 8px 0; text-align: center; break-inside: avoid; }
.rapport .r-figure svg { width: 100%; max-width: 640px !important; height: auto; }
.rapport .r-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 9.5pt; }
.rapport .r-table th, .rapport .r-table td { border: 1px solid #d9dfe9; padding: 4px 6px; text-align: left; vertical-align: top; }
.rapport .r-table th { background: #eef1f6; }
.rapport .r-table tr { break-inside: avoid; }
.rapport .r-code { font: 9pt/1.4 Consolas, ui-monospace, monospace; background: #f2f4f7; border: 1px solid #e3e8ef; padding: 6px 8px; white-space: pre-wrap; break-inside: avoid; }
.rapport .r-bloc { break-inside: avoid-page; }
.rapport .r-pied { margin-top: 18px; padding-top: 8px; border-top: 1px solid #d9dfe9; font-size: 8.5pt; color: #55627a; }

@media print {
  @page { margin: 14mm; }
  /* Toujours le thème clair sur papier, même si l'appli est en sombre. */
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --fond: #ffffff; --carte: #ffffff; --carte-2: #eef1f6; --texte: #142033; --texte-2: #55627a; --bord: #d9dfe9;
    --accent: #1c5fc7; --accent-texte: #ffffff; --ok: #1a8f4c; --warn: #b26b00; --ko: #c4302b; --neutre: #5f6b80;
    --chassis: #2a3344; --port-libre: #5b6577; --lien: #3b4b63; --propose: #d97706;
    color-scheme: light;
    padding: 0;
  }
  body { background: #fff; }
  body > :not(#rapport) { display: none !important; }
  .rapport { display: block !important; }
}

/* Chargement */
.scan {
  position: relative;
  overflow: hidden;
  border-radius: var(--rayon);
  background: var(--carte-2);
  aspect-ratio: 4 / 3;
  margin-bottom: 20px;
}
.scan img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.scan-ligne {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px 6px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: balayage 2.2s ease-in-out infinite alternate;
}
@keyframes balayage { from { top: 4%; } to { top: 94%; } }
@media (prefers-reduced-motion: reduce) { .scan-ligne { animation: none; top: 50%; } }

.progression { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.progression li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--texte-2);
  opacity: 0.55;
}
.progression li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bord);
}
.progression li.en-cours { opacity: 1; color: var(--texte); font-weight: 600; }
.progression li.en-cours::before {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: tourne 0.9s linear infinite;
}
.progression li.fait { opacity: 1; }
.progression li.fait::before {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12l4 4 8-8' fill='none' stroke='white' stroke-width='3'/%3E%3C/svg%3E") center / 14px no-repeat;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* Résultat */
.verdict {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--rayon);
  margin-bottom: 14px;
  background: var(--neutre-fond);
}
.verdict .pastille {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: var(--neutre);
}
.verdict .etiquette { font-weight: 800; font-size: 1.1rem; margin-bottom: 2px; }
.verdict p { margin: 0; }
.verdict .sous { color: var(--texte-2); font-size: 0.9rem; margin-top: 6px; }
.verdict.fonctionnel { background: var(--ok-fond); }
.verdict.fonctionnel .pastille { background: var(--ok); }
.verdict.fonctionnel .etiquette { color: var(--ok); }
.verdict.incomplet { background: var(--warn-fond); }
.verdict.incomplet .pastille { background: var(--warn); }
.verdict.incomplet .etiquette { color: var(--warn); }
.verdict.non_fonctionnel { background: var(--ko-fond); }
.verdict.non_fonctionnel .pastille { background: var(--ko); }
.verdict.non_fonctionnel .etiquette { color: var(--ko); }

.bandeau-demo {
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: var(--rayon);
  border: 2px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.bandeau-demo strong { display: block; color: var(--accent); margin-bottom: 2px; }
.bandeau-demo p { margin: 0 0 10px; font-size: 0.92rem; }

.alerte-qualite {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: var(--rayon);
  background: var(--warn-fond);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.alerte-qualite.insuffisante { background: var(--ko-fond); border-color: color-mix(in srgb, var(--ko) 40%, transparent); }
.alerte-qualite .symbole { flex: none; color: var(--warn); }
.alerte-qualite.insuffisante .symbole { color: var(--ko); }
.alerte-qualite strong { display: block; color: var(--warn); }
.alerte-qualite.insuffisante strong { color: var(--ko); }
.alerte-qualite p { margin: 4px 0 0; font-size: 0.92rem; }
.alerte-qualite .btn-mini { margin-top: 10px; }

.miniature .badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--warn);
  color: #1a1200;
}

.onglets {
  position: sticky;
  top: calc(61px + env(safe-area-inset-top, 0px));
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--carte-2);
}
.onglets button {
  border: 0;
  background: none;
  padding: 9px 4px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--texte-2);
}
.onglets button[aria-selected="true"] { background: var(--carte); color: var(--texte); box-shadow: var(--ombre); }

.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--ombre);
}
.carte > h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--texte-2); font-size: 0.92rem; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--neutre-fond);
  color: var(--neutre);
  white-space: nowrap;
}
.chip.ok { background: var(--ok-fond); color: var(--ok); }
.chip.warn { background: var(--warn-fond); color: var(--warn); }
.chip.ko { background: var(--ko-fond); color: var(--ko); }
.chip.accent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* Schéma */
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.topologie { display: block; width: 100%; height: auto; }
.topologie text { font-family: inherit; fill: var(--texte); }
.topologie .noeud-nom { font-size: 13px; font-weight: 700; }
.topologie .noeud-sous { font-size: 10.5px; fill: var(--texte-2); }
.topologie .port-etiquette { font-size: 10px; font-weight: 600; }
.topologie .port-fond { fill: var(--carte); stroke: var(--bord); }
/* Halo autour des noms pour qu'ils restent lisibles même sur un câble. */
.topologie .noeud-nom, .topologie .noeud-sous { paint-order: stroke; stroke: var(--carte); stroke-width: 4px; stroke-linejoin: round; }
.topologie .noeud:hover .noeud-nom, .topologie .noeud:focus .noeud-nom { fill: var(--accent); }

/* Aide à la lecture */
.guide-schema { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--bord); }
.guide-types { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.guide-types li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; }
.guide-types svg { flex: none; margin-top: 1px; }
.connexions { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.connexions li { padding: 8px 10px 8px 12px; border-radius: 10px; background: var(--carte-2); border-left: 3px solid var(--lien); overflow-wrap: anywhere; }
.connexions li.deduit { border-left-style: dashed; }
.connexions li.propose { border-left-color: var(--propose); }
.connexions li.conseille { border-left-color: var(--ok); }
.legende i.conseille { border-top: 2px solid var(--ok); }

/* Bascule « Ce qui est branché » / « Schéma conseillé » */
.bascule-schema { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: var(--carte-2); }
.bascule-schema button { border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 0.9rem; color: var(--texte-2); }
.bascule-schema button[aria-pressed="true"] { background: var(--carte); color: var(--texte); box-shadow: var(--ombre); }
.bascule-schema button[data-vue="conseille"][aria-pressed="true"] { color: var(--ok); }
.avantages { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.changements { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 6px; }
.connexions code { font: 500 0.85em var(--police-mono); padding: 1px 5px; border-radius: 5px; background: var(--carte); }
.topologie .icone { color: var(--texte); }
.topologie .noeud { cursor: pointer; }
.entete-schema { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.entete-schema h3 { margin: 0; }
.btn-mini {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bord);
  background: var(--carte-2);
  font-size: 0.82rem;
  font-weight: 600;
}
.btn-mini[aria-pressed="true"] { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.note-schema { font-size: 0.85rem; color: var(--texte-2); margin: 6px 0 0; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--texte-2); margin-top: 10px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { display: inline-block; width: 22px; border-top: 2px solid var(--lien); }
.legende i.deduit { border-top-style: dashed; }
.legende i.propose { border-top: 2px dashed var(--propose); }
.legende i.console { border-top: 2px dashed #38bdf8; }
.legende b { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

.facade { display: block; height: auto; }
.facade .port { cursor: pointer; }
.facade .port:focus { outline: none; }
.facade .port:focus rect.corps, .facade .port.actif rect.corps { stroke: var(--accent); stroke-width: 2.5; }
.facade text { font-family: inherit; }
.detail-port {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--carte-2);
  font-size: 0.92rem;
}
.equipement-entete { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.equipement-entete svg { flex: none; color: var(--texte); }
.equipement-entete h3 { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { color: var(--texte-2); font-weight: 600; }
details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }

/* Config */
.bloc-config { margin-top: 14px; }
.bloc-config:first-of-type { margin-top: 6px; }
.bloc-config h4 { margin: 0 0 6px; font-size: 0.95rem; }
.code {
  position: relative;
  background: var(--code-fond);
  color: var(--code-texte);
  border-radius: 10px;
  margin: 6px 0;
}
.code pre {
  margin: 0;
  padding: 34px 14px 12px;
  overflow-x: auto;
  font: 13px/1.6 var(--police-mono);
}
.code .cmt { color: #7f8ba3; }
.code .mot { color: #5eead4; }
.code .neg { color: #fca5a5; }
.code .num { color: #fcd34d; }
.copier {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.78rem;
}

/* Diagnostic */
.probleme { border-left: 4px solid var(--neutre); }
.probleme.bloquant { border-left-color: var(--ko); }
.probleme.important { border-left-color: var(--warn); }
.probleme.conseil { border-left-color: var(--accent); }
.probleme h3 { margin-bottom: 4px; }
.ok-vide { text-align: center; color: var(--ok); font-weight: 600; }

/* Étapes façon Photomath */
.etapes { list-style: none; padding: 0; margin: 0; counter-reset: etape; }
.etape {
  position: relative;
  padding: 0 0 18px 46px;
  counter-increment: etape;
  animation: apparait 0.35s ease;
}
.etape::before {
  content: counter(etape);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--accent);
  color: var(--accent-texte);
}
.etape:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 4px;
  border-left: 2px dashed var(--bord);
}
.etape h3 { margin: 4px 0 4px; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.actions-etapes { display: flex; gap: 10px; }
.actions-etapes button { flex: 1; }

/* Historique */
.item-historique {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid var(--bord);
  background: var(--carte);
}
.item-historique img, .item-historique .vignette {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--carte-2);
}
.item-historique strong { display: block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--texte);
  color: var(--fond);
  font-weight: 600;
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
  z-index: 50;
}
.toast.erreur { background: var(--ko); color: #fff; }


/* =================== Console : mise en page et panneaux =================== */
main { max-width: 1180px; }
.vue:not(#vue-accueil) { max-width: 900px; margin-inline: auto; }

.carte { border-radius: var(--rayon); }
.carte > h3, .panneau-entete h2, .panneau-entete h3 { font-size: 1rem; }
.panneau-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -16px -16px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--bord);
  background: var(--carte-2);
  border-radius: var(--rayon) var(--rayon) 0 0;
}
.panneau-entete h2, .panneau-entete h3 { margin: 0; }
.chip { font-family: var(--police-mono); font-weight: 500; letter-spacing: 0; }
.topologie .port-etiquette { font-family: var(--police-mono); font-weight: 500; }
code, kbd { font-family: var(--police-mono); }

/* En-tête de l'accueil : façade + titre, compact. */
.tete-espace { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: 4px 0 22px; }
.tete-espace .facade { margin: 0; }
.tete-espace h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin-bottom: 4px; }
.tete-texte { color: var(--texte-2); max-width: 62ch; margin: 0; }

/* Espace de travail : saisie à gauche, exemple à droite. */
.espace { display: grid; gap: 22px; align-items: start; }
@media (min-width: 960px) {
  .espace { grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); }
  .colonne-exemple { position: sticky; top: 76px; }
}
.colonne-saisie > .etape-form:first-child { margin-top: 0; }

/* Panneau « Essayer avec un exemple » */
.panneau-exemple .btn-principal { background: var(--accent); color: var(--accent-texte); margin-top: 12px; }
.photo-exemple { margin: 0; }
.photo-exemple img, .photos-analysees img { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--bord); }
.credit { font-size: 0.75rem; color: var(--texte-2); margin: 6px 0 0; }
.credit a { color: inherit; }
.mesures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 12px 0 0; background: var(--bord); border: 1px solid var(--bord); border-radius: 4px; overflow: hidden; }
.mesures div { background: var(--carte); padding: 8px 10px; }
.mesures dt { font-size: 0.75rem; color: var(--texte-2); }
.mesures dd { margin: 0; font: 700 1.3rem var(--police-mono); }
.txt-ko { color: var(--ko); }
.comment { margin-top: 18px; }
.comment .parcours { grid-template-columns: 1fr; }

/* Photo analysée en tête du résultat */
.photos-analysees { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }

/* Bouton de thème */
.btn-theme { margin-left: 8px; }
.btn-theme .icone-lune { display: none; }
:root[data-theme="light"] .btn-theme .icone-soleil { display: none; }
:root[data-theme="light"] .btn-theme .icone-lune { display: block; }
.barre { gap: 8px; }
.barre .navigation { margin-left: auto; }

/* États de focus visibles au clavier */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sur ordinateur, le panneau d'exemple est déjà visible à droite. */
.exemple-mobile { margin-top: 8px; }
@media (min-width: 960px) { .exemple-mobile { display: none; } }


/* =================== Visite guidée =================== */
.barre-outils { display: flex; align-items: center; gap: 8px; }
.barre-outils .btn-theme { margin-left: 0; }


.visite-fond { position: fixed; inset: 0; z-index: 100; background: transparent; }
.visite-cadre {
  position: fixed;
  z-index: 101;
  border-radius: 10px;
  pointer-events: none;
  outline: 2px solid var(--etiquette);
  /* Assombrit tout sauf l'élément mis en valeur. */
  box-shadow: 0 0 0 9999px rgb(4 7 11 / 74%);
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}
.visite-carte {
  position: fixed;
  z-index: 102;
  box-sizing: border-box;
  padding: 14px 16px 16px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--texte);
  box-shadow: 0 12px 40px rgb(0 0 0 / 45%);
}
.visite-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.visite-compteur {
  padding: 1px 8px;
  border-radius: 2px;
  background: var(--etiquette);
  color: var(--etiquette-texte);
  font: 700 0.9rem var(--police-titre);
}
.visite-passer { background: none; border: 0; padding: 4px 6px; color: var(--texte-2); font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; }
.visite-carte h2 { font-size: 1.15rem; margin: 0 0 6px; }
.visite-carte p { margin: 0 0 14px; color: var(--texte-2); line-height: 1.5; }
.visite-actions { display: flex; gap: 8px; }
.visite-actions button { margin: 0; flex: 1; padding: 10px 12px; }
.visite-actions button[hidden] { display: none; }

/* Flèche : un carré tourné, collé au bord de la carte qui regarde l'élément. */
.visite-fleche {
  position: absolute;
  left: var(--fleche-x, 24px);
  width: 16px;
  height: 16px;
  background: var(--carte);
  border: 1px solid var(--bord);
  transform: rotate(45deg);
  animation: visite-rebond 1.1s ease-in-out infinite;
}
.visite-carte[data-cote="bas"] .visite-fleche { top: -9px; border-right: 0; border-bottom: 0; --pousse: -3px; }
.visite-carte[data-cote="haut"] .visite-fleche { bottom: -9px; border-left: 0; border-top: 0; --pousse: 3px; }
.visite-carte[data-cote="libre"] .visite-fleche { display: none; }
@keyframes visite-rebond {
  50% { translate: 0 var(--pousse, 0px); }
}
@media (prefers-reduced-motion: reduce) {
  .visite-fleche { animation: none; }
  .visite-cadre { transition: none; }
}
