/* =========================================
   1. VARIABLES & CONFIGURATION (Light & Dark)
   ========================================= */
:root { 
    /* --- MODE CLAIR (Défaut) --- */
    --bg-body: #f8fafc; 
    --bg-card: #ffffff;      
    --bg-input: #f8fafc;     
    --bg-hover: #f1f5f9;     
    
    --text-main: #0f172a; 
    --text-light: #64748b;
    --text-inverse: #ffffff;
    
    --border: #e2e8f0; 
    --shadow-color: rgba(0,0,0,0.05);

    /* Identité Visuelle */
    --primary: #f97316; 
    --primary-dark: #c2410c; 
    --secondary: #ea580c; 
    --accent-blue: #1e3a8a; 

    /* Badges & Pills */
    --bg-amendement: #fff7ed; --c-amendement: #c2410c; --b-amendement: #ffedd5;
    --bg-reabo: #eff6ff; --c-reabo: #1e40af; --b-reabo: #dbeafe;
    --bg-acq: #f0fdf4; --c-acq: #15803d; --b-acq: #bbf7d0;
    --bg-annul: #fef2f2; --c-annul: #991b1b; --b-annul: #fee2e2;
    --bg-autre: #f8fafc; --c-autre: #475569; --b-autre: #e2e8f0;

    /* KPI */
    --kpi-good: #16a34a; 
    --kpi-mid: #d97706; 
    --kpi-bad: #dc2626;
    --kpi-pay: #f59e0b;
    --kpi-raf-color: var(--accent-blue); 

    --excel-th-bg: #ffffff;
    --excel-td-hover: #f0f9ff;
    
    --w-col1: 180px; 
}

/* --- MODE SOMBRE (Haut Contraste) --- */
body.dark-mode {
    --bg-body: #020617;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --bg-hover: #334155;
    --text-main: #f8fafc;
    --text-light: #cbd5e1;
    --border: #475569;
    --shadow-color: rgba(0,0,0,0.6);

    --accent-blue: #60a5fa;
    --primary: #fb923c;
    --primary-dark: #fdba74;

    --bg-amendement: #431407; --c-amendement: #fdba74; --b-amendement: #9a3412;
    --bg-reabo: #1e1b4b; --c-reabo: #93c5fd; --b-reabo: #1e40af;
    --bg-acq: #022c22; --c-acq: #6ee7b7; --b-acq: #166534;
    --bg-annul: #450a0a; --c-annul: #fca5a5; --b-annul: #991b1b;
    --bg-autre: #334155; --c-autre: #e2e8f0; --b-autre: #475569;

    --kpi-good: #4ade80; 
    --kpi-mid: #fbbf24; 
    --kpi-bad: #f87171;
    --kpi-pay: #fbbf24;
    --kpi-raf-color: #60a5fa;

    --excel-th-bg: #1e293b;
    --excel-td-hover: #334155;
}

