/* Main courante — composants specifiques, batis sur le design system LCR
   (variables, polices, couleurs de style.css). */

.page { padding: 24px 32px 80px; max-width: 1000px; }
@media (max-width: 640px) { .page { padding: 16px 16px 80px; } }

/* État de la soirée en grand (accueil) */
.state-hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 28px 24px; margin-bottom: 22px; }
.state-hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.state-hero.ouverte::before { background: var(--ok); }
.state-hero.fermee::before { background: var(--text-dim); }
.mc-state { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.1; margin: 2px 0 6px; }
.mc-state .dotbig { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 12px; vertical-align: middle; }
@media (max-width: 640px) { .mc-state { font-size: 26px; } }

/* Menu latéral Paramètres : repliable sur mobile */
@media (max-width: 640px) {
  .settings-nav { display: none; }
  .settings-nav.open { display: flex; }
}

/* Banniere de soiree */
.mc-banner {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px 18px 24px; margin-bottom: 20px;
}
.mc-banner::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--club); }
.mc-banner.fermee::before { background: var(--text-dim); }
.mc-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
h2.mc-h2 { font-family: var(--font-display); font-weight: 600; font-size: 18px; margin: 26px 0 12px; }

.state { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 10px;
  border-radius: 100px; text-transform: uppercase; }
.state-ouverte { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.state-fermee { color: var(--text-dim); background: var(--surface-alt); }
.vpill { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; color: #0F1115; }

/* Barre d'outils du fil */
.mc-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0 12px; }
.mc-toolbar input[type=search] { flex: 1; min-width: 180px; }
.zoom { display: flex; gap: 6px; align-items: center; color: var(--text-dim); font-size: 12px; }

/* Timeline verticale defilante */
.timeline { position: relative; }
.tl-axis { position: absolute; left: 0; top: 0; width: 52px; height: 100%; border-right: 2px solid var(--border); }
.tl-tick { position: absolute; left: 0; width: 44px; text-align: right;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.tl-tick::after { content: ''; position: absolute; right: -6px; top: 8px; width: 8px; height: 1px; background: var(--border); }
.tl-live { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--club); z-index: 2; }
.tl-live span { position: absolute; left: 6px; top: -9px; background: var(--club); color: #0F1115;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 7px; border-radius: 4px; }
.tl-body { position: relative; margin-left: 56px; }

.chip {
  position: absolute; left: 0; right: 0; display: flex; gap: 9px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--text-dim);
  border-radius: 8px; padding: 6px 11px; font-size: 13.5px; cursor: pointer;
  white-space: nowrap; overflow: hidden; transition: border-color .12s, transform .12s;
}
.chip:hover { border-color: var(--club); transform: translateX(2px); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip .t { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.chip .cat { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.chip .z { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 100px; background: var(--surface-alt); }
.chip .ex { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.chip .lock { color: var(--text-dim); font-size: 12.5px; }
.chip .draft { font-size: 10px; font-weight: 800; letter-spacing: .03em; color: var(--warn);
  border: 1px solid var(--warn); padding: 1px 6px; border-radius: 100px; }

/* Liste des soirees (accueil) */
.soiree-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .12s, transform .12s; }
.soiree-row:hover { border-color: var(--club); transform: translateY(-1px); }
.soiree-row .when { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }

/* Detail / personnes */
.pers { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.pers .field-row { margin-bottom: 8px; }
.mc-detail p { line-height: 1.5; white-space: pre-wrap; }
.mc-detail ul { margin: 6px 0 14px; padding-left: 18px; }
.mc-detail strong { font-family: var(--font-display); font-weight: 600; }
.restricted { background: var(--surface-alt); border: 1px dashed var(--border); border-radius: 8px;
  padding: 18px; color: var(--text-dim); text-align: center; }

/* Paramètres */
.set-row { background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 10px; }
.set-row .head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.set-row .head .name { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 4px 0; }
.checks label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 100px; text-transform: uppercase; letter-spacing: .03em; }
.role-grand_admin { color: var(--club); background: color-mix(in srgb, var(--club) 16%, transparent); }
.role-admin { color: var(--planete); background: color-mix(in srgb, var(--planete) 16%, transparent); }
.role-agent { color: var(--text-dim); background: var(--surface-alt); }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
input[type=color] { padding: 2px; height: 38px; cursor: pointer; }
.inactif { opacity: .55; }

/* ---- Mode selection sur les listes de configuration ---- */
.config-table.selecting tbody tr { cursor: pointer; }
.config-table.selecting tbody tr td button,
.config-table.selecting tbody tr td input { pointer-events: none; opacity: .4; }
.mc-bulkbar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px 14px;
  background: color-mix(in srgb, var(--club) 12%, var(--surface-alt));
  border: 1px solid var(--club); border-radius: 8px;
}
.mc-bulk-count { font-size: 13px; font-weight: 600; color: var(--text); }
.btn.active { background: var(--club); color: #0F1115; border-color: transparent; }

/* ---- Bandeau d'alerte (expiration cartes, etc.) ---- */
.mc-alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 600;
  border: 1px solid; }
.mc-alert.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: var(--warn); color: var(--warn); }
.mc-alert.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); color: var(--danger); }

