/* =====================================================================
   GS EVENT V2.1 — Design system (mobile-first)
   Thèmes : light (clair) · semi (à moitié clair) · dark (sombre)
   La couleur primaire / accent est injectée par le layout (paramètres)
   ===================================================================== */

:root {
  --primary: #6366F1;
  --primary-rgb: 99, 102, 241;
  --accent: #F97366;
  --accent-rgb: 249, 115, 102;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #0EA5E9;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --topbar-h: 64px;
  --bottom-h: 68px;
  --sidebar-w: 268px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --grad: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* --- Thème clair --- */
[data-theme="light"] {
  --bg: #F4F6FB;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F4FA;
  --border: #E4E8F1;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #94A3B8;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 20px 50px -20px rgba(15, 23, 42, .25);
  /* navigation */
  --nav-bg: #FFFFFF;
  --nav-text: #475569;
  --nav-muted: #94A3B8;
  --nav-border: #E9EDF5;
  --nav-hover: #F1F4FA;
  --nav-active-bg: rgba(var(--primary-rgb), .1);
  --nav-active: var(--primary);
}

/* --- Thème à moitié clair : contenu clair, navigation sombre --- */
[data-theme="semi"] {
  --bg: #E9EDF5;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #EEF1F7;
  --border: #DCE1EC;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #8B95A9;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 26px -14px rgba(15, 23, 42, .18);
  --shadow-lg: 0 20px 50px -20px rgba(15, 23, 42, .3);
  --nav-bg: #1E2440;
  --nav-text: #C7CCE0;
  --nav-muted: #7F87A6;
  --nav-border: rgba(255, 255, 255, .07);
  --nav-hover: rgba(255, 255, 255, .06);
  --nav-active-bg: rgba(var(--primary-rgb), .22);
  --nav-active: #FFFFFF;
}

/* --- Thème sombre --- */
[data-theme="dark"] {
  --bg: #0B1020;
  --bg-elev: #151B2E;
  --surface: #151B2E;
  --surface-2: #1C2338;
  --border: #252D45;
  --text: #E8EBF5;
  --text-2: #A3ABC3;
  --muted: #6B7491;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  --nav-bg: #0F1528;
  --nav-text: #A3ABC3;
  --nav-muted: #5F6886;
  --nav-border: #1E2640;
  --nav-hover: rgba(255, 255, 255, .04);
  --nav-active-bg: rgba(var(--primary-rgb), .18);
  --nav-active: #FFFFFF;
}

/* --- Bootstrap : alignement sur nos tokens --- */
[data-theme] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--text-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-primary: var(--primary);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary);
  --bs-link-color-rgb: var(--primary-rgb);
  --bs-border-radius: var(--radius-sm);
  --bs-font-sans-serif: var(--font);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
