:root {
  color-scheme: dark;
  --fond: #0B0F18; --surface: #111827; --surface-2: #182233; --ligne: #2A3650;
  --texte: #E8EDF4; --doux: #A2ADBE; --bleu: #4B9CC4; --bleu-fort: #6DB6DA; --rouge: #E0503F; --vert: #3DDC84; --jaune: #FFD60A;
  --rayon: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--fond); color: var(--texte); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--bleu-fort); }
code { font: 13px ui-monospace, Menlo, Consolas, monospace; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 18px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 30px 0 8px; font-weight: 620; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--bleu-fort); outline-offset: 2px; }

/* Formulaires */
label { display: block; margin: 14px 0 5px; font-size: 13px; font-weight: 550; color: #CDD5E0; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; color: var(--texte); background: var(--fond); border: 1px solid var(--ligne); border-radius: 8px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bleu-fort); box-shadow: 0 0 0 3px rgba(75, 156, 196, .22); }
input[disabled] { color: var(--doux); opacity: .75; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--bleu); flex: none; }
.masque { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; pointer-events: none; }
.bouton { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 16px; color: var(--texte); background: var(--surface-2); border: 1px solid var(--ligne); border-radius: 8px; font: inherit; font-weight: 580; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.bouton:hover { background: #22304A; }
.bouton-plein { color: #071018; background: var(--bleu-fort); border-color: var(--bleu-fort); }
.bouton-plein:hover { background: #8ACBE8; }
.bouton-danger { color: #FFD7D1; background: #4A1B17; border-color: #7E2C24; }
.bouton-danger:hover { background: #63231D; }
.lien { padding: 0; color: var(--bleu-fort); background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.alerte { margin: 0 0 14px; padding: 10px 13px; border: 1px solid; border-radius: 8px; font-size: 14px; }
.alerte-erreur { color: #FFD7D1; background: rgba(224, 80, 63, .13); border-color: rgba(224, 80, 63, .5); }
.alerte-ok { color: #C8F7DC; background: rgba(61, 220, 132, .1); border-color: rgba(61, 220, 132, .4); overflow-wrap: anywhere; }
.alerte-info { color: #CFE8F5; background: rgba(75, 156, 196, .12); border-color: rgba(75, 156, 196, .45); }
.aide { margin: 5px 0 0; color: var(--doux); font-size: 13px; }
.etat-valide { color: var(--vert); }
.etat-invalide { color: #FF9C8F; }

/* Connexion */
.page-acces { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px 16px; overflow: hidden; background: radial-gradient(1000px 700px at 75% 15%, rgba(75, 156, 196, .17), transparent 65%), radial-gradient(800px 600px at 15% 90%, rgba(224, 80, 63, .11), transparent 65%), var(--fond); }
.orbites { position: fixed; inset: 0; pointer-events: none; }
.orbites i { position: absolute; top: 50%; left: 50%; border: 1px solid rgba(160, 200, 225, .09); border-radius: 50%; transform: translate(-50%, -50%); }
.orbites i::after { content: ""; position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; background: var(--bleu-fort); border-radius: 50%; box-shadow: 0 0 10px var(--bleu-fort); }
.orbites i:nth-child(1) { width: 620px; height: 620px; animation: orbite 34s linear infinite; }
.orbites i:nth-child(2) { width: 920px; height: 920px; animation: orbite 58s linear infinite reverse; }
.orbites i:nth-child(3) { width: 1280px; height: 1280px; animation: orbite 90s linear infinite; }
.orbites i:nth-child(2)::after { background: var(--rouge); box-shadow: 0 0 10px var(--rouge); }
@keyframes orbite { to { transform: translate(-50%, -50%) rotate(360deg); } }
.carte-acces { position: relative; width: 100%; max-width: 410px; padding: 34px 32px 28px; background: rgba(17, 24, 39, .84); border: 1px solid rgba(120, 150, 185, .24); border-radius: 18px; box-shadow: 0 24px 70px rgba(0, 0, 0, .5); backdrop-filter: blur(14px); }
.carte-acces .logo { display: block; width: 88px; height: 88px; margin: 0 auto 16px; object-fit: contain; }
.carte-acces h1 { margin-bottom: 4px; font-size: 24px; text-align: center; }
.sous-titre { margin: 0 0 20px; color: var(--doux); font-size: 13px; text-align: center; }
.carte-acces .bouton-plein { width: 100%; margin-top: 20px; }
.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 84px; }
.voir-mdp { position: absolute; top: 5px; right: 5px; height: 32px; padding: 0 9px; color: var(--doux); background: none; border: 0; border-radius: 6px; font: 12px system-ui, sans-serif; cursor: pointer; }
.voir-mdp:hover { color: var(--texte); background: var(--surface-2); }
.lien-oubli { margin: 8px 0 0; font-size: 13px; text-align: right; }
.carte-acces .bouton-connexion { margin-top: 14px; }
.mention { margin: 18px 0 0; color: var(--doux); font-size: 12px; text-align: center; }
.lien-bas { margin: 16px 0 0; text-align: center; font-size: 13px; }

/* Administration */
.page-admin { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.lateral { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--ligne); }
.marque { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 2px 6px; color: var(--texte); font-size: 17px; font-weight: 680; text-decoration: none; }
.marque img { object-fit: contain; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a { padding: 9px 11px; color: #CDD5E0; border-radius: 8px; text-decoration: none; }
.lateral nav a:hover { background: var(--surface-2); }
.lateral nav a.actif { color: #fff; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--bleu-fort); font-weight: 600; }
.pied-lateral { display: flex; flex-direction: column; gap: 7px; margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--ligne); font-size: 13px; }
.pied-lateral .lien, .pied-lateral a { color: #CDD5E0; text-decoration: none; }
.pied-lateral .lien:hover, .pied-lateral a:hover { color: #fff; text-decoration: underline; }
.pied-lateral small { color: var(--doux); }
.contenu { width: 100%; max-width: 1180px; padding: 32px clamp(16px, 4vw, 44px) 60px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tuile { display: flex; flex-direction: column; gap: 4px; padding: 20px; color: var(--texte); background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); text-decoration: none; }
.tuile:hover { border-color: var(--bleu); }
.tuile strong { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tuile span { color: var(--doux); font-size: 13px; }
.tableau { overflow-x: auto; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 10px 12px; color: var(--doux); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--ligne); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(42, 54, 80, .55); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { color: var(--doux); }
.details { max-width: 340px; color: var(--doux); font-size: 12px; overflow-wrap: anywhere; }
.etat { display: inline-block; padding: 1px 8px; border: 1px solid; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.etat-actif { color: var(--vert); border-color: rgba(61, 220, 132, .45); }
.etat-inactif { color: var(--doux); border-color: var(--ligne); }
.etat-sensible { color: var(--jaune); border-color: rgba(255, 214, 10, .4); }
.formulaire.large { max-width: 900px; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); column-gap: 18px; }
.case { display: flex; align-items: flex-end; min-height: 42px; }
.case label { display: flex; align-items: center; gap: 9px; margin: 14px 0 10px; font-weight: 500; }
.liste-droits { display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.ligne-droit { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px; border-radius: 6px; font-weight: 450; cursor: pointer; }
.ligne-droit:hover { background: var(--surface-2); }
.ligne-droit small { margin-left: auto; color: var(--doux); font-weight: 400; }
.mention-droit { display: block; margin-top: 4px; color: var(--jaune); font-size: 12px; }
.editeur { min-height: 420px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre; overflow: auto; tab-size: 2; }
.filtre-tableau { max-width: 420px; margin-bottom: 14px; }
.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 20px; }
.fiche div { padding: 10px 13px; background: var(--surface); border: 1px solid var(--ligne); border-radius: 8px; }
.fiche dt { color: var(--doux); font-size: 12px; }
.fiche dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.page-erreur { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; text-align: center; }

@media (max-width: 780px) {
  .page-admin { display: block; }
  .lateral { position: static; height: auto; }
  .lateral nav { flex-direction: row; flex-wrap: wrap; }
  .pied-lateral { flex-direction: row; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 12px; }
  .carte-acces { padding: 26px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) { .orbites i { animation: none; } .bouton { transition: none; } }