/* ---- Roster agents ---- */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.agent-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.agent-card:hover { border-color: var(--club); transform: translateY(-1px); }
.agent-card.inactif { opacity: .55; }
.agent-name { color: var(--text); }
.agent-photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--surface-alt); }
.agent-photo-ph { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display);
  font-size: 22px; font-weight: 700; color: var(--text-dim); }
.agent-body { flex: 1; min-width: 0; }
.agent-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.agent-line { font-size: 12.5px; margin-top: 2px; }
.agent-line.mono { font-family: var(--font-mono); }
.agent-badge { display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.badge-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.badge-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.badge-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.badge-none { color: var(--text-dim); background: var(--surface-alt); }

/* ---- Pages de reference (deontologie, vigipirate) ---- */
.ref-section { margin-bottom: 26px; }
.ref-section > h3 { font-family: var(--font-display); font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--club); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin: 0 0 12px; }
.ref-art { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.ref-art h4 { margin: 0 0 8px; font-size: 14.5px; }
.ref-art h4 .num { font-family: var(--font-mono); color: var(--club); margin-right: 8px; font-size: 13px; }
.ref-art p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }
.ref-art p:last-child { margin-bottom: 0; }
.ref-art mark { background: color-mix(in srgb, var(--club) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.ref-empty { color: var(--text-dim); padding: 20px 0; }

/* ---- Vigipirate ---- */
.vig-grid { display: grid; gap: 14px; }
.vig-level { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--text-dim); border-radius: 10px; padding: 16px 18px; }
.vig-level.current { box-shadow: 0 0 0 2px var(--club); }
.vig-level h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; }
.vig-level .vig-current-tag { font-size: 11px; font-weight: 800; letter-spacing: .05em; color: var(--club); }
.vig-level p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }

/* ---- Zone Vigipirate (accueil) : carte de même gabarit que la soirée ---- */
.vig-hero { position: relative; overflow: hidden; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 28px 24px; display: flex; flex-direction: column; }
.vig-hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--vc, var(--text-dim)); }
.vig-badge { display: inline-block; align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #0F1115; padding: 3px 11px; border-radius: 100px; }
.vig-hero-level { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1;
  margin: 14px 0 8px; display: flex; align-items: center; gap: 12px; }
.vig-hero-level .vig-dot { width: 14px; height: 14px; }
.vig-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.vig-hero-consignes { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; margin: 0 0 16px; flex: 1; }
.vig-hero .btn { align-self: flex-start; margin-top: auto; }

/* ---- Reperes ouverture/fermeture dans la timeline ---- */
.tl-edge { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--text-dim); z-index: 1; }
.tl-edge span { position: absolute; left: 6px; top: -8px; background: var(--surface-alt); color: var(--text-dim);
  font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 100px; text-transform: uppercase; }

/* ---- Agents présents (fil de soirée) ---- */
.mc-present { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 0; }
.present-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 100px; padding: 3px 10px; font-size: 12.5px; }
.present-chip .avatar-placeholder { width: 20px; height: 20px; font-size: 9px; }

