﻿*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Palette bleu clair moderne */
    --primary: #2b6cb0;
    --primary-hover: #3182ce;
    --primary-dark: #2c5282;
    --primary-light: #4299e1;
    --primary-pale: #ebf8ff;
    --sidebar-from: #b2e0e0;
    --sidebar-to: #b2e0e0;

    /* La barre passe sur un fond clair : tout ce qui s'y écrit doit s'inverser avec
       elle. Ces cinq variables portent l'inversion en un seul endroit — sans elles,
       une quinzaine de couleurs en dur ailleurs dans la feuille laisseraient du blanc
       sur du turquoise pâle, c'est-à-dire un menu invisible. */
    --sidebar-texte: #0f4548;

    /* Le secondaire est mesuré, non choisi à l'œil : une première valeur plus claire
       (#3a7275) tombait à 3,81 contre ce fond, sous le seuil de 4,5. Elle portait la
       version, le profil de l'utilisateur et l'icône de déconnexion — précisément le
       genre de texte qu'on ne relit pas et qu'on ne signale donc jamais. */
    --sidebar-texte-doux: #2d5c5f;
    --sidebar-trait: rgba(0,0,0,.12);
    --sidebar-survol: rgba(255,255,255,.55);
    --sidebar-actif: #ffffff;
    --success: #38a169;
    --success-pale: #f0fff4;
    --danger: #e53e3e;
    --danger-pale: #fff5f5;
    --warning: #dd6b20;
    --warning-pale: #fffaf0;
    --bg: #f7fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e0;
    --text: #1a202c;
    --text-sec: #4a5568;
    --text-muted: #a0aec0;
    --radius: 10px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 6px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.05);
    --shadow-btn: 0 2px 4px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --shadow-btn-hover: 0 4px 8px rgba(0,0,0,.15), 0 2px 4px rgba(0,0,0,.10);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    color: var(--sidebar-texte);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,.08);
}

.sidebar-logo {
    padding: 20px 18px;
    border-bottom: 1px solid var(--sidebar-trait);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 3px 8px rgba(66,153,225,.35);
}

.logo-text {
    font-weight: 700;
    font-size: 17px;
    color: var(--sidebar-texte);
    letter-spacing: -.3px;
}

.logo-sub {
    font-size: 11px;
    color: var(--sidebar-texte-doux);
}

.logo-entreprise {
    font-size: 11px;
    color: var(--sidebar-texte);
    font-weight: 600;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--sidebar-trait);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section {
    padding: 14px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    /* Le rouge vif d'avant se lisait sur du bleu foncé ; sur ce fond pâle il tombe à
       peine au-dessus du seuil de lisibilité. Assombri, il garde son rôle d'accent —
       distinguer un titre de groupe d'une entrée — sans se battre avec le fond. */
    color: #9d3838;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 3px;
    cursor: pointer;
    color: var(--sidebar-texte) !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    border-radius: var(--radius-sm);
    transition: all .18s ease;
}

    .nav-item:hover {
        background: var(--sidebar-survol);
        color: var(--sidebar-texte) !important;
        transform: translateX(2px);
    }

    /* L'entrée courante était marquée par un voile blanc sur fond foncé. Le fond étant
       désormais clair, c'est le blanc franc qui la détache — elle paraît posée au-dessus
       plutôt que creusée dedans — et le filet bleu la désigne sans ambiguïté. */
    .nav-item.active {
        background: var(--sidebar-actif);
        color: var(--sidebar-texte) !important;
        font-weight: 600;
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .nav-item i {
        width: 20px;
        text-align: center;
        font-size: 15px;
    }

/* ── Entrée dépliante du menu ──────────────────────────────────────────────
   C'est un bouton, non un lien : il ne mène nulle part, il ouvre. Il garde donc
   l'allure d'une entrée — sans quoi on ne saurait pas qu'il se clique — mais
   `width:100%` et la remise à zéro des styles de bouton sont indispensables,
   un <button> n'héritant ni de la largeur ni de la police de son voisin <a>. */
.nav-groupe {
    width: 100%;
    border: 0;
    background: none;
    font-family: inherit;
    text-align: left;
}

    .nav-groupe span {
        flex: 1;
    }

    /* Le chevron dit l'état, et c'est la seule chose qui bouge : poser un fond au
       survol du titre lui donnerait l'apparence d'une destination. */
    .nav-groupe .chevron {
        font-size: 11px;
        opacity: .65;
        transition: transform .18s ease;
    }

    .nav-groupe.ouvert .chevron {
        transform: rotate(180deg);
    }

/* L'indentation dit l'appartenance — c'est elle qui fait lire les deux entrées
   comme le contenu du groupe, et non comme ses voisines. Le filet vertical la
   prolonge sur toute la hauteur, y compris entre les deux lignes. */
.nav-sous-groupe {
    margin: 0 0 3px 26px;
    padding-left: 10px;
    border-left: 1px solid var(--sidebar-trait);
}

    .nav-sous-groupe .nav-item {
        font-size: 13.5px;
        padding: 9px 12px;
    }

.sidebar-user {
    padding: 14px;
    border-top: 1px solid var(--sidebar-trait);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info-link {
    text-decoration: none;
    flex: 1;
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background .18s;
}

    .user-info-link:hover {
        background: var(--sidebar-survol);
    }

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--sidebar-texte);
}

