/* Le cockpit Elbrin : la charte du design system « Elbrin » (palettes Terracotta et Nuit).
   Filets plutôt qu'ombres ; l'accent est une couleur de signe, le texte prend accent-fort. */

:root {
  --surface: #F7F0EB;
  --surface-posee: #FBF7F3;
  --surface-creusee: #EFE5DD;
  --encre: #3B2F3A;
  --encre-douce: #6B5E67;
  --accent: #C9705F;
  --accent-fort: #A3503F;
  --accent-doux: #F1D9D0;
  --sur-accent: #FFFFFF;
  --filet: rgba(59, 47, 58, 0.16);
  --alerte: #9B3B2E;
  --alerte-doux: #F6DCD6;
  --succes: #3F6B4F;
  --succes-doux: #DCE9DF;
  --veille: #85632B;
  --veille-doux: #F1E5CC;

  --police-titre: "Fraunces", Georgia, "Times New Roman", serif;
  --police-texte: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --espace-1: 4px;
  --espace-2: 8px;
  --espace-3: 16px;
  --espace-4: 24px;
  --espace-5: 40px;
  --rayon-s: 6px;
  --rayon-m: 12px;
  --rayon-l: 24px;
  --rayon-plein: 999px;
  color-scheme: light;
}

:root[data-theme="nuit"] {
  --surface: #2A2129;
  --surface-posee: #33282F;
  --surface-creusee: #221A20;
  --encre: #F7F0EB;
  --encre-douce: #CFC2C7;
  --accent: #E08E7C;
  --accent-fort: #EBA595;
  --accent-doux: #4A3439;
  --sur-accent: #2A2129;
  --filet: rgba(247, 240, 235, 0.16);
  --alerte: #F2A99C;
  --alerte-doux: #4D2B2B;
  --succes: #A9D1B4;
  --succes-doux: #2C3B31;
  --veille: #E6C98F;
  --veille-doux: #45392A;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="terracotta"]) {
    --surface: #2A2129;
    --surface-posee: #33282F;
    --surface-creusee: #221A20;
    --encre: #F7F0EB;
    --encre-douce: #CFC2C7;
    --accent: #E08E7C;
    --accent-fort: #EBA595;
    --accent-doux: #4A3439;
    --sur-accent: #2A2129;
    --filet: rgba(247, 240, 235, 0.16);
    --alerte: #F2A99C;
    --alerte-doux: #4D2B2B;
    --succes: #A9D1B4;
    --succes-doux: #2C3B31;
    --veille: #E6C98F;
    --veille-doux: #45392A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* Un élément masqué l'est vraiment, quelle que soit sa règle d'affichage. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--surface);
  color: var(--encre);
  font-family: var(--police-texte);
  font-size: 15px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-fort); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent-fort); outline-offset: 2px; border-radius: var(--rayon-s); }

h1, h2, h3 { font-family: var(--police-titre); font-style: italic; font-weight: 400; margin: 0; }
h1 { font-size: 34px; line-height: 42px; }
h2 { font-size: 24px; line-height: 32px; }
h3 { font-size: 19px; line-height: 26px; }

p { margin: 0; }

.surtitre {
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--encre-douce);
}

.discret { color: var(--encre-douce); }
.petit { font-size: 13px; line-height: 20px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }

/* ------------------------------------------------------------ le cadre */

.cadre {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.barre {
  border-right: 1px solid var(--filet);
  background: var(--surface-creusee);
  padding: var(--espace-4) var(--espace-3);
  display: flex;
  flex-direction: column;
  gap: var(--espace-4);
  position: sticky;
  top: 0;
  height: 100vh;
}

.marque { display: flex; align-items: center; gap: var(--espace-2); text-decoration: none; color: var(--encre); }
.marque svg { width: 36px; height: 36px; flex: none; }
.marque .nom { font-family: var(--police-titre); font-style: italic; font-size: 24px; line-height: 28px; }
.marque .sous { display: block; font-size: 11px; line-height: 14px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--encre-douce); font-style: normal; font-family: var(--police-texte); font-weight: 600; }

.navigation { display: flex; flex-direction: column; gap: 2px; }
.navigation a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace-2);
  padding: 9px 12px;
  border-radius: var(--rayon-m);
  color: var(--encre);
  text-decoration: none;
  font-weight: 500;
}
.navigation a:hover { background: var(--surface-posee); }
.navigation a[aria-current="page"] { background: var(--accent-doux); color: var(--encre); font-weight: 600; }