/* ---- Animation de changement d'onglet dans les paramètres ---- */
@keyframes mc-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.settings-panel.mc-anim { animation: mc-panel-in .22s ease-out; }

/* ---- Historique des corrections (détail d'entrée) ---- */
.hist-list { list-style: none; padding: 0; margin: 6px 0 14px; }
.hist-list li { border-left: 2px solid var(--border); padding: 2px 0 8px 12px; margin-bottom: 8px; }
.hist-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }
.hist-old { font-size: 13px; color: var(--text-dim); white-space: pre-wrap; margin-top: 3px;
  text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }

/* ---- Pièces jointes (saisie + détail) ---- */
.mc-attach-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mc-attach-btns .active { background: var(--danger); color: #fff; border-color: transparent; }
.mc-attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mc-attach-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 100px; padding: 3px 6px 3px 11px; }
.mc-attach-del { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.mc-attach-del:hover { color: var(--danger); }
.mc-att-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 14px; }
.mc-att-photo { max-height: 120px; max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.mc-att-audio { height: 34px; }

/* ---- Thème clair (applique via data-theme=light sur <html>) ---- */
:root[data-theme="light"] {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-alt: #EDEFF3;
  --border: #D9DCE2;
  --text: #1A1D23;
  --text-dim: #5B6270;
}
:root[data-theme="light"] body { background: var(--bg); }
/* Le fond global (dégradés sombres de style.css) est neutralisé en clair */
:root[data-theme="light"] body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255,45,70,0.05), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(0,0,0,0.02), transparent 35%);
}
/* Boutons primaires : garder un texte lisible sur l'accent rouge en clair */
:root[data-theme="light"] .btn-primary { color: #FFFFFF; }
:root[data-theme="light"] .tl-live span,
:root[data-theme="light"] .vpill,
:root[data-theme="light"] .btn.active,
:root[data-theme="light"] .btn-select-mode.active { color: #FFFFFF; }
:root[data-theme="light"] .state-hero,
:root[data-theme="light"] .card,
:root[data-theme="light"] .soiree-row,
:root[data-theme="light"] .agent-card { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

/* ---- Menu de sélection du thème (popover) ---- */
#btn-theme .theme-ico { font-size: 15px; line-height: 1; }
.theme-menu { position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,0.4); padding: 6px; min-width: 150px; }
.theme-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); font-size: 13.5px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.theme-menu button:hover { background: var(--surface-alt); }
.theme-menu button.active { color: var(--club); font-weight: 600; }

/* ---- Logo inversé en mode jour (logo pensé pour fond sombre) ---- */
:root[data-theme="light"] .wordmark-logo,
:root[data-theme="light"] #help-logo { filter: invert(1) hue-rotate(180deg); }

/* ---- Accueil : soirée en cours + Vigipirate côte à côte ---- */
.home-top { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.home-top #state-hero { margin-bottom: 0; }
.home-top #vig-zone { margin: 0; }
.home-top .vig-zone { margin: 0; height: 100%; }
@media (max-width: 820px) { .home-top { grid-template-columns: 1fr; } }

/* ---- Fil : timeline + panneau des présents à droite ---- */
.fil-layout { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
.fil-side { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; }
.fil-side h3 { font-family: var(--font-display); font-size: 14px; margin: 0 0 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.fil-side .mc-present { flex-direction: column; align-items: stretch; gap: 6px; }
@media (max-width: 820px) { .fil-layout { grid-template-columns: 1fr; } .fil-side { position: static; } }

/* ---- Repères ouverture/fermeture cliquables ---- */
.tl-edge-click span { cursor: pointer; }
.tl-edge-click:hover span { background: var(--club); color: #0F1115; }

/* ---- Cloche de notifications ---- */
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: var(--club); color: #0F1115;
  font-size: 9px; font-weight: 800; min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.notif-panel { position: fixed; z-index: 200; width: 340px; max-width: 92vw; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,0.4); overflow: hidden; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; }
.notif-item:hover { background: var(--surface-alt); }
.notif-item:last-child { border-bottom: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-cat { font-size: 13px; font-weight: 600; }
.notif-meta { font-size: 11.5px; color: var(--text-dim); font-family: var(--font-mono); }
.notif-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* ---- Accueil pleine largeur : Vigipirate vraiment au bord droit ---- */
body[data-page="Accueil"] .page { max-width: 1400px; margin-left: auto; margin-right: auto; }
.home-top { grid-template-columns: 1fr 1fr; align-items: stretch; }
.home-top #state-hero, .home-top #vig-zone { margin: 0; height: 100%; }
.home-top .state-hero { height: 100%; }

/* ---- Timeline dans un bloc défilant isolé (fond contrasté, scrollbar masquée) ---- */
.tl-scroll {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: inset 0 0 24px rgba(0,0,0,0.25);
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE/Edge */
}
.tl-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }  /* Chrome/Safari */
:root[data-theme="light"] .tl-scroll { background: #EAECEF; box-shadow: inset 0 0 20px rgba(0,0,0,0.06); }
@media (max-width: 820px) { .tl-scroll { max-height: calc(100vh - 220px); } }

/* ---- Horloge en direct (fil de soirée) ---- */
.fil-clock { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--club);
  background: color-mix(in srgb, var(--club) 12%, transparent); padding: 3px 10px; border-radius: 100px; }

/* ---- Statistiques Shotgun (fil de soirée) ---- */
.sg-stats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.sg-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--club) 12%, var(--surface-alt)); border: 1px solid var(--border);
  border-radius: 100px; padding: 3px 11px; }

/* ---- UniFi Access : portes (réglages) ---- */
.ua-door { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }

/* ---- Bouton flottant « Revenir en live » (fil de soirée) ---- */
.btn-live { position: fixed; right: 20px; bottom: 24px; z-index: 120; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  border-radius: 100px; padding: 10px 18px; font-weight: 700; }

/* ---- Titre mobile : retour à la ligne (2 lignes max) au lieu de tronquer, ---- */
/* ---- sans épaissir exagérément la barre du haut. ---- */
@media (max-width: 640px) {
  .topbar { align-items: center; }
  .wordmark { font-size: 11px; max-width: 62vw; }
  .wordmark-tag {
    white-space: normal; overflow: hidden; text-overflow: clip;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    line-height: 1.15; font-size: 11px;
  }
}

/* ---- Ouvertures de portes (UniFi) : colonne À GAUCHE de la timeline. Les
       entrées sont décalées vers la droite (.has-doors) pour laisser la place. ---- */
.tl-body.has-doors .chip { left: 104px; }
.tl-body.has-doors .tl-live span, .tl-body.has-doors .tl-edge span { left: 104px; }
/* Barre de durée (session porte ouverte -> fermée) */
.door-bar { position: absolute; left: 2px; width: 5px; border-radius: 3px; z-index: 2;
  background: #8a5a2b; opacity: .55; }
/* Marque d'accès (badge / entrée / sortie) */
.door-mark { position: absolute; left: 10px; max-width: 92px; display: inline-flex; align-items: center; gap: 4px;
  height: 16px; padding: 0 6px; border-radius: 100px; z-index: 3;
  background: #8a5a2b; color: #fff; font-size: 10px; white-space: nowrap; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.door-mark .dm-t { font-family: var(--font-mono); font-size: 9px; opacity: .9; flex-shrink: 0; }
.door-mark .dm-l { overflow: hidden; text-overflow: ellipsis; }
.door-mark.refus { background: var(--danger); }

/* ---- Prochaines soirées Shotgun (accueil) ---- */
.sg-upcoming { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 20px; }
.sg-up-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.sg-up-card .n { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; }
.sg-up-card .d { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }
.sg-up-card .p { font-size: 13px; margin-top: 6px; }
.sg-up-card .p b { color: var(--club); }

/* ---- Zoom : curseur (slider) ---- */
#zoom-range { -webkit-appearance: none; appearance: none; width: 120px; height: 4px; border-radius: 4px;
  background: var(--surface-alt); outline: none; cursor: pointer; }
#zoom-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--club); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
#zoom-range::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--club);
  border: 2px solid var(--surface); }
@media (max-width: 560px) { #zoom-range { width: 84px; } }

/* ---- Présences + émargement (aside du fil) ---- */
.present-row { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-alt); border: 1px solid var(--border); }
.present-row.is-left { opacity: .62; }
.present-head { display: flex; align-items: center; gap: 8px; }
.present-head .avatar, .present-head .avatar-placeholder { width: 24px; height: 24px; font-size: 10px; }
.present-name { font-weight: 600; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.present-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 100px; color: var(--text-dim); background: var(--surface); }
.present-tag.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.present-times { font-size: 11.5px; color: var(--text-dim); font-family: var(--font-mono); }
.present-sigs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.present-sig { margin: 0; text-align: center; }
.present-sig img { width: 92px; height: 40px; object-fit: contain; background: #fff; border-radius: 6px;
  border: 1px solid var(--border); cursor: zoom-in; padding: 2px; }
.present-sig figcaption { font-size: 9.5px; color: var(--text-dim); margin-top: 2px; }

/* ---- Visionneuse plein écran (photos / signatures) ---- */
.mc-lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.mc-lightbox[hidden] { display: none; }
.mc-lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 8px; background: #fff; }
.mc-lightbox-close { position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; cursor: pointer; }
.mc-lightbox-close:hover { background: rgba(255,255,255,.28); }
.mc-att-photo.lightbox-img { cursor: zoom-in; }

/* ---- Case à cocher mise en forme (ex : identité vérifiée) ---- */
.mc-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; cursor: pointer; margin-top: 4px; }
.mc-check input { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--club); }