.user-sub {
    font-size: 11px;
    color: var(--sidebar-texte-doux);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.btn-logout {
    background: rgba(0,0,0,.06);
    border: none;
    cursor: pointer;
    color: var(--sidebar-texte-doux);
    font-size: 15px;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all .18s;
}

    .btn-logout:hover {
        background: rgba(229,62,62,.16);
        color: #9b2c2c;
    }

/* ── EN-TÊTE DE PAGE ────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.page-date {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── CARTES ─────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    background: none;
    border: none;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.2px;
}

/* ── STATISTIQUES ───────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }

.stat-label {
    font-size: 13px;
    color: var(--text-sec);
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

.stat-icon {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 26px;
    opacity: .18;
}

/* ── DASHBOARD ──────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.ecarts-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ecart-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ecart-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.ecart-label {
    font-size: 12px;
    color: var(--text-sec);
    font-weight: 500;
}

.ecart-value {
    font-size: 18px;
    font-weight: 700;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all .18s;
}

    .recent-item:hover {
        border-color: var(--primary-light);
        background: var(--primary-pale);
    }

.recent-info {
    flex: 1;
}

.recent-name {
    font-size: 14px;
    font-weight: 600;
}

.recent-date {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-text {
    color: var(--text-muted);
    text-align: center;
    padding: 28px;
}

/* ── BOUTONS (avec relief) ──────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-btn);
    transition: all .16s cubic-bezier(.4,0,.2,1);
    white-space: nowrap;
}

    .btn:hover {
        box-shadow: var(--shadow-btn-hover);
        transform: translateY(-1px);
    }

    .btn:active {
        transform: translateY(1px);
        box-shadow: 0 1px 2px rgba(0,0,0,.12);
    }

    .btn:disabled {
        opacity: .5;
        cursor: not-allowed;
        transform: none;
        box-shadow: var(--shadow-btn);
    }

.btn-primary {
    background: linear-gradient(180deg, var(--primary-hover), var(--primary));
    color: #fff;
}

    .btn-primary:hover {
        background: linear-gradient(180deg, var(--primary-light), var(--primary-hover));
        color: #fff;
    }

.btn-success {
    background: linear-gradient(180deg, #48bb78, var(--success));
    color: #fff;
}

    .btn-success:hover {
        background: linear-gradient(180deg, #68d391, #48bb78);
        color: #fff;
    }

.btn-danger {
    background: linear-gradient(180deg, #f56565, var(--danger));
    color: #fff;
}

    .btn-danger:hover {
        background: linear-gradient(180deg, #fc8181, #f56565);
        color: #fff;
    }

.btn-outline {
    background: linear-gradient(180deg, #ffffff, #f7fafc);
    border: 1px solid var(--border-strong);
    color: var(--text-sec);
}

    .btn-outline:hover {
        background: linear-gradient(180deg, #f7fafc, #edf2f7);
        color: var(--text);
        border-color: var(--primary-light);
    }

.btn-sm {
    padding: 8px 12px;
    min-height: 38px;
    font-size: 13px;
}

/* ── TABLEAUX ───────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

th {
    background: #edf2f7;
    padding: 13px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sec);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background .14s;
}

    tbody tr:hover td {
        background: var(--primary-pale);
    }

/* ── Tableau resserré ───────────────────────────────────────────────────────
   Pour les listes qui se comptent en centaines de lignes. À 78 px la ligne, un
   catalogue de 400 articles fait huit écrans ; il en fait trois ici.

   Ce qui prenait la place, dans l'ordre : le bouton d'action, dont le
   `min-height: 38px` imposait à lui seul la hauteur de la ligne ; puis le
   repli des libellés courts — « MAGASIN A1 », « AROME MAGGI » tenaient sur
   deux lignes ; le remplissage vient en dernier.

   Sous 768 px le tableau devient une pile de cartes, où chaque cellule est un
   bloc étiqueté : y interdire le repli couperait les valeurs. Ces règles ne
   s'appliquent donc qu'au-dessus. */
@media (min-width: 769px) {
    .table-dense th {
        padding: 7px 10px;
        font-size: 11px;
    }

    .table-dense td {
        padding: 5px 10px;
        font-size: 13px;
        line-height: 1.3;
        white-space: nowrap;
    }

    /* La désignation est la seule à pouvoir être longue. Elle est coupée plutôt
       que repliée — une ligne par article est la promesse de cette vue — et
       l'attribut `title` rend le texte entier au survol. */
    .table-dense td.cellule-longue {
        max-width: 240px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* L'exception à la ligne unique : une colonne dont le contenu *doit* se lire en
       entier. Le journal d'audit en vit — couper « avant » et « après » viderait de
       son sens la seule colonne pour laquelle on ouvre cet écran. On garde le repli
       et le gain de remplissage ; on perd la hauteur constante, ce qui est le bon
       échange ici et le mauvais sur un catalogue. */
    .table-dense td.cellule-texte {
        white-space: normal;
        max-width: 320px;
    }

    .table-dense .btn-sm {
        padding: 3px 8px;
        min-height: 26px;
        font-size: 12px;
    }
}

/* ── FORMULAIRES ────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    min-height: 44px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: all .16s;
    font-family: inherit;
}

    .form-control:hover {
        border-color: var(--text-muted);
    }

    .form-control:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(43,108,176,.14);
    }

    .form-control:disabled {
        background: #edf2f7;
        color: var(--text-muted);
        cursor: not-allowed;
    }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── BADGES ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-pale);
    color: #276749;
    border: 1px solid #9ae6b4;
}

.badge-danger {
    background: var(--danger-pale);
    color: #9b2c2c;
    border: 1px solid #feb2b2;
}

.badge-warning {
    background: var(--warning-pale);
    color: #9c4221;
    border: 1px solid #fbd38d;
}

.badge-info {
    background: var(--primary-pale);
    color: #2c5282;
    border: 1px solid #90cdf4;
}

.badge-gray {
    background: #edf2f7;
    color: var(--text-sec);
    border: 1px solid var(--border-strong);
}

/* ── MODALES ────────────────────────────────── */
.gs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,32,44,.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn .16s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gs-modal {
    background: #fff;
    border-radius: 16px;
    padding: 26px;
    min-width: 440px;
    max-width: 640px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}

@keyframes slideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gs-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: -.3px;
}

    .gs-modal-title button {
        background: #edf2f7;
        border: none;
        cursor: pointer;
        font-size: 20px;
        color: var(--text-sec);
        width: 34px;
        height: 34px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all .16s;
    }

        .gs-modal-title button:hover {
            background: var(--danger-pale);
            color: var(--danger);
        }

/* ── ALERTES ────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: var(--success-pale);
    color: #276749;
    border-color: var(--success);
}

.alert-danger {
    background: var(--danger-pale);
    color: #9b2c2c;
    border-color: var(--danger);
}

/* ── ÉTAT VIDE ──────────────────────────────── */
.empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}

    .empty i {
        font-size: 44px;
        margin-bottom: 16px;
        display: block;
        opacity: .35;
    }

    .empty p {
        font-size: 15px;
    }

