/* ============================================
   HOMEPROJECT - Design Professionnel Comptabilité
   Interface moderne pour gestion financière
   ============================================ */

/* Reset et variables */
:root {
    --sidebar-width: 280px;
    --topbar-height: 75px;

    /* Palette dark — Ardoise & Lime */
    --primary-color: #84CC16;          /* Lime — accent principal */
    --primary-dark: #65A30D;           /* Lime foncé hover */
    --primary-light: #A3E635;          /* Lime clair */
    --accent-color: #60A5FA;           /* Bleu clair info */
    --success-color: #4ADE80;          /* Vert succès */
    --warning-color: #FACC15;          /* Jaune alerte */
    --danger-color: #F87171;           /* Rouge erreur */

    /* Fonds dark */
    --bg-primary: #050810;             /* Fond général très sombre */
    --bg-secondary: #0F1623;           /* Fond cartes / panneaux */
    --bg-white: #0F1623;               /* Remplace le blanc */
    --bg-hover: #1A2235;               /* Survol lignes */
    --sidebar-bg: #0A0F1A;             /* Sidebar */
    --sidebar-active: #1F2937;         /* Item actif sidebar */

    /* Textes */
    --text-primary: #F1F5F9;           /* Texte principal (quasi blanc) */
    --text-secondary: #CBD5E1;         /* Texte secondaire */
    --text-muted: #94A3B8;             /* Texte discret */
    --text-light: #64748B;             /* Texte très discret */

    /* Bordures */
    --border-light: #1F2937;           /* Bordure standard dark */
    --border-medium: #374151;          /* Bordure moyenne */
    --border-dark: #4B5563;            /* Bordure visible */

    /* Ombres (moins visibles en dark) */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.6);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
}

/* ============================================
   BASE ET RESET
   ============================================ */

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Amélioration de la lisibilité des chiffres */
.amount, .price, .total, .monetary {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* ============================================
   SIDEBAR PROFESSIONNELLE
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-xl);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Header de la sidebar */
.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.logo-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Utilisateur dans la sidebar */
.sidebar-user {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    transition: background var(--transition-base);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.user-role {
    font-size: 12px;
    opacity: 0.65;
    color: var(--text-light);
}

/* Sections de navigation */
.sidebar-section {
    padding: 12px 0;
}

.sidebar-section-title {
    padding: 0 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.4;
    color: var(--text-light);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all var(--transition-base);
    position: relative;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary-light);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-base);
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-item:hover::before {
    height: 60%;
}

.sidebar-item.active {
    background: var(--sidebar-active);
    color: white;
}

.sidebar-item.active::before {
    height: 100%;
    background: var(--primary-light);
}

.sidebar-icon {
    font-size: 20px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-text {
    font-size: 14px;
    font-weight: 500;
}

/* Footer de la sidebar */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logout {
    color: #fca5a5;
}

.sidebar-logout:hover {
    background: rgba(252, 129, 129, 0.1);
    color: #fca5a5;
}

/* ============================================
   CONTENU PRINCIPAL
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Topbar professionnelle */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 36px;
    flex-direction: column;
    gap: 5px;
    border-radius: 6px;
    transition: background var(--transition-base);
}

.btn-menu-toggle:hover {
    background: var(--bg-secondary);
}

