/* Portail Les Maîtres du Quiz.
   Thème : clair par défaut, sombre si l'appareil le demande, ou forcé par data-theme (voir theme.js). */

:root {
  --fond: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --texte: #1c1d21;
  --texte-doux: #5f636d;
  --texte-pale: #8c909a;
  --trait: #e1e1dc;
  --trait-fort: #c9c9c2;
  --accent: #ffd23f;
  --accent-texte: #2a2100;
  --lien: #1a5fb4;
  --survol: rgba(0, 0, 0, 0.045);
  --choisi: rgba(0, 0, 0, 0.08);
  --ok-fond: #e7f5ec; --ok-texte: #1c6b3c; --ok-trait: #b5dcc3;
  --info-fond: #e6f0fb; --info-texte: #17538f; --info-trait: #b9d4f0;
  --alerte-fond: #fdf3d8; --alerte-texte: #7a5a00; --alerte-trait: #ecd590;
  --danger-fond: #fdeaea; --danger-texte: #a12626; --danger-trait: #f0bcbc;
  --ombre: 0 8px 30px rgba(0, 0, 0, 0.14);
  --menu-largeur: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #121418; --surface: #1b1e24; --surface-2: #23272e;
    --texte: #eef0f3; --texte-doux: #a9afba; --texte-pale: #7b818c;
    --trait: #2c3038; --trait-fort: #3d424c; --lien: #8cc4f5;
    --survol: rgba(255, 255, 255, 0.06); --choisi: rgba(255, 255, 255, 0.11);
    --ok-fond: #16281d; --ok-texte: #7fd6a2; --ok-trait: #2e6444;
    --info-fond: #14263a; --info-texte: #8cc4f5; --info-trait: #2a5078;
    --alerte-fond: #2b2410; --alerte-texte: #f2cf6b; --alerte-trait: #6b5617;
    --danger-fond: #2b1717; --danger-texte: #ff9a92; --danger-trait: #6e2c2c;
    --ombre: 0 8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --fond: #121418; --surface: #1b1e24; --surface-2: #23272e;
  --texte: #eef0f3; --texte-doux: #a9afba; --texte-pale: #7b818c;
  --trait: #2c3038; --trait-fort: #3d424c; --lien: #8cc4f5;
  --survol: rgba(255, 255, 255, 0.06); --choisi: rgba(255, 255, 255, 0.11);
  --ok-fond: #16281d; --ok-texte: #7fd6a2; --ok-trait: #2e6444;
  --info-fond: #14263a; --info-texte: #8cc4f5; --info-trait: #2a5078;
  --alerte-fond: #2b2410; --alerte-texte: #f2cf6b; --alerte-trait: #6b5617;
  --danger-fond: #2b1717; --danger-texte: #ff9a92; --danger-trait: #6e2c2c;
  --ombre: 0 8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--lien); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
h2 { font-size: 1.05rem; margin: 28px 0 12px; }
h3 { font-size: 0.95rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }

.icone { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.petit { font-size: 0.8rem; color: var(--texte-doux); }
.fort { font-weight: 600; }
.note { color: var(--texte-doux); font-size: 0.88rem; }
.fil { margin: 0 0 2px; font-size: 0.82rem; color: var(--texte-doux); }
.fil a { color: inherit; }

/* --- Menu de gauche --- */

.menu {
  position: fixed; inset: 0 auto 0 0; width: var(--menu-largeur);
  display: flex; flex-direction: column; gap: 1px;
  padding: 14px 10px; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--trait);
}
.marque { display: block; padding: 4px 8px 12px; font-weight: 700; color: var(--texte); text-decoration: none; letter-spacing: 0.01em; }
.menu-titre { margin: 14px 8px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texte-pale); }
.menu-vide { margin: 0 8px 4px; font-size: 0.85rem; color: var(--texte-pale); }
.menu-lien {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 7px; background: none;
  color: var(--texte-doux); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-lien span:not(.compte):not(.icone-texte) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-lien:hover { background: var(--survol); color: var(--texte); }
.menu-lien.actif { background: var(--choisi); color: var(--texte); font-weight: 600; }
.menu-action { color: var(--lien); }
.menu form { margin: 0; }
.menu-bas { margin-top: auto; padding-top: 10px; }
.compte { font-size: 0.78rem; color: var(--texte-pale); font-weight: 400; }
.icone-texte { width: 1.1em; font-size: 0.68rem; font-weight: 700; text-align: center; }

.projet-courant { margin: 0 0 8px; border: 1px solid var(--trait-fort); border-radius: 9px; background: var(--fond); }
.projet-courant summary { display: grid; grid-template-columns: 1fr auto; padding: 8px 10px; cursor: pointer; list-style: none; }
.projet-courant summary::-webkit-details-marker { display: none; }
.projet-courant summary .petit { grid-column: 1; }
.projet-courant summary .fort { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projet-courant summary .icone { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--texte-pale); }
.projet-liste { border-top: 1px solid var(--trait); padding: 4px; max-height: 50vh; overflow-y: auto; }
.projet-liste a { display: block; padding: 6px 8px; border-radius: 6px; color: var(--texte); text-decoration: none; }
.projet-liste a .petit { display: block; }
.projet-liste a:hover, .projet-liste a.actif { background: var(--survol); }

.menu-bouton { display: none; }

/* --- Page --- */

.avec-menu .page { margin-left: var(--menu-largeur); }
.page { max-width: 1080px; padding: 26px 32px 40px; }
.page.large { max-width: none; }
.sans-menu .page { margin: 0 auto; max-width: 560px; }
.entete-simple { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4vh; }
.entete-simple .marque { padding: 0; }

.entete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 0 0 20px; }
.entete form { margin: 0; }
.description { max-width: 70ch; color: var(--texte-doux); }
.pied { margin-top: 48px; font-size: 0.8rem; color: var(--texte-pale); }
.pied a { color: inherit; }

.rangee { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rangee.fin { justify-content: flex-end; margin-top: 6px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.colonnes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; margin-top: 12px; }

/* --- Boutons --- */

button { font: inherit; cursor: pointer; color: inherit; }
.bouton {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1px solid transparent; border-radius: 8px;
  background: var(--accent); color: var(--accent-texte); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.bouton:hover { filter: brightness(1.05); }
.bouton.secondaire { background: var(--surface); color: var(--texte); border-color: var(--trait-fort); font-weight: 500; }
.bouton.secondaire:hover { background: var(--surface-2); filter: none; }
.lien { background: none; border: 0; padding: 0; color: var(--lien); text-decoration: underline; }
.lien.danger, .danger { color: var(--danger-texte); }
.icone-bouton {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px;
  border: 0; border-radius: 6px; background: none; color: var(--texte-doux);
}
.icone-bouton:hover { background: var(--survol); color: var(--texte); }
.icone-bouton.accent { color: var(--lien); }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 2px solid var(--lien); outline-offset: 1px; }

/* --- Formulaires --- */

.formulaire { display: flex; flex-direction: column; gap: 13px; }
.formulaire label { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; color: var(--texte-doux); }
.formulaire.en-ligne { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.formulaire.en-ligne label { flex: 1 1 180px; }
.formulaire small { font-size: 0.8rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--trait-fort); border-radius: 7px;
  background: var(--surface); color: var(--texte); font: inherit;
}
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--texte-doux); }
.case { flex-direction: row !important; align-items: flex-start; gap: 9px !important; color: var(--texte) !important; }
.case input { margin-top: 3px; }
input.nombre { max-width: 10em; }
.avance summary { cursor: pointer; font-size: 0.86rem; color: var(--texte-doux); margin-bottom: 8px; }

/* --- Cartes, tuiles, avis --- */

