/* =====================================================================
   COULEURS ET MESURES RÉUTILISABLES (variables CSS)
   ---------------------------------------------------------------------
   Toutes les couleurs sont ici : pour changer le thème, on ne touche
   qu'à ce bloc. var(--nom) les réutilise partout ailleurs.
   ===================================================================== */
:root {
  --fond: #f1f4f9;            /* fond de la page */
  --carte: #ffffff;           /* fond des blocs blancs */
  --texte: #1e293b;           /* texte principal */
  --texte-doux: #64748b;      /* texte secondaire */
  --ligne: #e2e8f0;           /* traits fins de la grille */
  --ligne-paire: #f8fafc;     /* une ligne sur deux */
  --sombre: #1e293b;          /* en-tête de la grille */
  --sombre-2: #334155;
  --accent: #4f46e5;          /* violet-indigo : éléments actifs */
  --accent-doux: #eef2ff;
  --vert: #16a34a;
  --orange: #ea580c;
  --rouge: #dc2626;
  --ambre: #d97706;           /* horaires modifiés */
  --arrondi: 10px;
  --ombre: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* L'attribut "hidden" doit toujours cacher, même si on a mis un display ailleurs */
[hidden] { display: none !important; }

* { box-sizing: border-box; }   /* la taille d'un élément inclut ses bordures et marges intérieures */

body {
  margin: 0;
  /* Police moderne déjà installée sur l'ordinateur (pas besoin d'internet) */
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  /* La page fait exactement la hauteur de l'écran : seule la grille défile */
  display: flex;
  flex-direction: column;
  height: 100vh;
}


/* =====================================================================
   EN-TÊTE : titre, date, bouton, puis les onglets sur une 2e ligne
   ===================================================================== */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 20px 0;
  background: var(--carte);
  border-bottom: 1px solid var(--ligne);
}
header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }

.actions-entete { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.actions-entete label { color: var(--texte-doux); font-size: 0.9rem; }
header input[type="date"] {
  margin-left: 6px;
  padding: 7px 10px;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  font: inherit;
  color: var(--texte);
  background: var(--carte);
}

/* Onglets : "order: 3" les place en dernier, "flex-basis: 100%" sur toute la largeur */
#onglets {
  order: 3;
  flex-basis: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;           /* trop d'onglets ? on fait défiler au lieu de passer à la ligne */
  scrollbar-width: thin;      /* barre de défilement fine */
  padding-bottom: 10px;
}
#onglets button {
  flex-shrink: 0;             /* un onglet ne rétrécit jamais */
  background: transparent;
  color: var(--texte-doux);
  border: none;
  border-radius: 999px;       /* très arrondi = forme de pastille */
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 500;
}
#onglets button:hover { background: var(--fond); color: var(--texte); }
#onglets button.actif { background: var(--accent); color: white; }