/* CORRECTIFS SPÉCIFIQUES DARK MODE */
body.dark-mode input, body.dark-mode select, body.dark-mode textarea, 
body.dark-mode .form-control, body.dark-mode .form-control-modern {
    background-color: #0f172a !important;
    border: 1px solid #64748b !important;
    color: #fff !important;
}
body.dark-mode input:focus, body.dark-mode select:focus, body.dark-mode textarea:focus {
    border-color: var(--primary) !important;
    background-color: #1e293b !important;
    box-shadow: 0 0 0 1px var(--primary) !important;
}
body.dark-mode table th, body.dark-mode table td { border-color: #334155 !important; }
body.dark-mode table.sales-table th { background-color: #0f172a !important; color: #cbd5e1 !important; }
body.dark-mode .modal { border: 1px solid #475569; box-shadow: 0 0 50px rgba(0,0,0,0.8); }
body.dark-mode label, body.dark-mode .local-lbl, body.dark-mode .pay-lbl, body.dark-mode .summary-label { color: #cbd5e1 !important; }
body.dark-mode ::-webkit-scrollbar-track { background: #0f172a; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #475569; border: 1px solid #1e293b; }


/* Fond des panneaux latéraux sticky — utiliser la classe .sticky-sidebar */
.sticky-sidebar {
    background-color: var(--bg-card);
    box-shadow: 2px 0 5px var(--shadow-color);
}
body.dark-mode .sticky-sidebar {
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
}
/* =========================================
   2. RESET & TYPOGRAPHIE
   ========================================= */

/* =========================================
   TOOLTIPS TEMPS FORTS (INFO-BULLES)
   ========================================= */
.tf-tooltip-container {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
}
.tf-tooltip-icon {
    color: var(--text-light);
    font-size: 10px;
    opacity: 0.6;
    transition: 0.2s;
}
.tf-tooltip-container:hover .tf-tooltip-icon {
    color: var(--primary);
    opacity: 1;
}
.tf-tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 200px;
    background-color: var(--bg-card);
    color: var(--text-main);
    text-align: left;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    font-size: 10px;
    line-height: 1.4;
    font-weight: 500;
    font-family: 'Montserrat', sans-serif;
    transition: opacity 0.2s, visibility 0.2s, bottom 0.2s;
    pointer-events: none;
    white-space: normal; /* Force le retour à la ligne */
}
.tf-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--bg-card) transparent transparent transparent;
}
/* Flèche pour la bordure */
.tf-tooltip-text::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--border) transparent transparent transparent;
    z-index: -1;
}
.tf-tooltip-container:hover .tf-tooltip-text {
    visibility: visible;
    opacity: 1;
    bottom: 150%;
}
body.dark-mode .tf-tooltip-text {
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
body { 
    margin: 0; font-family: 'Montserrat', sans-serif; 
    background: var(--bg-body); color: var(--text-main); 
    height: 100vh; overflow: hidden; font-size: 13px; 
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.mono-font, .kpi-value-big, .pay-val, .col-money, .merged-val, .obj-value, .percentage-label, .sub-val, 
.raf-val, .raf-amount, .progress-target, .raf-j-val, .detail-main-val, .summary-value, .rib-value, .com-rate, .local-val-big { 
    font-family: 'Roboto Mono', monospace; 
}
input:not([type="checkbox"]), select, button, textarea, .tab-btn { font-family: 'Montserrat', sans-serif; -webkit-appearance: none; }
input[type="checkbox"] { -webkit-appearance: checkbox; appearance: auto; accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
#app-container { display: flex; flex-direction: column; height: 100%; width: 100%; }

/* =========================================
   3. AUTHENTIFICATION
   ========================================= */
#auth-screen { position: fixed; inset: 0; background: var(--bg-body); z-index: 9999; display: flex; justify-content: center; align-items: center; padding: 20px; }
.auth-box { background: var(--bg-card); padding: 40px; border-radius: 16px; width: 100%; max-width: 400px; text-align: center; box-shadow: 0 10px 25px -5px var(--shadow-color); border: 1px solid var(--border); }
.auth-input { width: 100%; padding: 14px; margin-bottom: 15px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--bg-input); color: var(--text-main); }
.btn-full { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }

/* =========================================
   4. NAVBAR
   ========================================= */
.navbar { background: var(--bg-card); border-bottom: 1px solid var(--border); height: 64px; display: flex; align-items: center; padding: 0 30px; justify-content: space-between; flex-shrink: 0; box-shadow: 0 2px 4px var(--shadow-color); z-index: 1000; }
.logo-container { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-text-lbc { font-weight: 900; font-size: 1.6rem; color: var(--primary); letter-spacing: -1px; line-height: 1; }
.logo-badge-tlv { background: var(--accent-blue); color: white; font-weight: 800; font-size: 0.85rem; padding: 4px 8px; border-radius: 6px; letter-spacing: 1px; transform: translateY(-2px); }
.user-menu { display: flex; align-items: center; gap: 15px; }
.clock-display { font-family: 'Roboto Mono', monospace; font-weight: 700; font-size: 13px; color: var(--text-main); background: var(--bg-input); padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); min-width: 80px; text-align: center; }
.user-info { text-align: right; line-height: 1.2; }
.user-name { font-weight: 700; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-light); }
.btn-logout { background: var(--bg-card); border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 8px; color: var(--text-light); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-logout:hover { background: var(--bg-hover); color: var(--primary); border-color: var(--primary); }

/* =========================================
   5. CONTENU & ONGLETS
   ========================================= */
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 30px; width: 100%; }
.tabs-nav { display: flex; gap: 5px; background: var(--bg-card); padding: 5px; border-radius: 12px; width: fit-content; margin: 0 auto 25px auto; border: 1px solid var(--border); overflow-x: auto; max-width: 100%; box-shadow: 0 1px 2px var(--shadow-color); }
.tab-btn { padding: 10px 24px; background: transparent; border: none; font-weight: 600; color: var(--text-light); cursor: pointer; border-radius: 8px; font-size: 13px; white-space: nowrap; transition: 0.2s; }
.tab-btn:hover { color: var(--text-main); background: var(--bg-hover); }
.tab-btn.active { background: var(--accent-blue); color: white; font-weight: 700; }
.tab-content { display: none; animation: fadeIn 0.3s ease-out; }
.tab-content.active { display: block; }

/* =========================================
   6. TIME TOOLBAR (Mois/Année - Nouveau)
   ========================================= */
.time-toolbar-container { display: flex; justify-content: center; margin-bottom: 25px; }
.time-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--bg-card); border: 1px solid var(--border); padding: 8px 10px; border-radius: 50px; min-width: 300px; box-shadow: 0 4px 10px -2px var(--shadow-color); }
.time-display-text { font-size: 15px; font-weight: 800; color: var(--primary); text-transform: uppercase; min-width: 160px; text-align: center; letter-spacing: 0.5px; }
.btn-time-nav { background: transparent; border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--text-light); display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; }
.btn-time-nav:hover { background: var(--primary); color: white; border-color: var(--primary); transform: scale(1.1); }
body.dark-mode .time-display-text { color: var(--primary); }
body.dark-mode .btn-time-nav:hover { box-shadow: 0 0 10px rgba(251, 146, 60, 0.4); }

/* =========================================
   7. CALCULETTE & LOCAL+
   ========================================= */
.calc-card { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 4px 6px -1px var(--shadow-color); padding: 0 25px 0 0; color: var(--text-main); transition: all 0.3s ease; }
.input-group-modern { position: relative; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); margin-bottom: 20px; width: 100%; }
.input-group-modern:focus-within { transform: translateX(8px) scale(1.02); }
.input-group-modern:focus-within label { color: var(--primary); }
.form-control-modern { width: 100%; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-main); background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); transition: all 0.2s; }
.form-control-modern:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1); }
.form-control-modern:disabled { background: var(--bg-hover); color: var(--text-light); cursor: not-allowed; }
option[hidden] { display: none; }

/* ── Select custom : suppression style natif + flèche SVG (tous les selects) ── */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
/* Flèche claire en dark mode */
body.dark-mode select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}
/* Fond des options — évite le fond blanc OS en dark mode */
select option {
    background-color: var(--bg-input);
    color: var(--text-main);
}
body.dark-mode select option {
    background-color: #0f172a;
    color: #f8fafc;
}

/* ── Boutons sidebar catégories (Interdit Pub, BL Concurrent, etc.) ── */
.sidebar-cat-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.sidebar-cat-btn:hover {
    background: var(--bg-input);
    border-color: var(--border);
}
.sidebar-cat-btn.active,
.sidebar-cat-btn.active-red {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    font-weight: 700;
}
.sidebar-cat-btn.active-blue {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--accent-blue);
    font-weight: 700;
}

.grid-calc { display: grid; grid-template-columns: 300px 1fr 340px; gap: 20px; align-items: start; }
.row-split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: start; width: 100%; }
.calc-config, .calc-col-cards, .calc-col-table { display: flex; flex-direction: column; gap: 15px; }

