/* ============================================================
   RHODE ISLAND RP — Règlement officiel
   Design : navy / gold, inspiration "document d'État"
   ============================================================ */

:root {
  /* Palette */
  --navy-900: #050f22;
  --navy-800: #0a1f3d;
  --navy-700: #11295a;
  --navy-600: #1a3a78;
  --navy-500: #2a4d8f;
  --gold-500: #d4af37;
  --gold-400: #e6c659;
  --gold-300: #f0d875;
  --cream-100: #f5f0e6;
  --cream-200: #ede4d0;
  --muted: #7888a8;
  --muted-strong: #9aa8c2;
  --success: #6ab988;
  --success-glow: rgba(106, 185, 136, 0.4);
  --danger: #d97777;

  /* Typo */
  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "DM Sans", -apple-system, sans-serif;

  /* Layout */
  --radius: 4px;
  --shadow-deep: 0 30px 80px -20px rgba(0, 0, 0, 0.7),
                 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* ---- Reset léger ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--cream-100);
  background: var(--navy-900);
  background-image:
    radial-gradient(ellipse at top, var(--navy-700) 0%, var(--navy-900) 50%, #02060f 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Fond décoratif : grain + étoiles ---- */
.bg-noise {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' /></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.bg-stars {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, var(--gold-500), transparent),
    radial-gradient(1px 1px at 70% 60%, var(--gold-400), transparent),
    radial-gradient(1px 1px at 40% 80%, var(--cream-100), transparent),
    radial-gradient(1px 1px at 90% 20%, var(--gold-500), transparent),
    radial-gradient(1px 1px at 10% 70%, var(--cream-100), transparent),
    radial-gradient(1.5px 1.5px at 60% 15%, var(--gold-400), transparent),
    radial-gradient(1px 1px at 85% 85%, var(--cream-200), transparent),
    radial-gradient(1px 1px at 30% 50%, var(--gold-300), transparent);
  background-size: 400px 400px, 350px 350px, 450px 450px, 380px 380px, 420px 420px, 360px 360px, 410px 410px, 390px 390px;
  background-position: 0 0, 100px 50px, 50px 200px, 200px 100px, 300px 300px, 150px 250px, 250px 50px, 100px 150px;
}

/* ---- Vues ---- */
.view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: none;
}
.view[data-active] { display: flex; }

/* ============================================================
   VUE LOGIN
   ============================================================ */

.view-login {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  max-width: 520px;
  width: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: var(--radius);
  padding: 56px 48px 48px;
  text-align: center;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-deep);
  animation: cardRise 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardRise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-card::before,
.login-card::after {
  content: "";
  position: absolute;
  width: 30px; height: 30px;
  border: 1px solid var(--gold-500);
  opacity: 0.5;
}
.login-card::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.login-card::after  { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.seal {
  width: 80px;
  height: 80px;
  margin: 0 auto 28px;
  color: var(--gold-500);
  animation: sealSpin 30s linear infinite;
}
@keyframes sealSpin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

.overline {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin: 0 0 16px;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 56px;
  line-height: 0.95;
  margin: 0 0 24px;
  color: var(--cream-100);
  letter-spacing: -0.02em;
}
.login-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--gold-400);
}

.login-sub {
  font-size: 15px;
  color: var(--muted-strong);
  margin: 0 0 36px;
  max-width: 380px;
  margin-inline: auto;
  margin-bottom: 36px;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, #5865F2 0%, #4752c4 100%);
  color: #fff;
  padding: 16px 36px;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(88, 101, 242, 0.55);
}
.btn-primary:active {
  transform: translateY(0);
}

.login-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 32px;
  font-style: italic;
}
.login-note strong {
  color: var(--gold-400);
  font-style: normal;
}

.error-banner {
  margin-top: 24px;
  padding: 12px 16px;
  background: rgba(217, 119, 119, 0.1);
  border: 1px solid rgba(217, 119, 119, 0.3);
  border-radius: var(--radius);
  color: #ffcaca;
  font-size: 13px;
}