/* ── CONNEXION ──────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Le même dégradé que la barre latérale, et non « sidebar-from → primary » :
       cette seconde couleur ne suivait pas le thème, si bien qu'éclaircir la barre
       ne changeait presque rien ici — la page de connexion étant justement le seul
       écran qu'on voit avant d'être entré. */
    background: linear-gradient(135deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 18px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,.22);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #fff;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(43,108,176,.3);
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -.6px;
}

.login-sub {
    color: var(--text-sec);
    font-size: 14px;
}

/* ── ONGLETS ────────────────────────────────── */
.tabs {
    display: flex;
    gap: 5px;
    background: #edf2f7;
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.tab {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sec);
    transition: all .16s;
    white-space: nowrap;
}

    .tab.active {
        background: #fff;
        color: var(--primary);
        box-shadow: var(--shadow-sm);
    }

    .tab:hover:not(.active) {
        background: rgba(255,255,255,.6);
    }

/* ── ÉCARTS ─────────────────────────────────── */
.ecart-manquant {
    color: var(--danger);
    font-weight: 700;
}

.ecart-surplus {
    color: var(--success);
    font-weight: 700;
}

.ecart-conforme {
    color: var(--text-muted);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

/* ── RESPONSIVE : TABLETTE ──────────────────── */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 18px;
    }

    .sidebar {
        width: 220px;
    }
}