.compteur {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--rayon-plein);
  background: var(--accent-fort);
  color: var(--sur-accent);
  font-size: 12px;
  line-height: 22px;
  font-weight: 700;
  text-align: center;
}

.personne { margin-top: auto; border-top: 1px solid var(--filet); padding-top: var(--espace-3); display: flex; flex-direction: column; gap: var(--espace-2); }
.personne .qui { font-weight: 600; }

.principal { padding: var(--espace-5) var(--espace-5) 80px; max-width: 1180px; width: 100%; }

.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--espace-3); margin-bottom: var(--espace-4); flex-wrap: wrap; }
.entete .titres { display: flex; flex-direction: column; gap: var(--espace-1); }
.entete p { color: var(--encre-douce); max-width: 60ch; }

/* ------------------------------------------------------------ blocs */

.section { margin-top: var(--espace-5); }
.section > .titre-section { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--espace-1) var(--espace-3); margin-bottom: var(--espace-3); padding-bottom: var(--espace-2); border-bottom: 1px solid var(--filet); }
.section > .titre-section h2 { flex: none; }
.section > .titre-section .discret { font-size: 13px; }

.carte {
  background: var(--surface-posee);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-m);
  padding: var(--espace-4);
  display: flex;
  flex-direction: column;
  gap: var(--espace-3);
}
.cartes { display: grid; gap: var(--espace-3); }
.cartes.grille { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.carte .tete { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--espace-3); }
.carte .tete .titres { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.carte .meta { display: flex; flex-wrap: wrap; gap: var(--espace-2) var(--espace-3); font-size: 13px; color: var(--encre-douce); }
.carte .actions, .actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); align-items: center; }
.actions input[type="text"] { flex: 1 1 220px; width: auto; min-width: 180px; }

.vide {
  border: 1px dashed var(--filet);
  border-radius: var(--rayon-m);
  padding: var(--espace-4);
  color: var(--encre-douce);
  text-align: center;
}

.bandeau {
  border-radius: var(--rayon-m);
  padding: var(--espace-3) var(--espace-4);
  background: var(--accent-doux);
  display: flex;
  gap: var(--espace-3);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.bandeau.alerte { background: var(--alerte-doux); }
.bandeau.succes { background: var(--succes-doux); }
.bandeau.veille { background: var(--veille-doux); }

/* ------------------------------------------------------------ pastilles */

.pastille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--rayon-plein);
  font-size: 12px;
  line-height: 20px;
  font-weight: 600;
  background: var(--surface-creusee);
  color: var(--encre);
  white-space: nowrap;
}
.pastille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.pastille.accent { background: var(--accent-doux); color: var(--accent-fort); }
.pastille.alerte { background: var(--alerte-doux); color: var(--alerte); }
.pastille.succes { background: var(--succes-doux); color: var(--succes); }
.pastille.veille { background: var(--veille-doux); color: var(--veille); }
.pastille.sans-point::before { display: none; }

/* ------------------------------------------------------------ boutons */

.bouton {
  appearance: none;
  border: 1px solid var(--accent-fort);
  background: var(--accent-fort);
  color: var(--sur-accent);
  font: inherit;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--rayon-plein);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--espace-2);
  line-height: 22px;
}
.bouton:hover { filter: brightness(1.06); }
.bouton.secondaire { background: transparent; color: var(--accent-fort); }
.bouton.discret { background: transparent; border-color: transparent; color: var(--encre); padding-left: 10px; padding-right: 10px; }
.bouton.discret:hover { background: var(--surface-creusee); filter: none; }
.bouton.refus { background: transparent; color: var(--alerte); border-color: var(--alerte); }
.bouton[disabled] { opacity: 0.55; cursor: progress; }

/* ------------------------------------------------------------ formulaires */

.formulaire { display: grid; gap: var(--espace-3); }
.formulaire > .bouton { justify-self: start; }
.champ { display: grid; gap: 6px; }
.champ label, .champ .libelle { font-weight: 600; font-size: 14px; }
.champ .aide { font-size: 13px; color: var(--encre-douce); }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--encre);
  background: var(--surface);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-s);
  padding: 8px 12px;
  width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-fort); outline: none; box-shadow: 0 0 0 2px var(--accent-doux); }
