/* ==========================================================================
   ISG · Ambassadeurs — Design system
   Feuille de style unique de l'application.
   Organisation :
     01. Tokens          06. Boutons          11. Onglets
     02. Reset & base    07. Tableaux         12. Pagination / bulk
     03. Layout          08. Badges           13. Pages spécifiques
     04. Blocs (cards)   09. Alertes          14. Utilitaires
     05. Formulaires     10. Navigation       15. Responsive
   ========================================================================== */

/* ==========================================================================
   00. POLICE (auto-hébergée)
   Inter est servi depuis assets/fonts/ et non depuis Google Fonts : aucun
   appel à un serveur tiers, donc aucune adresse IP de visiteur transmise
   hors du site — et un affichage qui ne dépend pas d'un domaine externe.
   Seuls les sous-ensembles latins sont embarqués (~130 Ko au total).
   ========================================================================== */

/* Inter — sous-ensemble latin-ext */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;      /* police variable : une seule ressource pour toutes les graisses */
    font-display: swap;
    src: url('../fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter — sous-ensemble latin */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;      /* police variable : une seule ressource pour toutes les graisses */
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   01. TOKENS
   ========================================================================== */

:root {
    /* --- Marque --- */
    --c-bleu:         #1E3A8A;
    --c-bleu-dark:    #16296180;
    --c-bleu-700:     #1D4ED8;
    --c-bleu-600:     #2563EB;
    --c-bleu-light:   #3B82F6;
    --c-bleu-50:      #EFF6FF;
    --c-bleu-100:     #DBEAFE;

    --c-rose:         #E0357C;
    --c-rose-light:   #FBCFE8;
    --c-violet:       #7C3AED;
    --c-violet-light: #C4B5FD;

    /* --- Neutres --- */
    --c-bg:           #F6F7FB;
    --c-surface:      #FFFFFF;
    --c-surface-alt:  #F8FAFC;
    --c-surface-mute: #F1F5F9;
    --c-border:       #E6E9EF;
    --c-border-strong:#D3D9E3;
    --c-text:         #0F172A;
    --c-text-soft:    #4A5568;
    --c-text-muted:   #8A94A6;

    /* --- Sémantique --- */
    --c-success:      #0E9F6E;
    --c-success-bg:   #E7F8F1;
    --c-success-fg:   #05603A;
    --c-warning:      #D97706;
    --c-warning-bg:   #FEF6E7;
    --c-warning-fg:   #8A4B08;
    --c-danger:       #DC2626;
    --c-danger-bg:    #FEECEC;
    --c-danger-fg:    #961C1C;
    --c-info:         #0284C7;
    --c-info-bg:      #E8F4FD;
    --c-info-fg:      #075985;

    /* --- Barre latérale (thème sombre) --- */
    --c-nav-bg:       #101B39;
    --c-nav-bg-soft:  #16244A;
    --c-nav-text:     #B9C3DA;
    --c-nav-text-hi:  #FFFFFF;
    --c-nav-border:   rgba(255,255,255,0.08);

    /* --- Élévation --- */
    --shadow-xs: 0 1px 2px rgba(16, 27, 57, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 27, 57, 0.06), 0 1px 2px rgba(16, 27, 57, 0.04);
    --shadow:    0 4px 16px -4px rgba(16, 27, 57, 0.10), 0 2px 6px -2px rgba(16, 27, 57, 0.05);
    --shadow-lg: 0 18px 40px -12px rgba(16, 27, 57, 0.22);
    --ring:      0 0 0 3px rgba(59, 130, 246, 0.18);

    /* --- Rayons --- */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    /* --- Dimensions --- */
    --sidebar-w:  268px;
    --topbar-h:   62px;
    --content-max: 1360px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: light;
}

/* ==========================================================================
   02. RESET & BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

a { color: var(--c-bleu-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 {
    margin: 0 0 10px;
    line-height: 1.25;
    color: var(--c-text);
    letter-spacing: -0.015em;
    font-weight: 650;
}
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14.5px; }
p  { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

hr {
    border: 0;
    border-top: 1px solid var(--c-border);
    margin: 20px 0;
}

code, pre, kbd {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88em;
}
code {
    background: var(--c-surface-mute);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    color: var(--c-text);
}
pre {
    background: var(--c-surface-mute);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    overflow-x: auto;
}

img, svg { vertical-align: middle; }
img { max-width: 100%; }

::selection { background: var(--c-bleu-100); }

:focus-visible {
    outline: 2px solid var(--c-bleu-light);
    outline-offset: 2px;
}

/* ==========================================================================
   03. LAYOUT
   ========================================================================== */

.layout { display: flex; min-height: 100vh; }

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.main-inner {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 26px 32px 56px;
}

/* --- Barre supérieure --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 32px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
.topbar-title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    color: var(--c-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}
.topbar-user:hover { text-decoration: none; border-color: var(--c-border-strong); box-shadow: var(--shadow-xs); }
.topbar-user .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.topbar-user small { display: block; font-weight: 500; color: var(--c-text-muted); font-size: 11.5px; }

/* --- Avatars --- */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-bleu) 0%, var(--c-violet) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* --- En-tête de page --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-header h1 { margin-bottom: 2px; }
.page-header .subtitle,
.subtitle {
    color: var(--c-text-soft);
    font-size: 13.5px;
    margin: 0;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--c-text-muted);
    margin: 26px 0 12px;
}
.section-title:first-child { margin-top: 0; }