/* ---- Fiche agent dédiée ---- */
.mc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.agent-hero { display: flex; gap: 18px; align-items: center; }
.agent-photo-lg { width: 150px; height: 150px; border-radius: 16px; object-fit: cover; flex-shrink: 0; background: var(--surface-alt); }
.agent-photo-lg.agent-photo-ph { display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 52px; color: var(--text-dim); }
@media (max-width: 560px) { .agent-photo-lg { width: 110px; height: 110px; } }
.agent-hero-name { font-family: var(--font-display); font-size: 26px; margin: 0 0 2px; }
.agent-detail-row { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.agent-detail-row:last-child { border-bottom: none; }
.agent-detail-row .k { width: 190px; flex-shrink: 0; color: var(--text-dim); font-size: 13px; }
.agent-detail-row .v { font-size: 14px; }
.agent-chevron { margin-left: auto; align-self: center; color: var(--text-dim); font-size: 22px; }
@media (max-width: 560px) { .agent-detail-row { flex-direction: column; gap: 2px; } .agent-detail-row .k { width: auto; } }

/* ---- Groupes de permissions (modales rôle / utilisateur) ---- */
.perm-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 10px 0 0; }
.perm-group legend { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); padding: 0 6px; }
.perm-group label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); padding: 4px 0; }
.perm-group input[type=checkbox]:disabled { opacity: .5; }
.perm-group label:has(input:disabled) { opacity: .7; }