/* ── RESPONSIVE : MOBILE ────────────────────── */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1002;
        width: 46px;
        height: 46px;
        background: linear-gradient(180deg, var(--primary-hover), var(--primary));
        color: #fff;
        border: none;
        border-radius: 12px;
        font-size: 19px;
        cursor: pointer;
        box-shadow: var(--shadow-btn);
    }

        .hamburger-btn:active {
            transform: scale(.95);
        }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(26,32,44,.5);
        z-index: 1000;
        animation: fadeIn .2s ease;
    }

    .app-layout {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 250px;
        height: 100vh;
        flex-direction: column;
        flex-wrap: nowrap;
        transform: translateX(-100%);
        transition: transform .26s cubic-bezier(.4,0,.2,1);
        z-index: 1001;
        overflow-y: auto;
        padding: 0;
    }

        .sidebar.sidebar-open {
            transform: translateX(0);
        }

    .sidebar-logo {
        padding: 12px 14px 10px 62px;
        border-bottom: 1px solid var(--sidebar-trait);
        flex-shrink: 0;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .logo-text {
        font-size: 15px;
    }

    .logo-sub {
        font-size: 10px;
    }

    .logo-entreprise {
        font-size: 10px;
        margin-top: 4px;
        padding-top: 4px;
    }

    .sidebar-nav {
        order: unset;
        width: 100%;
        display: block;
        overflow-x: visible;
        overflow-y: auto;
        padding: 2px 8px;
        gap: 0;
        border-top: none;
        flex: 1 1 auto;
    }

    .nav-section {
        display: block;
        padding: 8px 12px 3px;
        font-size: 9px;
    }

    .nav-item {
        margin-bottom: 1px;
        padding: 9px 12px;
        font-size: 13px;
        white-space: normal;
    }

        .nav-item i {
            font-size: 14px;
            width: 18px;
        }

    .sidebar-user {
        border-top: 1px solid var(--sidebar-trait);
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .user-name {
        font-size: 12px;
    }

    .user-sub {
        display: flex;
        font-size: 10px;
    }

    .btn-logout {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .main-content {
        padding: 70px 14px 20px;
    }

    .page-title {
        font-size: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .gs-modal {
        min-width: unset;
        padding: 20px;
        border-radius: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

    .stat-value {
        font-size: 26px;
    }

    .btn {
        padding: 12px 16px;
    }

    th, td {
        padding: 8px 10px;
        font-size: 13px;
        line-height: 1.35;
    }

    .table-wrap {
        border-radius: 8px;
    }
        /* Tableaux transformés en cartes empilées */
        .table-wrap.responsive-cards {
            border: none;
            overflow: visible;
        }

            .table-wrap.responsive-cards thead {
                display: none;
            }

            .table-wrap.responsive-cards table,
            .table-wrap.responsive-cards tbody,
            .table-wrap.responsive-cards tr,
            .table-wrap.responsive-cards td {
                display: block;
                width: 100%;
            }

            .table-wrap.responsive-cards tr {
                background: #fff;
                border: 1px solid var(--border);
                border-radius: 12px;
                padding: 14px;
                margin-bottom: 12px;
                box-shadow: var(--shadow-sm);
            }

            .table-wrap.responsive-cards tbody tr:hover td {
                background: transparent;
            }

            .table-wrap.responsive-cards td {
                border: none;
                padding: 5px 0;
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: 12px;
                font-size: 14px;
            }

                .table-wrap.responsive-cards td::before {
                    content: attr(data-label);
                    font-weight: 600;
                    font-size: 11px;
                    color: var(--text-muted);
                    text-transform: uppercase;
                    letter-spacing: .5px;
                    flex-shrink: 0;
                }

                .table-wrap.responsive-cards td:last-child {
                    padding-top: 12px;
                    margin-top: 8px;
                    border-top: 1px solid var(--border);
                    justify-content: flex-end;
                }

                    .table-wrap.responsive-cards td:last-child::before {
                        display: none;
                    }

                    .table-wrap.responsive-cards td:last-child > div {
                        flex-wrap: wrap;
                        justify-content: flex-end;
                    }
    /* Filtres empilés verticalement sur mobile */
    .card > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column;
        gap: 12px !important;
    }

        .card > div[style*="grid-template-columns"] .form-group {
            margin: 0;
            width: 100%;
        }

        .card > div[style*="grid-template-columns"] .btn {
            width: 100%;
        }

}
/* ── IMPRESSION ─────────────────────────────── */
.print-only {
    display: none;
}
/* ── MENU HAMBURGER (mobile) ────────────────── */
.hamburger-btn {
    display: none;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1002;
        width: 46px;
        height: 46px;
        background: linear-gradient(180deg, var(--primary-hover), var(--primary));
        color: #fff;
        border: none;
        border-radius: 12px;
        font-size: 19px;
        cursor: pointer;
        box-shadow: var(--shadow-btn);
    }

        .hamburger-btn:active {
            transform: scale(.95);
        }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(26,32,44,.5);
        z-index: 1000;
        animation: fadeIn .2s ease;
    }

    /* Sidebar en tiroir latéral */
    .app-layout {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        height: 100vh;
        flex-direction: column;
        flex-wrap: nowrap;
        transform: translateX(-100%);
        transition: transform .26s cubic-bezier(.4,0,.2,1);
        z-index: 1001;
        overflow-y: auto;
        padding: 0;
    }

        .sidebar.sidebar-open {
            transform: translateX(0);
        }

    .sidebar-logo {
        padding: 18px 16px 18px 68px;
        border-bottom: 1px solid var(--sidebar-trait);
    }

    .sidebar-nav {
        order: unset;
        width: 100%;
        display: block;
        overflow-x: visible;
        padding: 4px 10px;
        gap: 0;
        border-top: none;
        flex: 0 1 auto;
    }

    .sidebar-logo {
        padding: 14px 16px 12px 68px;
    }

    .nav-section {
        padding: 10px 12px 4px;
    }

    .nav-section {
        display: block;
    }

    .nav-item {
        margin-bottom: 3px;
        white-space: normal;
    }

        .nav-item span {
            display: inline;
        }

    .sidebar-user {
        border-top: 1px solid var(--sidebar-trait);
        padding: 14px;
    }

    .user-sub {
        display: flex;
    }

    .main-content {
        padding: 70px 14px 20px;
    }
}

@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: #fff;
        margin: 0;
    }

    .sidebar, .tabs, .btn, .page-header button,
    .form-group, .card:has(select), .alert, .hide-on-print, .hamburger-btn, .sidebar-overlay {
        display: none !important;
    }

    .app-layout {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .main-content {
        padding: 0 !important;
        overflow: visible !important;
    }

    .page-header {
        margin-bottom: 8px !important;
    }

    .page-title {
        font-size: 16px !important;
        margin: 0 !important;
    }

    .card {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    table {
        font-size: 10px !important;
        width: 100% !important;
    }

    th {
        padding: 3px 6px !important;
        font-size: 9px !important;
        background: #f1f1f1 !important;
    }

    td {
        padding: 3px 6px !important;
    }

    tr {
        page-break-inside: avoid;
    }

    .badge {
        padding: 1px 6px !important;
        font-size: 9px !important;
        border: none !important;
    }

    thead {
        display: table-header-group;
    }

    .print-only {
        display: block !important;
    }
    html, body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .app-layout, .main-content, .card, .table-wrap, .print-only {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        page-break-after: avoid;
        page-break-inside: auto;
    }

        .print-only h2 {
            font-size: 15px !important;
            margin-bottom: 6px !important;
        }

        .print-only p {
            font-size: 11px !important;
            margin-bottom: 8px !important;
        }

    table {
        page-break-after: avoid !important;
    }

    tbody {
        page-break-after: avoid !important;
    }

    @page {
        margin: 12mm;
    }
}