.btn-menu-toggle span { display: block; width: 22px; height: 2px; background: #84CC16 !important; border-radius: 2px; }

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-date {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.topbar-date::before {
    content: '📅';
    font-size: 16px;
}

/* Nom de l'entreprise dans la topbar (à gauche de la date) */
.topbar-entreprise {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: 6px;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-entreprise i {
    color: var(--accent-color, #B45309);
    font-size: 13px;
    flex-shrink: 0;
}

.topbar-entreprise:empty {
    display: none;
}

/* Wrapper du contenu */
.content-wrapper {
    flex: 1;
    padding: 24px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.content-footer {
    padding: 24px 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
    font-weight: 500;
}

/* ============================================
   ALERTES MODERNES
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #dc2626;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #3b82f6;
}

/* ============================================
   CARDS PROFESSIONNELLES
   ============================================ */

.card {
    background: var(--bg-white);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   BOUTONS PROFESSIONNELS
   ============================================ */

.btn, .btn-primary, .btn-secondary, .btn-add, .btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
    line-height: 1.5;
    white-space: nowrap;
}

.btn-primary, .btn-add {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover, .btn-add:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.btn-primary:active, .btn-add:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-export {
    background: var(--success-color);
    color: white;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

.btn-export:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   TABLEAUX PROFESSIONNELS
   ============================================ */

.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    font-size: 14px;
}

/* Largeurs optimisées pour les colonnes de devis/factures */
table th:has(input[type="checkbox"]),
table td:has(input[type="checkbox"]) {
    width: 40px;
    text-align: center;
}

/* Colonne Actions réduite */
table th[style*="width: 180px"],
table th[style*="width: 200px"],
table th:last-child {
    width: 180px !important;
    min-width: 180px;
}

/* Colonnes montants - plus d'espace */
table th:contains("Montant"),
table td:nth-child(5),
table td:nth-child(6),
table td:nth-child(7) {
    min-width: 110px;
    white-space: nowrap;
}

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 10px 6px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-medium);
}

td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-primary);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Colonnes alignées à droite pour les montants */
th.text-right, td.text-right {
    text-align: right;
}

/* Style spécial pour les totaux */
tfoot {
    background: var(--bg-secondary);
    font-weight: 700;
}

tfoot td {
    padding: 10px 6px;
    border-top: 2px solid var(--border-medium);
    border-bottom: none;
}

/* ============================================
   FORMULAIRES PROFESSIONNELS
   ============================================ */

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all var(--transition-base);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-input:disabled, .form-select:disabled, .form-textarea:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   STATS CARDS COMPTABLES
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    padding: 18px;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    font-size: 32px;
    opacity: 0.8;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
}

.stat-change {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* ============================================
   BADGES PROFESSIONNELS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================
   GRAPHIQUES
   ============================================ */

.chart-card {
    background: var(--bg-white);
    border-radius: 6px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-top: 20px;
    border: 1px solid var(--border-light);
}

.chart-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 280px;
    gap: 12px;
    padding: 0 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--primary-light), var(--primary-color));
    border-radius: 4px 4px 0 0;
    min-height: 8px;
    transition: all var(--transition-slow);
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -2px 8px rgba(30, 64, 175, 0.2);
}

.chart-bar:hover {
    opacity: 0.85;
    transform: translateY(-6px);
}

.chart-bar-value {
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
}

.chart-labels {
    display: flex;
    justify-content: space-around;
    padding: 10px 12px 0 12px;
}

.chart-labels span {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: capitalize;
}

/* ============================================
   CARTES D'ALERTE
   ============================================ */

.alert-card {
    background: var(--bg-white);
    border-radius: 6px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
}

.alert-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.alert-card.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-card.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.alert-message {
    font-size: 14px;
    color: var(--text-secondary);
}

.alert-link {
    margin-left: auto;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    transition: color var(--transition-base);
}

.alert-link:hover {
    color: var(--primary-dark);
}

/* ============================================
   MODAL PROFESSIONNELLE
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 8px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalFadeIn var(--transition-slow);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    font-size: 32px;
    font-weight: 300;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-base);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-primary);
}

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-menu-toggle {
        display: flex;
    }
    
    .topbar {
        padding: 0 16px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .topbar-date {
        display: none;
    }

    .topbar-entreprise {
        display: none;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .stat-value {
        font-size: 28px;
    }
}

/* ============================================
   UTILITAIRES
   ============================================ */

/* Boutons icônes compacts pour tableaux */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    background: var(--bg-secondary);
    color: var(--text-primary);
    white-space: nowrap;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-icon.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.btn-icon.btn-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Conteneur des boutons d'action */
.action-buttons {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    align-items: center;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }

/* Couleurs de texte */
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-muted); }

/* Poids de police */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Tailles de police */
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }

/* ============================================
   ANIMATIONS ET EFFETS
   ============================================ */

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