/* ---- Page Historique (façon inventaire) ---- */
.hist-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.hist-tabs button { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 100px; padding: 7px 16px; font-size: 13px; cursor: pointer; }
.hist-tabs button.active { background: var(--club); border-color: var(--club); color: #fff; font-weight: 600; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); }
.hist-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.hist-table tr:hover td { background: var(--surface-alt); }
.hist-when { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.hist-act { font-weight: 600; }
.hist-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 100px;
  background: var(--surface-alt); color: var(--text-dim); }
.hist-badge.alert { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.hist-badge.soiree { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* ---- Fiche agent : boutons en haut à droite, badge archive ---- */
.agent-hero { position: relative; }
.agent-hero-actions { position: absolute; top: 0; right: 0; display: flex; gap: 8px; }
.agent-arch-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 100px;
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); margin-left: 8px; }
.agent-card.archive { opacity: .6; }
@media (max-width: 560px) { .agent-hero-actions { position: static; margin-top: 10px; } }

/* ---- Sélection multiple des cartes agent ---- */
.agents-grid.selecting .agent-card { cursor: pointer; }
.agents-grid.selecting .agent-card .agent-chevron { display: none; }
.agent-card.is-selected { border-color: var(--club); box-shadow: 0 0 0 2px color-mix(in srgb, var(--club) 40%, transparent); }
#agents-select.active { color: var(--club); border-color: var(--club); }

/* ---- Sur mobile : accueil empilé (soirée puis Vigipirate) ---- */
@media (max-width: 820px) { .home-top { grid-template-columns: 1fr !important; } }
/* ---- Bouton « Sélectionner » actif (liste agents) : contour rouge lisible ---- */
#agents-select.active { background: transparent; color: var(--club); border-color: var(--club); }

/* ---- Fil élargi : la colonne « présents » va plus à droite ---- */
.page.page-wide { max-width: none; }
@media (min-width: 821px) { .page-wide .fil-layout { grid-template-columns: 1fr 320px; } }

/* ---- Compteurs "en gros" dans l'aside du fil ---- */
.fil-counters { display: flex; flex-direction: column; gap: 8px; }
.counter-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.counter-card.accent { border-color: var(--club); background: color-mix(in srgb, var(--club) 8%, var(--surface-alt)); }
.counter-card .cc-num { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--text); }
.counter-card.accent .cc-num { color: var(--club); }
.counter-card .cc-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text); }
.counter-card .cc-lbl { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .03em; }
.counter-card .cc-note { font-size: 11px; color: var(--warn); margin-top: 3px; }

