/* Panel BTC v2 — feuille unique, servie comme fichier (la CSP interdit le style en ligne).
   Charte BTC v2 « Ardoise & laiton » : thème sombre par défaut, jetons uniques ci-dessous. */

/* Polices embarquées (OFL, voir polices/LISEZ-MOI.txt) : servies par le BFF, aucune requête externe.
   Polices variables : un fichier couvre tous les graisses déclarées. */
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 400 900; font-display: swap;
             src: url("polices/Cinzel-latin.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
             src: url("polices/Nunito-latin.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
             src: url("polices/JetBrainsMono-latin.woff2") format("woff2"); }

:root {
  /* Surfaces */
  --fond: #1e222a;
  --champ: #242933;
  --carte: #2e3440;
  --lisere: #4c566a;
  /* Texte (AA : #eceff4 et #9aa7be tiennent 4,5:1 sur fond, champ et carte) */
  --texte: #eceff4;
  --discret: #9aa7be;
  /* Accents : laiton = action principale / courant ; patine = sain / Banc ; alerte = danger */
  --laiton: #e4ba53;
  --laiton-clair: #f0daa2;
  --patine: #4cc2b2;
  --alerte: #f08a6e;

  --police-titre: "Cinzel", "Trajan Pro", Georgia, serif;
  --police-texte: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-donnees: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --rayon: 12px;
  --rayon-petit: 8px;
  --cible: 44px;
  --laterale: 248px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.5 var(--police-texte); }
a { color: var(--laiton-clair); }
a:hover { color: var(--laiton); }
:focus-visible { outline: 2px solid var(--laiton-clair); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font: 700 clamp(1.5rem, 4vw, 2rem)/1.2 var(--police-titre); letter-spacing: .04em; color: var(--laiton-clair); }
h2 { font: 600 1.25rem/1.3 var(--police-titre); margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h4 { font-size: .95rem; margin: .8rem 0 .2rem; color: var(--laiton-clair); }
.donnee, td.donnee { font-family: var(--police-donnees); }
.discret, .horodatage { color: var(--discret); }
.horodatage { font-size: 13px; }

/* ---------- Coquille : barre latérale + contenu ---------- */
panel-application { display: block; min-height: 100vh; }
.coquille { display: grid; grid-template-columns: var(--laterale) minmax(0, 1fr); min-height: 100vh; }
.laterale { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
            gap: 1.5rem; padding: 1.5rem 1rem; background: var(--champ); border-right: 1px solid var(--lisere); }
.marque { display: flex; align-items: center; gap: .75rem; padding: 0 .5rem; }
.marque img { display: block; width: 32px; height: 32px; flex: none; }
.marque .nom { display: flex; flex-direction: column; line-height: 1.2; }
.marque .nom b { font: 700 1.1rem var(--police-titre); letter-spacing: .06em; color: var(--laiton-clair); }
.marque .nom span { font-size: 12px; color: var(--discret); }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a { display: flex; align-items: center; min-height: var(--cible); padding: 0 .75rem; border-radius: var(--rayon-petit);
          color: var(--texte); text-decoration: none; font-weight: 600; }
.menu a:hover { background: var(--carte); color: var(--laiton-clair); }
.menu a[aria-current=page] { background: var(--carte); color: var(--laiton-clair); font-weight: 700; box-shadow: inset 3px 0 0 var(--laiton); }
.session { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border-radius: var(--rayon-petit);
           background: var(--fond); border: 1px solid var(--lisere); font-size: 13px; color: var(--discret); }
.session .etat { overflow-wrap: anywhere; }
main.principal { min-width: 0; padding: 2rem 2.5rem; display: flex; flex-direction: column; gap: 1.75rem; }

.pastille { align-self: flex-start; font-size: 12px; font-weight: 700; line-height: 1; padding: .3rem .65rem; border-radius: 999px;
            color: var(--fond); }
.pastille:empty { display: none; }
.pastille.production { background: var(--laiton); }
.pastille.banc { background: var(--patine); }

/* Barre du haut, visible seulement sur téléphone ; le menu devient un tiroir. */
.barre-mobile { display: none; }
.voile { display: none; }
.menu-mobile { display: grid; place-items: center; width: var(--cible); padding: 0; flex: none; }
.icone-menu { display: grid; gap: 4px; width: 20px; }
.icone-menu span { display: block; height: 2px; border-radius: 2px; background: var(--texte); }

@media (max-width: 768px) {
  .coquille { display: block; }
  .barre-mobile { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
                  padding: .6rem 1rem; background: var(--champ); border-bottom: 1px solid var(--lisere); }
  .barre-mobile .titre-courant { font: 700 1.05rem var(--police-titre); letter-spacing: .05em; color: var(--laiton-clair);
                                 min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .laterale { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(300px, 86vw); height: 100%;
              visibility: hidden; transform: translateX(-100%); }
  .laterale.ouverte { visibility: visible; transform: none; }
  .voile.ouvert { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(15 17 21 / .72); }
  main.principal { padding: 1rem; gap: 1.25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .laterale { transition: transform .2s ease, visibility .2s; }
}

/* ---------- Connexion ---------- */
.accueil { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 1rem; }
.accueil .pastille { align-self: center; }
.accueil .chapeau { text-align: center; }
.accueil .connexion { width: min(26rem, 100%); }
.accueil .connexion input { width: 100%; }

/* ---------- Écran : en-tête, barre d'outils ---------- */
ecran-ensemble, ecran-noeuds, ecran-infrastructure, ecran-taches, ecran-modeles, ecran-modules, ecran-joueurs,
ecran-sanctions, ecran-exploitation, ecran-comptes, ecran-metier { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.entete-ecran { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.entete-ecran .texte { display: flex; flex-direction: column; gap: .4rem; min-width: 0; flex: 1 1 24rem; }
.chapeau { margin: 0; font-size: 14px; color: var(--discret); max-width: 70ch; }
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.contenu { display: flex; flex-direction: column; gap: 1.75rem; min-width: 0; }
section { min-width: 0; }
.detail { min-width: 0; }

/* ---------- Boutons et champs : cibles de 44 px ---------- */
button { font: inherit; font-weight: 600; min-height: var(--cible); padding: 0 1rem; border: 1px solid var(--lisere); border-radius: var(--rayon-petit);
         background: var(--carte); color: var(--texte); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--discret); }
button:disabled { opacity: .55; cursor: progress; }
button.danger { background: transparent; color: var(--alerte); border-color: var(--alerte); font-weight: 700; }
button.danger:hover:not(:disabled) { background: rgb(240 138 110 / .12); border-color: var(--alerte); }
button.principal { background: var(--laiton); color: var(--fond); border-color: var(--laiton); font-weight: 700; }
button.principal:hover:not(:disabled) { background: var(--laiton-clair); border-color: var(--laiton-clair); }
button.discret { background: transparent; }
input, select, textarea { font: inherit; min-height: var(--cible); padding: .4rem .75rem; max-width: 100%; border: 1px solid var(--discret);
                          border-radius: var(--rayon-petit); background: var(--champ); color: var(--texte); }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; accent-color: var(--laiton); vertical-align: middle; }
label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; gap: .5rem; min-height: var(--cible); }
textarea { width: 100%; font-family: var(--police-donnees); font-size: 13px; }
::placeholder { color: var(--discret); opacity: 1; }
fieldset { min-width: 0; margin: 0; padding: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
           border: 1px solid var(--lisere); border-radius: var(--rayon); background: var(--champ); }
legend { padding: 0 .5rem; font-weight: 700; color: var(--laiton-clair); }
fieldset > p, fieldset > br { flex-basis: 100%; margin: 0; }
fieldset > div { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; flex-basis: 100%; }
fieldset label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

/* ---------- Cartes, pilules, jauges ---------- */
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.carte { display: flex; flex-direction: column; gap: .9rem; min-width: 0; padding: 1.1rem; border-radius: var(--rayon);
         background: var(--carte); border: 1px solid var(--lisere); }
.carte.pointillee { background: transparent; border-style: dashed; color: var(--discret); justify-content: center; align-self: start; }
.carte-tete { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.carte-tete .nom { font: 600 1rem var(--police-donnees); overflow-wrap: anywhere; }
.carte .sous { font-size: 13px; color: var(--discret); overflow-wrap: anywhere; }
.carte .gestes { display: flex; flex-wrap: wrap; gap: .5rem; }
.pilule { display: inline-block; padding: .2rem .7rem; border-radius: 999px; border: 1px solid var(--discret); color: var(--discret);
          font-size: 12px; font-weight: 700; white-space: nowrap; }
.pilule.ton-patine { border-color: var(--patine); color: var(--patine); }
.pilule.ton-laiton { border-color: var(--laiton); color: var(--laiton); }
.pilule.ton-alerte { border-color: var(--alerte); color: var(--alerte); }
.mesures { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .75rem; margin: 0; }
.mesures.large { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.mesures.large div { padding: .6rem .8rem; border: 1px solid var(--lisere); border-radius: var(--rayon-petit); background: var(--carte); }
.carte a, .alerte a { display: inline-flex; align-items: center; min-height: var(--cible); }
.mesures div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mesures dt { font-size: 12px; color: var(--discret); }
.mesures dd { margin: 0; font: 600 1.05rem var(--police-donnees); overflow-wrap: anywhere; }
.mesures dd.sous { font: 12px/1.4 var(--police-texte); color: var(--discret); }
.jauge-ligne { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: 13px; color: var(--discret); }
.jauge-ligne .donnee { color: var(--texte); }
.jauge { position: relative; height: 12px; border-radius: 999px; background: var(--fond); border: 1px solid var(--lisere); overflow: hidden; }
.jauge .reservee { position: absolute; inset: 0 auto 0 0; background: var(--laiton); opacity: .55; }
.jauge .utilisee { position: absolute; inset: 0 auto 0 0; background: var(--laiton-clair); }
.legende { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: 12px; color: var(--discret); }
.legende i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 2px; background: var(--fond); border: 1px solid var(--lisere); }
.legende i.reservee { background: var(--laiton); opacity: .55; border-color: var(--laiton); }
.legende i.utilisee { background: var(--laiton-clair); border-color: var(--laiton-clair); }

.alertes { display: flex; flex-direction: column; gap: .5rem; }
.alerte { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .75rem 1rem; border-radius: var(--rayon-petit);
          background: var(--carte); border: 1px solid var(--lisere); }
.alerte::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--discret); flex: none; }
.alerte.ton-alerte::before { background: var(--alerte); }
.alerte.ton-laiton::before { background: var(--laiton); }
.alerte b { min-width: 5.5rem; }
.alerte.ton-alerte b { color: var(--alerte); }
.alerte.ton-laiton b { color: var(--laiton); }
.alerte span { flex: 1 1 14rem; min-width: 0; }

/* État « bientôt disponible » : l'écran existe, la donnée n'est pas encore branchée. */
.bientot { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: 1.1rem; border-radius: var(--rayon);
           border: 1px dashed var(--lisere); background: var(--champ); }
.bientot p { margin: 0; font-size: 14px; color: var(--discret); max-width: 70ch; }
.bientot strong { color: var(--texte); }
.protegees { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.protegees li { font: 600 13px var(--police-donnees); padding: .2rem .6rem; border: 1px solid var(--laiton); border-radius: 999px; color: var(--laiton); }
details { border: 1px solid var(--lisere); border-radius: var(--rayon); background: var(--champ); }
details > summary { display: flex; align-items: center; min-height: var(--cible); padding: 0 1rem; cursor: pointer; font-weight: 700; color: var(--laiton-clair); }
details[open] > summary { border-bottom: 1px solid var(--lisere); }
details > :not(summary) { margin: 1rem; }
/* Fiche joueur (lot 2.3) : sections par famille espacees ; les boutons de profil passent a la ligne. */
details.famille + details.famille { margin-top: .75rem; }
[aria-label="Profils du joueur"] { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Origine, comptes rendus ---------- */
.limite { padding: .6rem .9rem; border-radius: var(--rayon-petit); background: var(--carte); border-left: 4px solid var(--laiton); }
.origine { display: block; font-size: 12px; padding: .3rem .7rem; margin: .25rem 0; border-left: 4px solid; border-radius: 4px; background: var(--champ); overflow-wrap: anywhere; }
.origine.orchestrateur { border-color: var(--laiton); color: var(--discret); }
.origine.metier { border-color: var(--patine); color: var(--discret); }
.origine.absente { border-color: var(--alerte); color: var(--alerte); font-weight: 700; }
.vide { color: var(--discret); font-style: italic; }
.erreur { color: var(--alerte); }
.succes { color: var(--patine); }
.compte-rendu p { margin: .3rem 0; overflow-wrap: anywhere; }

/* ---------- Tableaux : boîte à défilement horizontal, jamais la page ---------- */
.defile { overflow-x: auto; border: 1px solid var(--lisere); border-radius: var(--rayon); max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: .7rem 1rem; text-align: left; vertical-align: top; border-top: 1px solid var(--lisere); }
thead th { border-top: 0; background: var(--champ); color: var(--discret); font-weight: 700; white-space: nowrap; }
tbody tr { background: var(--carte); }
td.gestes { white-space: normal; }
/* Un tableau large (Sanctions : 14 colonnes) defile dans sa boite : la colonne des gestes reste visible a droite. */
@media (min-width: 769px) {
  .defile td.gestes, .defile th.gestes { position: sticky; right: 0; box-shadow: -1px 0 0 var(--lisere); }
  .defile td.gestes { background: var(--carte); }
  .defile th.gestes { background: var(--champ); }
}
/* Tableau a lignes empilees sur telephone : une ligne = une carte, chaque cellule porte son libelle (data-label). */
@media (max-width: 768px) {
  table.empile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.empile, table.empile tbody, table.empile tr, table.empile td { display: block; }
  table.empile tr { border-top: 1px solid var(--lisere); padding: .5rem 0; }
  table.empile tr:first-child { border-top: 0; }
  table.empile td { border-top: 0; padding: .35rem 1rem; }
  table.empile td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--discret); }
  table.empile td.gestes > div { min-width: 0; }
}
td.gestes > div { display: flex; flex-wrap: wrap; gap: .5rem; min-width: 10rem; }

pre.console { margin: 0; padding: 1rem; max-height: 24rem; overflow: auto; border-radius: var(--rayon); background: var(--champ);
              border: 1px solid var(--lisere); font: 13px/1.7 var(--police-donnees); white-space: pre; }

/* ---------- Confirmation des gestes destructeurs ---------- */
dialog.confirmation { width: min(30rem, calc(100vw - 2rem)); padding: 1.5rem; border: 1px solid var(--alerte); border-radius: var(--rayon);
                      background: var(--carte); color: var(--texte); }
dialog.confirmation[open] { display: flex; flex-direction: column; gap: 1rem; }
dialog.confirmation::backdrop { background: rgb(15 17 21 / .72); }
dialog.confirmation h2 { margin: 0; font-size: 1.15rem; color: var(--alerte); overflow-wrap: anywhere; }
dialog.confirmation p { margin: 0; }
dialog.confirmation .consequence { font-weight: 600; line-height: 1.5; }
dialog.confirmation label { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; font-size: 13px; color: var(--discret); }
dialog.confirmation label b { font-family: var(--police-donnees); color: var(--texte); overflow-wrap: anywhere; }
dialog.confirmation input { width: 100%; background: var(--fond); font-family: var(--police-donnees); }
dialog.confirmation .choix { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .75rem; }
dialog.confirmation .choix .danger { background: var(--alerte); color: var(--fond); border-color: var(--alerte); }
dialog.confirmation .choix .danger:hover:not(:disabled) { background: var(--alerte); filter: brightness(1.1); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none !important; } }