.animate-slide-in {
    animation: slideIn 0.4s ease;
}

/* Effet de chargement */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   IMPRESSIONS (pour PDF et factures)
   ============================================ */

@media print {
    .sidebar,
    .topbar,
    .btn-add,
    .btn-export,
    .btn-danger,
    .content-footer {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
}
/* ============================================================
   REFONTE DARK SIDEBAR + DASHBOARD - v2026
   ============================================================ */

/* SIDEBAR DARK - palette ardoise & lime */
.sidebar {
    background: #0A0F1A !important;
    border-right: 1px solid #1F2937;
    box-shadow: none !important;
}

.sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid #1F2937 !important;
    padding: 22px 18px !important;
}

.logo-name {
    color: white !important;
    font-weight: 600;
    letter-spacing: 0;
}

.logo-icon {
    box-shadow: none !important;
    background: white;
    padding: 4px;
}

/* User card */
.sidebar-user {
    background: transparent !important;
    border-bottom: 1px solid #1F2937 !important;
    padding: 16px 18px !important;
}

.sidebar-user:hover {
    background: rgba(132, 204, 22, 0.04) !important;
}

.user-avatar {
    background: linear-gradient(135deg, #84CC16, #65A30D) !important;
    color: #0A0F1A !important;
    box-shadow: none !important;
    font-weight: 700;
}

.user-name {
    color: white !important;
    font-weight: 500 !important;
}

.user-role {
    color: #9CA3AF !important;
    opacity: 1 !important;
}

/* Nav */
.sidebar-section-title {
    color: #6B7280 !important;
    opacity: 1 !important;
    font-size: 10px !important;
    letter-spacing: 1.2px !important;
    padding: 0 18px 8px !important;
}

.sidebar-item {
    color: #9CA3AF !important;
    padding: 11px 18px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-left: 3px solid transparent !important;
}

.sidebar-item::before {
    display: none !important;
}

.sidebar-item:hover {
    background: rgba(132, 204, 22, 0.06) !important;
    color: white !important;
    border-left-color: rgba(132, 204, 22, 0.3) !important;
}

.sidebar-item.active {
    background: rgba(132, 204, 22, 0.12) !important;
    color: #A3E635 !important;
    border-left-color: #84CC16 !important;
}

.sidebar-item.active .sidebar-icon {
    color: #A3E635 !important;
}

.sidebar-icon {
    color: #6B7280;
    font-size: 17px !important;
    width: 22px !important;
    transition: color 0.2s;
}

.sidebar-footer {
    background: var(--sidebar-bg) !important;
    border-top: 1px solid #1F2937 !important;
}

.sidebar-logout {
    color: #9CA3AF !important;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #FB7185 !important;
    border-left-color: rgba(239, 68, 68, 0.3) !important;
}

/* TOPBAR - ajustement pour cohérence visuelle avec sidebar dark */
.topbar {
    background: white;
    border-bottom: 1px solid #E5E7EB;
}

.page-title {
    color: #1F2937 !important;
}

/* TOPBAR DARK — cohérence avec la sidebar */
.topbar {
    background: #0A0F1A !important;
    border-bottom: 1px solid #1F2937 !important;
    box-shadow: none !important;
}

.page-title {
    color: white !important;
    font-size: 16px !important;
    font-weight: 500 !important;
}

.topbar-date {
    color: #6B7280 !important;
    font-size: 12px !important;
}

.btn-menu-toggle span { display: block; width: 22px; height: 2px; background: #84CC16 !important; border-radius: 2px; }

.btn-menu-toggle:hover span {
    background: white !important;
}

/* Supprimer l'encadré blanc de la date */
.topbar-date {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    color: #6B7280 !important;
    font-size: 12px !important;
    font-weight: 400 !important;
}

.topbar-date::before {
    content: '' !important;
    display: none !important;
}

/* Cohérence avec la date : pas d'encadré, juste du texte */
.topbar-entreprise {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    color: #E5E7EB !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    max-width: 280px !important;
}

.topbar-entreprise i {
    color: #84CC16 !important;
}

/* ============================================================
   DARK MODE GLOBAL — corrections éléments hard-codés
   ============================================================ */

/* Fond général */
body { background: #050810 !important; color: #F1F5F9 !important; }
.main-content { background: #050810 !important; }
.content-wrapper { background: #050810 !important; }

/* Cards / panels */
.card, .card-body, .form-card {
    background: #0F1623 !important;
    border-color: #1F2937 !important;
    color: #F1F5F9 !important;
}
.card-header {
    background: #080D18 !important;
    border-bottom-color: #1F2937 !important;
    color: white !important;
}
.card-title, .card-header h2, .card-header h3 {
    color: white !important;
}

/* Tables */
table { color: #E5E7EB !important; }
thead, .table-header { background: #080D18 !important; }
th { color: #9CA3AF !important; border-color: #1F2937 !important; }
td { border-color: #1A2235 !important; color: #E5E7EB !important; }
tbody tr:hover { background: rgba(132,204,22,0.03) !important; }
tbody tr:nth-child(even) { background: rgba(255,255,255,0.015) !important; }

/* Formulaires */
.form-input, .form-select, .form-textarea, input, select, textarea {
    background: #1F2937 !important;
    border-color: #374151 !important;
    color: #F1F5F9 !important;
}
.form-input:focus, .form-select:focus, .form-textarea:focus,
input:focus, select:focus, textarea:focus {
    border-color: #84CC16 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(132,204,22,0.15) !important;
}
input::placeholder, textarea::placeholder { color: #6B7280 !important; }
label, .form-label { color: #9CA3AF !important; }
option { background: #1F2937 !important; color: #F1F5F9 !important; }

/* Boutons */
.btn-primary, .btn-add {
    background: #84CC16 !important;
    color: #0A0F1A !important;
    border-color: #84CC16 !important;
}
.btn-primary:hover, .btn-add:hover {
    background: #A3E635 !important;
    border-color: #A3E635 !important;
}
.btn-secondary {
    background: #1F2937 !important;
    color: #E5E7EB !important;
    border-color: #374151 !important;
}
.btn-secondary:hover { background: #374151 !important; }
.btn-danger, .btn-delete {
    background: rgba(239,68,68,0.15) !important;
    color: #F87171 !important;
    border-color: rgba(239,68,68,0.3) !important;
}
.btn-danger:hover, .btn-delete:hover { background: rgba(239,68,68,0.3) !important; }
.btn-icon {
    background: #1F2937 !important;
    color: #9CA3AF !important;
    border-color: #374151 !important;
}
.btn-icon:hover { background: #374151 !important; color: white !important; }
.btn-view { background: rgba(132,204,22,0.12) !important; color: #A3E635 !important; }
.btn-edit { background: rgba(96,165,250,0.12) !important; color: #60A5FA !important; }

/* Badges statut */
.badge-success, .status-payee, .statut-payee {
    background: rgba(74,222,128,0.15) !important;
    color: #4ADE80 !important;
}
.badge-warning, .status-attente, .statut-en_attente {
    background: rgba(250,204,21,0.15) !important;
    color: #FACC15 !important;
}
.badge-danger, .status-retard, .statut-retard {
    background: rgba(248,113,113,0.15) !important;
    color: #F87171 !important;
}
.badge-info, .status-partielle {
    background: rgba(96,165,250,0.15) !important;
    color: #60A5FA !important;
}

/* Modals */
.modal, .modal-content, .modal-body {
    background: #0F1623 !important;
    border-color: #1F2937 !important;
    color: #F1F5F9 !important;
}
.modal-header {
    background: #080D18 !important;
    border-bottom-color: #1F2937 !important;
    color: white !important;
}
.modal-footer {
    background: #080D18 !important;
    border-top-color: #1F2937 !important;
}
.modal-overlay, .modal-backdrop {
    background: rgba(0,0,0,0.75) !important;
}

/* Alertes flash */
.alert-success { background: rgba(74,222,128,0.12) !important; border-color: rgba(74,222,128,0.3) !important; color: #4ADE80 !important; }
.alert-error, .alert-danger { background: rgba(248,113,113,0.12) !important; border-color: rgba(248,113,113,0.3) !important; color: #F87171 !important; }
.alert-warning { background: rgba(250,204,21,0.12) !important; border-color: rgba(250,204,21,0.3) !important; color: #FACC15 !important; }
.alert-info { background: rgba(96,165,250,0.12) !important; border-color: rgba(96,165,250,0.3) !important; color: #60A5FA !important; }

/* Tabs */
.tab-btn { background: transparent !important; color: #9CA3AF !important; border-color: transparent !important; }
.tab-btn.active { background: rgba(132,204,22,0.12) !important; color: #A3E635 !important; border-color: #84CC16 !important; }
.tab-btn:hover { color: white !important; background: rgba(255,255,255,0.05) !important; }
.tabs { border-bottom-color: #1F2937 !important; }

/* Pagination */
.pagination-btn { background: #1F2937 !important; color: #9CA3AF !important; border-color: #374151 !important; }
.pagination-btn:hover { background: #374151 !important; color: white !important; }
.pagination-btn.active { background: #84CC16 !important; color: #0A0F1A !important; border-color: #84CC16 !important; }

/* Filtres / search */
.filter-bar, .search-bar { background: #0F1623 !important; border-color: #1F2937 !important; }

/* Liens */
a { color: #84CC16; }
a:hover { color: #A3E635; }

/* Dividers */
hr { border-color: #1F2937 !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #050810; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* Login page */
.login-container, .login-box {
    background: #0F1623 !important;
    border-color: #1F2937 !important;
}
.login-page { background: #050810 !important; }

/* Info boxes / stat boxes */
.stat-card, .info-box, .summary-box {
    background: #0F1623 !important;
    border-color: #1F2937 !important;
    color: #F1F5F9 !important;
}

/* Dropdowns */
.dropdown-menu {
    background: #0F1623 !important;
    border-color: #1F2937 !important;
}
.dropdown-item { color: #E5E7EB !important; }
.dropdown-item:hover { background: #1F2937 !important; }

/* ============================================================
   BARRE D'ACTIONS UNIFIÉE — boutons modernisés
   Fusionner "Nouveau" + filtres sur la même ligne
   ============================================================ */

/* Barre principale du card-header */
.page-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-actions-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Bouton "Nouveau" modernisé — plus compact */
.btn-add, .btn-new {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 14px !important;
    background: #84CC16 !important;
    color: #0A0F1A !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.15s !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

.btn-add:hover, .btn-new:hover {
    background: #A3E635 !important;
    transform: translateY(-1px) !important;
    color: #0A0F1A !important;
    box-shadow: none !important;
}

/* Bouton filtre modernisé */
.btn-filter-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #1F2937;
    color: #E5E7EB;
    border: 1px solid #374151;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-filter-inline:hover {
    background: #374151;
    border-color: #84CC16;
    color: white;
}

.btn-filter-inline.active {
    background: rgba(132,204,22,0.12);
    border-color: #84CC16;
    color: #A3E635;
}

/* Bouton reset compact */
.btn-reset-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: transparent;
    color: #9CA3AF;
    border: 1px solid #374151;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-reset-inline:hover {
    color: #F87171;
    border-color: rgba(248,113,113,0.4);
    background: rgba(248,113,113,0.05);
}

/* Export CSV */
.btn-export {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 14px !important;
    background: rgba(74,222,128,0.12) !important;
    color: #4ADE80 !important;
    border: 1px solid rgba(74,222,128,0.3) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.15s !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

.btn-export:hover {
    background: rgba(74,222,128,0.2) !important;
    border-color: rgba(74,222,128,0.5) !important;
    color: #4ADE80 !important;
    transform: none !important;
}

/* Compteur de résultats */
.results-count {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
}

/* Masquer l'ancien btn-group séparé */
.btn-group-filters {
    display: none !important;
}

/* Formulaire filtres inline — sur la même ligne */
.filters-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filters-inline .form-input,
.filters-inline .form-select {
    padding: 7px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    height: 34px !important;
    min-width: 0 !important;
}

.filters-inline input[type=text] { width: 160px; }
.filters-inline select { width: 130px; }
.filters-inline input[type=date] { width: 130px; }

/* ============================================
   TOAST NOTIFICATIONS — Bulle en bas à droite
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 320px;
    max-width: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 25, 35, 0.15), 0 2px 8px rgba(15, 25, 35, 0.08);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    z-index: 9999;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid #888780;
}
.toast-notification.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}
.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    color: #fff;
}
.toast-content {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.5;
    color: #2c2c2a;
    padding-top: 4px;
}
.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888780;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.toast-close:hover { color: #2c2c2a; }

/* Variantes par type */
.toast-success { border-left-color: #1D9E75; }
.toast-success .toast-icon { background: #1D9E75; }

.toast-error { border-left-color: #E24B4A; }
.toast-error .toast-icon { background: #E24B4A; }

.toast-warning { border-left-color: #EF9F27; }
.toast-warning .toast-icon { background: #EF9F27; }

.toast-info { border-left-color: #378ADD; }
.toast-info .toast-icon { background: #378ADD; }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

/* Mobile : pleine largeur */

/* ============================================
   TOAST NOTIFICATIONS — Thème sombre lime
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    min-width: 320px;
    max-width: 480px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    box-shadow: var(--shadow-xl);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    z-index: 9999;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 3px solid var(--text-muted);
}
.toast-notification.toast-out { animation: toastOut 0.3s ease-in forwards; }

.toast-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--bg-primary);
}
.toast-content {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-primary);
    padding-top: 3px;
}
.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.toast-close:hover { color: var(--text-primary); }

.toast-success { border-left-color: var(--primary-color); }
.toast-success .toast-icon { background: var(--primary-color); }

.toast-error { border-left-color: #F87171; }
.toast-error .toast-icon { background: #F87171; color: #fff; }

.toast-warning { border-left-color: #FBBF24; }
.toast-warning .toast-icon { background: #FBBF24; }

.toast-info { border-left-color: var(--accent-color); }
.toast-info .toast-icon { background: var(--accent-color); color: #fff; }

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

@media (max-width: 600px) {
    .toast-notification {
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: 0;
        max-width: none;
    }
}

/* ============================================
   MOBILE UX — Correctifs bloquants
   ============================================ */
@media (max-width: 768px) {

    /* 1. Empêcher le zoom iOS sur les inputs (font >= 16px) */
    .form-input, .form-select, .form-textarea,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], input[type="tel"],
    input[type="search"], select, textarea {
        font-size: 16px !important;
    }

    /* 2. Tableaux de listes en cartes empilées */
    .data-table thead,
    table.data-table thead,
    .table-list thead {
        display: none;
    }
    .data-table, .data-table tbody,
    .table-list, .table-list tbody {
        display: block;
        width: 100%;
    }
    .data-table tr, .table-list tr {
        display: block;
        background: var(--bg-secondary);
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px 14px;
    }
    .data-table td, .table-list td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border: none;
        font-size: 14px;
        text-align: right;
    }
    .data-table td::before, .table-list td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 500;
        flex-shrink: 0;
        text-align: left;
    }
    /* Actions en bas de carte sur toute la largeur */
    .data-table td.actions-cell, .table-list td.actions-cell {
        justify-content: flex-end;
        padding-top: 10px;
        margin-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.05);
    }

    /* 3. Lignes de facture/devis en mode édition — colonnes empilées */
    .lignes-table thead,
    table.lignes thead {
        display: none;
    }
    .lignes-table tr, table.lignes tr {
        display: block;
        background: var(--bg-secondary);
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 10px;
        margin-bottom: 12px;
        padding: 14px;
    }
    .lignes-table td, table.lignes td {
        display: grid;
        grid-template-columns: minmax(80px, 1fr) 2fr;
        gap: 10px;
        align-items: center;
        padding: 6px 0;
        border: none;
    }
    .lignes-table td::before, table.lignes td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 500;
    }
    .lignes-table td input,
    .lignes-table td select,
    table.lignes td input,
    table.lignes td select {
        width: 100%;
    }
}
/* ============================================
   PAGE DE CONNEXION (LOGIN)
   À placer à la fin du fichier style.css
   ============================================ */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    position: relative;
    background: var(--bg-primary);
    overflow-x: hidden; /* bloque le débordement horizontal des halos, garde le scroll vertical possible */
}

/* Halos décoratifs en arrière-plan (lime en haut-droite, bleu très subtil en bas-gauche) */
/* position: fixed → ils restent en place et n'ajoutent pas de hauteur scrollable */
.login-page::before,
.login-page::after {
    content: '';
    position: fixed;
    width: 520px;
    height: 520px;
    pointer-events: none;
    z-index: 0;
}

.login-page::before {
    top: -220px;
    right: -180px;
    background: radial-gradient(circle, rgba(132, 204, 22, 0.18) 0%, transparent 70%);
}

.login-page::after {
    bottom: -220px;
    left: -180px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.10) 0%, transparent 70%);
}

/* Card principale de connexion */
.login-container {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    box-shadow: var(--shadow-xl);
    padding: 42px 38px 32px;
    width: 100%;
    max-width: 440px;
    animation: loginSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden; /* contient le trait dégradé en haut */
}

/* Trait dégradé lime en haut de la card (rappel du style des stat-cards) */
.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

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

/* En-tête (logo + titre + sous-titre) */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

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

.login-logo img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(132, 204, 22, 0.25);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Alertes (scopées login pour ne pas écraser .alert global) */
.login-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 3px solid;
    line-height: 1.5;
}

.login-alert-error {
    background: rgba(248, 113, 113, 0.10);
    border-color: var(--danger-color);
    color: #FCA5A5;
}

.login-alert-warning {
    background: rgba(250, 204, 21, 0.10);
    border-color: var(--warning-color);
    color: #FDE68A;
}

/* CTA renouvellement de licence */
.login-renew-cta {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--bg-primary) !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(132, 204, 22, 0.35);
    transition: all var(--transition-base);
}

.login-renew-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(132, 204, 22, 0.45);
}

/* Formulaire */
.login-form-group {
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.login-input {
    width: 100%;
    padding: 13px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
}

.login-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(132, 204, 22, 0.18);
}

.login-input::placeholder {
    color: var(--text-light);
}

/* Bouton principal de connexion */
.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.4px;
    margin-top: 8px;
    transition: all var(--transition-base);
    box-shadow: 0 4px 18px rgba(132, 204, 22, 0.30);
    font-family: var(--font-sans);
    text-transform: uppercase;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(132, 204, 22, 0.45);
}

.login-btn:active {
    transform: translateY(0);
}

/* Pied de page */
.login-footer {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.login-footer a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-base);
}

.login-footer a:hover {
    color: var(--primary-color);
}

/* Mobile : éviter le zoom iOS, ajuster les paddings */
@media (max-width: 600px) {
    .login-page {
        padding: 20px 16px;
    }
    .login-container {
        padding: 32px 24px 24px;
        border-radius: 14px;
    }
    .login-input {
        font-size: 16px;
    }
    .login-header h1 {
        font-size: 24px;
    }
}
/* ============================================
   SIDEBAR — Footer (Déconnexion) toujours visible
   PC, tablette, mobile.
   ============================================ */

/* La sidebar est un flex-colonne à hauteur fixe, sans scroll global.
   --real-vh est injecté par JS (window.innerHeight) pour corriger le bug
   Chrome Android où 100vh / 100dvh retournent la hauteur sans barre d'adresse. */
.sidebar {
    height: 100vh;
    height: 100dvh;
    height: var(--real-vh, 100dvh);
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Toute la partie haute (header + user + nav) scrolle en interne */
.sidebar-top {
    flex: 1 1 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
    -webkit-overflow-scrolling: touch;
}

/* Le footer n'est pas dans .sidebar-top : il reste toujours visible en bas */
.sidebar-footer {
    flex-shrink: 0 !important;
    margin-top: 0 !important;
    background: var(--sidebar-bg) !important;
}