:root {
  /* Palette SNOOKER MASTER (identique à l'application) */
  --gold: #D4AF37;
  --gold-light: #F2D57E;
  --gold-dark: #9C7A1E;

  --table-green: #0B8A47;
  --table-green-dark: #06693A;
  --felt: #0E7A44;
  --felt-edge: #0A5A33;

  --bg: #17191C;
  --bg-2: #202327;
  --bg-3: #262A2E;
  --darker: #101214;
  --border: #2E3237;
  --border-light: rgba(255, 255, 255, 0.10);
  --text: #F2F4F8;
  --text-dim: #9AA3B2;

  --primary: #0B6E4F;
  --secondary: #33691E;
  --accent: #7CB342;
  --player1: #E53935;
  --player2: #1E88E5;
  --end-turn-blue: #1E6FE8;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--player2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ Pages de connexion ============ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top left, rgba(212, 175, 55, 0.10), transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(11, 138, 71, 0.12), transparent 50%),
    var(--bg);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card, var(--bg-2));
  background: linear-gradient(160deg, #202327 0%, #17191C 100%);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 38px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }

.logo-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--gold-light), var(--gold-dark));
  color: #14171c;
  font-weight: 900;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 26px rgba(212, 175, 55, 0.5);
  overflow: hidden;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 5px;
}

.login-title { font-size: 24px; font-weight: 900; letter-spacing: 1px; }
.login-subtitle {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--gold);
  margin: 4px 0 20px;
}
.login-hint { margin-top: 16px; font-size: 12px; color: var(--text-dim); }

/* ============ Champs ============ */
.field-label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 6px;
  letter-spacing: 0.5px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
select.field-input option { background: var(--bg-3); }

