/* =========================================================================
   Coquille applicative : rail de navigation, barre de contexte, surfaces.
   ========================================================================= */

.coquille {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.coquille[data-replie='oui'] { --rail: 66px; }

/* ------------------------------------------------------------------ Rail */

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--trait);
  overflow: hidden;
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  min-height: var(--barre);
}

.sceau {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--indigo) 0%, var(--prune) 130%);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.04em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 18%);
}

.marque-texte { overflow: hidden; white-space: nowrap; }
.marque-nom {
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.marque-sous { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--encre-3); }

.coquille[data-replie='oui'] .marque-texte,
.coquille[data-replie='oui'] .rail-groupe-titre,
.coquille[data-replie='oui'] .rail-lien span,
.coquille[data-replie='oui'] .rail-pied-detail { display: none; }
.coquille[data-replie='oui'] .rail-lien { justify-content: center; padding-inline: 0; }

.rail-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }

.rail-groupe-titre {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--encre-3);
  padding: 14px 8px 6px;
}

.rail-lien {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--encre-2);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.rail-lien:hover { background: var(--surface-3); color: var(--encre); text-decoration: none; }
.rail-lien svg { flex: none; width: 17px; height: 17px; stroke-width: 1.7; }

.rail-lien[aria-current='page'] { background: var(--indigo-voile); color: var(--indigo); font-weight: 600; }
.rail-lien[aria-current='page']::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--indigo);
}

.pastille-nav {
  margin-left: auto;
  font-family: var(--chiffres);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--brique-voile);
  color: var(--brique);
}

.rail-pied { border-top: 1px solid var(--trait); padding: 10px; }

.carte-compte {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.carte-compte:hover { background: var(--surface-3); }

.jeton-avatar {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--indigo-voile);
  color: var(--indigo);
  font-weight: 700;
  font-size: 12px;
  font-family: var(--display);
}

/* ------------------------------------------------------------------ Barre de contexte */

.principal { display: flex; flex-direction: column; min-width: 0; }

.barre {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--barre);
  padding: 0 20px;
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--trait);
}

.barre-titre { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.barre-sous { font-size: 12px; color: var(--encre-3); }

.temoin-direct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--jade);
  padding: 4px 9px 4px 7px;
  border-radius: 99px;
  background: var(--jade-voile);
}
.temoin-direct[data-etat='hors'] { color: var(--brique); background: var(--brique-voile); }
.temoin-direct i {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  animation: pulsation 2.4s ease-in-out infinite;
}
@keyframes pulsation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.contenu { padding: 22px 20px 60px; max-width: 1560px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------------ Boutons */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--encre);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, transform 0.08s, box-shadow 0.14s;
}
.bouton:hover { background: var(--surface-3); border-color: var(--encre-3); }
.bouton:active { transform: translateY(1px); }
.bouton:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.bouton svg { width: 16px; height: 16px; stroke-width: 1.8; }