/* Grid Local + */
.grid-local-plus { display: grid; grid-template-columns: 320px 1fr 300px; gap: 20px; align-items: start; max-width: 1400px; margin: 0 auto; }
.local-result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 30px; position: relative; overflow: hidden; box-shadow: 0 10px 25px -5px var(--shadow-color); }
.local-result-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 6px; background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.local-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; border-bottom: 1px dashed var(--border); padding-bottom: 15px; }
.local-title { font-size: 1.4rem; font-weight: 900; color: var(--text-main); text-transform: uppercase; letter-spacing: -0.5px; }
.local-badge { background: #eff6ff; color: #1e40af; font-weight: 800; font-size: 10px; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; }
.local-meta-badge { background: linear-gradient(135deg, #4f46e5, #9333ea); color: white; box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3); }
.local-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; }
.local-lbl { color: var(--text-light); font-weight: 600; text-transform: uppercase; font-size: 11px; }
.local-val { font-weight: 700; color: var(--text-main); text-align: right; }
.local-val-big { font-size: 1.8rem; color: var(--primary); font-weight: 800; }
.local-footer { margin-top: 20px; padding-top: 15px; border-top: 2px solid var(--bg-hover); display: flex; justify-content: space-between; align-items: center; }
.breakdown-container { margin-top: 20px; background: var(--bg-input); border-radius: 8px; padding: 10px; border: 1px solid var(--border); }
.breakdown-title { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-light); margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.breakdown-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.breakdown-table td { padding: 4px 0; color: var(--text-main); }
.breakdown-table td:last-child { text-align: right; font-weight: 700; font-family: 'Roboto Mono', monospace; color: var(--primary); }

.btn-copy-action { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; font-family: 'Roboto Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; background-color: var(--bg-card); color: var(--secondary); border: 1px solid var(--secondary); border-radius: 8px; cursor: pointer; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.btn-copy-action:hover { background-color: var(--secondary); color: white; transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(234, 88, 12, 0.3); }

/* Résumé Calculette */
.summary-results-grid { display: flex; flex-direction: column; gap: 15px; }
.summary-card { background: #1e293b; border-radius: 12px; padding: 20px; color: white; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); display: flex; flex-direction: column; justify-content: center; text-align: center; }
.summary-card-monthly { background: #1e293b; border-left: 5px solid var(--primary); }
.summary-card-annual { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border); }
.summary-label { font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 1px; opacity: 0.8; }
.summary-value { font-size: 1.8rem; font-weight: 700; margin-bottom: 5px; }
.summary-sub { font-size: 11px; opacity: 0.8; font-weight: 500; line-height: 1.4; }

.result-info-banner { background: #ecfeff; border: 1px solid #a5f3fc; border-left: 5px solid #06b6d4; border-radius: 12px; padding: 15px 25px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 4px rgba(0,0,0,0.02); position: relative; overflow: hidden; color: #0e7490; }
body.dark-mode .result-info-banner { background: #164e63; border-color: #0e7490; color: #cffafe; }
body.dark-mode .rib-label { color: #67e8f9; }
body.dark-mode .rib-value { color: #22d3ee; }
.result-info-banner::after { content: '\f129'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: -10px; top: -20px; font-size: 100px; color: #06b6d4; opacity: 0.05; pointer-events: none; }
.rib-group { display: flex; flex-direction: column; gap: 4px; z-index: 1; }
.rib-label { font-size: 10px; font-weight: 800; color: #0e7490; text-transform: uppercase; letter-spacing: 0.5px; }
.rib-value { font-size: 18px; font-weight: 700; color: #0891b2; }
.rib-highlight { color: #f97316; font-weight: 800; }

.options-ref-table { width: 100%; border-collapse: collapse; margin-top: 0; font-size: 11px; }
.options-ref-table th { background: var(--bg-hover); color: var(--text-light); text-transform: uppercase; font-weight: 800; padding: 8px; text-align: left; border-bottom: 2px solid var(--border); }
.options-ref-table td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.opt-acronym { font-weight: 800; color: var(--accent-blue); background: var(--bg-hover); padding: 2px 6px; border-radius: 4px; margin-right: 5px; font-size: 10px; }
.col-ttc { font-weight: 700; font-size: 11px; text-align: right; color: var(--text-main); }
.commissions-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.commissions-table th { background: #fff7ed; color: #9a3412; text-transform: uppercase; font-weight: 800; padding: 6px; text-align: center; border-bottom: 2px solid #ffedd5; font-size: 9px; }
body.dark-mode .commissions-table th { background: #431407; color: #fdba74; border-bottom-color: #7c2d12; }
.commissions-table td { padding: 6px; border-bottom: 1px solid var(--border); color: var(--text-main); text-align: center; }
.commissions-table td:first-child { text-align: left; font-weight: 600; color: var(--text-main); }
.com-rate { font-weight: 700; color: var(--primary); }
.fim-badge { background: var(--bg-hover); color: var(--text-light); padding: 2px 4px; border-radius: 4px; font-weight: 600; font-size: 9px; }

/* =========================================
   8. KPI DASHBOARD (Utilisé dans Suivi Ventes)
   ========================================= */
.kpi-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: 0 2px 6px var(--shadow-color); display: flex; flex-direction: column; min-height: 200px; position: relative; transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px var(--shadow-color); }
.kpi-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-light); margin-bottom: 10px; width: 100%; border-bottom: 2px solid var(--border); padding-bottom: 5px; letter-spacing: 0.5px; text-align: center; }
.kpi-merged { border-left: 5px solid var(--text-main); } 
.kpi-raf { border-left: 5px solid var(--kpi-raf-color); } 
.kpi-perf { border-left: 5px solid var(--primary); align-items: center; text-align: center; } 
.kpi-content-wrapper { flex: 1; display: flex; flex-direction: column; width: 100%; padding-top: 5px; }
.kpi-value-big { font-size: 2rem; font-weight: 700; color: var(--text-main); margin-top: 0; letter-spacing: -1px; text-align: center; width: 100%; display: flex; align-items: center; justify-content: center; flex-grow: 1; margin-bottom: auto; }
.merged-section { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); width: 100%; }
.merged-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.merged-title { font-size: 10px; font-weight: 800; color: var(--text-light); margin-bottom: 4px; display:block; text-align: center; letter-spacing: 0.5px; text-transform: uppercase; }
.merged-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 3px; }
.merged-val { font-weight: 700; color: var(--text-main); }
.obj-list { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; width: 100%; }
.obj-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; border-left: 3px solid #cbd5e1; font-size: 11px; transition: all 0.3s; }
.obj-item.reached { border-left-color: #16a34a; background: var(--bg-acq); border-color: #bbf7d0; }
body.dark-mode .obj-item.reached { background: rgba(21, 128, 61, 0.2); border-color: #166534; }
.obj-item .label { font-weight: 700; color: var(--text-light); text-transform: uppercase; }
.obj-item.reached .label { color: #15803d; }
body.dark-mode .obj-item.reached .label { color: #86efac; }
.progress-bar-container { flex-grow: 1; height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); } 
.progress-bar.p100 { background: var(--kpi-raf-color); } 
.progress-bar.p110 { background: #22c55e; } 
.progress-bar.p120 { background: #14b8a6; }
.progress-target { font-weight: 700; font-size: 10px; color: var(--text-main); text-align: right; min-width: 65px; }

.raf-j-container { display:flex; justify-content:space-between; align-items:center; background: var(--bg-reabo); border:1px solid var(--border); padding:8px 12px; border-radius:8px; margin-top:8px; margin-bottom: 10px; }
.raf-j-lbl { font-size:10px; font-weight:800; color:var(--accent-blue); text-transform:uppercase; }
.raf-j-val { font-size:14px; font-weight:700; color:var(--accent-blue); }
.raf-j-sub { font-size:9px; color:var(--text-light); font-weight:500; }

.perf-value-container { margin-bottom: 8px; text-align: center; width: 100%; }
.perf-label-small { font-size: 11px; font-weight: 800; color: var(--text-light); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-circle-wrapper { position: relative; width: 110px; height: 110px; margin: 0 auto; }
.circular-chart { display: block; margin: 0 auto; max-width: 100%; max-height: 100%; }
.circle-bg { fill: none; stroke: var(--bg-hover); stroke-width: 2.5; }
body.dark-mode .circle-bg { stroke: #334155; }
.circle { fill: none; stroke-width: 2.5; stroke-linecap: round; transition: stroke-dasharray 0.6s ease 0s, stroke 0.6s ease; }
.percentage-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-weight: 700; font-size: 20px; color: var(--text-main); }
.sub-stat-group { width: 100%; border-top: 1px dashed var(--border); margin-top: auto; padding-top: 5px; flex-shrink: 0; }
.sub-stat-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; width: 100%; color: var(--text-light); font-weight: 500; }
.sub-val { font-weight: 700; color: var(--text-main); }

/* =========================================
   9. BARRE REMUNERATION
   ========================================= */
.pay-bar-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 25px; background: var(--border); border: 1px solid var(--border); border-left: 5px solid var(--kpi-pay); border-radius: 12px; overflow: hidden; }
.pay-item { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-card); padding: 20px; }
.pay-lbl { color: #b45309; font-weight: 800; font-size: 10px; text-transform: uppercase; margin-bottom: 6px; text-align: center; letter-spacing: 0.5px; }
body.dark-mode .pay-lbl { color: #fcd34d; }
.pay-val { font-weight: 700; color: var(--text-main); font-size: 16px; text-align: center;}
.pay-highlight { color: var(--kpi-pay); font-size: 18px; }
.bonus-pills-container { display: flex; justify-content: center; gap: 15px; margin-bottom: 30px; flex-wrap: wrap; }
.btn-pill { background: var(--bg-card); border: 1px solid var(--border); padding: 10px 24px; border-radius: 50px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--text-light); transition: all 0.2s; display: flex; align-items: center; gap: 8px; text-transform: uppercase; white-space: nowrap; box-shadow: 0 1px 2px var(--shadow-color); }
.btn-pill:hover { border-color: #cbd5e1; transform: translateY(-1px); background: var(--bg-hover); }
.btn-pill.active { background: #dcfce7; border-color: #16a34a; color: #15803d; box-shadow: 0 2px 4px rgba(22, 163, 74, 0.1); }
body.dark-mode .btn-pill.active { background: rgba(22, 163, 74, 0.2); color: #86efac; border-color: #15803d; }
.action-bar { display: flex; justify-content: space-between; margin-bottom: 20px; gap: 15px; flex-wrap: wrap; }
.btn-action-add { background: var(--secondary); color: white; border: none; padding: 12px 30px; border-radius: 10px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 10px rgba(234, 88, 12, 0.2); font-size: 13px; display: flex; align-items: center; gap: 8px; white-space: nowrap; transition: 0.2s; text-transform: uppercase; }
.btn-action-add:hover { background: #c2410c; transform: translateY(-2px); }
.btn-action-export { background: var(--bg-card); color: #10b981; border: 1px solid #10b981; padding: 12px 20px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px; white-space: nowrap; transition: 0.2s; text-transform: uppercase; }
.btn-action-export:hover { background: #ecfdf5; transform: translateY(-2px); }

/* =========================================
   10. TABLES DONNEES
   ========================================= */
.box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 0; box-shadow: 0 4px 20px var(--shadow-color); overflow: hidden; display: flex; flex-direction: column; }
.table-container { width: 100%; overflow-x: auto; background: var(--bg-card); -webkit-overflow-scrolling: touch; }
table.sales-table { width: 100%; border-collapse: collapse; min-width: 1000px; }
table.sales-table th { background-color: var(--bg-body); color: var(--text-light); padding: 16px 12px; font-size: 11px; text-transform: uppercase; font-weight: 800; border-bottom: 2px solid var(--border); text-align: center; white-space: nowrap; position: sticky; top: 0; z-index: 10; letter-spacing: 0.5px; }
table.sales-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-main); vertical-align: middle; text-align: center; }
.col-money { font-weight: 700; text-align: right !important; color: var(--text-main); } 
.col-prime { font-weight: 700; text-align: right !important; color: #15803d; } 
body.dark-mode .col-prime { color: #4ade80; }
.col-id { color: var(--accent-blue); font-weight: 700; text-align: left !important; }
.badge-art { display: block; width: 100%; box-sizing: border-box; padding: 6px 4px; border-radius: 6px; font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; text-align: center; }
.art-pub { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; } 
.art-boutique { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; } 
.art-agilite { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; } 
.art-efficacite { background: #dcfce7; color: #166534; border: 1px solid #86efac; } 
.art-default { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
body.dark-mode .art-pub { background: #172554; color: #93c5fd; border-color: #1e40af; }
body.dark-mode .art-boutique { background: #431407; color: #fdba74; border-color: #7c2d12; }
body.dark-mode .art-agilite { background: #3b0764; color: #d8b4fe; border-color: #581c87; }
body.dark-mode .art-efficacite { background: #052e16; color: #86efac; border-color: #14532d; }
body.dark-mode .art-default { background: #1e293b; color: #94a3b8; border-color: #334155; }
.btn-link-devis { text-decoration: none; background: #e0f2fe; color: #0284c7; padding: 5px 10px; border-radius: 6px; font-weight: 700; font-size: 11px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: 0.2s; }
.btn-link-devis:hover { background: #bae6fd; }
.btn-icon-action { background: var(--bg-card); border: 1px solid var(--border); border-radius:6px; color: var(--text-light); cursor: pointer; padding: 8px; margin: 0 2px; transition: 0.2s; }
.btn-icon-action:hover { border-color: var(--primary); color: var(--primary); }
.btn-trash:hover { border-color: #ef4444; color: #ef4444; }
.badge-contrat { display: block; width: 100%; box-sizing: border-box; padding: 6px 4px; border-radius: 6px; text-align: center; font-weight: 800; font-size: 10px; text-transform: uppercase; border: 1px solid transparent; letter-spacing: 0.5px; }
.type-acquisition { background: var(--bg-acq); color: var(--c-acq); border-color: var(--b-acq); } 
.type-reabo { background: var(--bg-reabo); color: var(--c-reabo); border-color: var(--b-reabo); } 
.type-amendement { background: var(--bg-amendement); color: var(--c-amendement); border-color: var(--b-amendement); } 
.type-annulation { background: var(--bg-annul); color: var(--c-annul); border-color: var(--b-annul); } 
.type-autre { background: var(--bg-autre); color: var(--c-autre); border-color: var(--b-autre); }        

/* =========================================
   STYLE BADGES STATUTS (Style ADV) - NEW
   ========================================= */
.status-pill { 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 10px; 
    font-weight: 800; 
    text-transform: uppercase; 
    display: inline-block; 
    width: 32px; 
    text-align: center; 
}
.pill-ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.pill-ko { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.pill-nc { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
/* Dark Mode Pills */
body.dark-mode .pill-ok { background: rgba(22, 163, 74, 0.2); color: #86efac; border-color: #15803d; }
body.dark-mode .pill-ko { background: rgba(220, 38, 38, 0.2); color: #fca5a5; border-color: #991b1b; }
body.dark-mode .pill-nc { background: #334155; color: #94a3b8; border-color: #475569; }

/* =========================================
   STYLES BOUTON MESSAGERIE (Style ADV)
   ========================================= */
.btn-msg { 
    color: var(--text-light); 
    border: 1px solid var(--border);
    transition: all 0.2s;
    position: relative; /* Pour la pastille rouge */
}
/* Cas 1 : Il y a des messages (mais lus) */
.btn-msg.has-msg { 
    color: var(--primary); 
    border-color: var(--primary); 
    background-color: var(--bg-amendement);
}
/* Cas 2 : Il y a des messages NON LUS */
.btn-msg.has-unread { 
    color: white !important; 
    background-color: var(--primary) !important; 
    border-color: var(--primary) !important; 
    box-shadow: 0 2px 5px rgba(249, 115, 22, 0.4);
}
/* La petite pastille rouge */
.btn-msg.has-unread::after { 
    content: ''; 
    position: absolute; 
    top: -3px; 
    right: -3px; 
    width: 10px; 
    height: 10px; 
    background: #ef4444; 
    border: 2px solid white; 
    border-radius: 50%; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); 
}

/* =========================================
   11. MATRICE EXCEL
   ========================================= */
.excel-table { border-collapse: separate; border-spacing: 0; width: max-content; background: var(--bg-card); white-space: nowrap; font-size: 13px; table-layout: fixed; border-radius: 8px; }
.excel-table th { padding: 12px 10px; text-align: center; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 90px; background-color: var(--excel-th-bg); font-size: 12px; color: var(--text-main); }
.excel-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 90px; background-color: var(--excel-th-bg); transition: background-color 0.2s; color: var(--text-main); }
.excel-table tbody tr:hover td { background-color: var(--excel-td-hover) !important; }
.excel-table .sticky-col-1 { position: sticky; left: 0; z-index: 40; width: var(--w-col1); min-width: var(--w-col1); border-right: 2px solid var(--border); background-color: var(--excel-th-bg); text-align: left !important; padding-left: 15px !important; box-shadow: 4px 0 8px -4px var(--shadow-color); }
.excel-table thead tr th.sticky-col-1 { z-index: 60 !important; background-color: var(--bg-body); border-right: 2px solid var(--border); }
.excel-table thead th { position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 4px -2px var(--shadow-color); }
.excel-table tfoot td { position: sticky; bottom: 0; z-index: 45; background-color: #1e293b; color: white; font-weight: 700; text-align: right; font-size: 13px; border-top: 3px solid #0f172a; }
body.dark-mode .excel-table tfoot td { background-color: #020617 !important; border-top-color: #1e293b !important; }
.excel-table tfoot td.sticky-col-1 { text-align: left; z-index: 60 !important; background-color: #1e293b; color: white; font-weight: 800; border-top: 3px solid #0f172a; border-right: 2px solid var(--border); }
body.dark-mode .excel-table tfoot td.sticky-col-1 { background-color: #020617 !important; }
/* Headers Colorés */
.th-univ-global { background-color: #fffbeb; color: #b45309; border-top: 4px solid #f59e0b; font-weight: 800; letter-spacing: 1px; font-size: 13px !important; }
body.dark-mode .th-univ-global { background-color: #451a03 !important; color: #fbbf24 !important; border-top-color: #d97706 !important; }
.th-type-global { background-color: #fef3c7; color: #78350f; font-weight: 700; border-bottom: 1px solid #d1d5db; text-align: center !important; }
body.dark-mode .th-type-global { background-color: #78350f !important; color: #fcd34d !important; border-bottom-color: #92400e !important; }
.sep-global { border-left: 3px solid #f59e0b !important; }
body.dark-mode .sep-global { border-left-color: #d97706 !important; }
.th-univ-acq { background-color: #eff6ff; color: #1e40af; border-top: 4px solid #3b82f6; font-weight: 800; letter-spacing: 1px; font-size: 13px !important; }
body.dark-mode .th-univ-acq { background-color: #172554 !important; color: #60a5fa !important; border-top-color: #2563eb !important; }
.th-type-acq { background-color: #dbeafe; color: #1e3a8a; font-weight: 700; border-bottom: 1px solid #bfdbfe; text-align: center !important; }
body.dark-mode .th-type-acq { background-color: #1e3a8a !important; color: #93c5fd !important; border-bottom-color: #1d4ed8 !important; }
.sep-acq { border-left: 3px solid #3b82f6 !important; }
body.dark-mode .sep-acq { border-left-color: #2563eb !important; }
.th-univ-reabo { background-color: #f5f3ff; color: #5b21b6; border-top: 4px solid #8b5cf6; font-weight: 800; letter-spacing: 1px; font-size: 13px !important; }
body.dark-mode .th-univ-reabo { background-color: #4c1d95 !important; color: #a78bfa !important; border-top-color: #7c3aed !important; }
.th-type-reabo { background-color: #ede9fe; color: #4c1d95; font-weight: 700; border-bottom: 1px solid #ddd6fe; text-align: center !important; }
body.dark-mode .th-type-reabo { background-color: #5b21b6 !important; color: #ddd6fe !important; border-bottom-color: #6d28d9 !important; }
.sep-reabo { border-left: 3px solid #8b5cf6 !important; }
body.dark-mode .sep-reabo { border-left-color: #7c3aed !important; }
.sep-internal { border-left: 2px solid var(--border) !important; }
.th-kpi { background-color: #f8fafc; color: #475569; font-weight: 600; font-size: 11px !important; text-transform: uppercase; }
body.dark-mode .th-kpi { background-color: var(--bg-body) !important; color: var(--text-light) !important; }
body.dark-mode .excel-table td { background-color: #1e293b !important; color: #f1f5f9 !important; border-color: #334155 !important; }
body.dark-mode .excel-table .sticky-col-1 { background-color: #1e293b !important; color: #f1f5f9 !important; border-right: 2px solid #475569 !important; }
body.dark-mode .excel-table tbody tr:hover td { background-color: #334155 !important; color: #ffffff !important; }
body.dark-mode .excel-table td span { color: inherit; }

/* =========================================
   12. SETTINGS & MODALES
   ========================================= */
.settings-finance-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.year-selector-simple { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 15px; background: var(--bg-card); padding: 10px 20px; border-radius: 10px; border: 1px solid var(--border); width: fit-content; margin-left: auto; margin-right: auto; }
.btn-arrow { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; color: var(--text-light); transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.year-display { font-weight: 800; font-size: 16px; color: var(--text-main); min-width: 60px; text-align: center; }
/* =========================================
   NIVEAU 1 : MENU OUTILS PRINCIPAL (Style Souligné)
   ========================================= */
.sub-tabs-container {
    display: flex;
    justify-content: center !important;
    flex-wrap: wrap;
    gap: 35px !important;
    margin-bottom: 30px !important;
    border-bottom: 2px solid var(--border) !important;
    padding-bottom: 0 !important; /* Le bouton doit toucher la ligne */
    background: transparent !important;
    border-radius: 0 !important;
}
.sub-tab-btn {
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    padding: 10px 5px !important;
    margin-bottom: -2px !important; /* Superpose la barre grise */
    font-weight: 600 !important;
    color: var(--text-light) !important;
    cursor: pointer;
    font-size: 13px !important;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none !important;
}
.sub-tab-btn:hover {
    color: var(--text-main) !important;
}
.sub-tab-btn.active {
    color: var(--primary) !important; /* Orange LBC */
    border-bottom-color: var(--primary) !important;
    font-weight: 800 !important;
}

/* =========================================
   NIVEAU 2 : SOUS-MENU PUBLICITÉ (Style Pilule)
   ========================================= */
.pub-nav-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 30px auto;
    background: var(--bg-input);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    gap: 6px;
}
.pub-tab-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-bottom: none; /* Sécurité */
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    font-size: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}
.pub-tab-btn:hover {
    color: var(--text-main);
}
.pub-tab-btn.active {
    background: var(--bg-card);
    color: var(--accent-blue); /* Bleu TLV */
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border-bottom: none;
}
.sub-tab-content { display: none; animation: fadeIn 0.3s ease-out; }
.sub-tab-content.active { display: block; }
.months-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 20px; }
.month-toggle { padding: 10px 5px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; text-align: center; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-light); transition: 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50px; }
.month-toggle.selected { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }
.badge-filled { font-size: 9px; margin-top: 3px; font-weight: 700; color: var(--primary); }
.month-toggle.selected .badge-filled { color: white; opacity: 0.9; }
.select-links { display: flex; gap: 15px; font-size: 11px; margin-bottom: 15px; justify-content: center; }
.select-link { color: var(--accent-blue); text-decoration: underline; cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(5px); z-index: 3000; display: none; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.modal { background: var(--bg-card); padding: 25px; border-radius: 24px; width: 100%; max-width: 850px; box-shadow: 0 25px 50px -12px var(--shadow-color); max-height: 90vh; overflow-y: auto; box-sizing: border-box; color: var(--text-main); border: 1px solid var(--border); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-weight: 800; font-size: 18px; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.5px; }
.close-btn { cursor: pointer; font-size: 20px; color: var(--text-light); }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 15px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .span-2 { grid-column: span 2; }
.form-label { font-size: 11px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control { padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--bg-input); color: var(--text-main); width: 100%; box-sizing: border-box; transition: 0.2s; }
.form-control:focus { border-color: var(--primary); outline: none; background: var(--bg-card); }
.checkbox-wrapper { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); cursor: pointer; transition: 0.2s; box-sizing: border-box; width: 100%; }
.checkbox-wrapper:hover { background: var(--bg-card); border-color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); padding-top: 20px; }
.btn-cancel { background: transparent; border: 1px solid #cbd5e1; padding: 10px 20px; border-radius: 8px; font-weight: 700; color: var(--text-light); cursor: pointer; }
.btn-save { background: var(--primary); border: none; padding: 10px 25px; border-radius: 8px; font-weight: 700; color: white; cursor: pointer; box-shadow: 0 2px 5px rgba(249, 115, 22, 0.3); }
.btn-save-settings { background: var(--primary); color: white; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.2s ease; box-shadow: 0 4px 6px rgba(249, 115, 22, 0.2); display: inline-flex; align-items: center; gap: 8px; }
.btn-save-settings:hover { background: #c2410c; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(249, 115, 22, 0.3); }
.error-banner { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; padding: 10px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 10px; animation: shake 0.3s; }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } 100% { transform: translateX(0); } }
.history-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; margin-bottom: 15px; padding-right: 5px; }
.history-item { background: var(--bg-input); border: 1px solid var(--border); padding: 10px; border-radius: 8px; position: relative; }
.history-item.mine { background: var(--bg-reabo); border-color: var(--b-reabo); } 
.history-meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-light); margin-bottom: 4px; text-transform: uppercase; font-weight: 700; }
.history-text { font-size: 12px; color: var(--text-main); white-space: pre-wrap; line-height: 1.4; }
.btn-edit-com { cursor: pointer; color: var(--accent-blue); font-size: 11px; margin-left: 10px; transition:0.2s; }
.btn-edit-com:hover { color: var(--primary); text-decoration: underline; }

/* =========================================
   13. DASHBOARD MEL
   ========================================= */
.dashboard-mel-grid { display: flex; flex-direction: column; gap: 25px; margin-top: 25px; }
.dashboard-section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-light); margin-bottom: 10px; padding-left: 10px; border-left: 4px solid #cbd5e1; display: flex; justify-content: space-between; align-items: center; }
.btn-view-all { font-size: 11px; color: var(--accent-blue); font-weight: 700; text-transform: uppercase; cursor: pointer; background: none; border: none; text-decoration: underline; }
.btn-view-all:hover { color: var(--primary); }
.dashboard-table-wrapper { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; overflow-x: auto; box-shadow: 0 2px 4px var(--shadow-color); }
tr.empty-dashboard-row td { padding: 20px; color: var(--text-light); font-style: italic; text-align: center; }

/* =========================================
   14. NOTIFICATIONS (TOASTS) - NEW
   ========================================= */
#toast-container { 
    position: fixed; bottom: 24px; right: 24px; z-index: 9999; 
    display: flex; flex-direction: column; gap: 10px; 
    pointer-events: none; 
}
.toast { 
    pointer-events: auto;
    background: var(--bg-card); color: var(--text-main); 
    padding: 16px 24px; border-radius: 12px; 
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15), 0 4px 6px -2px rgba(0,0,0,0.05); 
    border-left: 5px solid var(--primary); font-weight: 600; 
    display: flex; align-items: center; gap: 15px; 
    font-size: 13px; max-width: 450px; min-width: 300px;
    animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
}
.toast.success { border-left-color: var(--kpi-good); } 
.toast.error { border-left-color: var(--kpi-bad); } 
.toast.info { border-left-color: var(--accent-blue); }
@keyframes toastSlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* =========================================
   15. MESSAGERIE STYLE ADV (Harmonisation) - NEW
   ========================================= */
.history-container {
    background: var(--bg-input);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.msg-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 13px;
    position: relative;
    max-width: 85%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    line-height: 1.4;
    word-wrap: break-word;
}
.msg-bubble.others {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text-main);
}
.msg-bubble.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 6px -2px rgba(249, 115, 22, 0.3);
    border: none;
}
.msg-meta {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 4px;
    opacity: 0.8;
    font-weight: 700;
    gap: 15px;
    text-transform: uppercase;
}
.msg-bubble.mine .msg-meta { color: rgba(255,255,255,0.9); }
.msg-bubble.others .msg-meta { color: var(--text-light); }
.system-log {
    align-self: stretch;
    width: 100%;
    background: var(--bg-hover);
    border: 1px dashed var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    margin: 8px 0;
    font-weight: 600;
}
body.dark-mode .msg-bubble.others { background: #1e293b; border-color: #334155; }
body.dark-mode .system-log { background: rgba(255,255,255,0.05); border-color: #475569; }

/* =========================================
   DIAGRAMME DE GANTT PREMIUM (TEMPS FORTS)
   ========================================= */
.gantt-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 10px var(--shadow-color);
    scroll-behavior: smooth;
}
.gantt-header {
    display: grid;
    grid-template-columns: repeat(12, 300px); /* Agrandissement à 300px au lieu de 200px */
    background: var(--bg-hover);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.gantt-month {
    padding: 12px 0;
    text-align: center;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-light);
    text-transform: uppercase;
    border-right: 1px solid var(--border);
}
.gantt-body {
    position: relative;
    min-height: 300px; /* Hauteur augmentée pour les 50 événements */
    width: 3600px;
    background-image: repeating-linear-gradient(to right, transparent, transparent 300px, rgba(0,0,0,0.02) 300px, rgba(0,0,0,0.02) 600px);
    border-bottom: 1px solid var(--border);
}
body.dark-mode .gantt-body {
    background-image: repeating-linear-gradient(to right, transparent, transparent 300px, rgba(255,255,255,0.02) 300px, rgba(255,255,255,0.02) 600px);
}

.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: rgba(239, 68, 68, 0.4);
    z-index: 10;
    display: none;
    pointer-events: none;
}
.gantt-today-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.gantt-today-label::after {
    content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
    border-width: 4px 4px 0 4px; border-style: solid;
    border-color: #ef4444 transparent transparent transparent;
}

.gantt-bar {
    position: absolute;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    cursor: help;
    border: 1px solid rgba(0,0,0,0.05);
    transition: z-index 0.1s;
}
.gantt-bar i {
    margin-right: 10px;
    font-size: 13px;
    opacity: 0.9;
}
.gantt-bar:hover {
    z-index: 40; /* Permet à la bulle de passer au-dessus de tout */
}

/* =======================================================
   INVERSION DES BULLES POUR LES LIGNES 1 ET 2 (Vers le bas)
   ======================================================= */
.gantt-bar[style*="top: 40px"] .gantt-tooltip,
.gantt-bar[style*="top: 85px"] .gantt-tooltip {
    bottom: auto;
    top: calc(100% + 8px); /* La bulle passe EN DESSOUS de la barre */
    transform: translateX(-50%) translateY(-5px); /* Animation ajustée */
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.4); /* L'ombre tombe vers le bas */
}

/* Au survol : position finale */
.gantt-bar[style*="top: 40px"]:hover .gantt-tooltip,
.gantt-bar[style*="top: 85px"]:hover .gantt-tooltip {
    transform: translateX(-50%) translateY(0);
}

/* On inverse la petite flèche (pointe vers le haut) */
.gantt-bar[style*="top: 40px"] .gantt-tooltip::after,
.gantt-bar[style*="top: 85px"] .gantt-tooltip::after {
    bottom: auto;
    top: -6px; /* On place la flèche en haut de la bulle */
    border-width: 0 6px 6px 6px; 
    border-color: transparent transparent #1e293b transparent;
}

/* Couleurs Mates et Premium */
.gb-hiver { background: #64748b; } 
.gb-printemps { background: #52796f; } 
.gb-ete { background: #d4a373; color: #fff; } 
.gb-automne { background: #cb795c; } 
.gb-q4 { background: #4b5563; } 
.gb-love { background: #b56576; } 

/* NOUVELLES INFO-BULLES RICHES (HTML INTERNE) */
.gantt-tooltip {
    position: absolute;
    bottom: calc(100% + 8px); /* Au-dessus de la barre */
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: #1e293b;
    color: #f8fafc;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: normal; /* Autorise le retour à la ligne */
    width: 280px; /* Plus large pour les conseils */
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 -10px 25px -5px rgba(0,0,0,0.4);
    z-index: 10000 !important;
    line-height: 1.5;
    border: 1px solid #334155;
    cursor: default;
}
/* 2. LE PONT INVISIBLE (C'est ça la magie !) */
/* Ça crée une zone transparente sous la bulle qui relie la bulle à la barre */
.gantt-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; /* S'accroche au bas de la bulle */
    left: 0;
    width: 100%;
    height: 15px; /* Hauteur de la zone invisible (doit être plus grande que ton margin-bottom) */
    background: transparent;
}

/* 3. L'état au survol de la barre */
.gantt-bar:hover .gantt-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto; /* TRÈS IMPORTANT : Réactive la possibilité de cliquer sur le bouton ! */
}
.gantt-bar:hover .gantt-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Couleurs Mates */

/* Info-bulles 100% CSS - Orientées vers le HAUT */
.gantt-bar[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px); /* Apparaît au-DESSUS de la barre */
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: #1e293b;
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 -10px 25px -5px rgba(0,0,0,0.3); /* Ombre projetée vers le haut */
    z-index: 50;
    line-height: 1.4;
}

/* La petite flèche de la bulle (pointe vers le bas) */
.gantt-bar[data-tooltip]::after {
    content: ''; 
    position: absolute; 
    bottom: calc(100% + 2px); 
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    border-width: 6px; 
    border-style: solid;
    border-color: #1e293b transparent transparent transparent; /* Pointe vers le bas */
    opacity: 0; 
    visibility: hidden; 
    transition: all 0.2s ease; 
    pointer-events: none; 
    z-index: 50;
}

/* Animation douce à l'apparition */
.gantt-bar[data-tooltip]:hover::before,
.gantt-bar[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Couleurs Mates */

/* Empêche la sélection de texte pendant le scroll manuel */
.gantt-container.dragging {
    cursor: grabbing;
    user-select: none;
}
.gantt-container {
    cursor: grab;
    /* On enlève le scroll-behavior smooth pour le drag sinon ça crée un lag */
    scroll-behavior: auto !important; 
}


/* =========================================
   16. RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .navbar                   { padding: 0 20px; }
    .kpi-container            { grid-template-columns: 1fr; }
    main                      { padding: 20px; }
    .modal                    { max-width: 95%; }
    .form-grid                { grid-template-columns: 1fr; }
    .col-1, .col-2,
    .col-3, .col-4            { grid-column: span 1; }
    .grid-calc,
    .grid-local-plus          { grid-template-columns: 1fr; }
    .dashboard-mel-grid       { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .navbar                   { padding: 0 15px; height: 60px; }
    .logo-text-lbc            { font-size: 1.2rem; }
    .clock-display,
    .user-info                { display: none; }
    .btn-logout               { background: var(--bg-input); border: none; }
    main                      { padding: 15px; padding-bottom: 80px; }
    .kpi-container            { grid-template-columns: 1fr; gap: 15px; }
    .kpi-card                 { min-height: auto; padding: 20px; }
    .pay-bar-container        { grid-template-columns: 1fr 1fr; gap: 1px; }
    .pay-item                 { padding: 15px; }
    .bonus-pills-container    { flex-direction: column; gap: 10px; align-items: stretch; }
    .btn-pill                 { justify-content: center; width: 100%; box-sizing: border-box; }
    .action-bar               { flex-direction: column-reverse; gap: 10px; }
    .btn-action-add,
    .btn-action-export        { width: 100%; justify-content: center; }
    .modal                    { padding: 20px; width: 95%; max-height: 85vh; }
    .span-2                   { grid-column: span 1; }
    .box                      { padding: 20px !important; }
    .months-grid              { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   LABELS FORMULAIRE D'AUTHENTIFICATION
   ========================================= */
.auth-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    display: block;
    margin-bottom: 4px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   LIEN SKIP-TO-CONTENT (Accessibilité)
   ========================================= */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    font-weight: 700;
    border-radius: 0 0 8px 0;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
}
.skip-to-content:focus {
    left: 0;
    width: auto;
    height: auto;
}