.login-footer {
  margin-top: 48px;
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================================
   VUE RÈGLEMENT
   ============================================================ */

.view-rules {
  flex-direction: column;
  align-items: stretch;
  padding-bottom: 100px; /* place pour la accept-bar */
}

/* Header sticky */
.rules-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(5, 15, 34, 0.92);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-display);
}
.brand-mark {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.1em;
  color: var(--gold-500);
}
.brand-sep {
  width: 1px;
  height: 18px;
  background: rgba(212, 175, 55, 0.3);
}
.brand-title {
  font-style: italic;
  font-size: 18px;
  color: var(--cream-100);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 999px;
  font-size: 13px;
  color: var(--cream-100);
}
.user-logout {
  color: var(--muted-strong);
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.user-logout:hover { color: var(--gold-400); }

.progress-track {
  height: 2px;
  background: rgba(212, 175, 55, 0.1);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px var(--gold-500);
}

/* Layout : sidebar + content */
.rules-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

/* Sidebar */
.rules-nav {
  position: sticky;
  top: 100px;
}
.nav-inner {
  padding: 24px;
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.nav-overline {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-500);
  margin: 0 0 6px;
}
.nav-count {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--cream-100);
}
.nav-count strong { color: var(--gold-400); }
.nav-help {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 24px;
  font-style: italic;
}

.section-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.section-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted-strong);
  border-radius: 3px;
  text-align: left;
  transition: all 0.2s;
  font-weight: 500;
  width: 100%;
}
.section-nav button:hover {
  background: rgba(212, 175, 55, 0.05);
  color: var(--cream-100);
}
.section-nav button.active {
  background: rgba(212, 175, 55, 0.1);
  color: var(--cream-100);
}
.section-nav button .nav-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-size: 10px;
}
.section-nav button.done {
  color: var(--cream-100);
}
.section-nav button.done .nav-check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 10px var(--success-glow);
}

/* Content area */
.rules-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
  scroll-margin-top: 90px;
}
.section-card.done {
  border-color: rgba(106, 185, 136, 0.35);
  box-shadow: 0 0 0 1px rgba(106, 185, 136, 0.1), 0 20px 40px -20px rgba(106, 185, 136, 0.15);
}

.section-head {
  padding: 28px 36px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.section-head-text { flex: 1; min-width: 0; }
.section-head .overline { margin-bottom: 8px; }
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--cream-100);
}
.section-head .badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(122, 137, 168, 0.1);
  color: var(--muted-strong);
  border: 1px solid rgba(122, 137, 168, 0.2);
  transition: all 0.4s;
}
.section-card.done .badge {
  background: rgba(106, 185, 136, 0.15);
  color: var(--success);
  border-color: rgba(106, 185, 136, 0.4);
}

.section-body {
  padding: 24px 36px 32px;
  color: var(--cream-200);
  font-size: 15px;
  line-height: 1.75;
}

.section-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin: 28px 0 12px;
  color: var(--gold-400);
  letter-spacing: 0;
}
.section-body h3:first-child { margin-top: 4px; }

.section-body h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cream-100);
  margin: 20px 0 8px;
}

.section-body p { margin: 0 0 14px; }
.section-body p:last-child { margin-bottom: 0; }
.section-body strong { color: var(--cream-100); font-weight: 600; }
.section-body em { color: var(--gold-300); font-style: italic; }

.section-body ul,
.section-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}
.section-body li { margin-bottom: 6px; }
.section-body li::marker { color: var(--gold-500); }

.section-body blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--gold-500);
  background: rgba(212, 175, 55, 0.05);
  font-style: italic;
  color: var(--cream-100);
  font-size: 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}
.section-body th {
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-400);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.15);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.section-body td {
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.1);
  vertical-align: top;
}
.section-body code {
  font-family: "SF Mono", Menlo, monospace;
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-300);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Sentinel : la marque "fin de section" qui déclenche la validation */
.section-end {
  margin: 32px -36px -32px;
  padding: 18px 36px;
  border-top: 1px dashed rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.025);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  transition: all 0.4s;
}
.section-card.done .section-end {
  color: var(--success);
  background: rgba(106, 185, 136, 0.08);
  border-top-color: rgba(106, 185, 136, 0.3);
  border-top-style: solid;
}
.section-end .end-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* Accept bar */
.accept-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(5, 15, 34, 0.95);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.4);
}
.accept-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.accept-status {
  font-size: 13px;
  color: var(--muted-strong);
}
.accept-status strong { color: var(--gold-400); }
.accept-status.complete { color: var(--success); }

.btn-accept {
  background: rgba(212, 175, 55, 0.1);
  color: var(--muted);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 14px 32px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: all 0.3s;
  cursor: not-allowed;
}
.btn-accept:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-400) 100%);
  color: var(--navy-900);
  border-color: var(--gold-300);
  cursor: pointer;
  box-shadow: 0 0 0 0 var(--gold-500), 0 10px 30px -5px rgba(212, 175, 55, 0.5);
  animation: pulseGold 2s ease-in-out infinite;
}
.btn-accept:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15), 0 14px 36px -5px rgba(212, 175, 55, 0.6);
}
@keyframes pulseGold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0), 0 10px 30px -5px rgba(212, 175, 55, 0.5); }
  50%      { box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15), 0 10px 30px -5px rgba(212, 175, 55, 0.5); }
}
.btn-accept[aria-busy="true"] .btn-label::after {
  content: "…";
}