.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 12px; padding: 20px; margin: 0 0 18px; }
.carte h2:first-child { margin-top: 0; }
.etroit { max-width: 460px; margin-left: auto; margin-right: auto; }
.texte-long { max-width: 760px; }
.texte-long li { margin-bottom: 6px; }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tuile {
  display: flex; flex-direction: column; gap: 6px; min-height: 96px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 12px;
  color: var(--texte); text-decoration: none; text-align: left;
}
.tuile:hover { border-color: var(--trait-fort); background: var(--surface-2); }
.tuile-titre { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tuile-chiffre { color: var(--texte-doux); font-size: 0.88rem; }
.tuile .rangee { margin-top: auto; }
.tuile-ajout { align-items: center; justify-content: center; flex-direction: row; border-style: dashed; background: none; color: var(--lien); font-weight: 500; }

.vide { padding: 36px 24px; border: 1px dashed var(--trait-fort); border-radius: 12px; text-align: center; }
.vide h2, .vide h3 { margin: 0 0 6px; font-size: 1.05rem; }
.vide p { color: var(--texte-doux); max-width: 52ch; margin: 0 auto 16px; }

.avis { padding: 10px 14px; border-radius: 9px; border: 1px solid var(--info-trait); background: var(--info-fond); color: var(--info-texte); overflow-wrap: anywhere; }
.avis-ok { border-color: var(--ok-trait); background: var(--ok-fond); color: var(--ok-texte); }
.avis-error { border-color: var(--danger-trait); background: var(--danger-fond); color: var(--danger-texte); }

.pastille {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px;
  border: 1px solid var(--trait-fort); border-radius: 999px;
  color: var(--texte-doux); font-size: 0.76rem; font-weight: 500; white-space: nowrap;
}
.etat-draft { border-color: var(--alerte-trait); background: var(--alerte-fond); color: var(--alerte-texte); }
.etat-approved { border-color: var(--info-trait); background: var(--info-fond); color: var(--info-texte); }
.etat-locked { border-color: var(--ok-trait); background: var(--ok-fond); color: var(--ok-texte); }

.client-bloc { margin-bottom: 8px; }
.client-bloc h2 a { color: var(--texte); text-decoration: none; }
.client-bloc h2 a:hover { text-decoration: underline; }

.activite, .a-venir { list-style: none; margin: 0; padding: 0; }
.activite li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--trait); }
.activite a { color: var(--texte); text-decoration: none; }
.activite a:hover { text-decoration: underline; }
.activite .petit { white-space: nowrap; }
.extrait { display: block; color: var(--texte-doux); }
.a-venir li { display: flex; gap: 10px; padding: 8px 0; color: var(--texte-doux); }
.a-venir span { display: flex; flex-direction: column; }
.a-venir strong { color: var(--texte); font-weight: 500; }

/* --- Tableau des fiches --- */

.outils { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 12px; }
.outils input[type=search] { width: 220px; }
.outils select { width: auto; }
.tableau-cadre { overflow-x: auto; background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; }
.tableau { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tableau th, .tableau td { padding: 0; border-bottom: 1px solid var(--trait); border-right: 1px solid var(--trait); text-align: left; vertical-align: top; }
.tableau th:last-child, .tableau td:last-child { border-right: 0; }
.tableau tbody:last-child tr:last-child td { border-bottom: 0; }
.tableau thead th { background: var(--surface-2); color: var(--texte-doux); font-size: 0.82rem; font-weight: 600; padding: 8px 10px; white-space: nowrap; }
.tableau.simple td, .tableau.simple th { padding: 9px 12px; border-right: 0; vertical-align: middle; }
.tableau.simple form { display: inline; margin-left: 10px; }
.entete-champ { display: inline-flex; align-items: center; gap: 6px; margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; font-weight: 600; }
.entete-champ:hover { background: var(--choisi); color: var(--texte); }
.entete-champ .icone { color: var(--texte-pale); }
.marque-champ { padding: 0 6px; border-radius: 999px; background: var(--alerte-fond); color: var(--alerte-texte); font-size: 0.7rem; font-weight: 500; }

.cel { padding: 8px 10px !important; min-width: 110px; max-width: 420px; overflow-wrap: anywhere; }
.cel.t-longtext { min-width: 240px; white-space: pre-line; }
.cel.t-number { min-width: 80px; }
.cel.t-bool { min-width: 60px; text-align: center !important; }
.cel.editable { cursor: text; }
.cel.editable:hover { background: var(--survol); }
.cel.editable:focus { outline: 2px solid var(--lien); outline-offset: -2px; }
.cel.edition { padding: 0 !important; outline: 2px solid var(--lien); outline-offset: -2px; }
.cel.edition input, .cel.edition select, .cel.edition textarea { border: 0; border-radius: 0; padding: 8px 10px; background: var(--surface); min-height: 100%; }
.cel.edition textarea { min-height: 7em; display: block; }
.cel.enregistre { animation: eclat 0.9s ease-out; }
@keyframes eclat { from { background: var(--ok-fond); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .cel.enregistre { animation: none; } }

.poignee { width: 28px; text-align: center !important; color: var(--texte-pale); padding: 8px 2px !important; }
.poignee [data-poignee] { cursor: grab; display: inline-block; }
/* L'état et le bouton d'ouverture restent visibles quand le tableau défile en largeur. */
.cel-etat { width: 132px; min-width: 132px; padding: 6px 8px !important; white-space: nowrap; position: sticky; right: 56px; background: var(--surface); border-left: 1px solid var(--trait); }
.col-actions { width: 56px; min-width: 56px; padding: 4px 6px !important; text-align: right !important; white-space: nowrap; position: sticky; right: 0; background: var(--surface); }
.tableau thead .cel-etat, .tableau thead .col-actions { background: var(--surface-2); }
.tableau.simple .col-actions { position: static; width: auto; background: none; }
select.etat { padding: 2px 6px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; width: auto; }

.groupe-titre th { background: var(--fond); padding: 0 !important; }
.groupe-titre button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; background: none; font-weight: 600; text-align: left; }
.groupe-titre button[aria-expanded="false"] .icone { transform: rotate(-90deg); }
.groupe.replie tr:not(.groupe-titre) { display: none; }
.ligne-ajout td { padding: 0 !important; }
.ligne-ajout button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px 8px 38px; border: 0; background: none; color: var(--texte-pale); text-align: left; }
.ligne-ajout button:hover { background: var(--survol); color: var(--lien); }
tr.glisse { opacity: 0.4; }
tr.cible td { box-shadow: inset 0 2px 0 var(--lien); }
tr.filtre { display: none; }
.aide { margin-top: 10px; }