/* ==========================================================================
   04. BLOCS (CARDS)
   ========================================================================== */

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.card-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
    margin-bottom: 12px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: -22px -22px 18px;
    padding: 15px 22px;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-surface-alt);
    border-radius: var(--radius) var(--radius) 0 0;
}
.card-header h2, .card-header h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-header { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }

/* --- Statistiques --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
a.stat-card:hover,
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.stat-label {
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-text-muted);
    display: block;
}
.stat-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--c-text);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12.5px; color: var(--c-text-soft); margin-top: 6px; }

/* Accent coloré optionnel : <div class="stat-card accent-rose"> */
.stat-card.accent-bleu   { box-shadow: inset 3px 0 0 var(--c-bleu),    var(--shadow-sm); }
.stat-card.accent-rose   { box-shadow: inset 3px 0 0 var(--c-rose),    var(--shadow-sm); }
.stat-card.accent-violet { box-shadow: inset 3px 0 0 var(--c-violet),  var(--shadow-sm); }
.stat-card.accent-success{ box-shadow: inset 3px 0 0 var(--c-success), var(--shadow-sm); }
.stat-card.accent-warning{ box-shadow: inset 3px 0 0 var(--c-warning), var(--shadow-sm); }
.stat-card.accent-danger { box-shadow: inset 3px 0 0 var(--c-danger),  var(--shadow-sm); }

/* --- Grille de détails --- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.detail-item {
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.detail-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-muted);
    margin-bottom: 4px;
}
.detail-value { font-size: 14.5px; font-weight: 550; color: var(--c-text); }
.detail-value a { font-weight: 600; }

/* --- Grilles génériques utilisées par certaines pages --- */
.profile-grid,
.emails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

/* --- État vide --- */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--c-text-muted);
}
.empty-state-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 12px;
    opacity: 0.45;
}
.empty-state h3 { color: var(--c-text-soft); }

/* ==========================================================================
   05. FORMULAIRES
   ========================================================================== */

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-soft);
}
.form-group > label,
.form-row > label {
    display: block;
    margin-bottom: 6px;
}
.required { color: var(--c-danger); font-weight: 700; }

.form-control,
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=tel],
input[type=search], input[type=url], input[type=month], input[type=week],
select, textarea {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.45;
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    appearance: none;
    -webkit-appearance: none;
}
input[type=date], input[type=time], input[type=datetime-local] { min-height: 39px; }

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A94A6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 34px;
    cursor: pointer;
}
select[multiple] { background-image: none; padding-right: 12px; }

textarea { resize: vertical; min-height: 92px; line-height: 1.6; }

.form-control:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-bleu-light);
    box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--c-text-muted); }