.bouton.primaire {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
  box-shadow: var(--ombre-1);
}
.bouton.primaire:hover { background: color-mix(in srgb, var(--indigo) 85%, #000); border-color: transparent; }
:root[data-theme='sombre'] .bouton.primaire { color: #0b1020; }

.bouton.encaisser { background: var(--safran); border-color: var(--safran); color: #fff; }
.bouton.encaisser:hover { background: color-mix(in srgb, var(--safran) 86%, #000); }
:root[data-theme='sombre'] .bouton.encaisser { color: #22160a; }

.bouton.danger { color: var(--brique); border-color: color-mix(in srgb, var(--brique) 40%, transparent); }
.bouton.danger:hover { background: var(--brique-voile); }

.bouton.fantome { background: transparent; border-color: transparent; color: var(--encre-2); }
.bouton.fantome:hover { background: var(--surface-3); color: var(--encre); border-color: transparent; }

.bouton.petit { padding: 4px 9px; font-size: 12px; border-radius: var(--r-xs); }
.bouton.icone { padding: 7px; }
.bouton.large { width: 100%; padding: 11px 16px; font-size: 15px; }

/* ------------------------------------------------------------------ Cartes */

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-1);
}
.carte-entete {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--trait);
}
.carte-titre { font-family: var(--display); font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.carte-corps { padding: 16px 18px; }
.carte-corps.serre { padding: 0; }

.grille { display: grid; gap: 16px; }

/* ------------------------------------------------------------------ Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  background: var(--surface-3);
  color: var(--encre-2);
  white-space: nowrap;
}
.badge.jade { background: var(--jade-voile); color: var(--jade); }
.badge.safran { background: var(--safran-voile); color: var(--safran); }
.badge.brique { background: var(--brique-voile); color: var(--brique); }
.badge.indigo { background: var(--indigo-voile); color: var(--indigo); }

.puce-etab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--encre-2);
}
.puce-etab i { width: 8px; height: 8px; border-radius: 2.5px; flex: none; }

/* ------------------------------------------------------------------ Champs */

.champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.champ > label { font-size: 12px; font-weight: 600; color: var(--encre-2); }
.champ .aide { font-size: 11.5px; color: var(--encre-3); }

.saisie, select.saisie, textarea.saisie {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--encre);
  font-size: 14px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.saisie:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 18%, transparent);
}
.saisie::placeholder { color: var(--encre-3); }
textarea.saisie { resize: vertical; min-height: 72px; line-height: 1.45; }
select.saisie {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--encre-3) 50%), linear-gradient(135deg, var(--encre-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.saisie.chiffre { font-family: var(--chiffres); }

.recherche { position: relative; flex: 1; min-width: 180px; }
.recherche svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--encre-3); pointer-events: none; }
.recherche .saisie { padding-left: 33px; }

.segments { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-sm); }
.segments button {
  border: 0; background: transparent; color: var(--encre-2);
  padding: 5px 11px; border-radius: var(--r-xs);
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.segments button[aria-pressed='true'] { background: var(--surface); color: var(--encre); box-shadow: var(--ombre-1); }

.bascule { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.bascule input { accent-color: var(--indigo); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ Tableaux */

.enveloppe-table { overflow-x: auto; }

table.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tableau th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  padding: 9px 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--encre-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--trait);
  white-space: nowrap;
}
table.tableau td { padding: 9px 14px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
table.tableau tbody tr { transition: background 0.1s; }
table.tableau tbody tr:hover { background: var(--surface-2); }
table.tableau tbody tr[data-cliquable] { cursor: pointer; }
table.tableau tbody tr:last-child td { border-bottom: 0; }
table.tableau td.num, table.tableau th.num { text-align: right; font-family: var(--chiffres); font-variant-numeric: tabular-nums; }

.identite { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identite .initiales {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; font-family: var(--display);
  color: #fff;
}
.identite .nom { font-weight: 600; line-height: 1.2; }
.identite .meta { font-size: 11.5px; color: var(--encre-3); font-family: var(--chiffres); }

.jauge { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.jauge i { display: block; height: 100%; border-radius: 99px; background: var(--jade); transition: width 0.5s cubic-bezier(0.2, 0, 0, 1); }
.jauge[data-etat='partiel'] i { background: var(--safran); }
.jauge[data-etat='faible'] i { background: var(--brique); }

/* ------------------------------------------------------------------ États vides et chargement */

.vide { padding: 46px 24px; text-align: center; color: var(--encre-3); }
.vide h3 { font-size: 15px; color: var(--encre-2); margin-bottom: 4px; }
.vide p { font-size: 13px; max-width: 380px; margin: 0 auto 14px; }

.squelette {
  background: linear-gradient(100deg, var(--surface-3) 30%, var(--surface-2) 50%, var(--surface-3) 70%);
  background-size: 220% 100%;
  animation: balayage 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes balayage { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ------------------------------------------------------------------ Fenêtres modales */

.voile {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(6 10 20 / 55%);
  backdrop-filter: blur(3px);
  animation: apparition 0.18s ease-out;
}
@keyframes apparition { from { opacity: 0; } to { opacity: 1; } }

.modale {
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-3);
  animation: montee 0.24s cubic-bezier(0.2, 0, 0, 1);
  overflow: hidden;
}
.modale.large { width: min(940px, 100%); }
@keyframes montee { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

.modale-entete { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--trait); }
.modale-corps { padding: 20px; overflow-y: auto; }
.modale-pied { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--trait); background: var(--surface-2); }

/* ------------------------------------------------------------------ Notifications */

.notifications {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 380px;
}

.notification {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--trait);
  border-left: 3px solid var(--indigo);
  box-shadow: var(--ombre-2);
  animation: glissement 0.26s cubic-bezier(0.2, 0, 0, 1);
  font-size: 13.5px;
}
.notification[data-ton='succes'] { border-left-color: var(--jade); }
.notification[data-ton='erreur'] { border-left-color: var(--brique); }
.notification[data-ton='argent'] { border-left-color: var(--safran); }
.notification strong { display: block; font-size: 13px; }
.notification.sortie { animation: retrait 0.2s ease-in forwards; }
@keyframes glissement { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes retrait { to { opacity: 0; transform: translateX(28px); } }

/* ------------------------------------------------------------------ Réactivité */

.rail-bascule { display: none; }

@media (max-width: 1000px) {
  .coquille { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    z-index: 60;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.2, 0, 0, 1);
    box-shadow: var(--ombre-3);
  }
  .coquille[data-tiroir='ouvert'] .rail { transform: none; }
  .coquille[data-tiroir='ouvert']::after {
    content: '';
    position: fixed; inset: 0; z-index: 50;
    background: rgb(6 10 20 / 45%);
  }
  .rail-bascule { display: inline-flex; }
  .contenu { padding: 16px 14px 60px; }
  .barre { padding: 0 14px; }
}

/* ------------------------------------------------------------------ Marque SANKI EDUC */

.sceau-image { flex: none; width: 34px; height: 34px; border-radius: 9px; display: block; }
.coquille[data-replie='oui'] .sceau-image { width: 30px; height: 30px; }

/* ------------------------------------------------------------------ Bandeau d'abonnement */

.bandeau-abonnement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 550;
  border-bottom: 1px solid var(--trait);
  background: var(--safran-voile);
  color: var(--safran);
}
.bandeau-abonnement[data-ton='brique'] { background: var(--brique-voile); color: var(--brique); }
.bandeau-abonnement[data-ton='indigo'] { background: var(--indigo-voile); color: var(--indigo); }
.bandeau-abonnement svg { flex: none; width: 17px; height: 17px; }
.bandeau-abonnement .bouton { margin-left: auto; }
