/* =====================================================================
   Interface 1 — questions et réglages
   Écran de travail clair : barre latérale blanche, contenu sur papier.
   ===================================================================== */

body.admin-page { min-height: 100vh; background: var(--papier); }

/* Cadre : barre latérale + contenu (la barre passe au-dessus en étroit) */
.admin-cadre { min-height: 100vh; display: flex; flex-wrap: wrap; }

.admin-nav {
  flex: 1 1 240px; max-width: 100%;
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--trait);
}
.admin-marque { display: flex; align-items: center; gap: 10px; padding: 0 10px 16px; }
.admin-marque .etoile-logo { width: 30px; height: 30px; flex: none; }
.admin-marque span { font-family: var(--police-titre); font-weight: 700; font-size: 20px; line-height: 1.15; }

.nav-groupe {
  margin: 0; padding: 14px 10px 4px;
  font-family: var(--police-texte); font-size: 13px; font-weight: 600; letter-spacing: 0;
  color: var(--gris-texte);
}
.nav-groupe + .nav-liste, .admin-marque + .nav-groupe { margin-top: 0; }
.admin-nav .nav-groupe:not(:first-of-type) { padding-top: 22px; }
.nav-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.nav-lien {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 44px; padding: 6px 10px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--texte); font-size: 15px; text-align: left; cursor: pointer;
}
.nav-lien:hover { background: var(--surface-2); }
.nav-lien[aria-current="page"] { background: var(--surface-2); font-weight: 700; }
.nav-lien .nom { min-width: 0; overflow-wrap: anywhere; }
.nav-lien .nb { color: var(--gris-texte); font-size: 14px; font-weight: 500; flex: none; }
.nav-ajout { justify-content: flex-start; color: var(--majorelle-fonce); font-weight: 700; margin-top: 2px; }

.nav-pied { margin-top: auto; padding: 22px 10px 0; display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; }
.nav-pied a { display: inline-flex; align-items: center; min-height: 44px; color: var(--majorelle-fonce); font-weight: 600; }

.admin-corps {
  flex: 999 1 560px; min-width: 0;
  display: flex; flex-direction: column; gap: 18px;
  padding: 32px 36px 64px;
}
.admin-corps > * { margin: 0; }