/* ============================================================
   VUE SUCCÈS
   ============================================================ */

.view-success {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.success-card {
  max-width: 560px;
  width: 100%;
  text-align: center;
  padding: 60px 40px;
  animation: cardRise 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 32px;
  border-radius: 50%;
  background: rgba(106, 185, 136, 0.1);
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  box-shadow: 0 0 50px var(--success-glow);
  animation: pulseGreen 2.5s ease-in-out infinite;
}
@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 30px var(--success-glow); }
  50%      { box-shadow: 0 0 60px var(--success-glow); }
}

.success-card h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 56px;
  line-height: 0.95;
  margin: 0 0 24px;
  color: var(--cream-100);
  letter-spacing: -0.02em;
}
.success-card h2 em {
  font-style: italic;
  color: var(--gold-400);
  font-weight: 400;
}

.success-text {
  color: var(--muted-strong);
  margin: 0 0 32px;
  font-size: 15px;
}
.success-text strong { color: var(--gold-400); }
.success-hint {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold-300);
  font-size: 18px;
  margin: 0;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 14px 24px;
  background: rgba(217, 119, 119, 0.95);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .view-rules {
    padding-bottom: 160px;
  }
  .rules-layout {
    grid-template-columns: 1fr;
    padding: 24px 16px;
    gap: 24px;
  }
  .rules-nav {
    position: static;
  }
  .nav-inner { padding: 16px; }
  .section-nav { max-height: 200px; overflow-y: auto; }

  .header-inner { padding: 14px 16px; }
  .brand-title { display: none; }

  .section-head { padding: 20px 22px 16px; }
  .section-head h2 { font-size: 24px; }
  .section-body { padding: 18px 22px 24px; font-size: 14px; }
  .section-end { margin: 24px -22px -24px; padding: 14px 22px; }

  .accept-inner {
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }
  .btn-accept { width: 100%; }
  .accept-status { text-align: center; }

  .login-card { padding: 40px 24px 32px; }
  .login-title { font-size: 42px; }
  .success-card h2 { font-size: 42px; }
}

/* Scrollbar custom */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--navy-900); }
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(212, 175, 55, 0.4); }

/* ============================================================
   MODE CONSULTATION (Citoyen) — lecture libre
   ============================================================ */

/* Pill "Consultation libre" visible uniquement en mode consult */
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-pill {
  display: none; /* caché par défaut, montré en mode consult */
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(106, 185, 136, 0.1);
  border: 1px solid rgba(106, 185, 136, 0.35);
  color: var(--success);
}

body[data-mode="consult"] .mode-pill-consult {
  display: inline-flex;
}

/* En mode consult : on cache la barre d'acceptation flottante */
body[data-mode="consult"] .accept-bar {
  display: none;
}

/* En mode consult : on cache la barre de progression (top header) */
body[data-mode="consult"] .progress-track {
  display: none;
}

/* En mode consult : sidebar plus aérée, numéros au lieu de checks */
body[data-mode="consult"] .nav-count {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
}

body[data-mode="consult"] .section-nav button .nav-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.3);
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--gold-400);
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.25s;
}

body[data-mode="consult"] .section-nav button:hover .nav-num,
body[data-mode="consult"] .section-nav button.active .nav-num {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
}

/* Layout reste identique, juste un peu plus de respiration en bas */
body[data-mode="consult"] .rules-layout {
  padding-bottom: 100px;
}

/* ============================================================
   BOUTON ACCÈS FONDATEUR
   ============================================================ */

.btn-fondateur {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy-900);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  border: 1px solid var(--gold-500);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
}

/* Bug fix : sans ça, `display: inline-flex` écrasait l'attribut HTML `hidden`,
   ce qui faisait apparaître le bouton à tous les utilisateurs. */
.btn-fondateur[hidden] {
  display: none !important;
}

.btn-fondateur:hover {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.45);
}

.btn-fondateur svg {
  filter: drop-shadow(0 0 4px rgba(255, 215, 100, 0.4));
}

@media (max-width: 720px) {
  .btn-fondateur {
    padding: 6px 10px;
    font-size: 10px;
  }
  .btn-fondateur span.label { display: none; }
}