input:disabled, select:disabled, textarea:disabled,
input[readonly] {
    background: var(--c-surface-mute);
    color: var(--c-text-soft);
    cursor: not-allowed;
    box-shadow: none;
}

input[type=color] {
    width: 52px;
    height: 39px;
    padding: 3px;
    cursor: pointer;
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
}
input[type=file] {
    width: 100%;
    padding: 8px 12px;
    font-size: 13.5px;
    background: var(--c-surface-alt);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-xs);
    cursor: pointer;
}

input[type=checkbox], input[type=radio] {
    width: 17px;
    height: 17px;
    accent-color: var(--c-bleu-600);
    vertical-align: -3px;
    margin-right: 6px;
    cursor: pointer;
}
/* Un label qui contient une case à cocher redevient une ligne normale */
label:has(> input[type=checkbox]),
label:has(> input[type=radio]) {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
    color: var(--c-text);
    cursor: pointer;
    margin-bottom: 0;
}

.input-sm,
.toolbar .form-control,
.toolbar input, .toolbar select {
    padding: 7px 10px;
    font-size: 13px;
}
.toolbar select { padding-right: 30px; }

.help-text {
    font-size: 12.5px;
    color: var(--c-text-muted);
    margin: 5px 0 0;
    line-height: 1.5;
}

/* --- Grilles de formulaire ---
   .form-row a deux usages historiques dans le projet :
     a) conteneur de 2 champs côte à côte  -> grille
     b) conteneur d'un champ (label+input) -> bloc simple
   On distingue avec :has(), avec repli sur .form-grid-2 pour les vieux moteurs. */
.form-row   { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }

.form-row:has(> label),
.form-row:has(> input),
.form-row:has(> select),
.form-row:has(> textarea),
.form-grid-2 > .form-row {
    display: block;
    margin-bottom: 16px;
}

/* Repli pour les navigateurs sans :has() — un champ posé directement dans
   un .form-row occupe alors toute la largeur de la grille, ce qui rend le
   même résultat visuel que le bloc ci-dessus. */
.form-row > label,
.form-row > input,
.form-row > select,
.form-row > textarea,
.form-row > .input-group,
.form-row > .help-text,
.form-row-3 > label,
.form-row-3 > input,
.form-row-3 > select,
.form-row-3 > textarea {
    grid-column: 1 / -1;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 18px;
}

.input-group { display: flex; gap: 6px; align-items: stretch; }
.input-group > input, .input-group > select { flex: 1; min-width: 0; }

fieldset {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin: 0 0 18px;
}
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--c-text-muted); padding: 0 6px; }

/* --- Barre d'outils / filtres --- */
.toolbar,
.logs-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar form,
.logs-filters form { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; align-items: center; }

/* Formulaire de filtres dans une card : champs sur une ligne, largeur auto */
.card > form[method=get] { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card > form[method=get] input,
.card > form[method=get] select { width: auto; min-width: 150px; flex: 0 1 auto; }
.card > form[method=get] input[type=search],
.card > form[method=get] input[type=text] { min-width: 210px; flex: 1 1 210px; }

/* ==========================================================================
   06. BOUTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.005em;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
                box-shadow 0.15s var(--ease), transform 0.06s var(--ease), color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary   { background: var(--c-bleu);    color: #fff; }
.btn-primary:hover:not(:disabled)   { background: #1B336F; color: #fff; box-shadow: var(--shadow-sm); }

.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--c-surface-alt); border-color: #BFC7D4; color: var(--c-text); }

.btn-success   { background: var(--c-success); color: #fff; }
.btn-success:hover:not(:disabled)   { background: #0B8A5F; color: #fff; }

.btn-danger    { background: var(--c-danger);  color: #fff; }
.btn-danger:hover:not(:disabled)    { background: #B91C1C; color: #fff; }

.btn-warning   { background: var(--c-warning); color: #fff; }
.btn-warning:hover:not(:disabled)   { background: #B45309; color: #fff; }

.btn-info      { background: var(--c-info);    color: #fff; }
.btn-info:hover:not(:disabled)      { background: #0369A1; color: #fff; }

.btn-rose      { background: var(--c-rose);    color: #fff; }
.btn-rose:hover:not(:disabled)      { background: #C82A6C; color: #fff; }

.btn-violet    { background: var(--c-violet);  color: #fff; }
.btn-violet:hover:not(:disabled)    { background: #6D28D9; color: #fff; }

.btn-ghost     { background: transparent; color: var(--c-text-soft); box-shadow: none; }
.btn-ghost:hover:not(:disabled)     { background: var(--c-surface-mute); color: var(--c-text); }

.btn-link      { background: none; border: 0; box-shadow: none; color: var(--c-bleu-700); padding: 0; }
.btn-link:hover { text-decoration: underline; }

.btn-sm  { padding: 6px 11px; font-size: 12.5px; border-radius: var(--radius-xs); gap: 5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg  { padding: 12px 22px; font-size: 15px; border-radius: var(--radius); }
.btn-block { width: 100%; }

.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-icon.btn-sm { padding: 6px; width: 30px; height: 30px; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ==========================================================================
   07. TABLEAUX
   ========================================================================== */

.table-wrap {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Une table directement dans une .card déborde proprement */
.card > .table { margin: -22px; width: calc(100% + 44px); }
.card > .table:not(:first-child) { margin-top: 4px; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.8px;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--c-border);
}
.table thead th {
    position: relative;
    background: var(--c-surface-alt);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-text-muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--c-border);
}