/* ---- Animation plein écran de clôture de soirée ---- */
.closure-anim { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--club) 22%, #0b0d12), #07080b);
  opacity: 0; transition: opacity .4s ease; }
.closure-anim.show { opacity: 1; }
.closure-anim.out { opacity: 0; }
.closure-anim .ca-inner { text-align: center; transform: translateY(14px) scale(.96); opacity: 0;
  transition: transform .5s cubic-bezier(.2,.7,.3,1), opacity .5s ease; }
.closure-anim.show .ca-inner { transform: none; opacity: 1; }
.ca-check { width: 96px; height: 96px; }
.ca-circle { stroke: var(--club); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: caCircle .6s .15s ease forwards; }
.ca-tick { stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 48; stroke-dashoffset: 48; animation: caTick .4s .6s ease forwards; }
@keyframes caCircle { to { stroke-dashoffset: 0; } }
@keyframes caTick { to { stroke-dashoffset: 0; } }
.ca-title { font-family: var(--font-display); font-weight: 700; font-size: 32px; color: #fff; margin-top: 14px; }
.ca-sub { font-family: var(--font-display); font-size: 18px; color: var(--club); margin-top: 4px; }
.ca-sub2 { color: rgba(255,255,255,.75); font-size: 14px; margin-top: 10px; }
.ca-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---- Animation bascule vue <-> édition (fiche agent) ---- */
#agent-view.view-anim { animation: agentFade .28s cubic-bezier(.2,.7,.3,1); }
@keyframes agentFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- Horloge en direct à volets ---- */
#fil-clock { display: inline-flex; }
.clk-c { display: inline-block; }
.clk-c.flip { animation: clkFlip .35s cubic-bezier(.2,.7,.3,1); }
@keyframes clkFlip { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Présents cliquables (signatures dans une fenêtre) ---- */
button.present-row.present-click { width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.present-row.present-click:hover { border-color: var(--club); }
.present-chev { margin-left: auto; color: var(--text-dim); font-size: 18px; }
.present-nosig { width: 92px; height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-dim); background: var(--surface-alt); border: 1px dashed var(--border); border-radius: 6px; }

/* ---- Détail d'une entrée (design soigné) ---- */
.entry-detail { --grav: var(--text-dim); }
.ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ed-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-title h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.ed-libre { color: var(--text-dim); font-weight: 400; font-size: 16px; }
.ed-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--grav) 20%, transparent); }
.ed-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.ed-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 10px;
  border-radius: 100px; background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.ed-badge { font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 100px; text-transform: uppercase; letter-spacing: .03em; }
.ed-badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.ed-badge.draft { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.ed-body { margin-top: 14px; }
.ed-body .mc-detail { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.ed-body .mc-detail > p:first-child { margin-top: 0; }
.ed-body .mc-detail strong { display: block; margin: 14px 0 6px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-dim); }
.ed-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