/* --- Panneau de droite --- */

.panneau {
  position: fixed; inset: 0 0 0 auto; width: min(480px, 100vw); z-index: 20;
  padding: 22px 22px 40px; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--trait); box-shadow: var(--ombre);
}
.panneau h2 { margin: 0 34px 16px 0; font-size: 1.15rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panneau-fermer { position: absolute; top: 16px; right: 14px; border: 0; background: none; padding: 6px; border-radius: 6px; color: var(--texte-doux); }
.panneau-fermer:hover { background: var(--survol); }
.bloc { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--trait); }
.commentaire, .historique { margin-bottom: 12px; }
.commentaire p, .historique p { margin: 0; overflow-wrap: anywhere; }
.sous-champ { border: 1px solid var(--trait); border-radius: 8px; margin-bottom: 8px; }
.sous-champ summary { padding: 8px 10px; cursor: pointer; font-weight: 500; }
.sous-champ .formulaire { padding: 4px 10px 12px; }
fieldset.liste { border: 1px solid var(--trait); border-radius: 9px; padding: 10px 12px; margin: 0; min-width: 0; }
fieldset.liste legend { padding: 0 6px; font-size: 0.86rem; color: var(--texte-doux); }
fieldset.liste table { width: 100%; border-collapse: collapse; }
fieldset.liste th { font-size: 0.78rem; font-weight: 600; color: var(--texte-doux); text-align: left; padding: 0 6px 4px 0; }
fieldset.liste td { padding: 3px 6px 3px 0; }

/* --- Fenêtres et bulles --- */