/* En-têtes de colonne triables */
.table thead th .th-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.12s var(--ease);
}
.table thead th .th-sort:hover { color: var(--c-text); }
.th-sort-ico {
    display: inline-flex;
    opacity: 0;
    transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
}
.table thead th .th-sort:hover .th-sort-ico { opacity: 0.45; }
.th-sort.is-active { color: var(--c-bleu-600); }
.th-sort.is-active .th-sort-ico { opacity: 1; }
.th-sort.is-asc .th-sort-ico { transform: rotate(180deg); }

.table tbody tr { transition: background-color 0.12s var(--ease); }
.table tbody tr:hover { background: var(--c-surface-alt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td strong { font-weight: 620; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.row-checkbox { cursor: pointer; }
.row-selected, .table tbody tr.row-selected:hover { background: var(--c-bleu-50) !important; }

/* ==========================================================================
   08. BADGES & PASTILLES
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    line-height: 1.5;
    white-space: nowrap;
    background: var(--c-surface-mute);
    color: var(--c-text-soft);
}

.badge-success, .status-valide, .status-termine   { background: var(--c-success-bg); color: var(--c-success-fg); }
.badge-warning, .status-en_attente                { background: var(--c-warning-bg); color: var(--c-warning-fg); }
.badge-danger,  .status-refuse                    { background: var(--c-danger-bg);  color: var(--c-danger-fg); }
.badge-info,    .status-publie, .status-liste_attente { background: var(--c-info-bg); color: var(--c-info-fg); }
.badge-violet,  .status-mission_terminee          { background: #F1EAFE; color: #5B21B6; }
.badge-rose                                       { background: #FDE8F1; color: #9D174D; }
.badge-gray, .badge-secondary,
.status-brouillon, .status-archive, .status-indisponible { background: var(--c-surface-mute); color: #475569; }
.badge-primary                                    { background: var(--c-bleu-100); color: #1E40AF; }

.status-present               { background: #E0E7FF; color: #3730A3; }
.status-invite,
.badge-status-invite          { background: #FFEDD5; color: #9A3412; }
.status-invite_refuse,
.badge-status-invite_refuse   { background: var(--c-danger-bg); color: var(--c-danger-fg); font-style: italic; }

/* Rôles (deux conventions coexistent dans les pages) */
.role-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    margin: 3px 0;
    width: fit-content;
}
.role-admin,        .badge-role-admin        { background: var(--c-rose);       color: #fff; }
.role-admission,    .badge-role-admission    { background: var(--c-violet);     color: #fff; }
.role-ambassadeur,  .badge-role-ambassadeur  { background: var(--c-bleu-light); color: #fff; }

.color-dot, .legend-color, .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 7px;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 3px rgba(16,27,57,0.08);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12.5px;
    color: var(--c-text-soft);
    margin-right: 14px;
}
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--c-surface-mute);
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-soft);
}

.count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--c-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   09. ALERTES / FLASH
   ========================================================================== */

.flash, .alert {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    font-size: 13.8px;
    line-height: 1.55;
}
.flash ul, .alert ul { margin: 0; padding-left: 20px; }
.flash > :last-child, .alert > :last-child { margin-bottom: 0; }

.flash-success, .alert-success { background: var(--c-success-bg); border-color: var(--c-success); color: var(--c-success-fg); }
.flash-error,   .flash-danger,
.alert-error,   .alert-danger  { background: var(--c-danger-bg);  border-color: var(--c-danger);  color: var(--c-danger-fg); }
.flash-warning, .alert-warning,
.warn                          { background: var(--c-warning-bg); border-color: var(--c-warning); color: var(--c-warning-fg); }
.flash-info,    .alert-info    { background: var(--c-info-bg);    border-color: var(--c-info);    color: var(--c-info-fg); }

.flash a, .alert a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ==========================================================================
   10. NAVIGATION (barre latérale)
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 120;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--c-nav-bg);
    color: var(--c-nav-text);
    border-right: 1px solid rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--c-nav-border);
    flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo:hover { text-decoration: none; }