/* Sauvegarde / restauration */
.sauvegarde { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.info-sauvegarde { font-size: 0.8rem; color: var(--texte-doux); }
.info-sauvegarde.a-faire { color: var(--orange); font-weight: 600; }   /* il est temps de sauvegarder */

#btn-horaires { background: var(--carte); color: var(--ambre); border-color: #fcd34d; }
#btn-horaires:hover { background: #fffbeb; }


/* =====================================================================
   AIDE ET LÉGENDE
   ===================================================================== */
.aide {
  margin: 12px 20px;
  font-size: 0.85rem;
  color: var(--texte-doux);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.aide b { color: var(--texte); font-weight: 600; }
.legende {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}


/* =====================================================================
   LA GRILLE, présentée comme une "carte" blanche
   ===================================================================== */
main {
  flex: 1;                    /* prend toute la hauteur qui reste */
  min-height: 0;
  margin: 0 20px 20px;
  overflow: auto;             /* barre de défilement si la grille est plus grande */
  background: var(--carte);
  border-radius: var(--arrondi);
  box-shadow: var(--ombre);
}

table {
  /* "separate" (et pas "collapse") permet d'arrondir les cases réservées */
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;        /* toutes les colonnes ont la même largeur */
}

th, td {
  --fond-ligne: var(--carte); /* couleur de fond de la ligne (changée pour les lignes paires) */
  border-right: 1px solid var(--ligne);
  border-bottom: 1px solid var(--ligne);
  width: 72px;
  min-width: 72px;
  max-width: 72px;            /* min ET max : la colonne ne s'élargit jamais, même avec un long nom */
  height: 34px;
  padding: 0 6px;
  font-size: 11.5px;
  text-align: center;
  /* Si un nom est trop long : on coupe avec "..." */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* En-tête sombre avec les horaires, qui reste visible quand on descend */
thead th {
  background: var(--sombre);
  color: white;
  font-weight: 600;
  border-color: var(--sombre-2);
  position: sticky;
  top: 0;
  z-index: 2;
}
thead th small { display: block; font-weight: 400; font-size: 9.5px; opacity: 0.7; }

/* Colonne de gauche (numéros), qui reste visible quand on va à droite */
th.num {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  background: var(--sombre);
  color: #cbd5e1;
  font-weight: 600;
  border-color: var(--sombre-2);
  position: sticky;
  left: 0;
  z-index: 1;
}
thead th.num { z-index: 3; }   /* le coin en haut à gauche passe au-dessus de tout */

/* Les horaires sont cliquables (pour modifier les horaires à partir de là) */
thead th[data-heure] { cursor: pointer; }
thead th[data-heure]:hover { background: var(--sombre-2); }

/* Session dont la durée n'est pas la durée normale */
thead th.modifie,
thead th.modifie:hover { background: var(--ambre); }

/* Bowling : colonnes de 15 min plus étroites, quarts d'heure plus discrets */
table.colonnes-etroites th,
table.colonnes-etroites td { width: 48px; min-width: 48px; max-width: 48px; }
table.colonnes-etroites th.num { width: 44px; min-width: 44px; max-width: 44px; }
/* Une case qui s'étale sur plusieurs colonnes (colspan) ne doit pas être limitée */
td[colspan] { max-width: none !important; }
thead th.quart { color: #64748b; font-weight: 400; cursor: default; }
thead th.quart:hover { background: var(--sombre); }
/* Une partie (case qui s'étale) : texte à gauche, comme une barre */
table.colonnes-etroites td[colspan] { text-align: left; padding-left: 10px; }

/* Lignes alternées (nth-child(even) = lignes paires) */
tbody tr:nth-child(even) td { --fond-ligne: var(--ligne-paire); background: var(--fond-ligne); }

/* Les cases sont cliquables */
tbody td { cursor: pointer; transition: background 0.15s; }
tbody td:empty:hover { background: var(--accent-doux); }

/* ===== Cases remplies : des "pastilles" arrondies =====
   L'ombre intérieure de la couleur de la ligne crée une petite marge
   tout autour : la case ressemble à une pastille posée dans la grille. */
tbody td.inscription,
tbody td.blocage {
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px var(--fond-ligne);
  font-weight: 600;
  color: #1e293b;
}
tbody td.inscription:hover,
tbody td.blocage:hover { filter: brightness(0.95); }   /* un peu plus foncé au survol */

/* Case bloquée : rayures ambre douces */
tbody td.blocage,
tbody tr:nth-child(even) td.blocage,
.legende.blocage {
  background: repeating-linear-gradient(-45deg, #fef3c7, #fef3c7 6px, #fde68a 6px, #fde68a 12px);
  color: #92400e;
  font-style: italic;
  font-weight: 500;
}
.legende.inscription { background: hsl(220, 70%, 85%); color: #1e293b; }

/* ===== Statuts des groupes =====
   "#corps td..." : l'id rend la règle plus forte (plus "spécifique")
   que celle des lignes paires, donc la couleur du statut gagne toujours. */
#corps td.statut-envoye,   .statut-envoye   { background: var(--vert);   color: white; }
#corps td.statut-absent,   .statut-absent   { background: var(--orange); color: white; }
#corps td.statut-non-paye, .statut-non-paye { background: var(--rouge);  color: white; }
.legende.modifie { background: var(--ambre); color: white; }

/* Ligne du bas : équipements libres par créneau */
tfoot td, tfoot th {
  background: #f1f5f9;
  color: var(--texte-doux);
  font-weight: 700;
  border-top: 1px solid var(--ligne);
  position: sticky;
  bottom: 0;
}
tfoot th.num { background: var(--sombre); color: #cbd5e1; font-size: 10px; }
tfoot td.complet { background: #fee2e2; color: var(--rouge); }


/* =====================================================================
   RÉCAP DES ANNIVERSAIRES (onglet 🎂)
   ===================================================================== */
.barre-anniv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 20px; }
.resume-anniv {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-doux);
  color: var(--accent);
  font-weight: 600;
}

#table-anniv { table-layout: auto; }
#table-anniv th,
#table-anniv td { width: 84px; min-width: 84px; max-width: 84px; padding: 0; }
#table-anniv th.num { width: 44px; min-width: 44px; max-width: 44px; }
#table-anniv .large { width: 150px; min-width: 150px; max-width: 150px; }
#table-anniv .tres-large { width: 300px; min-width: 300px; max-width: none; }

/* En-têtes sur 2 lignes : le texte peut passer à la ligne */
#table-anniv thead th {
  white-space: normal;
  line-height: 1.15;
  padding: 4px;
  font-size: 11px;
  hyphens: auto;              /* coupe les mots trop longs avec un tiret (en français grâce à lang="fr") */
  text-overflow: clip;
}
#table-anniv thead tr:first-child th { height: 30px; }
#table-anniv thead tr:nth-child(2) th { top: 30px; height: 40px; }   /* collée SOUS la 1re ligne */
#table-anniv thead th.bandeau { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }

/* Couleurs des groupes (en-têtes) */
#table-anniv th.g-infos     { background: var(--sombre); }
#table-anniv th.g-activites { background: #475569; border-color: #64748b; }
#table-anniv th.g-options   { background: #94a3b8; border-color: #a5b4c8; }
#table-anniv th.sans-groupe { background: #cbd5e1; color: var(--texte); border-color: #d5dde8; }
#table-anniv th.sans-groupe.tres-large { background: var(--carte); color: var(--texte); }

/* Couleurs des cases (corps) : "#corps-anniv" (un id) passe devant la couleur des lignes paires */
#corps-anniv td.g-infos         { background: #fffbeb; }
#corps-anniv td.g-infos.large   { background: #fff1e6; }
#corps-anniv td.g-activites     { background: #f8fafc; }
#corps-anniv td:nth-child(even).g-activites { background: #f1f5f9; }

/* Chaque case contient un champ de saisie invisible, qui prend toute la place */
#corps-anniv td { cursor: text; }
#corps-anniv input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--texte);
}
#corps-anniv input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--carte); }

/* Numéro de ligne cliquable : Arrivé (vert) / Absent (orange) */
#corps-anniv th.cliquable { cursor: pointer; }
#corps-anniv th.cliquable:hover { background: var(--sombre-2); color: white; }
#corps-anniv th.etat-arrive,
#corps-anniv th.etat-arrive:hover { background: var(--vert); color: white; }
#corps-anniv th.etat-absent,
#corps-anniv th.etat-absent:hover { background: var(--orange); color: white; }
/* Un absent : la ligne est estompée et le prénom barré */
#corps-anniv tr.etat-absent td { opacity: 0.55; }
#corps-anniv tr.etat-absent input[data-cle="prenom"] { text-decoration: line-through; }

/* Cases réservables (Laser, Bowling, Karaoké...) : un "+" à cliquer */
#corps-anniv input.reservable { cursor: pointer; text-align: center; }
#corps-anniv input.reservable::placeholder { color: #c7d2fe; font-weight: 700; font-size: 15px; }
#corps-anniv input.reservable:hover { background: var(--accent-doux); }
/* Case réservée : pastille violette avec l'horaire */
#corps-anniv input.reserve {
  background: var(--accent-doux);
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--carte);
  border-radius: 8px;
}

/* Fenêtre de choix d'horaire : une grille de boutons */
#fenetre-anniv { width: min(560px, 94vw); }
.choix-horaires {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));   /* autant de colonnes que possible */
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 8px;
}
.choix-horaires button {
  text-align: left;
  padding: 8px 10px;
  line-height: 1.25;
}
.choix-horaires button:hover { border-color: var(--accent); background: var(--accent-doux); }
.choix-horaires button b { font-size: 1rem; }
.choix-horaires button small { display: block; font-size: 0.72rem; color: var(--texte-doux); font-weight: 400; }
.choix-horaires .aucun { grid-column: 1 / -1; color: var(--rouge); margin: 0; }