.text-muted, .text-secondary { color: var(--text-2) !important; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.bg-primary { background-color: var(--primary) !important; }
.fw-800 { font-weight: 800; }
.small-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.text-grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
::selection { background: rgba(var(--primary-rgb), .25); }

/* =========================== LAYOUT =========================== */
.app-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
[data-theme="semi"] .topbar { background: var(--nav-bg); color: #fff; }
[data-theme="semi"] .topbar .icon-btn { color: var(--nav-text); background: rgba(255,255,255,.06); border-color: transparent; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.1rem; font-weight: 800; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .sub { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-brand img { width: 32px; height: 32px; border-radius: 9px; }

.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 1.15rem;
  transition: transform .15s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { color: var(--primary); }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: .85rem; letter-spacing: .02em;
}
.avatar.sm { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; font-size: .72rem; }

/* Page */
.page { flex: 1; padding: 16px 16px calc(var(--bottom-h) + var(--safe-bottom) + 24px); width: 100%; max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--text-2); font-size: .88rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.app-footer { padding: 18px 16px calc(var(--bottom-h) + var(--safe-bottom) + 16px); text-align: center; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); margin-top: auto; }
.app-footer a { color: var(--text-2); }
.app-footer .contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 6px; }
.page + .app-footer { padding-top: 18px; }
.page:has(+ .app-footer) { padding-bottom: 24px; }

/* Sidebar (tiroir sur mobile) */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1050;
  width: min(86vw, var(--sidebar-w));
  background: var(--nav-bg); color: var(--nav-text);
  border-right: 1px solid var(--nav-border);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .32s var(--ease);
  padding-top: var(--safe-top);
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 1045; background: rgba(8, 11, 24, .5); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 12px; box-shadow: 0 8px 20px -8px rgba(var(--primary-rgb), .8); }
.sidebar-brand .name { font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; color: var(--text); line-height: 1.1; }
[data-theme="semi"] .sidebar-brand .name, [data-theme="dark"] .sidebar-brand .name { color: #fff; }
.sidebar-brand .tag { font-size: .7rem; color: var(--nav-muted); }
.sidebar-account { margin: 0 14px 6px; padding: 10px 12px; border-radius: 12px; background: var(--nav-hover); font-size: .78rem; display: flex; align-items: center; gap: 8px; color: var(--nav-text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-section { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--nav-muted); padding: 16px 12px 6px; }
.nav-link-x {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px; margin-bottom: 2px;
  color: var(--nav-text); font-weight: 600; font-size: .92rem;
  transition: background .2s, color .2s;
}
.nav-link-x i { font-size: 1.15rem; width: 22px; text-align: center; opacity: .85; }
.nav-link-x:hover { background: var(--nav-hover); color: var(--nav-active); }
.nav-link-x.active { background: var(--nav-active-bg); color: var(--nav-active); }
.nav-link-x.active i { color: var(--primary); opacity: 1; }
[data-theme="semi"] .nav-link-x.active i, [data-theme="dark"] .nav-link-x.active i { color: #A5A8FF; }
.sidebar-user { border-top: 1px solid var(--nav-border); padding: 12px 14px calc(12px + var(--safe-bottom)); display: flex; align-items: center; gap: 10px; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who b { display: block; font-size: .88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="semi"] .sidebar-user .who b, [data-theme="dark"] .sidebar-user .who b { color: #fff; }
.sidebar-user .who span { font-size: .72rem; color: var(--nav-muted); }
.sidebar-user a.logout { color: var(--nav-muted); font-size: 1.2rem; padding: 6px; }
.sidebar-user a.logout:hover { color: var(--danger); }

/* Barre de navigation du bas (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
  height: calc(var(--bottom-h) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--nav-bg) 90%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--nav-border);
}
.bottom-nav a, .bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--nav-muted); font-size: .66rem; font-weight: 700; background: none; border: 0; border-radius: 14px;
  transition: color .2s;
}
.bottom-nav i { font-size: 1.35rem; line-height: 1; transition: transform .2s var(--ease); }
.bottom-nav .active { color: var(--nav-active); }
.bottom-nav .active i { transform: translateY(-1px); color: var(--primary); }
[data-theme="semi"] .bottom-nav .active i, [data-theme="dark"] .bottom-nav .active i { color: #A5A8FF; }
.bottom-nav .fab-slot { position: relative; }
.bottom-nav .fab-slot span.fab {
  width: 54px; height: 54px; margin-top: -26px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; box-shadow: 0 12px 24px -8px rgba(var(--primary-rgb), .7);
}
.bottom-nav .fab-slot span.fab i { color: #fff !important; font-size: 1.5rem; }

/* ===== Desktop ===== */
@media (min-width: 992px) {
  .sidebar { transform: none; width: var(--sidebar-w); }
  .sidebar-backdrop, .bottom-nav, .only-mobile { display: none !important; }
  .app-main { margin-left: var(--sidebar-w); }
  .topbar { padding: 0 28px; }
  .page { padding: 24px 28px 32px; }
  .page-head h2 { font-size: 1.7rem; }
  .app-footer { padding-bottom: 18px; }
}
@media (max-width: 991.98px) { .only-desktop { display: none !important; } .page-head h2 { display: none; } .page-head:not(:has(p, .page-actions, a.small)) { display: none; } }

/* =========================== COMPOSANTS =========================== */
.card-x, .card-glass {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-x { padding: 16px; }
.card-x + .card-x { margin-top: 16px; }
.card-x .card-x-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-x .card-x-head h3 { font-size: 1rem; font-weight: 800; margin: 0; }
@media (min-width: 768px) { .card-x { padding: 20px; } }

.card, .modal-content, .dropdown-menu, .list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }
.dropdown-menu { border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; }
.dropdown-item { border-radius: 9px; padding: 9px 12px; color: var(--text); font-weight: 500; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item i { width: 20px; margin-right: 6px; }

/* Statistiques */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat .ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 10px; }
.stat .lbl { font-size: .75rem; font-weight: 600; color: var(--text-2); }
.stat .val { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat .meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.stat.hero { background: var(--grad); border: 0; color: #fff; }
.stat.hero .lbl, .stat.hero .meta { color: rgba(255,255,255,.82); }
.stat.hero .ico { background: rgba(255,255,255,.18); color: #fff; }
.stat.hero::after { content: ''; position: absolute; width: 140px; height: 140px; right: -40px; top: -50px; border-radius: 50%; background: rgba(255,255,255,.12); }
@media (min-width: 768px) { .stat { padding: 18px; } .stat .val { font-size: 1.6rem; } }

.tone-primary { background: rgba(var(--primary-rgb), .12); color: var(--primary); }
.tone-accent { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.tone-success { background: rgba(16, 185, 129, .13); color: var(--success); }
.tone-warning { background: rgba(245, 158, 11, .15); color: #D97706; }
.tone-danger { background: rgba(239, 68, 68, .13); color: var(--danger); }
.tone-info { background: rgba(14, 165, 233, .13); color: var(--info); }
.tone-muted { background: var(--surface-2); color: var(--text-2); }

/* Badges / chips */
.badge-x { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-x::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-x.no-dot::before { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .85rem;
  transition: all .2s;
}
.chip .count { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 8px 18px -10px rgba(var(--primary-rgb), .9); }
.chip.active .count { background: rgba(255,255,255,.22); color: #fff; }

/* Boutons */
.btn { border-radius: 12px; font-weight: 700; padding: .62rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .15s var(--ease), box-shadow .2s, background .2s; }
.btn:active { transform: scale(.97); }
.btn-sm { padding: .4rem .7rem; border-radius: 10px; font-size: .82rem; }
.btn-lg { padding: .85rem 1.3rem; border-radius: 14px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary); --bs-btn-active-border-color: var(--primary); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); box-shadow: 0 8px 20px -10px rgba(var(--primary-rgb), .9); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-grad { background: var(--grad); color: #fff; border: 0; box-shadow: 0 10px 24px -10px rgba(var(--primary-rgb), .9); }
.btn-grad:hover { color: #fff; filter: brightness(1.06); }
.btn-soft { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-soft:hover { background: var(--border); color: var(--text); }
.btn-whatsapp { background: #25D366; color: #fff; border: 0; }
.btn-whatsapp:hover { background: #1EBE5A; color: #fff; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); }

/* Formulaires */
.form-label { font-size: .8rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.form-control, .form-select {
  min-height: 46px; border-radius: 12px; border: 1.5px solid var(--border);
  background-color: var(--surface); color: var(--text); font-size: 16px; /* évite le zoom iOS */
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14); background-color: var(--surface); color: var(--text); }
.form-control-sm, .form-select-sm { min-height: 36px; font-size: .85rem; border-radius: 10px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-text { color: var(--muted); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 42px; }
.input-group-text { background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text-2); border-radius: 12px; }
@media (min-width: 768px) { .form-control, .form-select { font-size: .92rem; } }

/* Filtres */
.filters { padding: 12px; margin-bottom: 16px; }
.filters-toggle { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: var(--text); font-weight: 700; padding: 2px 4px; }
.filters .collapse.show, .filters .collapsing { margin-top: 10px; }
@media (min-width: 768px) { .filters { padding: 16px; } .filters .collapse { margin-top: 0 !important; } }

/* Tables : deviennent des cartes sur mobile */
.table-x { width: 100%; margin: 0; color: var(--text); --bs-table-bg: transparent; }
.table-x thead th { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table-x tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr { transition: background .15s; }
.table-x tbody tr:hover { background: var(--surface-2); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
@media (max-width: 767.98px) {
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .table-x thead { display: none; }
  .table-x, .table-x tbody, .table-x tr, .table-x td { display: block; width: 100%; }
  .table-x tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; position: relative;
  }
  .table-x tbody tr:hover { background: var(--surface); }
  .table-x tbody td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table-x tbody td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; color: var(--muted); text-align: left; flex-shrink: 0; }
  .table-x tbody td.cell-main { display: block; text-align: left; padding: 0 0 8px; margin-bottom: 6px; border-bottom: 1px dashed var(--border); }
  .table-x tbody td.cell-main::before, .table-x tbody td.cell-actions::before, .table-x tbody td[data-label=""]::before { display: none; }
  .table-x tbody td.cell-actions { justify-content: flex-end; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
  .table-x tbody td.empty { display: block; text-align: center; }
}
.cell-title { font-weight: 700; color: var(--text); }
.cell-sub { font-size: .78rem; color: var(--muted); }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.pager-info { font-size: .82rem; color: var(--text-2); }
.pager-nav { display: flex; gap: 4px; }
.pager-btn, .pager-dots { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; font-weight: 700; font-size: .85rem; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); }
.pager-dots { border: 0; background: none; }
.pager-btn:hover { color: var(--primary); border-color: var(--primary); }
.pager-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-btn.disabled { opacity: .4; pointer-events: none; }
.pager-size { width: auto; min-height: 38px; }
@media (max-width: 575.98px) { .pager { justify-content: center; } .pager-info { width: 100%; text-align: center; } }

/* Etat vide */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty-state .ico { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.empty-state h4 { font-weight: 800; font-size: 1.05rem; color: var(--text); }

/* Alertes / toasts */
.alert { border-radius: 14px; border: 0; font-weight: 500; }
.toast-stack { position: fixed; z-index: 2000; left: 12px; right: 12px; top: calc(var(--safe-top) + 12px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center; }
.toast-x {
  pointer-events: auto; width: 100%; max-width: 420px;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--ease);
}
.toast-x .ti { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: 0 0 34px; }
.toast-x .tm { flex: 1; font-size: .88rem; font-weight: 600; }
.toast-x.hide { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }

/* Modales : feuille du bas sur mobile */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.modal-header .modal-title { font-weight: 800; font-size: 1.05rem; }
.modal-body { padding: 18px 20px; }
.modal-footer { border-top: 1px solid var(--border); padding: 12px 20px; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
@media (max-width: 575.98px) {
  .modal.sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; transform: translateY(100%); transition: transform .3s var(--ease) !important; }
  .modal.sheet.show .modal-dialog { transform: none; }
  .modal.sheet .modal-content { border-radius: 24px 24px 0 0; max-height: 92vh; padding-bottom: var(--safe-bottom); }
  .modal.sheet .modal-content::before { content: ''; width: 42px; height: 5px; border-radius: 9px; background: var(--border); margin: 10px auto 0; }
  .modal.sheet .modal-body { overflow-y: auto; }
}

/* Liste d'éléments */
.list-x { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.list-item .grow { flex: 1; min-width: 0; }

/* Cartes d'événement */
.event-card { position: relative; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.event-card .ev-date { width: 56px; flex: 0 0 56px; height: 60px; border-radius: 14px; background: var(--grad); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.event-card .ev-date b { font-size: 1.35rem; font-weight: 800; }
.event-card .ev-date span { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.event-card.past .ev-date { background: var(--surface-2); color: var(--text-2); }
.progress-x { height: 8px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.progress-x > span { display: block; height: 100%; border-radius: 9px; background: var(--grad); transition: width .6s var(--ease); }

/* Theme switcher */
.theme-switch { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.theme-switch button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 7px 10px; color: var(--text-2); font-size: .8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.theme-switch button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Animation d'entrée */
.page > * { animation: rise .45s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .04s; }
.page > *:nth-child(3) { animation-delay: .08s; }
.page > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* App installée (standalone) : pas de sélection de texte sur la navigation, pull-to-refresh désactivé */
@media (display-mode: standalone) {
  .sidebar, .bottom-nav, .topbar { user-select: none; -webkit-user-select: none; }
}

/* =========================== PAGES PUBLIQUES (auth) =========================== */
.auth-body {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(var(--primary-rgb), .35), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(var(--accent-rgb), .28), transparent 60%),
    var(--bg);
}
[data-theme="dark"] .auth-body, [data-theme="semi"] .auth-body {
  background:
    radial-gradient(1200px 600px at -10% -10%, rgba(var(--primary-rgb), .45), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(var(--accent-rgb), .3), transparent 60%),
    #0B1020;
}
[data-theme="semi"] .auth-body { color: #E8EBF5; }
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 16px 24px; }
.auth-card {
  width: 100%; max-width: 440px; padding: 28px 22px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 28px; box-shadow: var(--shadow-lg);
  animation: rise .6s var(--ease) both;
}
[data-theme="semi"] .auth-card { --surface: #151B2E; --border: #252D45; --text: #E8EBF5; --text-2: #A3ABC3; --muted: #6B7491; --surface-2: #1C2338; color: var(--text); }
@media (min-width: 576px) { .auth-card { padding: 36px 34px; } }
.auth-logo { width: 88px; height: 88px; margin: 0 auto 14px; display: block; filter: drop-shadow(0 18px 30px rgba(var(--primary-rgb), .45)); animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px) rotate(-2deg); } }
.auth-title { text-align: center; font-weight: 800; font-size: 1.7rem; letter-spacing: -.03em; margin: 0; }
.auth-sub { text-align: center; color: var(--text-2); font-size: .88rem; margin: 4px 0 24px; }
.auth-foot { text-align: center; font-size: .78rem; color: var(--muted); padding: 0 16px calc(16px + var(--safe-bottom)); }
.auth-foot a { color: var(--text-2); }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 38px; height: 38px; border-radius: 10px; }

/* Carte d'installation de l'application */
.install-card {
  display: none; margin-top: 18px; padding: 14px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .12), rgba(var(--accent-rgb), .12));
  border: 1px dashed rgba(var(--primary-rgb), .35);
}
.install-card { position: relative; }
.install-card.show { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; animation: rise .5s var(--ease) both; }
.install-card #installBtn { flex: 1 1 100%; }
.install-card #installClose { position: absolute; top: 10px; right: 10px; }
.install-card .txt { padding-right: 18px; }
.install-card img { width: 46px; height: 46px; border-radius: 13px; }
.install-card .txt { flex: 1; min-width: 0; }
.install-card .txt b { display: block; font-size: .9rem; }
.install-card .txt span { font-size: .76rem; color: var(--text-2); }
.ios-steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.ios-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.ios-steps li:last-child { border: 0; }
.ios-steps li::before { content: counter(s); flex: 0 0 28px; height: 28px; border-radius: 9px; background: var(--grad); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.ios-share-ico { display: inline-flex; width: 26px; height: 26px; border-radius: 7px; align-items: center; justify-content: center; background: rgba(14,165,233,.15); color: #0A84FF; vertical-align: middle; }
.ios-arrow { position: fixed; bottom: calc(10px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 2100; color: #fff; font-size: 2rem; animation: bounce 1.2s infinite; display: none; text-shadow: 0 4px 12px rgba(0,0,0,.5); }
@keyframes bounce { 50% { transform: translate(-50%, 8px); } }

/* Splash au démarrage de l'app installée */
.splash { position: fixed; inset: 0; z-index: 3000; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; transition: opacity .4s; }
.splash img { width: 96px; height: 96px; animation: pulse 1.4s ease-in-out infinite; }
.splash b { font-weight: 800; letter-spacing: .08em; }
.splash.gone { opacity: 0; pointer-events: none; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* Impression */
@media print {
  .sidebar, .topbar, .bottom-nav, .app-footer, .filters, .pager, .no-print, .toast-stack { display: none !important; }
  .app-main { margin: 0 !important; }
  .page { padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* Saisie du code à 6 chiffres */
.otp { display: flex; gap: 8px; justify-content: center; }
.otp input { width: 48px; height: 58px; padding: 0; text-align: center; font-size: 1.6rem; font-weight: 800; border-radius: 14px; background: var(--surface-2); border: 2px solid color-mix(in srgb, var(--text-2) 30%, transparent); caret-color: var(--primary); }
.otp input:focus { border-color: var(--primary); }
@media (max-width: 360px) { .otp input { width: 40px; height: 52px; } }

/* Cartes des formules d'abonnement */
.plan-card {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 14px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 16px; background: var(--surface); transition: all .2s var(--ease); height: 100%;
}
.plan-card:hover { border-color: rgba(var(--primary-rgb), .5); }
.btn-check:checked + .plan-card { border-color: var(--primary); box-shadow: 0 10px 26px -14px rgba(var(--primary-rgb), .9); background: linear-gradient(180deg, rgba(var(--primary-rgb), .08), transparent); }
.btn-check:checked + .plan-card::after { content: '\F26A'; font-family: bootstrap-icons; position: absolute; top: 10px; right: 12px; color: var(--primary); font-size: 1.2rem; }
.plan-name { font-weight: 800; font-size: .95rem; }
.plan-price { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.plan-desc { font-size: .78rem; color: var(--text-2); }
.plan-month { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.plan-events { display: inline-flex; gap: 5px; align-items: center; margin: 4px auto 2px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; color: var(--primary); background: rgba(var(--primary-rgb), .12); }
.plan-up { font-size: .76rem; color: var(--success); margin-top: 6px; line-height: 1.3; }
.plan-badge { position: absolute; top: -10px; left: 12px; background: var(--grad); color: #fff; font-size: .66rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

/* Bandeau d'abonnement */
.sub-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; font-size: .88rem; font-weight: 600; }
.sub-banner .btn { margin-left: auto; flex-shrink: 0; }

/* App installée : pas de lien vers le site vitrine */
@media (display-mode: standalone), (display-mode: fullscreen) { #backSite { display: none !important; } }

/* Éditeur de listes (paramètres du site) */
.rep-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; position: relative; }
.rep-row .rep-tools { display: flex; gap: 6px; justify-content: flex-end; }
@media (min-width: 768px) { .rep-row.cols-3 { grid-template-columns: 160px 1fr; } .rep-row.cols-3 .wide, .rep-row.cols-3 .rep-tools { grid-column: 1 / -1; } }

/* ===== Alertes de service (commandes, appels, addition) ===== */
.gs-alert { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; color: #fff;
  --k1: var(--accent); --k2: var(--primary);
  background: radial-gradient(circle at 50% 35%, var(--k1), var(--k2)); animation: gsFlash 1s ease-in-out infinite alternate; }
.gs-alert[hidden] { display: none; }
.gs-alert.k-call { --k1: #EF4444; --k2: #7F1D1D; }
.gs-alert.k-bill { --k1: #F59E0B; --k2: #9A3412; }
.gs-alert.k-late { --k1: #F59E0B; --k2: #1E2440; }
@keyframes gsFlash { from { filter: brightness(1); } to { filter: brightness(1.35) saturate(1.2); } }
.gs-alert::before { content: ""; position: absolute; inset: 0; border: 10px solid rgba(255, 255, 255, .85); animation: gsEdge .5s steps(2) infinite; pointer-events: none; }
@keyframes gsEdge { 50% { border-color: transparent; } }
.gs-alert-card { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; text-align: center;
  background: rgba(10, 14, 30, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 28px; padding: 26px 20px 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: gsPop .35s var(--ease); }
@keyframes gsPop { from { transform: scale(.85); opacity: 0; } }
.gs-ring { width: 92px; height: 92px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; background: #fff; color: var(--k2);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); animation: gsRing 1.2s infinite; }
.gs-ring i { animation: gsShake 1.2s infinite; transform-origin: 50% 10%; }
@keyframes gsRing { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); } 100% { box-shadow: 0 0 0 34px rgba(255, 255, 255, 0); } }
@keyframes gsShake { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-16deg); } 20%, 40% { transform: rotate(16deg); } }
.gs-kicker { font-size: .85rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.gs-big { font-size: clamp(2.2rem, 11vw, 3.4rem); font-weight: 800; line-height: 1.05; margin: 4px 0 6px; text-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
.gs-meta { font-weight: 600; opacity: .9; }
.gs-items { list-style: none; margin: 14px 0 0; padding: 10px 14px; text-align: left; background: rgba(255, 255, 255, .12); border-radius: 16px; font-size: 1.02rem; }
.gs-items li { padding: 4px 0; border-bottom: 1px dashed rgba(255, 255, 255, .2); }
.gs-items li:last-child { border: 0; }
.gs-items b { margin-right: 4px; }
.gs-note { margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .18); font-weight: 600; text-align: left; }
.gs-actions { display: grid; gap: 8px; margin-top: 18px; }
.gs-actions .btn-light { font-weight: 800; color: #111827; padding: 14px; border-radius: 16px; }
.gs-actions .btn-outline-light { border-radius: 14px; font-weight: 700; }
.gs-more { margin-top: 6px; font-size: .85rem; font-weight: 700; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .gs-alert, .gs-alert::before, .gs-ring, .gs-ring i { animation: none; } }
html.gs-alerting body { overflow: hidden; }

.gs-unlock { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 1990; border: 0; border-radius: 999px;
  padding: 10px 18px; font-weight: 800; color: #fff; background: var(--grad); box-shadow: 0 10px 30px rgba(var(--primary-rgb), .45); animation: pulse 1.4s ease-in-out infinite; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.gs-unlock[hidden] { display: none; }
@media (min-width: 992px) { .gs-unlock { bottom: 24px; } }

.icon-btn { position: relative; }
.nav-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); animation: pulse 1.2s infinite; }
.nav-count[hidden] { display: none; }
.sidebar-nav a, .bottom-nav a { position: relative; }
.sidebar-nav .nav-count { position: static; margin-left: auto; }
.bottom-nav .nav-count { top: 4px; right: calc(50% - 24px); }

/* ===== Support : conversation ===== */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: min(62vh, 640px); overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 86%; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-who { font-size: .72rem; color: var(--muted); margin: 0 6px 3px; font-weight: 600; }
.msg.staff .msg-who i { color: var(--primary); }
.msg-body { padding: 10px 14px; border-radius: 18px; background: var(--surface-2); color: var(--text); line-height: 1.5; word-break: break-word; }
.msg.mine .msg-body { background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.msg.theirs .msg-body { border-bottom-left-radius: 6px; }
.msg-file { display: block; margin-top: 8px; color: inherit; font-weight: 700; }
.msg-file img { max-width: 240px; max-height: 200px; border-radius: 12px; display: block; }
.msg-system { align-self: center; text-align: center; font-size: .78rem; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 6px 14px; max-width: 92%; }
.msg-system span { color: var(--muted); }
.reply-box textarea { resize: vertical; }
.row-unread .cell-title { font-weight: 800; }
.unread-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: middle; }
.menu-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; line-height: 20px; text-align: center; }
.bottom-nav .has-badge { position: relative; }
.bottom-nav .has-badge::after { content: ""; position: absolute; top: 6px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

/* ===== Affiche d'événement ===== */
.poster-drop { display: grid; place-items: center; width: 100%; max-width: 260px; aspect-ratio: 3 / 4; margin-bottom: 8px; border: 2px dashed var(--border); border-radius: 18px; overflow: hidden; cursor: pointer; background: var(--surface-2); transition: border-color .2s; }
.poster-drop:hover { border-color: var(--primary); }
.poster-drop img { width: 100%; height: 100%; object-fit: cover; }
.poster-drop .ph { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px; color: var(--text-2); }
.poster-drop .ph i { font-size: 2rem; color: var(--primary); }
.poster-drop [hidden] { display: none !important; }
.ev-poster { width: 56px; height: 74px; flex: 0 0 56px; border-radius: 12px; object-fit: cover; box-shadow: var(--shadow); }
.ref-code { font-size: 1.15rem; letter-spacing: .12em; padding: 2px 10px; border-radius: 8px; background: rgba(255,255,255,.2); }