/* ============ Boutons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #14171c;
}
.btn-gold:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

.btn-green { background: var(--table-green-dark); color: #fff; border: 1px solid var(--table-green); }
.btn-green:hover { filter: brightness(1.15); }

.btn-red { background: #b71c1c; color: #fff; border: 1px solid var(--player1); }
.btn-red:hover { filter: brightness(1.15); }

.btn-blue { background: #0d47a1; color: #fff; border: 1px solid var(--player2); }
.btn-blue:hover { filter: brightness(1.15); }

.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }

/* ============ Layout applicatif ============ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--darker) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-circle { width: 46px; height: 46px; font-size: 16px; box-shadow: none; }
.brand-name { font-weight: 900; font-size: 16px; letter-spacing: 0.5px; }
.brand-sub { font-size: 9px; letter-spacing: 2px; color: var(--gold); }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--border-light); color: var(--text); }
.nav-item.active {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.30);
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #14171c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}
.user-name { font-weight: 700; font-size: 13px; }
.user-role { font-size: 11px; color: var(--gold); }

.main {
  flex: 1;
  padding: 22px 26px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at top right, rgba(212, 175, 55, 0.05), transparent 50%),
    var(--bg);
}

/* ============ Entêtes ============ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 14px; }
.page-title { font-size: 24px; font-weight: 900; }
.page-subtitle { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ============ Alertes ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}
.alert-success { background: rgba(124, 179, 66, 0.12); border: 1px solid rgba(124, 179, 66, 0.4); color: var(--accent); }
.alert-error { background: rgba(229, 57, 53, 0.12); border: 1px solid rgba(229, 57, 53, 0.4); color: #ef9a9a; }
.alert-info { background: rgba(30, 136, 229, 0.12); border: 1px solid rgba(30, 136, 229, 0.4); color: #90caf9; }

/* ============ Cartes ============ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-title {
  font-size: 13px;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

/* ============ Statut de liaison App <-> Panel ============ */
.app-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
}
.app-status-chip .app-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa4b0;
  flex: 0 0 auto;
}
.app-status-chip.connected { border-color: rgba(124, 179, 66, 0.5); color: #c8e6c9; }
.app-status-chip.connected .app-status-dot { background: var(--accent); box-shadow: 0 0 6px rgba(124, 179, 66, 0.8); }
.app-status-chip.disconnected { border-color: rgba(229, 57, 53, 0.4); color: #ef9a9a; }
.app-status-chip.disconnected .app-status-dot { background: var(--player1); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* ============ Cartes statistiques ============ */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.stat-value { font-size: 26px; font-weight: 900; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-dim); letter-spacing: 0.5px; }

/* ============ Match en direct ============ */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid var(--player1);
  border-radius: 20px;
  color: #ef9a9a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--player1); }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); } }

/* Tableau vert façon billard */
.match-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 0;
  background: radial-gradient(ellipse at center, #0E7A44 0%, #0A5A33 100%);
  border: 1px solid #1a9c5a;
  border-radius: 20px;
  padding: 22px 16px;
}
.match-player { text-align: center; flex: 1; }
.match-player-name { font-size: 18px; font-weight: 800; color: #fff; }
.match-player-score { font-size: 54px; font-weight: 900; line-height: 1.1; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.match-score { font-size: 26px; font-weight: 900; margin: 6px 0 2px; color: #fff; }
.match-color-tag {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.match-score-pill {
  position: relative;
  text-align: center;
  min-width: 110px;
}
.match-score-pill .frames {
  font-size: 34px;
  font-weight: 900;
  color: #14171c;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border: 1px solid rgba(212, 175, 55, 0.6);
  border-radius: 16px;
  padding: 10px 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.match-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.match-meta span { font-size: 12px; color: var(--text-dim); }
.match-meta b { color: var(--text); font-weight: 700; }

.player-card {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.player-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, var(--gold-light), var(--gold-dark));
  color: #14171c;
  font-weight: 900;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}
.match-player .player-avatar { margin-bottom: 10px; box-shadow: 0 0 0 3px rgba(255,255,255,0.25); }

/* ============ Tableaux ============ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}
.table tbody tr:hover { background: var(--border-light); }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 12px;
  background: var(--border-light);
}
.rank-1 { background: rgba(212, 175, 55, 0.2); color: var(--gold); }
.rank-2 { background: rgba(200, 200, 210, 0.18); color: #d7dde6; }
.rank-3 { background: rgba(205, 127, 50, 0.22); color: #e0a066; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: rgba(124, 179, 66, 0.15); color: var(--accent); }
.badge-red { background: rgba(229, 57, 53, 0.15); color: #ef9a9a; }
.badge-blue { background: rgba(30, 136, 229, 0.15); color: #90caf9; }
.badge-gold { background: rgba(212, 175, 55, 0.15); color: var(--gold); }

/* ============ Liste d'attente ============ */
.wait-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.wait-item.next { border-color: var(--gold); background: rgba(212, 175, 55, 0.06); }
.wait-rank {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: var(--border-light);
}
.wait-name { font-weight: 700; flex: 1; }
.wait-src { font-size: 11px; color: var(--text-dim); }
.wait-actions { display: flex; align-items: center; gap: 6px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty-state .big { font-size: 40px; margin-bottom: 8px; }

/* ============ Avatars ============ */
.avatar-cell { width: 46px; }
.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(212, 175, 55, 0.35);
}
.avatar-placeholder {
  background: radial-gradient(circle at 30% 25%, var(--gold-light), var(--gold-dark));
  color: #14171c;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-file-input { display: none; }
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-wait { width: 34px; height: 34px; font-size: 15px; flex-shrink: 0; }
.player-avatar-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* ============ Recherche & ajout rapide (liste d'attente) ============ */
.wsearch { box-sizing: border-box; }
.wquick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-add-item { margin: 0; }
.quick-add-item .btn {
  display: inline-flex;
  align-items: center;
  max-width: 210px;
}
.qav {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
.qav-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 25%, var(--gold-light), var(--gold-dark));
  color: #14171c;
  font-weight: 900;
  font-size: 11px;
}

/* ============ Formulaire inline ============ */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field-label { flex-basis: 100%; }

.form-card { max-width: 620px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field-label { flex-basis: 100%; }
.form-row > div { flex: 1; min-width: 200px; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar { width: 80px; }
  .sidebar-brand .brand-name, .sidebar-brand .brand-sub,
  .nav-item span:not(.nav-icon), .user-chip div:last-child { display: none; }
  .nav-item { justify-content: center; }
  .nav-icon { width: auto; }
  .main { padding: 16px; }
  .match-player-score { font-size: 40px; }
}

.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   THÈMES VISUELS DU PANEL
   Chaque thème ne redéfinit que des variables CSS (le layout ne bouge pas).
   Le thème "glass" ajoute en plus la matière vitreuse (transparence + blur).
   ===================================================================== */

/* ---- ROYAL : or sur ardoise profonde ---- */
body[data-theme="royal"] {
  --gold: #E6C15C;
  --gold-light: #F6E7A7;
  --gold-dark: #B8902E;
  --bg: #141216;
  --bg-2: #1D1A22;
  --bg-3: #262228;
  --darker: #0E0C10;
  --border: #312C37;
  --border-light: rgba(255, 255, 255, 0.10);
  --primary: #0B6E4F;
  --secondary: #5A4E12;
  --accent: #D4AF37;
  --player1: #F87171;
  --player2: #A5B4FC;
  --text: #F7F3E8;
  --text-dim: #B4A78F;
}

/* ---- EMERALD : vert billard / feutre ---- */
body[data-theme="emerald"] {
  --gold: #C7EFD4;
  --gold-light: #EAFBE9;
  --gold-dark: #7FD1A0;
  --bg: #0B2317;
  --bg-2: #10301F;
  --bg-3: #123A25;
  --darker: #07190F;
  --border: #1E4A30;
  --border-light: rgba(140, 255, 190, 0.10);
  --table-green: #1FBF6B;
  --table-green-dark: #0E9450;
  --felt: #17A05A;
  --felt-edge: #0C6B3B;
  --primary: #0E9450;
  --secondary: #2E7D32;
  --accent: #66BB6A;
  --player1: #FF7B6B;
  --player2: #66BBFF;
  --text: #EAF7EF;
  --text-dim: #A3C9B0;
}

/* ---- OCEAN : bleu profond / cyan ---- */
body[data-theme="ocean"] {
  --gold: #FFD98E;
  --gold-light: #FFE9B8;
  --gold-dark: #C9974A;
  --bg: #07141F;
  --bg-2: #0C2233;
  --bg-3: #102C40;
  --darker: #040C13;
  --border: #1C3F57;
  --border-light: rgba(120, 200, 255, 0.10);
  --primary: #0E7490;
  --secondary: #155E75;
  --accent: #22D3EE;
  --player1: #FB7185;
  --player2: #38BDF8;
  --text: #ECF7FE;
  --text-dim: #9CC3D6;
}

/* ---- CRIMSON : rouge moderne ---- */
body[data-theme="crimson"] {
  --gold: #FFC26B;
  --gold-light: #FFDDA8;
  --gold-dark: #C99041;
  --bg: #170B0D;
  --bg-2: #231014;
  --bg-3: #2C1318;
  --darker: #0F0507;
  --border: #3A1A20;
  --border-light: rgba(255, 140, 150, 0.10);
  --primary: #B71C1C;
  --secondary: #6D1F2E;
  --accent: #F25C54;
  --player1: #FF5D5D;
  --player2: #7EB8FF;
  --text: #FDF0F1;
  --text-dim: #D6A9AE;
}

body[data-theme="royal"] .nav-item.active,
body[data-theme="emerald"] .nav-item.active,
body[data-theme="ocean"] .nav-item.active,
body[data-theme="crimson"] .nav-item.active {
  background: rgba(255, 255, 255, 0.06);
}

/* ---- GLASS : verre dépoli (template demandé) ---- */
body[data-theme="glass"] {
  --gold: #F2E9C4;
  --gold-light: #FFF6DC;
  --gold-dark: #C9B458;
  --table-green: #8FE0B4;
  --table-green-dark: #57C98F;
  --felt: #5CB98C;
  --felt-edge: #3E8F68;
  --bg: transparent;
  --bg-2: rgba(255, 255, 255, 0.07);
  --bg-3: rgba(255, 255, 255, 0.11);
  --darker: rgba(5, 7, 15, 0.9);
  --border: rgba(255, 255, 255, 0.14);
  --border-light: rgba(255, 255, 255, 0.18);
  --text: #F4F6FB;
  --text-dim: #A9B4CC;
  --primary: #38BDF8;
  --secondary: #818CF8;
  --accent: #34D399;
  --player1: #FB7185;
  --player2: #60A5FA;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
  background:
    radial-gradient(1200px 800px at 15% 0%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(1100px 800px at 90% 10%, rgba(129, 140, 248, 0.20), transparent 60%),
    radial-gradient(1400px 900px at 50% 115%, rgba(52, 211, 153, 0.16), transparent 60%),
    linear-gradient(135deg, #0B1023 0%, #141B3D 45%, #0D1226 100%);
  background-attachment: fixed;
}
body[data-theme="glass"].login-body {
  background:
    radial-gradient(1200px 800px at 15% 0%, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(1100px 800px at 90% 10%, rgba(129, 140, 248, 0.24), transparent 60%),
    radial-gradient(1400px 900px at 50% 115%, rgba(52, 211, 153, 0.18), transparent 60%),
    linear-gradient(135deg, #0B1023 0%, #141B3D 45%, #0D1226 100%);
  background-attachment: fixed;
}
body[data-theme="glass"] .main { background: transparent; }
body[data-theme="glass"] .sidebar {
  background: rgba(10, 14, 30, 0.55);
  backdrop-filter: blur(24px) saturate(150%);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
body[data-theme="glass"] .card,
body[data-theme="glass"] .stat-card,
body[data-theme="glass"] .player-card {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
}
body[data-theme="glass"] .wait-item,
body[data-theme="glass"] .field-input,
body[data-theme="glass"] .app-status-chip {
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px) saturate(140%);
}
body[data-theme="glass"] .wait-item.next {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.55);
}
body[data-theme="glass"] .login-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
body[data-theme="glass"] .nav-item:hover { background: rgba(255, 255, 255, 0.10); }
body[data-theme="glass"] .nav-item.active {
  background: rgba(242, 233, 196, 0.12);
  border-color: rgba(242, 233, 196, 0.35);
}
body[data-theme="glass"] .match-board {
  background: radial-gradient(ellipse at center, rgba(14, 122, 68, 0.9) 0%, rgba(10, 90, 51, 0.95) 100%);
}
body[data-theme="glass"] .table tbody tr:hover { background: rgba(255, 255, 255, 0.06); }

/* =====================================================================
   FACTURE (STATISTIQUES) — style moderne façon « fatoura »
   ===================================================================== */
.invoice {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.invoice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 26px;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.invoice-brand { display: flex; align-items: center; gap: 14px; }
.invoice-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);
  text-transform: uppercase;
}
.invoice-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.invoice-meta { text-align: right; font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.invoice-meta b { color: var(--text); }

.invoice-period { display: flex; gap: 8px; flex-wrap: wrap; padding: 18px 26px 0; }
.period-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.15s;
}
.period-btn:hover { color: var(--text); border-color: var(--text-dim); }
.period-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #14171c;
  border-color: transparent;
}

.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th,
.invoice-table td { padding: 13px 26px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.invoice-table th {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}
.invoice-table tbody tr:hover { background: var(--border-light); }
.invoice-table tfoot td {
  font-weight: 900;
  border-top: 2px solid var(--gold);
  color: var(--gold);
  background: rgba(212, 175, 55, 0.06);
}
.invoice-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.invoice-stamp {
  border: 2px solid var(--gold);
  color: var(--gold);
  border-radius: 8px;
  padding: 5px 12px;
  font-weight: 900;
  letter-spacing: 3px;
  transform: rotate(-4deg);
  opacity: 0.9;
}
.invoice-empty { text-align: center; padding: 46px 20px; color: var(--text-dim); }
.invoice-empty .big { font-size: 42px; margin-bottom: 8px; }

/* ---- Cartes "liens" du hub statistiques ---- */
a.stat-card { text-decoration: none; transition: transform 0.15s, border-color 0.15s; }
a.stat-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.stat-card .stat-arrow { margin-left: auto; color: var(--gold); font-size: 18px; }

/* ---- Sélecteur de thème (paramètres) ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.theme-option { position: relative; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: 58px;
  border-radius: 11px;
  border: 2px solid var(--border);
  background: var(--bg-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.theme-preview .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.theme-option input:checked + .theme-preview {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
  color: var(--text);
}
.theme-preview.pv-classic { background: linear-gradient(150deg, #202327 0%, #17191c 100%); }
.theme-preview.pv-glass   { background: linear-gradient(150deg, #1b2a5e 0%, #0b1023 60%, #141b3d 100%); }
.theme-preview.pv-royal   { background: linear-gradient(150deg, #1d1a22 0%, #0e0c10 100%); }
.theme-preview.pv-emerald { background: linear-gradient(150deg, #10301f 0%, #07190f 100%); }
.theme-preview.pv-ocean   { background: linear-gradient(150deg, #0c2233 0%, #040c13 100%); }
.theme-preview.pv-crimson { background: linear-gradient(150deg, #231014 0%, #0f0507 100%); }
.theme-preview.pv-glass .dot   { background: #7dd3fc; }
.theme-preview.pv-royal .dot   { background: #e6c15c; }
.theme-preview.pv-emerald .dot { background: #66bb6a; }
.theme-preview.pv-ocean .dot   { background: #22d3ee; }
.theme-preview.pv-crimson .dot { background: #f25c54; }

/* ---- Note importante (règle 24h/10h) ---- */
.alert-note {
  background: rgba(212, 175, 55, 0.10);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold);
}
.alert-note .note-tag {
  display: inline-block;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 2px 8px;
  margin-right: 8px;
}

/* ---- Recherche inline ---- */
.search-box { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.search-box .field-input { flex: 1; min-width: 220px; }
/* ---- Dossier Mois & jours (stats_monthly.php) ---- */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.day-folder {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px 12px;
  text-decoration: none;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--border-light), transparent);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.day-folder:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
.day-folder.has {
  background: linear-gradient(180deg, rgba(212,175,55,.14), rgba(212,175,55,.03));
  border-color: rgba(212,175,55,.45);
}
.day-folder.empty {
  opacity: .5;
}
.day-folder.today { border-color: var(--accent); }
.day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.day-num {
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.day-folder.has .day-num { color: var(--gold); }
.today-chip {
  font-size: 9px;
  font-weight: 900;
  color: #05140a;
  background: var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  letter-spacing: 1px;
}
.day-week {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.day-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(212,175,55,.12);
  align-self: flex-start;
}
.day-count.muted { color: var(--text-dim); background: transparent; }
.win-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--border-light);
  margin-bottom: 8px;
}
@media (max-width: 640px) {
  .month-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .day-num { font-size: 20px; }
}