/* Logo déposé dans Paramètres. Deux versions possibles (fond clair / fond
   foncé) : le choix se fait côté PHP via brand_logo_url(). */
.logo-img {
    display: block;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.logo-text strong {
    font-size: 14.5px; font-weight: 650; color: var(--c-nav-text-hi);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-text span {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.11em;
    color: rgba(255,255,255,0.45); font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 12px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 4px; }

.nav-section {
    padding: 18px 10px 7px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: rgba(255,255,255,0.38);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    font-size: 13.6px;
    font-weight: 550;
    color: var(--c-nav-text);
    transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: var(--c-nav-text-hi);
    text-decoration: none;
}
.nav-item.active {
    background: var(--c-nav-bg-soft);
    color: var(--c-nav-text-hi);
    font-weight: 650;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--c-rose);
}
.nav-item .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    flex-shrink: 0;
    font-size: 15px;
    opacity: 0.75;
}
.nav-item .nav-icon svg { width: 18px; height: 18px; stroke-width: 1.9; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }
.nav-item .nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-item .count { margin-left: auto; }

.sidebar-footer {
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid var(--c-nav-border);
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    min-width: 0;
}
.user-card:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.user-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-info strong {
    font-size: 13px; font-weight: 620; color: var(--c-nav-text-hi);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info small { font-size: 11px; color: rgba(255,255,255,0.5); }

/* --- Bouton menu mobile + voile --- */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    flex-shrink: 0;
    padding: 0;
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}
.mobile-menu-btn svg { width: 20px; height: 20px; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}
body.nav-open .sidebar-backdrop { opacity: 1; visibility: visible; }

/* ==========================================================================
   11. ONGLETS
   ========================================================================== */

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-link {
    position: relative;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--c-text-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tab-link:hover { color: var(--c-text); text-decoration: none; }
.tab-link.active { color: var(--c-bleu); border-bottom-color: var(--c-bleu); }

/* --- Bandeau d'évènement collant --- */
.event-sticky {
    position: sticky;
    top: var(--topbar-h);
    z-index: 50;
    margin: -26px -32px 20px;
    padding: 18px 32px 0;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 6px 10px -10px rgba(16,27,57,0.35);
}
.event-sticky .tabs { border-bottom: 0; margin-bottom: 0; flex-wrap: nowrap; }
.event-sticky .tab-link { white-space: nowrap; }
.event-sticky-inner { max-width: 100%; }

.header-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}
.header-back:hover { color: var(--c-text); text-decoration: none; }