.case { display: flex; gap: var(--espace-2); align-items: center; font-size: 14px; }
.ligne-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--espace-3); }
.choix { display: flex; gap: var(--espace-3); flex-wrap: wrap; }

/* ------------------------------------------------------------ tableaux */

.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th { text-align: left; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--encre-douce); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--filet); }
.tableau td { padding: 10px 12px; border-bottom: 1px solid var(--filet); vertical-align: top; }
.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover td { background: var(--surface-posee); }

.parametres { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--espace-3); font-size: 14px; }
.parametres dt { color: var(--encre-douce); }
.parametres dd { margin: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ la boucle */

.frise { display: grid; gap: var(--espace-3); position: relative; }
.tour { display: grid; grid-template-columns: 44px 1fr; gap: var(--espace-3); }
.tour .numero {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--accent); color: var(--accent-fort);
  display: grid; place-items: center;
  font-family: var(--police-titre); font-style: italic; font-size: 20px;
}
.objection { border-top: 1px solid var(--filet); padding-top: var(--espace-2); display: grid; gap: 4px; }
.objection:first-child { border-top: 0; padding-top: 0; }

.sortie { background: var(--surface); border: 1px solid var(--filet); border-radius: var(--rayon-s); padding: var(--espace-3); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 420px; overflow: auto; }

.fil { display: grid; gap: var(--espace-2); }
.message { display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--rayon-m); background: var(--surface-posee); border: 1px solid var(--filet); max-width: 72ch; }
.message.moi { justify-self: end; background: var(--accent-doux); border-color: transparent; }
.message .auteur { font-size: 12px; font-weight: 600; color: var(--encre-douce); }
.message .corps { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ note du savoir-faire */

.note h1 { font-size: 28px; line-height: 36px; margin: var(--espace-4) 0 var(--espace-2); }
.note h2 { font-size: 22px; line-height: 30px; margin: var(--espace-4) 0 var(--espace-2); }
.note h3 { font-size: 18px; line-height: 26px; margin: var(--espace-3) 0 var(--espace-2); }
.note p, .note ul, .note ol { margin: 0 0 var(--espace-3); }
.note pre { background: var(--surface-creusee); padding: var(--espace-3); border-radius: var(--rayon-s); overflow: auto; }
.note .lien-interne { background: var(--accent-doux); border-radius: var(--rayon-s); padding: 0 6px; font-size: 13px; }

/* ------------------------------------------------------------ connexion */

.connexion { min-height: 100vh; display: grid; place-items: center; padding: var(--espace-4); }
.connexion .carte { width: min(460px, 100%); gap: var(--espace-4); }
.connexion .monogramme { width: 96px; height: 96px; }
.connexion .devise { font-size: 12px; letter-spacing: 0.3em; font-weight: 600; text-transform: uppercase; color: var(--encre-douce); }

/* ------------------------------------------------------------ avis */

.avis {
  position: fixed; right: var(--espace-4); bottom: var(--espace-4);
  max-width: 420px; padding: var(--espace-3) var(--espace-4);
  border-radius: var(--rayon-m); background: var(--encre); color: var(--surface);
  font-weight: 500; z-index: 10;
}
.avis.erreur { background: var(--alerte); color: #FFFFFF; }

.chargement { color: var(--encre-douce); display: flex; align-items: center; gap: var(--espace-2); }
.chargement::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent;
  animation: tourner 0.8s linear infinite;
}
@keyframes tourner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chargement::before { animation: none; } }

/* ------------------------------------------------------------ petits écrans */

@media (max-width: 860px) {
  .cadre { grid-template-columns: 1fr; }
  .barre { position: static; height: auto; flex-direction: column; gap: var(--espace-3); border-right: 0; border-bottom: 1px solid var(--filet); }
  .navigation { flex-direction: row; flex-wrap: wrap; }
  .personne { margin-top: 0; flex-direction: row; align-items: center; justify-content: space-between; }
  .principal { padding: var(--espace-4) var(--espace-3) 64px; }
  .tour { grid-template-columns: 1fr; }
}

/* Le logo : ses couleurs suivent la palette active (pas de var() dans les attributs SVG). */
.trait-encre { stroke: var(--encre); }
.trait-accent { stroke: var(--accent); }
.point-accent { fill: var(--accent); }
