/* Thème sombre commun à toutes les pages de l'outil (2026-10-19).
   Les noms de couleurs (--fond, --carte, --texte…) sont ceux déjà utilisés
   par relecture.html et publication.html. Couleurs et menu unique de la
   maquette validée par Romain le 2026-10-23 (fond plus sombre, accent violet,
   police Inter, pastilles vert / orange / rouge / gris). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --fond: #0a0b0d;
  --fond-haut: #0e0f12;
  --carte: #121418;
  --carte-2: #181a20;
  --bord: #23262e;
  --bord-fort: #30343e;
  --texte: #ecedf1;
  --doux: #a3a7b3;
  --accent: #a9a8ff;          /* liens et contours : lisible sur fond sombre */
  --accent-plein: #5b59f0;    /* fond des boutons : texte blanc lisible */
  --accent-fond: rgba(110, 108, 255, .16);
  --ok: #3fcf8e;
  --ok-fond: rgba(63, 207, 142, .12);
  --erreur: #ff8a8e;
  --erreur-fond: rgba(242, 85, 90, .13);
  --attention: #f5a524;
  --attention-fond: rgba(245, 165, 36, .13);
  --gris: #b6bac4;
  --gris-fond: rgba(139, 144, 156, .14);
  --violet: #b59cff;
  --violet-fond: #2a2242;
  --rayon: 14px;
  --ombre: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -12px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { background: var(--fond); }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 80px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 6px; color: var(--texte); }
p { margin: 0 0 10px; }

/* Barre du haut */
.barre-haut {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 18px 0; margin-bottom: 8px; border-bottom: 1px solid var(--bord);
}
.marque { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; color: var(--texte); }
.marque:hover { text-decoration: none; }
.marque-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: #6e6cff; color: #ffffff; font-weight: 700; font-size: 16px;
}
.barre-droite { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lien-discret { color: var(--doux); font-size: 14px; }
.lien-discret:hover { color: var(--texte); text-decoration: none; }

/* Pastille du mode (test / réel) */
.mode { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--bord); background: var(--carte); }
.mode::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mode.sandbox { color: var(--attention); }
.mode.production { color: var(--erreur); }