/* ==========================================================================
   12. PAGINATION & ACTIONS GROUPÉES
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-top: 1px solid var(--c-border);
    margin-top: 0;
}
.card > .pagination { margin: 4px -22px -22px; }
.card-flush > .pagination { margin: 0; }
.pagination-info { font-size: 13px; color: var(--c-text-muted); }
.pagination-controls { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 550;
    color: var(--c-text-soft);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-xs);
    transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--c-surface-mute);
    color: var(--c-text);
    text-decoration: none;
}
.pagination-btn.active {
    background: var(--c-bleu);
    border-color: var(--c-bleu);
    color: #fff;
    font-weight: 650;
}
.pagination-btn.disabled { color: var(--c-border-strong); pointer-events: none; }
.pagination-ellipsis { align-self: center; padding: 0 4px; color: var(--c-text-muted); }

.bulk-actions-bar {
    position: sticky;
    top: calc(var(--topbar-h) + 8px);
    z-index: 45;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--c-nav-bg);
    color: #fff;
    box-shadow: var(--shadow-lg);
}
.bulk-actions-bar.active { display: flex; }
.bulk-actions-bar .count {
    background: rgba(255,255,255,0.16);
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    min-width: auto;
    padding: 2px 10px;
    height: auto;
}
.bulk-actions-bar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-actions-bar .actions .btn {
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    box-shadow: none;
}
.bulk-actions-bar .actions .btn:hover { background: rgba(255,255,255,0.24); color: #fff; }
.bulk-actions-bar .actions .btn-danger { background: var(--c-danger); border-color: var(--c-danger); }
.bulk-actions-bar .actions .btn-danger:hover { background: #B91C1C; }

/* ==========================================================================
   13. PAGES SPÉCIFIQUES
   ========================================================================== */

/* --- Connexion --- */
.login-page {
    display: flex;
    min-height: 100vh;
    margin: 0;
    background: var(--c-bg);
}
.login-visual {
    position: relative;
    flex: 1 1 46%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 12%, rgba(224, 53, 124, 0.38) 0%, transparent 48%),
        radial-gradient(circle at 85% 88%, rgba(124, 58, 237, 0.42) 0%, transparent 52%),
        linear-gradient(150deg, #16296B 0%, #101B39 100%);
    overflow: hidden;
}
.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
    pointer-events: none;
}
.login-visual > * { position: relative; z-index: 1; }
.login-visual .logo-text strong { color: #fff; }
.login-visual h2 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: #fff;
    max-width: 15ch;
}
.login-visual p { color: rgba(255,255,255,0.66); font-size: 14.5px; max-width: 42ch; }
.login-points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; }
.login-points li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
}
.login-points svg { width: 18px; height: 18px; color: var(--c-rose-light); flex-shrink: 0; }
.login-legal { font-size: 12px; color: rgba(255,255,255,0.4); }

.login-panel {
    flex: 1 1 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.login-card {
    width: 100%;
    max-width: 400px;
}
.login-card .logo { justify-content: flex-start; margin-bottom: 26px; }
.login-card .logo-img { max-width: 240px; }
.login-visual .logo-img { max-width: 260px; }
.sidebar .logo-img { max-width: 100%; }
.login-card .logo-text strong { color: var(--c-text); }
.login-card .logo-text span { color: var(--c-text-muted); }
.login-card h1 { font-size: 25px; margin-bottom: 4px; }
.login-card .subtitle { margin-bottom: 26px; }
.login-card .form-group { margin-bottom: 15px; }
.login-card .btn-lg { margin-top: 6px; }

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    font-size: 12px;
    color: var(--c-text-muted);
}
.login-divider::before, .login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border);
}
.btn-microsoft {
    background: var(--c-surface);
    color: var(--c-text);
    border-color: var(--c-border-strong);
    font-weight: 600;
}
.btn-microsoft:hover { background: var(--c-surface-alt); color: var(--c-text); }

.login-foot { margin-top: 22px; font-size: 13px; color: var(--c-text-muted); }

.pwd-field { position: relative; }
.pwd-field input { padding-right: 42px; }
.pwd-toggle {
    position: absolute;
    top: 50%; right: 4px;
    transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: var(--radius-xs);
    color: var(--c-text-muted);
    cursor: pointer;
}
.pwd-toggle:hover { color: var(--c-text); background: var(--c-surface-mute); }
.pwd-toggle svg { width: 17px; height: 17px; }