/* ============================================================
   VUE ADMIN — Dashboard Fondateur
   ============================================================ */

.view-admin {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.view-admin[data-active] {
  display: flex;
}

.admin-header {
  background: linear-gradient(180deg, rgba(10, 31, 61, 0.95), rgba(5, 15, 34, 0.85));
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-crown {
  font-size: 38px;
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.5));
}

.admin-brand h1 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 4px 0 0;
  color: var(--cream-100);
  font-weight: 500;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-100);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-back:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-500);
}

.admin-body {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  width: 100%;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(17, 41, 90, 0.5), rgba(10, 31, 61, 0.3));
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-500), transparent);
  opacity: 0.6;
}

.stat-card:hover {
  border-color: rgba(212, 175, 55, 0.35);
  transform: translateY(-2px);
}

.stat-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-strong);
  margin: 0 0 12px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  color: var(--cream-100);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-hint {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

.stat-suspect .stat-value { color: #e8a87c; }
.stat-suspect::before { background: linear-gradient(90deg, #e8a87c, transparent); }
.stat-accepted .stat-value { color: var(--success); }
.stat-accepted::before { background: linear-gradient(90deg, var(--success), transparent); }

/* Filtres */
.visitors-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-strong);
  background: rgba(17, 41, 90, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover {
  color: var(--cream-100);
  border-color: rgba(212, 175, 55, 0.35);
}

.filter-chip.is-active {
  color: var(--navy-900);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  border-color: var(--gold-500);
}

.sort-select {
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--cream-100);
  background: rgba(17, 41, 90, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 100px;
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--gold-500);
}

.sort-select option {
  background: var(--navy-800);
}

/* Table visiteurs */
.visitors-list {
  background: linear-gradient(180deg, rgba(17, 41, 90, 0.3), rgba(10, 31, 61, 0.2));
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  padding: 8px;
  min-height: 200px;
}

.visitors-loading, .visitors-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}

.visitors-table {
  display: flex;
  flex-direction: column;
}

.visitors-row {
  display: grid;
  grid-template-columns: 1.8fr 1.1fr 0.6fr 0.85fr 0.95fr 0.7fr 1fr 0.9fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  transition: background 0.2s;
}

.visitors-row:hover:not(.visitors-head) {
  background: rgba(212, 175, 55, 0.04);
}

.visitors-head {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-strong);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  margin-bottom: 4px;
}

.visitors-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.visitor-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-700));
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-400);
  flex-shrink: 0;
}

.visitor-name {
  font-weight: 600;
  color: var(--cream-100);
}

.cell-when {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Role pills */
.role-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.role-non_verifie { background: rgba(232, 168, 124, 0.15); color: #e8a87c; }
.role-citoyen    { background: rgba(106, 185, 136, 0.15); color: var(--success); }
.role-fondateur  { background: rgba(212, 175, 55, 0.15); color: var(--gold-400); }

/* State badges */
.state-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.state-accepted { background: rgba(106, 185, 136, 0.15); color: var(--success); }
.state-suspect  { background: rgba(232, 168, 124, 0.18); color: #e8a87c; }
.state-progress { background: rgba(212, 175, 55, 0.12); color: var(--gold-400); }
.state-consult  { background: rgba(122, 136, 168, 0.15); color: var(--muted-strong); }

/* Responsive : table → cartes en mobile */
@media (max-width: 880px) {
  .visitors-head { display: none; }
  .visitors-row:not(.visitors-head) {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "user user"
      "role visits"
      "time validated"
      "sections state"
      "when when";
    gap: 8px 16px;
    padding: 16px;
    background: rgba(212, 175, 55, 0.04);
    margin-bottom: 8px;
  }
  .cell-user { grid-area: user; }
  .visitors-row [role="cell"]:nth-child(2) { grid-area: role; }
  .visitors-row [role="cell"]:nth-child(3) { grid-area: visits; }
  .visitors-row [role="cell"]:nth-child(4) { grid-area: time; }
  .visitors-row [role="cell"]:nth-child(5) { grid-area: validated; }
  .visitors-row [role="cell"]:nth-child(6) { grid-area: sections; }
  .visitors-row [role="cell"]:nth-child(7) { grid-area: state; }
  .visitors-row [role="cell"]:nth-child(8) { grid-area: when; }
  .visitors-row .num { text-align: left; }
  .admin-header-inner { padding: 16px; flex-direction: column; align-items: flex-start; gap: 12px; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ============================================================
   ADMIN — Activity Chart + Leaderboard + Modal
   ============================================================ */

.admin-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 48px;
}

@media (max-width: 1024px) {
  .admin-row { grid-template-columns: 1fr; }
}

.card-panel {
  background: linear-gradient(180deg, rgba(17, 41, 90, 0.5), rgba(10, 31, 61, 0.3));
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--cream-100);
  margin: 0;
}

.panel-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted-strong);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-arrivals { background: var(--gold-500); }
.dot-validations { background: var(--success); }

.panel-loading,
.panel-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
}

/* === ACTIVITY CHART === */

.activity-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-top: 8px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  cursor: default;
}