/* Cartes (et anciennes « section ») */
.carte, section {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 20px; margin: 16px 0; box-shadow: var(--ombre);
}
.carte-titre { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.carte-titre h2 { margin: 0; }

/* Textes d'état */
.doux { color: var(--doux); font-size: 13.5px; }
.ok { color: var(--ok); }
.erreur { color: var(--erreur); }
.attention { color: var(--attention); }
.cache { display: none !important; }

/* Boutons */
button, .bouton {
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  padding: 10px 16px; border-radius: 9px; border: 1px solid var(--accent-plein);
  background: var(--accent-plein); color: #ffffff; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: filter .15s, background .15s, border-color .15s;
}
button:hover:not(:disabled), .bouton:hover { filter: brightness(1.08); text-decoration: none; }
button:focus-visible, .bouton:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.secondaire, .bouton.secondaire { background: transparent; color: var(--texte); border-color: var(--bord-fort); }
button.secondaire:hover:not(:disabled), .bouton.secondaire:hover { border-color: var(--accent); }
button.discret { background: transparent; border-color: transparent; color: var(--doux); padding: 6px 8px; }
button.discret:hover:not(:disabled) { color: var(--texte); }
button.grand { padding: 13px 22px; font-size: 15px; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Champs */
label { display: block; font-size: 13px; color: var(--doux); margin: 10px 0 5px; }
label.case { display: flex; gap: 10px; align-items: flex-start; color: var(--texte); font-size: 14px; }
label.case input { width: auto; margin-top: 3px; accent-color: var(--accent); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 9px;
  background: var(--fond); color: var(--texte); font: inherit;
}
input::placeholder, textarea::placeholder { color: #667085; }
input:disabled { opacity: .5; }

/* Tableaux */
.defilement { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
td, th { text-align: left; padding: 9px 6px; border-top: 1px solid var(--bord); vertical-align: top; }
th { color: var(--doux); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }

/* Messages */
.resultat { margin-top: 10px; font-size: 14px; min-height: 1.2em; overflow-wrap: anywhere; white-space: pre-line; }
.message { padding: 12px 14px; border-radius: 10px; font-size: 14px; border: 1px solid var(--bord); background: var(--carte-2); }
.message.ok { color: var(--ok); background: var(--ok-fond); border-color: #24563a; }
.message.erreur { color: var(--erreur); background: var(--erreur-fond); border-color: #5a2626; }
.message.attention { color: var(--attention); background: var(--attention-fond); border-color: #5c4519; }

/* Confirmation dans la page (pas de fenêtre du navigateur) */
.confirmation { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-fond); }
.confirmation p { margin: 0 0 12px; }
.confirmation button { margin-right: 6px; }

/* Bandeau du mode test */
.bandeau-sandbox { border: 1px solid #5c4519; background: var(--attention-fond); color: var(--attention); border-radius: 10px; padding: 10px 14px; margin: 14px 0; font-size: 14px; }

/* Mots techniques expliqués : souligné pointillé, explication au survol ou au toucher */
.terme { border-bottom: 1px dotted var(--doux); cursor: help; position: relative; }
.terme:hover::after, .terme:focus::after {
  content: attr(data-aide); position: absolute; left: 0; top: calc(100% + 6px); z-index: 20;
  width: max-content; max-width: min(320px, 80vw); white-space: normal;
  background: #0b0d11; color: var(--texte); border: 1px solid var(--bord); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-weight: 400; line-height: 1.45; box-shadow: var(--ombre);
}

/* Lien retour */
.retour { display: inline-block; margin: 18px 0 4px; color: var(--doux); font-size: 14px; }
.retour:hover { color: var(--texte); text-decoration: none; }

@media (max-width: 600px) {
  .carte, section { padding: 16px; }
  h1 { font-size: 21px; }
}

/* Menu unique (maquette validée par Romain le 2026-10-23), posé par menu.js :
   barre du haut fixe ; menu à gauche sur ordinateur, onglets en bas sur
   téléphone ; caché tant que Romain n'est pas connecté. */
body.avec-menu { padding-top: 64px; }
body.avec-menu.connecte { padding-left: 232px; }
body.avec-menu main { padding-top: 8px; }
.app-haut {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: var(--fond-haut); border-bottom: 1px solid var(--bord);
}
.app-haut .barre-droite { gap: 10px; flex-wrap: nowrap; }
.app-haut button { padding: 8px 14px; min-height: 40px; }
.app-menu { display: none; }
body.connecte .app-menu {
  position: fixed; top: 64px; bottom: 0; left: 0; width: 232px; z-index: 20; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 20px 14px;
  background: var(--fond); border-right: 1px solid var(--bord);
}
.app-menu a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 9px;
  color: #c4c7d0; font-weight: 500; font-size: 14.5px;
}
.app-menu a:hover { background: var(--carte); color: var(--texte); text-decoration: none; }
.app-menu a[aria-current="page"] { background: var(--accent-fond); color: #ffffff; font-weight: 600; }
.app-menu-etat { margin: 18px 14px 0; font-size: 12.5px; color: var(--doux); }

/* Pastilles d'état (vert, orange, rouge, gris) */
.pastille {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pastille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastille.vert { color: var(--ok); background: var(--ok-fond); }
.pastille.orange { color: var(--attention); background: var(--attention-fond); }
.pastille.rouge { color: var(--erreur); background: var(--erreur-fond); }
.pastille.gris { color: var(--gris); background: var(--gris-fond); }

@media (max-width: 760px) {
  body.avec-menu.connecte { padding-left: 0; padding-bottom: 84px; }
  .app-haut { padding: 0 14px; }
  body.connecte .app-menu {
    top: auto; bottom: 0; right: 0; width: auto; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); overflow: visible;
    background: var(--fond-haut); border-right: 0; border-top: 1px solid var(--bord);
  }
  .app-menu a {
    flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; min-height: 52px;
    padding: 0 2px; font-size: 11px; line-height: 1.2; text-align: center;  /* les 5 onglets se partagent la largeur */
  }
  .app-menu a[aria-current="page"] { background: transparent; color: var(--accent); }
  .app-menu-etat { display: none; }
}
@media (max-width: 520px) {
  .app-haut .marque-nom { display: none; }  /* le logo « e » reste ; la place va au mode et à la déconnexion */
  .app-haut .mode-detail { display: none; }
  .app-haut button { padding: 8px 11px; font-size: 13px; }
}