.boutons-anniv { display: flex; gap: 8px; }


/* =====================================================================
   TICKETS ANNIVERSAIRE (bouton 🎟️)
   ---------------------------------------------------------------------
   Mesures en millimètres (mm) : un ticket fait 193 × 91 mm, comme le
   modèle papier, pour en mettre 3 sur une page A4 portrait.
   ===================================================================== */
#vue-tickets { background: transparent; box-shadow: none; padding: 4px 0 24px; page: tickets; }
#liste-tickets { display: flex; flex-direction: column; align-items: center; gap: 6mm; }
.aucun-ticket { color: var(--texte-doux); margin-top: 40px; }

.ticket {
  --brique: rgb(139, 67, 60);              /* la couleur relevée sur ton ticket */
  position: relative;
  width: 193mm;
  height: 91mm;
  padding: 5mm 7mm 4mm;
  background: white;
  border: 0.35mm solid #222;
  color: #1f1f1f;
  box-shadow: var(--ombre);
  font-size: 3.6mm;
}
.ticket-titre {
  margin: 1mm 0 0;
  text-align: center;
  font-size: 8.6mm;
  font-weight: 900;
  letter-spacing: -0.2mm;
  text-transform: uppercase;
}
.ticket-date { margin: 0.5mm 0 3mm; text-align: center; }
.ticket-infos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6mm 8mm;
  padding: 0 12mm;             /* même marge à gauche et à droite : le bloc est centré */
}
.ticket-infos p { margin: 0; white-space: nowrap; }
.ticket-trait { border: none; border-top: 0.35mm solid var(--brique); margin: 3mm 12mm 4mm; }