.dialogue { width: min(460px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--trait); border-radius: 14px; background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.dialogue::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialogue h2 { margin: 0; font-size: 1.15rem; }
.bulles { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.bulle { padding: 9px 16px; border-radius: 9px; background: var(--texte); color: var(--fond); box-shadow: var(--ombre); max-width: min(560px, 92vw); }
.bulle.erreur { background: var(--danger-texte); color: #fff; }

/* --- Petits écrans --- */

@media (max-width: 860px) {
  .menu { transform: translateX(-100%); transition: transform 0.18s ease; z-index: 25; box-shadow: var(--ombre); }
  .menu.ouvert { transform: none; }
  .menu-bouton { display: inline-flex; position: fixed; top: 10px; left: 10px; z-index: 26; padding: 8px; border: 1px solid var(--trait-fort); border-radius: 8px; background: var(--surface); }
  .avec-menu .page { margin-left: 0; padding: 62px 16px 32px; }
  .colonnes, .deux { grid-template-columns: 1fr; }
  .activite li { flex-direction: column; gap: 2px; }
}

/* --- Régie d'un évènement en direct --- */

.regie { display: grid; grid-template-columns: 260px minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.regie .carte h2 { margin: 0 0 12px; }
.rejoindre { text-align: center; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.code-direct { margin: 12px 0 2px; font-size: 2rem; font-weight: 700; letter-spacing: 0.18em; }
.adresse { overflow-wrap: anywhere; }
.jeton { display: flex; gap: 8px; margin: 0 0 12px; }
.jeton input { font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; }
.etapes { margin: 0; padding-left: 20px; color: var(--texte-doux); }
.etapes li { margin-bottom: 6px; }
.code-court { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.08em; }
.cle-neuve { border-color: var(--accent); }
.cle-neuve h2 { margin: 0 0 8px; }
.cle-neuve .jeton { margin-top: 12px; }
.apercu iframe { display: block; width: 100%; aspect-ratio: 9 / 17; border: 6px solid var(--texte); border-radius: 22px; background: #121418; }

@media (max-width: 1180px) { .regie { grid-template-columns: 240px minmax(0, 1fr); } .apercu { display: none; } }
@media (max-width: 860px) { .regie { grid-template-columns: 1fr; } }

/* Choix de l'état d'un évènement : trois boutons collés, celui en cours est foncé. */
.etats { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--trait-fort); border-radius: 9px; overflow: hidden; margin: 0 0 10px; }
.etats button { border: 0; background: var(--surface); padding: 8px 16px; font: inherit; color: var(--texte-doux); cursor: pointer; }
.etats button + button { border-left: 1px solid var(--trait-fort); }
.etats button:hover { background: var(--survol); color: var(--texte); }
.etats button[aria-pressed=true] { background: var(--accent); color: var(--accent-texte); font-weight: 600; cursor: default; }
.rangee.centre { justify-content: center; }

/* Droits : cases en colonnes, groupes d'une fenêtre large. */
.dialogue.large { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.groupe-droits { border: 1px solid var(--trait); border-radius: 9px; padding: 8px 12px 10px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.groupe-droits legend { padding: 0 6px; font-size: 0.86rem; color: var(--texte-doux); }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; }
.droits { margin-top: 24px; }
.droits h2 { display: flex; align-items: center; gap: 8px; }
.outils-direct { margin-top: 12px; }

/* Fichiers d'un projet : zone de dépôt, grille de vignettes. */
.depot { border: 1px dashed var(--trait-fort); border-radius: 12px; padding: 14px 18px; margin: 0 0 18px; color: var(--texte-doux); }
.depot.survol { border-color: var(--accent); background: var(--surface-2); }
.depot p { margin: 0; }
.envois { margin: 8px 0 0; padding-left: 18px; font-size: 0.86rem; }
.envois .fini { color: var(--ok-texte); }
.envois .echec { color: var(--danger-texte); }
.grille-fichiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.carte-fichier { border: 1px solid var(--trait); border-radius: 10px; padding: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.carte-fichier .vignette { height: 110px; display: flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--texte-doux);
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; overflow: hidden; text-decoration: none; }
.carte-fichier.dossier .vignette { background: var(--surface-2); }
.carte-fichier .vignette svg { width: 42px; height: 42px; }
.carte-fichier .vignette img { max-width: 100%; max-height: 100%; object-fit: contain; }
.carte-fichier .type { font-weight: 700; letter-spacing: 0.08em; font-size: 0.9rem; }
.carte-fichier .nom { margin: 0; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-fichier .petit { margin: 0; }
.carte-fichier .actions { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.82rem; }
.carte-fichier .actions form { display: inline; }

/* Couleur dans une fiche : une pastille à côté du code. */
.pastille-couleur { display: inline-block; width: 1em; height: 1em; border-radius: 4px; border: 1px solid var(--trait-fort); vertical-align: -0.15em; }
.champ-couleur { display: flex; align-items: center; gap: 8px; }

/* --- Pages d'accueil (connexion, mot de passe, invitation) ---
   À l'image de l'écran de démarrage de l'app (EcranDemarrage.cpp) : carte bleu nuit au liseré doré,
   logo aux bords fondus sur un halo bleu-violet qui respire, lueur dorée au pied, reflet qui
   traverse le médaillon. Toujours sombre, quel que soit le thème choisi. */

.ecran-page {
  --fond: #01020a; --surface: #0b1433; --surface-2: #101b40;
  --texte: #e9ebf7; --texte-doux: #c9cde6; --texte-pale: #8a90b4;
  --trait: rgba(255, 255, 255, 0.1); --trait-fort: rgba(201, 205, 230, 0.26);
  --accent: #e8bf5a; --accent-texte: #2a1c00; --lien: #e8bf5a; --or-sombre: #9a6c18; --or-pale: #f7dc8c;
  --ok-fond: #16281d; --ok-texte: #7fd6a2; --ok-trait: #2e6444;
  --info-fond: #14263a; --info-texte: #8cc4f5; --info-trait: #2a5078;
  --alerte-fond: #2b2410; --alerte-texte: #f2cf6b; --alerte-trait: #6b5617;
  --danger-fond: #2b1717; --danger-texte: #ff9a92; --danger-trait: #6e2c2c;
  color-scheme: dark;
  background: radial-gradient(ellipse 90% 60% at 50% 18%, #0a1236 0%, #040820 45%, #01020a 100%) fixed, #01020a;
  color: var(--texte);
}
.ecran-page .page { max-width: 480px; padding: 22px 16px 28px; }
.ecran-page .entete-simple { margin-bottom: 18px; color: var(--texte-pale); }
.ecran-page .entete-simple a { color: var(--texte-pale); text-decoration: none; }
.ecran-page .entete-simple a:hover { color: var(--accent); }
.ecran-page .pied { margin-top: 26px; text-align: center; }
.ecran-page .avis { margin: 0 0 14px; }

.ecran {
  position: relative; overflow: hidden;
  padding: 26px 30px 22px; border-radius: 20px;
  border: 1.6px solid transparent;
  background:
    linear-gradient(180deg, #070e2a 0%, #040a1e 55%, #02040c 100%) padding-box,
    linear-gradient(135deg, var(--or-pale) 0%, var(--or-sombre) 50%, var(--accent) 100%) border-box;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 60px rgba(60, 70, 220, 0.12);
}

/* Le logo : bords fondus par un masque radial, halo et lueur derrière, reflet par-dessus. */
.ecran-logo { position: relative; width: 170px; aspect-ratio: 1; margin: 0 auto 6px; }
.ecran-logo.grand { width: min(320px, 100%); margin-top: 2px; }
.ecran-logo picture, .ecran-logo img { position: relative; display: block; width: 100%; height: 100%; }
.ecran-logo img {
  -webkit-mask-image: radial-gradient(circle closest-side at 50% 52%, #000 80%, transparent 100%);
  mask-image: radial-gradient(circle closest-side at 50% 52%, #000 80%, transparent 100%);
}
/* Le mouvement, lent et posé : le halo respire sur une douzaine de secondes ; toutes les 9 s, un
   reflet doré glisse en 2,6 s sur le médaillon, et la lueur au pied s'allume doucement à son passage. */
.ecran-logo .halo {
  position: absolute; left: -12%; top: -12%; width: 124%; height: 124%; border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(70, 80, 230, 0.43) 0%, rgba(40, 40, 160, 0.2) 55%, transparent 100%);
  animation: ecran-souffle 6s ease-in-out infinite alternate;
}
.ecran-logo .lueur {
  position: absolute; left: 8%; top: 58%; width: 84%; height: 52%; border-radius: 50%;
  background: radial-gradient(ellipse closest-side, rgba(255, 196, 96, 0.2) 0%, transparent 100%);
  opacity: 0.65;
  animation: ecran-lueur 9s ease-in-out 1.2s infinite;
}
/* Le reflet : une bande de lumière à 45° qui traverse le médaillon (centre à 56,5 %, rayon 39,5 %). */
.ecran-logo .reflet {
  position: absolute; left: 10.5%; top: 17%; width: 79%; height: 79%; border-radius: 50%; overflow: hidden;
  mix-blend-mode: screen; pointer-events: none;
}
.ecran-logo .reflet::after {
  content: ''; position: absolute; inset: -50%;
  background: linear-gradient(135deg, transparent 34%, rgba(255, 226, 160, 0.06) 42%, rgba(255, 232, 178, 0.17) 48%,
    rgba(255, 242, 210, 0.22) 50%, rgba(255, 232, 178, 0.17) 52%, rgba(255, 226, 160, 0.06) 58%, transparent 66%);
  transform: translate(-80%, -80%);
  animation: ecran-reflet 9s cubic-bezier(0.45, 0, 0.3, 1) 1.2s infinite backwards;
}
@keyframes ecran-souffle {
  from { opacity: 0.68; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1.03); }
}
@keyframes ecran-reflet {
  0% { transform: translate(-80%, -80%); }
  29% { transform: translate(80%, 80%); }
  100% { transform: translate(80%, 80%); }
}
@keyframes ecran-lueur {
  0%, 12% { opacity: 0.65; }
  30% { opacity: 1; }
  55%, 100% { opacity: 0.65; }
}
@media (prefers-reduced-motion: reduce) {
  .ecran-logo .halo, .ecran-logo .lueur, .ecran-logo .reflet::after { animation: none; }
  .ecran-logo .reflet { display: none; }
}

/* La ligne dorée « PORTAIL » entre deux filets qui s'estompent. */
.ecran-ligne { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.ecran-ligne::before, .ecran-ligne::after { content: ''; flex: 1; height: 1px; }
.ecran-ligne::before { background: linear-gradient(90deg, transparent, var(--or-sombre)); }
.ecran-ligne::after { background: linear-gradient(90deg, var(--or-sombre), transparent); }
.ecran-ligne span {
  color: var(--accent); font: 600 12px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 2px; text-transform: uppercase;
}

.ecran-titre { justify-content: center; font-size: 1.25rem; font-weight: 600; margin: 0 0 16px; color: var(--texte); }
.ecran > p { color: var(--texte-doux); }
.ecran .formulaire label { color: var(--texte-doux); }
.ecran input[type=text], .ecran input[type=email], .ecran input[type=password] {
  padding: 9px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); border-color: rgba(201, 205, 230, 0.22);
}
.ecran input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 191, 90, 0.18); }
.ecran .formulaire .bouton {
  justify-content: center; padding: 10px 16px; margin-top: 4px; border-radius: 9px; font-weight: 700; letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--or-sombre) 0%, var(--accent) 55%, var(--or-pale) 100%);
  box-shadow: 0 6px 20px rgba(232, 191, 90, 0.18);
}
.ecran .formulaire .bouton:hover { filter: brightness(1.08); }
.ecran-lien { text-align: center; margin: 14px 0 10px; }
.ecran .note { font-size: 0.78rem; color: var(--texte-pale); text-align: center; }

@media (max-width: 420px) {
  .ecran { padding: 20px 18px 18px; }
}

/* ---------- Statistiques du site (views/site_stats.php): one hue for magnitude, text in text colors ---------- */
.stat-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-periods .bouton { height: 34px; padding: 0 12px; font-size: 0.86rem; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 18px; }
.stat-tile { background: var(--surface); border: 1px solid var(--trait); border-radius: 12px; padding: 16px 18px; }
.stat-tile p { margin: 0 0 4px; color: var(--texte-doux); font-size: 0.86rem; }
.stat-tile strong { display: inline-block; margin-right: 8px; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-tile .note { display: block; margin-top: 4px; }
.stat-delta { font-size: 0.86rem; color: var(--texte-doux); }
.stat-delta.up { color: var(--ok-texte); }
.stat-delta.down { color: var(--danger-texte); }
.stat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.stat-bars li { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 0.9rem; }
.stat-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { display: block; width: 100%; height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.stat-bar { fill: var(--lien); }
.stat-bar-value { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.stat-bar-value small { color: var(--texte-pale); }
.stat-days { display: flex; align-items: stretch; gap: 2px; height: 170px; padding-top: 18px; }
.stat-days.hours { height: 120px; }
.stat-day { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 4px; }
.stat-day:hover .stat-day-col { filter: brightness(1.25); }
.stat-day-col { display: block; width: 100%; max-width: 26px; height: 130px; border-radius: 4px 4px 0 0; }
.stat-days.hours .stat-day-col { height: 80px; }
.stat-day-label { height: 16px; margin-top: 4px; font-size: 0.7rem; color: var(--texte-pale); }
.stat-day-lead { position: absolute; top: -16px; font-size: 0.7rem; color: var(--texte); white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 18px; }
.stat-grid.two { gap: 18px; }
.stat-grid h3, .card h3 { margin: 16px 0 8px; font-size: 0.92rem; color: var(--texte-doux); }
.stat-table td, .stat-table th { white-space: nowrap; }
.stat-table td:nth-child(4), .stat-table td:nth-child(6) { white-space: normal; }
.stat-family td { font-weight: 600; }
.stat-separator td { padding-top: 14px; color: var(--texte-pale); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-lead td { background: var(--ok-fond); }
@media (max-width: 600px) { .stat-grid { grid-template-columns: 1fr; } .stat-bars li { grid-template-columns: 1fr auto; } .stat-bar-track { grid-column: 1 / -1; grid-row: 2; } }
