/*
  Espace client (dashboard.phorys.com) et console (admin.phorys.com) : feuille commune.
  Jetons de couleur, police et boutons repris de phorys.com (workers/attente/public/_phorys/accueil.css).
  Thème sombre par défaut (<html data-theme="dark">), bascule jour/nuit par /_phorys/theme.js. Mobile d'abord.
*/

/* Figtree (licence SIL OFL), auto-hébergée : romain et italique, graisses 300 à 900, jeu latin (tout le français). */
@font-face {
  font-family: "Figtree";
  src: url("/_phorys/polices/figtree.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("/_phorys/polices/figtree-italique.woff2") format("woff2");
  font-weight: 300 900; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Thème clair : un blanc pastel chaud. */
  color-scheme: light;
  --fond: #fbf8f4;
  --fond-2: #f5efe8;
  --surface: #ffffff;
  --surface-2: #f3ede6;
  --trait: #e8dfd5;
  --trait-2: #d6cbbf;
  --texte: #1b1c23;
  --texte-2: #4d4852;
  --texte-3: #736b76;
  --accent: #b4532a;
  --accent-2: #c2416a;
  --vert-texte: #1d7f4e;
  --rouge-texte: #b3261e;
  --ombre: rgba(90, 60, 40, 0.22);
  --peche: #ffdab4;
  --encre: #1b1c23;
  --degrade: linear-gradient(135deg, #f9e1a8 0%, #ffdab4 50%, #f2aebb 100%);
  --action: linear-gradient(135deg, #4f6ef7 0%, #6a4ff0 100%);
  --rayon: 18px;
  --gouttiere: clamp(16px, 4.5vw, 48px);
  --large: 1080px;
  --etroit: 460px;
  --sortie: cubic-bezier(0.16, 1, 0.3, 1);
  --police: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* Thème sombre (par défaut) : l'encre chaude de phorys.com. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #16151a;
  --fond-2: #1d1b21;
  --surface: #25222a;
  --surface-2: #2e2a33;
  --trait: #34303a;
  --trait-2: #4a4450;
  --texte: #f5efe8;
  --texte-2: #cfc6bc;
  --texte-3: #a69c92;
  --accent: #ffdab4;
  --accent-2: #f2aebb;
  --vert-texte: #a6ecc4;
  --rouge-texte: #ffb4a9;
  --ombre: rgba(0, 0, 0, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--fond); color: var(--texte);
  font-family: var(--police); font-optical-sizing: auto; font-size: 1.0625rem; line-height: 1.6;
}
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
strong { font-weight: 680; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.evitement {
  position: absolute; left: 12px; top: -60px; z-index: 30;
  padding: 10px 16px; border-radius: 999px; background: var(--peche); color: var(--encre); font-weight: 650; text-decoration: none;
}
.evitement:focus { top: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nw { white-space: nowrap; }

/* ---------- En-tête et pied ---------- */
.entete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  width: 100%; max-width: var(--large); margin: 0 auto; padding: 14px var(--gouttiere);
}
.marque { display: inline-flex; align-items: center; gap: 9px; color: var(--texte); text-decoration: none; font-weight: 740; font-size: 1.3rem; letter-spacing: -0.03em; }
.marque img { width: 28px; height: 28px; }
.marque-espace { margin-left: 4px; padding: 2px 10px; border: 1px solid var(--trait); border-radius: 999px; color: var(--texte-3); font-size: 0.8rem; font-weight: 600; letter-spacing: 0; }
.entete-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; }
.entete-lien {
  font-size: 0.95rem; font-weight: 620; color: var(--texte-2); text-decoration: none;
  padding: 10px 2px; border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s;
}
.entete-lien:hover, .entete-lien[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.pied { width: 100%; max-width: var(--large); margin: 0 auto; padding: 28px var(--gouttiere) 36px; color: var(--texte-3); font-size: 0.9rem; }
.pied a { color: inherit; }

/* ---------- Bouton jour / nuit ---------- */
.theme-bascule {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none; padding: 0;
  border: 1px solid var(--trait); border-radius: 50%; background: var(--surface); color: var(--texte);
  cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.3s var(--sortie);
}
.theme-bascule:hover { border-color: var(--trait-2); transform: rotate(-12deg); }
.theme-bascule svg { width: 20px; height: 20px; grid-area: 1 / 1; transition: opacity 0.3s, transform 0.4s var(--sortie); }
.theme-bascule .icone-lune { opacity: 0; transform: rotate(-60deg) scale(0.6); }
:root[data-theme="dark"] .theme-bascule .icone-soleil { opacity: 0; transform: rotate(60deg) scale(0.6); }
:root[data-theme="dark"] .theme-bascule .icone-lune { opacity: 1; transform: none; }

/* ---------- Mise en page ---------- */
.contenu { flex: 1; width: 100%; max-width: var(--large); margin: 0 auto; padding: 16px var(--gouttiere) 48px; }
.contenu > * + * { margin-top: 24px; }
.etroit { max-width: var(--etroit); margin-left: auto; margin-right: auto; }
.intro { color: var(--texte-2); }
.carte {
  padding: clamp(20px, 4vw, 32px); border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--surface); box-shadow: 0 24px 48px -32px var(--ombre);
}
.carte > * + * { margin-top: 16px; }
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.chiffre { font-size: 2rem; font-weight: 760; letter-spacing: -0.03em; }
.discret { color: var(--texte-3); font-size: 0.92rem; }

/* ---------- Boutons (couleur d'action de phorys.com) ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 28px; border: 0; border-radius: 999px;
  background: var(--action); color: #fff;
  font-weight: 700; font-size: 1.0625rem; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 14px 34px -14px rgba(92, 92, 245, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.25s var(--sortie), box-shadow 0.25s var(--sortie), filter 0.25s;
}
.bouton:hover { transform: translateY(-2px); filter: brightness(1.08); }
.bouton:active { transform: translateY(0); }
.bouton-bloc { display: flex; width: 100%; }
.bouton-discret {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--trait); border-radius: 999px; background: transparent; color: var(--texte-2);
  font-size: 0.95rem; font-weight: 550; text-decoration: none; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.bouton-discret:hover { border-color: var(--trait-2); color: var(--texte); background: var(--fond-2); }
.bouton-danger { color: var(--rouge-texte); }

/* ---------- Formulaires ---------- */
form > * + * { margin-top: 18px; }
.champ { display: grid; gap: 6px; }
.champ label, .champ .libelle { font-weight: 620; font-size: 0.97rem; }
.champ .aide { color: var(--texte-3); font-size: 0.88rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 16px; border: 1px solid var(--trait-2); border-radius: 12px;
  background: var(--fond); color: var(--texte); font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.case { display: flex; align-items: center; gap: 10px; font-size: 0.97rem; cursor: pointer; }
.case input { width: 20px; height: 20px; accent-color: #5a5ff3; }
.code-saisie { letter-spacing: 0.3em; font-size: 1.3rem; font-variant-numeric: tabular-nums; text-align: center; }
.cf-turnstile { min-height: 65px; }

/* ---------- Messages ---------- */
.message { padding: 14px 18px; border: 1px solid var(--trait); border-left-width: 4px; border-radius: 12px; background: var(--surface-2); }
.message-erreur { border-left-color: var(--rouge-texte); }
.message-ok { border-left-color: var(--vert-texte); }
.message-info { border-left-color: var(--accent); }

/* ---------- Tableaux (listes de sessions, clients, blocages) ---------- */
.tableau-defile { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
th { color: var(--texte-3); font-weight: 620; font-size: 0.85rem; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td form { margin: 0; }
.etiquette { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--trait-2); font-size: 0.82rem; font-weight: 620; }
.etiquette-ok { color: var(--vert-texte); }
.etiquette-alerte { color: var(--rouge-texte); }
.pagination { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- QR code (dessiné par /_phorys/qr.js) ---------- */
.qr { width: 220px; max-width: 100%; aspect-ratio: 1; padding: 0; border-radius: 12px; overflow: hidden; background: #fff; }
.qr svg { width: 100%; height: 100%; }
.secret-texte { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1rem; letter-spacing: 0.06em; word-break: break-all; }

@media (min-width: 720px) {
  .contenu { padding-top: 32px; }
}