.ticket-activites { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 4mm; }
.ticket-colonne { display: flex; flex-direction: column; gap: 2.4mm; }
.ticket-activite { display: flex; align-items: flex-start; gap: 2.5mm; line-height: 1.3; }
.ticket-activite strong { display: block; font-size: 3.7mm; font-weight: 800; text-transform: uppercase; }
.ticket-activite b { color: var(--brique); font-size: 3.9mm; }
.ticket-case {
  flex-shrink: 0;
  display: grid;
  place-items: center;          /* centre le ✓ dans la case */
  width: 5.5mm;
  height: 5.5mm;
  border: 0.35mm solid #222;
  color: var(--brique);
  font-size: 4.6mm;
  font-weight: 900;
}
.ticket-bandeau {
  margin-top: 0.5mm;
  padding: 0.8mm;
  background: var(--brique);
  color: white;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3mm;
  font-size: 3.9mm;
}
/* Pointillés là où il n'y a rien : on peut compléter au stylo */
.pointilles { display: inline-block; width: 26mm; border-bottom: 0.3mm dotted #555; }
.ticket-infos .pointilles { width: 40mm; }

/* Les tickets s'impriment en A4 PORTRAIT (le récap, lui, en paysage) */
@page tickets { size: A4 portrait; margin: 8mm; }


/* =====================================================================
   IMPRESSION (bouton 🖨️) : A4 paysage, sans les boutons ni les onglets
   ===================================================================== */
@media print {
  /* A4 paysage = 297 × 210 mm ; avec 7 mm de marge il reste environ 1070 × 740 pixels */
  @page { size: A4 landscape; margin: 7mm; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }   /* garder les couleurs */
  body { display: block; height: auto; background: white; }
  #onglets, #btn-horaires, #btn-imprimer, .aide, dialog, .sauvegarde { display: none !important; }
  header { padding: 0 0 6px; border: none; }
  header h1 { font-size: 16px; }
  header input[type="date"] { border: none; padding: 0; font-weight: 700; }
  main { margin: 0; overflow: visible; box-shadow: none; border-radius: 0; }
  thead th, th.num, tfoot td, tfoot th { position: static; }

  /* Récap anniversaires : colonnes plus étroites pour tenir sur UNE page */
  #table-anniv th,
  #table-anniv td { width: 50px; min-width: 50px; max-width: 50px; }
  /* 25 lignes × 24 px : tout tient en hauteur (les N° de ligne aussi, sinon ils imposent 34 px) */
  #table-anniv td,
  #table-anniv tbody th { height: 24px; }
  #table-anniv th.num { width: 24px; min-width: 24px; max-width: 24px; }
  #table-anniv .large { width: 84px; min-width: 84px; max-width: 84px; }
  #table-anniv .tres-large { width: 150px; min-width: 150px; max-width: 150px; }
  #table-anniv thead th { font-size: 8px; padding: 2px; }
  #table-anniv thead tr:first-child th { height: 18px; }
  #table-anniv thead tr:nth-child(2) th { height: 30px; }
  #corps-anniv input { height: 23px; font-size: 9px; padding: 0 2px; }
  #corps-anniv input::placeholder { color: transparent !important; }   /* pas de "+" sur papier */
  #corps-anniv input.reserve { box-shadow: none; border-radius: 0; }
  #corps-anniv input.reservable { font-size: 8px; letter-spacing: -0.2px; }   /* "14h00 P1-2" doit tenir */

  /* Tickets : pas d'en-tête de page, 3 tickets par feuille puis saut de page */
  .barre-anniv { display: none !important; }
  body:has(#vue-tickets:not([hidden])) header { display: none !important; }
  #vue-tickets { padding: 0; }
  #liste-tickets { display: block; }
  .ticket { box-shadow: none; margin: 0 0 3mm; break-inside: avoid; }
  .ticket:nth-child(3n) { break-after: page; margin-bottom: 0; }
}


/* =====================================================================
   FENÊTRES POPUP
   ===================================================================== */
dialog {
  border: none;
  border-radius: 16px;
  padding: 24px;
  width: min(400px, 92vw);
  color: var(--texte);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
/* Fond derrière la fenêtre : assombri et flouté */
dialog::backdrop { background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 16px; font-size: 1.15rem; font-weight: 700; }

dialog label { display: block; margin-bottom: 14px; font-size: 0.9rem; font-weight: 500; }
dialog input[type="text"],
dialog input[type="number"],
dialog input[type="time"],
dialog input[type="date"],
dialog input[type="password"],
dialog select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
  color: var(--texte);
  background: var(--carte);
}
/* Le champ actif est entouré de violet */
dialog input:focus,
dialog select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }

/* Choix Inscrire / Bloquer et Blind test / Karaoké : boutons radio en "segments" */
.choix-action {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--fond);
  border-radius: 10px;
}
.choix-action label {
  flex: 1;
  margin: 0;
  padding: 7px 10px;
  border-radius: 7px;
  text-align: center;
  cursor: pointer;
  color: var(--texte-doux);
}
.choix-action input { accent-color: var(--accent); }
/* :has() = "le label qui contient un bouton radio coché" */
.choix-action label:has(input:checked) { background: var(--carte); color: var(--texte); box-shadow: var(--ombre); }
.choix-action label:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }

.info { font-size: 0.85rem; color: var(--texte-doux); margin: -4px 0 12px; line-height: 1.4; }
dialog label.case-a-cocher { display: flex; align-items: center; gap: 8px; cursor: pointer; }
dialog label.case-a-cocher input { width: 16px; height: 16px; accent-color: var(--accent); }

.boutons-statut { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.boutons-statut button { border-width: 2px; }
/* Le statut actuel du groupe est entouré */
.boutons-statut button.actif { border-color: var(--texte); box-shadow: 0 0 0 2px var(--carte), 0 0 0 4px var(--texte); }

.apercu {
  font-size: 0.85rem;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.4;
}


/* =====================================================================
   BOUTONS
   ===================================================================== */
.boutons { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
button {
  cursor: pointer;
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--carte);
  color: var(--texte);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, filter 0.15s;
}
button:hover { background: var(--fond); }
button.principal { background: var(--accent); border-color: var(--accent); color: white; }
button.danger { background: var(--rouge); border-color: var(--rouge); color: white; }
button.principal:hover,
button.danger:hover,
.boutons-statut button:hover { filter: brightness(1.08); }


/* =====================================================================
   VERSION EN LIGNE : connexion, compte, historique, comptes
   ===================================================================== */

/* --- Page de connexion (et page d'installation) --- */
body.page-connexion { display: grid; place-items: center; min-height: 100vh; height: auto; padding: 16px; }
.carte-connexion {
  width: min(380px, 100%);
  padding: 28px;
  background: var(--carte);
  border-radius: 16px;
  box-shadow: var(--ombre);
}
.carte-connexion h1 { margin: 0 0 4px; font-size: 1.4rem; }
.carte-connexion label { display: block; margin: 14px 0; font-size: 0.9rem; font-weight: 500; }
.carte-connexion input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}
.carte-connexion input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.carte-connexion button { width: 100%; padding: 11px; margin-top: 6px; }
.erreur-connexion { background: #fee2e2; color: var(--rouge); padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; }

/* --- Zone du compte connecté (en-tête) --- */
.compte { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nom-utilisateur { font-size: 0.85rem; font-weight: 600; color: var(--texte); margin-right: 4px; }
/* Le voyant : vert = à jour, bleu = envoi en cours, rouge = pas de réseau */
.voyant { width: 10px; height: 10px; border-radius: 50%; background: var(--vert); flex-shrink: 0; }
.voyant[data-etat="envoi"] { background: var(--accent); }
.voyant[data-etat="hors-ligne"] { background: var(--rouge); animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: 0.3; } }

/* --- Grandes fenêtres (historique, comptes) --- */
dialog.grande { width: min(900px, 96vw); }
dialog h3 { margin: 18px 0 8px; font-size: 1rem; }
.filtres-historique { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.filtres-historique label { margin: 0; }
.liste-historique, .liste-comptes { max-height: 55vh; overflow: auto; margin: 12px 0; border: 1px solid var(--ligne); border-radius: 10px; }
.liste-historique table, .liste-comptes table { width: 100%; border-collapse: collapse; table-layout: auto; }
.liste-historique th, .liste-historique td,
.liste-comptes th, .liste-comptes td {
  width: auto; min-width: 0; max-width: none; height: auto;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--ligne);
  text-align: left;
  font-size: 0.85rem;
  white-space: normal;
  vertical-align: top;
}
.liste-historique thead th, .liste-comptes thead th { position: sticky; top: 0; background: var(--sombre); color: white; }
.liste-historique td small, .liste-comptes td small { display: block; color: var(--texte-doux); font-size: 0.75rem; }
.liste-historique td:first-child { white-space: nowrap; }
.rangement { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-doux); color: var(--accent); font-size: 0.75rem; font-weight: 600; }
.concerne { color: var(--texte-doux); }
.vide-historique { text-align: center !important; color: var(--texte-doux); padding: 24px !important; }

.liste-comptes select { margin: 0; padding: 5px 8px; width: auto; display: inline-block; }
.liste-comptes input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.actions-compte { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-compte button { padding: 5px 10px; font-size: 0.8rem; }
.form-compte { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; }
.form-compte input, .form-compte select { margin: 0 !important; }
@media (max-width: 640px) { .form-compte { grid-template-columns: 1fr; } }

@media print { .compte { display: none !important; } }