/* --- Cartes d'évènement --- */
.event-card {
    position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-bleu);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.event-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.event-card-title, .mission-title {
    font-size: 15.5px;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 0 0 3px;
}
.event-card-meta, .mission-meta {
    display: flex;
    gap: 8px 16px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 13px;
    color: var(--c-text-soft);
}
.event-card-meta span, .mission-meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-card-meta svg, .mission-meta svg { width: 15px; height: 15px; color: var(--c-text-muted); }

.brief-section {
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-top: 14px;
    white-space: pre-line;
    font-size: 14px;
    line-height: 1.65;
}
.map-link, .contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

/* --- Pointage --- */
.punch-zone {
    background: var(--c-surface);
    border: 2px dashed var(--c-border-strong);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.punch-zone.active { border-color: var(--c-success); background: var(--c-success-bg); }
.punch-zone.error  { border-color: var(--c-danger);  background: var(--c-danger-bg); }
.punch-btn { width: 100%; max-width: 340px; font-size: 16px; padding: 15px 24px; }
.punch-btn.arrive { background: var(--c-success); color: #fff; }
.punch-btn.depart { background: var(--c-bleu); color: #fff; }
.punch-status { font-size: 13.5px; color: var(--c-text-soft); margin-top: 10px; }
.qr-fallback { margin-top: 14px; font-size: 13px; color: var(--c-text-muted); }

.qr-display {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    max-width: 360px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}
.qr-display canvas, .qr-display img { max-width: 100%; height: auto; }

/* --- Calendrier --- */
#calendar {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}
.fc-event { cursor: pointer; border-radius: 5px !important; }
.fc .fc-button-primary {
    background: var(--c-surface) !important;
    border-color: var(--c-border-strong) !important;
    color: var(--c-text) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    box-shadow: none !important;
}
.fc .fc-button-primary:hover { background: var(--c-surface-alt) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--c-bleu) !important;
    border-color: var(--c-bleu) !important;
    color: #fff !important;
}
.fc .fc-toolbar-title { font-size: 18px !important; font-weight: 650 !important; }

/* --- Pages d'erreur --- */
.error-page {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}
.error-code {
    font-size: 84px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, var(--c-bleu) 0%, var(--c-rose) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

/* ==========================================================================
   14. UTILITAIRES
   ========================================================================== */

.muted, .text-muted { color: var(--c-text-muted); }
.text-soft    { color: var(--c-text-soft); }
.text-success { color: var(--c-success-fg); }
.text-danger  { color: var(--c-danger-fg); }
.text-warning { color: var(--c-warning-fg); }
.text-info    { color: var(--c-info-fg); }
.text-bleu    { color: var(--c-bleu); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.small        { font-size: 12.5px; line-height: 1.5; }
.fw-600       { font-weight: 600; }
.nowrap       { white-space: nowrap; }
.tabular      { font-variant-numeric: tabular-nums; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.flex        { display: flex; }
.flex-gap    { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flex-between{ display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-1      { flex: 1; min-width: 0; }
.gap-1       { gap: 8px; }
.gap-2       { gap: 16px; }
.w-100       { width: 100%; }

.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 16px; height: 16px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.hide { display: none !important; }

/* ==========================================================================
   15. RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
    :root { --sidebar-w: 240px; }
    .main-inner { padding: 22px 22px 48px; }
    .topbar { padding: 0 22px; }
    .event-sticky { margin: -22px -22px 18px; padding: 16px 22px 0; }
}

@media (max-width: 980px) {
    .form-row, .form-row-3, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .form-row > .form-group:last-child,
    .form-row-3 > .form-group:last-child { margin-bottom: 16px; }
}

/* ---------- Tablette / mobile : la barre latérale devient un tiroir ---------- */
@media (max-width: 860px) {
    .mobile-menu-btn { display: inline-flex; }

    .sidebar {
        width: 282px;
        transform: translateX(-100%);
        transition: transform 0.28s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: translateX(0); }

    .main { margin-left: 0; }
    .main-inner { padding: 18px 16px 44px; }
    .topbar { padding: 0 16px; gap: 10px; }
    .topbar-user span.topbar-user-name { display: none; }
    .topbar-user { padding: 4px; border: 0; box-shadow: none; }

    .event-sticky { margin: -18px -16px 16px; padding: 14px 16px 0; }
    .bulk-actions-bar { top: calc(var(--topbar-h) + 4px); }

    h1 { font-size: 21px; }
    h2 { font-size: 17px; }
    .card { padding: 16px; }
    .card-header { margin: -16px -16px 14px; padding: 13px 16px; }
    .card > .table { margin: -16px; width: calc(100% + 32px); }
    .card > .pagination { margin: 4px -16px -16px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 24px; }
    .page-header { gap: 12px; }
    .page-actions { width: 100%; }

    /* Formulaires de filtres : pleine largeur, empilés */
    .card > form[method=get] input,
    .card > form[method=get] select { width: 100%; min-width: 0; flex: 1 1 140px; }
    .card > form[method=get] .btn { flex: 1 1 100%; }

    /* ---------- Tableaux : passage en cartes ----------
       Le JS (app.js) ajoute data-label sur chaque cellule à partir des <th>. */
    .table.responsive-cards thead { display: none; }
    .table.responsive-cards,
    .table.responsive-cards tbody,
    .table.responsive-cards tr,
    .table.responsive-cards td { display: block; width: 100%; }

    .table.responsive-cards tr {
        position: relative;
        margin: 0 0 10px;
        padding: 4px 0;
        border: 1px solid var(--c-border);
        border-radius: var(--radius-sm);
        background: var(--c-surface);
        box-shadow: var(--shadow-xs);
    }
    .table.responsive-cards tr:last-child { margin-bottom: 0; }
    .table.responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        padding: 8px 14px;
        border: 0;
        text-align: right;
        min-height: 34px;
    }
    .table.responsive-cards td + td { border-top: 1px dashed var(--c-border); }
    .table.responsive-cards td::before {
        content: attr(data-label);
        flex-shrink: 0;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--c-text-muted);
    }
    .table.responsive-cards td[data-label=""]::before { content: none; }

    /* Case à cocher de sélection : épinglée dans le coin de la carte */
    .table.responsive-cards td:first-child:has(> input[type=checkbox]) {
        position: absolute; top: 8px; right: 10px;
        width: auto; min-height: 0; padding: 0; border: 0;
    }
    .table.responsive-cards td:first-child:has(> input[type=checkbox]) + td { padding-right: 46px; }

    /* Première colonne renseignée : titre de la carte */
    .table.responsive-cards td.card-title-cell {
        display: block;
        padding: 11px 14px 9px;
        text-align: left;
        font-size: 14.5px;
        background: var(--c-surface-alt);
        border-bottom: 1px solid var(--c-border);
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    }
    .table.responsive-cards td.card-title-cell::before { content: none; }
    .table.responsive-cards td.card-title-cell + td { border-top: 0; }
    .table.responsive-cards td:empty { display: none; }
    .table.responsive-cards .table-actions,
    .table.responsive-cards .actions { justify-content: flex-end; }

    .card-flush .table.responsive-cards,
    .card > .table.responsive-cards { padding: 10px; margin: 0; width: 100%; }
}

@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 13px 13px 12px; }
    .stat-value { font-size: 22px; margin-top: 5px; }
    .stat-label { font-size: 10.5px; }
    .stat-sub { font-size: 11.5px; margin-top: 3px; }
    .detail-grid { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { padding: 28px 18px; }
    .page-actions .btn { flex: 1 1 auto; }
    .btn-lg { padding: 11px 18px; font-size: 14.5px; }
}

@media (max-width: 359px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ---------- Impression ---------- */
@media print {
    .sidebar, .topbar, .mobile-menu-btn, .page-actions,
    .bulk-actions-bar, .pagination, .sidebar-backdrop { display: none !important; }
    .main { margin-left: 0; }
    .main-inner { padding: 0; max-width: none; }
    body { background: #fff; }
    .card, .table-wrap { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* ---------- Accessibilité : mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