.bar-group:hover {
  filter: brightness(1.15);
}

.bar-group::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-900);
  border: 1px solid var(--gold-500);
  color: var(--cream-100);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 5;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}

.bar-group:hover::before {
  opacity: 1;
}

.bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.bar {
  width: 50%;
  max-width: 14px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: height 0.4s cubic-bezier(.34,1.56,.64,1);
}

.bar-arrivals { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); }
.bar-validations { background: linear-gradient(180deg, #8fd9aa, var(--success)); }

.bar-val {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: var(--cream-100);
  margin-bottom: 2px;
}

.bar-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.chart-totals {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 12px;
  color: var(--muted-strong);
}

/* === LEADERBOARD === */

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-item {
  display: grid;
  grid-template-columns: 36px 36px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(10, 31, 61, 0.3);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.lb-item:hover {
  background: rgba(212, 175, 55, 0.06);
  border-color: rgba(212, 175, 55, 0.15);
}

.lb-item.is-fondateur {
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.08);
}

.lb-rank {
  font-size: 22px;
  text-align: center;
  line-height: 1;
}

.lb-num {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--gold-400);
  font-weight: 600;
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-700));
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-400);
  font-size: 15px;
}

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

.lb-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--cream-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-crown {
  font-style: normal;
  font-size: 12px;
  margin-left: 2px;
}

.lb-stats {
  font-size: 11.5px;
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
}

/* === MODAL === */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 34, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: modalFade 0.2s ease;
}

.modal-backdrop[hidden] {
  display: none !important;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: linear-gradient(180deg, rgba(13, 37, 64, 0.98), rgba(5, 15, 34, 0.98));
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 60px rgba(212,175,55,0.15);
  animation: modalSlideIn 0.3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalSlideIn {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--cream-100);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  display: grid;
  place-items: center;
}

.modal-close:hover {
  background: var(--gold-500);
  color: var(--navy-900);
  transform: rotate(90deg);
}

.modal-head {
  display: flex;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.modal-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-800));
  border: 2px solid var(--gold-500);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-400);
  font-size: 26px;
  flex-shrink: 0;
}

.modal-identity {
  flex: 1;
  min-width: 0;
}

.modal-identity h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--cream-100);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.modal-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.modal-id {
  font-size: 11px;
  color: var(--muted);
}

.modal-id code {
  font-family: var(--font-body);
  background: rgba(212, 175, 55, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.modal-id code:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.3);
}

.modal-id code.copied::after {
  content: " ✓ copié";
  color: var(--success);
  font-weight: 600;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.modal-stat {
  background: rgba(10, 31, 61, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 8px;
  padding: 14px 16px;
}

.modal-stat-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-strong);
  margin-bottom: 6px;
}

.modal-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--cream-100);
  font-weight: 500;
  line-height: 1;
}

.modal-stat-value.is-suspect {
  color: #e8a87c;
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin: 0 0 14px 0;
}

.modal-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.modal-timeline::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 20px;
  bottom: 20px;
  width: 1px;
  background: linear-gradient(180deg, var(--gold-500), transparent);
  opacity: 0.4;
}

.modal-timeline li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: flex-start;
  position: relative;
}

.tl-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-800);
  border: 1px solid rgba(212, 175, 55, 0.3);
  display: grid;
  place-items: center;
  font-size: 16px;
  z-index: 1;
  position: relative;
}

.modal-timeline strong {
  display: block;
  font-size: 14px;
  color: var(--cream-100);
  font-weight: 600;
  margin-bottom: 2px;
}

.tl-time {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.modal-warning {
  background: rgba(232, 168, 124, 0.1);
  border: 1px solid rgba(232, 168, 124, 0.35);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--cream-100);
  line-height: 1.5;
}

.modal-warning strong {
  color: #e8a87c;
}

@media (max-width: 640px) {
  .modal-card { padding: 20px; }
  .modal-stats { grid-template-columns: 1fr 1fr; }
  .modal-identity h2 { font-size: 22px; }
  .modal-avatar { width: 54px; height: 54px; font-size: 22px; }
}