/* En-tête de banque ---------------------------------------------------- */
.tete-banque { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.tete-texte { flex: 1 1 320px; min-width: 0; }
.tete-banque h1, .tete-section h1 { font-size: 34px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.etat-banque { margin-top: 6px; color: var(--gris-texte); }
.etat-banque.prete { color: var(--emeraude-fonce); font-weight: 600; }
.actions-banque { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-banque .btn { border-width: 1px; font-weight: 600; }
.actions-banque .btn-primaire { font-weight: 700; }

.gestion-banque { display: flex; flex-wrap: wrap; gap: 2px; margin: -10px 0 0 -10px; }
.gestion-banque .btn { padding: 6px 10px; font-size: 14px; font-weight: 600; color: var(--gris-texte); }
.gestion-banque .btn:hover { color: var(--texte); }
.btn.lien-danger, .gestion-banque .btn.lien-danger { color: var(--grenade-fonce); }

.tete-section p { margin-top: 6px; color: var(--gris-texte); max-width: 720px; }

/* Onglets des manches ---------------------------------------------------- */
.manches { display: flex; gap: 4px; border-bottom: 1px solid var(--trait); overflow-x: auto; }
.manches button {
  min-height: 44px; padding: 0 16px; margin-bottom: -1px;
  border: 0; border-bottom: 3px solid transparent; background: transparent;
  color: var(--gris-texte); font-size: 15px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.manches button:hover { color: var(--texte); }
.manches button[aria-selected="true"] { color: var(--texte); font-weight: 700; border-bottom-color: var(--majorelle); }
.manches .nb { color: var(--gris-texte); font-weight: 500; margin-left: 4px; }

.outils { display: flex; gap: 12px 20px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: -4px; }
.aide-manche { flex: 1 1 360px; color: var(--gris-texte); font-size: 14px; max-width: 720px; }
.outils .recherche { flex: 0 1 260px; }
.outils .recherche input { border-width: 1px; }

/* Table des questions ------------------------------------------------------ */
.table-q-boite { overflow-x: auto; background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; }
.table-q { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 15px; }
.table-q th {
  padding: 12px 16px; text-align: left; vertical-align: bottom;
  color: var(--gris-texte); font-size: 13px; font-weight: 500;
}
.table-q td { padding: 12px 16px; vertical-align: top; border-top: 1px solid var(--surface-2); overflow-wrap: anywhere; }
.table-q td[dir="auto"] { text-align: start; unicode-bidi: plaintext; }
.table-q .col-num { width: 44px; padding-right: 0; }
.table-q td.num { color: var(--gris-texte); }
.table-q .col-chiffre { text-align: right; white-space: nowrap; }
.table-q td.texte { min-width: 220px; line-height: 1.4; }
.table-q td.rep { font-weight: 600; min-width: 110px; }
.table-q td.theme { color: var(--gris-texte); min-width: 90px; }
.table-q td.pts { font-family: var(--police-titre); font-weight: 800; font-size: 18px; line-height: 1.3; }
.table-q td.temps { color: var(--gris-texte); }
.table-q .col-actions { width: 1%; padding: 6px 10px; }
.table-q td.col-actions { vertical-align: middle; }
.carte-q.edition { background: #FFF7E3; }

.actions-q { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.actions-q .btn { border-width: 1px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.actions-q .btn-icone { min-width: 44px; padding: 6px; font-size: 17px; color: var(--gris-texte); }

.table-m2 td:nth-child(2) { min-width: 300px; }
.indices-liste { list-style: none; margin: 0; padding: 0; }
.indices-liste li { display: flex; gap: 10px; align-items: baseline; padding: 2px 0; line-height: 1.4; }
.indices-liste li + li { border-top: 1px dashed var(--surface-2); }
.indices-liste b {
  flex: none; min-width: 22px; text-align: center;
  font-family: var(--police-titre); font-weight: 800; font-size: 15px; color: #8A5A00;
}

.note-table { color: var(--gris-texte); font-size: 14px; margin-top: -8px; }

.vide-admin { padding: 36px 20px; text-align: center; background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; color: var(--gris-texte); }
.vide-admin strong { display: block; color: var(--texte); font-family: var(--police-titre); font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.vide-admin .actions-vide { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* Éditeur ----------------------------------------------------------------- */
#zone-editeur:empty { display: none; }
.editeur { background: var(--surface); border: 1px solid var(--majorelle); border-radius: 14px; padding: 20px 22px; }
.editeur h2 { font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.editeur .grille-ed { display: grid; grid-template-columns: minmax(0, 1fr) 160px minmax(0, 1fr) 150px; gap: 14px; margin-top: 14px; }
.editeur .grille-ed .champ + .champ, .editeur .indices-ed .champ + .champ { margin-top: 0; }
.editeur .indices-ed { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editeur .indices-ed .champ > span strong { color: #8A5A00; }
.editeur .grille-reponse { margin-top: 14px; }
.editeur input, .editeur textarea, .editeur select { border-width: 1px; }
.points-rapides { display: flex; gap: 6px; margin-top: 6px; }
.points-rapides button {
  width: 44px; height: 44px; border-radius: 9px; border: 1px solid var(--trait);
  background: var(--surface); color: var(--texte); font-family: var(--police-titre); font-weight: 800; font-size: 17px; cursor: pointer;
}
.points-rapides button:hover { border-color: var(--majorelle); }
.points-rapides button.actif { background: var(--majorelle); border-color: var(--majorelle); color: #fff; }
.editeur .pied-ed { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--surface-2); }
.editeur .pied-ed .espace { flex: 1; }
.editeur .pied-ed .aide { margin: 0; }
.erreur-ed { color: var(--grenade-fonce); font-weight: 700; }
.erreur-ed:empty { display: none; }
.editeur .erreur-ed { margin-top: 12px; }

/* Import (dialogue) ------------------------------------------------------- */
.import-zone .champ { margin-top: 14px; }
.import-zone textarea { font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; font-size: 14px; min-height: 180px; white-space: pre; border-width: 1px; }
.actions-import { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions-import .btn { border-width: 1px; font-size: 15px; font-weight: 600; }
.import-apercu { margin-top: 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--trait); background: var(--papier); font-weight: 600; }
.import-apercu.ok { border-color: rgba(11, 122, 89, .35); background: #EAF8F2; color: var(--emeraude-fonce); }
.import-apercu.ko { border-color: rgba(168, 26, 48, .3); background: #FDEEF0; color: var(--grenade-fonce); }
.import-erreurs { margin: 8px 0 0; padding-left: 20px; color: var(--grenade-fonce); font-size: 14px; max-height: 160px; overflow: auto; }
.colonnes-modele { font-size: 13px; color: var(--gris-texte); margin-top: 10px; line-height: 1.8; }
.colonnes-modele code { background: var(--surface-2); color: var(--texte); padding: 1px 6px; border-radius: 6px; }
.ligne-mode { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-top: 10px; }
.ligne-mode label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }

/* Dialogues de cette page : bordures discrètes */
.admin-page .dialogue { border: 1px solid var(--trait); }
.admin-page .dialogue-corps h2 { font-weight: 700; }
.admin-page .dialogue input[type="text"] { border-width: 1px; }

/* Réglages, titre et logo, code d'accès ------------------------------------ */
.panneau-admin { background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 22px; }
.panneau-admin h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.panneau-admin > p { color: var(--gris-texte); margin-bottom: 14px; }
.panneau-etroit { max-width: 540px; }
.panneau-etroit form .btn { margin-top: 16px; }
.panneau-admin input, .panneau-admin select { border-width: 1px; }

.reglages fieldset { border: 0; border-top: 1px solid var(--trait); padding: 18px 0 20px; margin: 0; min-width: 0; }
.reglages fieldset:first-child { border-top: 0; padding-top: 0; }
.reglages fieldset:last-child { padding-bottom: 0; }
.reglages legend { float: left; width: 100%; margin-bottom: 12px; padding: 0; font-family: var(--police-titre); font-size: 20px; font-weight: 700; }
.reglages legend + * { clear: both; }
.reglages .etiquette { margin-top: 16px; }
.reglages .case { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; font-weight: 600; flex-wrap: wrap; }
.reglages .nombre-court { width: 84px; min-height: 44px; padding: 4px 8px; display: inline-block; }
.reglages .champ.court { max-width: 360px; margin-top: 14px; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grille-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grille-2 .champ + .champ, .grille-3 .champ + .champ, .grille-4 .champ + .champ { margin-top: 0; }
.grille-2, .grille-3, .grille-4 { margin-top: 14px; }
.reglages legend + .grille-2, .reglages legend + .grille-3 { margin-top: 0; }
.reglages .grille-4 + .champ { margin-top: 14px; }

/* « Titre et logo » : seule la partie Affichage du formulaire est visible */
.reglages-affichage .reglages fieldset:not(:first-child) { display: none; }
.reglages-affichage .reglages fieldset:first-child { padding-bottom: 0; }

.barre-enregistrer {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 10px;
  margin: 0 -36px; padding: 14px 36px;
  background: var(--papier); border-top: 1px solid var(--trait);
}

.logo-zone { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-apercu { width: 240px; height: 140px; border-radius: 12px; border: 1px solid var(--trait); display: grid; place-items: center; background: var(--encre); overflow: hidden; color: var(--gris-texte); font-size: 14px; text-align: center; padding: 8px; }
.logo-apercu img { max-width: 100%; max-height: 100%; object-fit: contain; }
.actions-logo { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-logo .btn { border-width: 1px; }

/* Porte (code d'accès) sur cette page ------------------------------------ */
.admin-page .porte-carte { border: 1px solid var(--trait); box-shadow: none; border-radius: 16px; }
.admin-page .porte-carte .etoile-logo { width: 48px; height: 48px; }
.admin-page .porte-carte h1 { font-weight: 700; }
.admin-page .porte-carte input { border-width: 1px; }
.admin-page .porte-carte .btn-gros { min-height: 52px; font-size: 18px; }

/* Étroit ---------------------------------------------------------------- */
@media (max-width: 799px) {
  .admin-cadre { align-content: flex-start; }
  .admin-nav { border-right: 0; border-bottom: 1px solid var(--trait); padding: 14px 16px 10px; }
  .nav-pied { margin-top: 6px; padding-top: 6px; }
  .admin-corps { padding: 22px 16px 56px; gap: 16px; }
  .barre-enregistrer { margin: 0 -16px; padding: 12px 16px; }
  .tete-banque h1, .tete-section h1 { font-size: 28px; }
  .editeur { padding: 16px; }
  .editeur .grille-ed { grid-template-columns: minmax(0, 1fr) 140px; }
  .editeur .indices-ed, .grille-2, .grille-3 { grid-template-columns: 1fr; }
  .grille-4 { grid-template-columns: 1fr 1fr; }
  .outils .recherche { flex: 1 1 100%; }
  .panneau-admin { padding: 18px 16px; }
}
@media (max-width: 480px) {
  .actions-banque { width: 100%; }
  .actions-banque .btn { flex: 1 1 auto; }
  .editeur .grille-ed { grid-template-columns: 1fr; }
}

/* Écrans de pause importés ---------------------------------------------- */
.pauses-liste { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pauses-liste li { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pauses-liste img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: var(--encre); border-radius: 10px; border: 1px solid var(--trait); }
.pauses-liste .pauses-vide { grid-column: 1 / -1; color: var(--gris-texte); font-size: 14px; }
.btn.occupe { opacity: .6; pointer-events: none; }
.case-logo { display: flex; align-items: center; gap: 8px; flex-basis: 100%; font-size: 14px; color: var(--gris-texte); }
