/* Design System - Calcul-Cost */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 100%);
    --card-bg: rgba(22, 28, 45, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.2);
    
    --success: #10b981;
    --success-hover: #059669;
    
    --warning: #f59e0b;
    --danger: #f43f5e;
    --danger-hover: #e11d48;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Vitesse et timing de transition entre les pages */
    --page-trans-duration: 400ms;
    --page-trans-timing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   MODE CLAIR (LIGHT THEME)
   ========================================================================== */
[data-theme="light"],
body.light-theme {
    --bg-main: #f8fafc;
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-hover-border: rgba(79, 70, 229, 0.45);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --link-color: #4f46e5;
    --link-hover: #3730a3;
    --link-active: #312e81;
    
    --success: #059669;
    --success-hover: #047857;
    
    --warning: #d97706;
    --danger: #e11d48;
    --danger-hover: #be123c;
}

[data-theme="light"] header,
body.light-theme header {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .header-sub-nav-wrapper,
body.light-theme .header-sub-nav-wrapper {
    background: rgba(248, 250, 252, 0.98);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .brand,
body.light-theme .brand {
    color: #4f46e5;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-links a,
body.light-theme .nav-links a {
    color: #475569;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .nav-links a:hover,
body.light-theme .nav-links a:hover {
    color: #0f172a;
    background: #f1f5f9;
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-links li.active a,
body.light-theme .nav-links li.active a {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.35);
    font-weight: 700;
}

[data-theme="light"] .user-name,
body.light-theme .user-name {
    color: #0f172a;
    font-weight: 600;
}

[data-theme="light"] .page-title,
body.light-theme .page-title {
    color: #0f172a;
    font-weight: 700;
}

[data-theme="light"] .card-value,
body.light-theme .card-value {
    color: #0f172a;
    font-weight: 700;
}

[data-theme="light"] .card:not(.invoice-print-card),
body.light-theme .card:not(.invoice-print-card) {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .card:not(.invoice-print-card):hover,
body.light-theme .card:not(.invoice-print-card):hover {
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.08);
}

[data-theme="light"] .form-control,
body.light-theme .form-control {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .form-control:focus,
body.light-theme .form-control:focus {
    background: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    color: #0f172a;
}

[data-theme="light"] .form-group label,
body.light-theme .form-group label {
    color: #334155;
    font-weight: 600;
}

[data-theme="light"] .btn-secondary,
body.light-theme .btn-secondary {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

[data-theme="light"] .btn-secondary:hover,
body.light-theme .btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

[data-theme="light"] footer,
body.light-theme footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
}

[data-theme="light"] table,
body.light-theme table {
    color: #1e293b;
}

[data-theme="light"] table th,
body.light-theme table th {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-weight: 700 !important;
}

[data-theme="light"] table td,
body.light-theme table td {
    border-bottom: 1px solid #f1f5f9 !important;
    color: #1e293b;
}

[data-theme="light"] table tr:hover,
body.light-theme table tr:hover {
    background: #f1f5f9 !important;
}

[data-theme="light"] table tr:nth-child(even),
body.light-theme table tr:nth-child(even) {
    background: #f8fafc !important;
}

[data-theme="light"] .table-actions,
[data-theme="light"] th.table-actions,
[data-theme="light"] td.table-actions,
body.light-theme .table-actions,
body.light-theme th.table-actions,
body.light-theme td.table-actions {
    background: #ffffff !important;
    border-left: 1px solid #e2e8f0 !important;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] tr:nth-child(even) td.table-actions,
body.light-theme tr:nth-child(even) td.table-actions {
    background: #f8fafc !important;
}

[data-theme="light"] .mobile-drawer,
body.light-theme .mobile-drawer {
    background: #ffffff !important;
    border-left: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .mobile-drawer-header,
body.light-theme .mobile-drawer-header {
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .mobile-drawer-link,
body.light-theme .mobile-drawer-link {
    color: #334155 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

[data-theme="light"] .mobile-drawer-link:hover,
body.light-theme .mobile-drawer-link:hover {
    background: #f8fafc !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .mobile-actions-dropdown,
body.light-theme .mobile-actions-dropdown {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .mobile-actions-header,
body.light-theme .mobile-actions-header {
    background: #f1f5f9 !important;
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .mobile-actions-title,
body.light-theme .mobile-actions-title {
    color: #1e293b !important;
}

[data-theme="light"] .mobile-action-item,
body.light-theme .mobile-action-item {
    color: #334155 !important;
    border-bottom-color: #f1f5f9 !important;
}

[data-theme="light"] .mobile-action-item:hover,
body.light-theme .mobile-action-item:hover {
    background: #f8fafc !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .quick-dock-btn,
body.light-theme .quick-dock-btn {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .quick-dock-btn:hover,
body.light-theme .quick-dock-btn:hover {
    background: #ffffff !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .quick-dock-drawer,
body.light-theme .quick-dock-drawer {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .quick-dock-drawer-header,
body.light-theme .quick-dock-drawer-header {
    background: #f8fafc !important;
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .quick-dock-tab-btn,
body.light-theme .quick-dock-tab-btn {
    color: #64748b !important;
}

[data-theme="light"] .quick-dock-tab-btn.active,
body.light-theme .quick-dock-tab-btn.active {
    color: #4f46e5 !important;
    border-bottom-color: #4f46e5 !important;
}

[data-theme="light"] .quick-dock-search-input,
body.light-theme .quick-dock-search-input {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* Commutateur de Thème Header */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.theme-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #fff;
    transform: rotate(15deg) scale(1.05);
}

[data-theme="light"] .theme-toggle-btn,
body.light-theme .theme-toggle-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

[data-theme="light"] .theme-toggle-btn:hover,
body.light-theme .theme-toggle-btn:hover {
    background: #e2e8f0;
    color: #4f46e5;
}

.theme-toggle-btn .theme-icon-sun {
    display: inline-block;
}

.theme-toggle-btn .theme-icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle-btn .theme-icon-sun,
body.light-theme .theme-toggle-btn .theme-icon-sun {
    display: none !important;
}

[data-theme="light"] .theme-toggle-btn .theme-icon-moon,
body.light-theme .theme-toggle-btn .theme-icon-moon {
    display: inline-block !important;
}


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

body {
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Transitions Inter-Pages : Effets Configurables par le SuperAdmin */
@keyframes pageEnterSlideUp {
    0% {
        opacity: 0;
        transform: translateY(28px);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

@keyframes pageEnterFade {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes pageEnterSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-28px);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

@keyframes pageEnterZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

/* Layout */
.wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    animation: pageEnterSlideUp var(--page-trans-duration) var(--page-trans-timing);
}

html[data-trans-effect="slide_up"] .wrapper {
    animation-name: pageEnterSlideUp;
}
html[data-trans-effect="fade"] .wrapper {
    animation-name: pageEnterFade;
}
html[data-trans-effect="slide_down"] .wrapper {
    animation-name: pageEnterSlideDown;
}
html[data-trans-effect="zoom_in"] .wrapper {
    animation-name: pageEnterZoomIn;
}
html[data-trans-effect="none"] .wrapper {
    animation: none !important;
}
html[data-trans-effect="none"] #page-transition-bar {
    display: none !important;
}

body.page-is-exiting main.wrapper {
    opacity: 0 !important;
    transform: translateY(-16px) !important;
    transition: opacity var(--page-trans-duration) ease-in, transform var(--page-trans-duration) ease-in !important;
}
html[data-trans-effect="none"] body.page-is-exiting main.wrapper {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* Barre supérieure de progression / balayage lors de la transition */
#page-transition-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #38bdf8, #818cf8, #a855f7);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.7), 0 0 5px rgba(56, 189, 248, 0.5);
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    transition: width var(--page-trans-duration) ease-out, opacity 0.15s ease-out;
}

#page-transition-bar.active {
    opacity: 1;
    width: 100%;
    animation: progressShimmer 1.2s infinite linear;
}

@keyframes progressShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Header Navbar */
header {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    position: relative;
    z-index: 100;
    padding: 12px 0 12px 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Sticky Sub-Navigation Bar */
.header-sub-nav-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    width: 100%;
    margin-top: 0px;
}

.header-sub-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 22px;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    min-width: 140px;
    min-height: 55px;
    height: 55px;
    flex-shrink: 0;
}

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

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.nav-links li.active a {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    text-align: right;
    font-size: 14px;
}

.user-name {
    font-weight: 600;
    color: #fff;
    display: block;
}

.user-role {
    font-size: 11px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(99, 102, 241, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.btn-logout {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

/* Footer */
footer {
    background: rgba(17, 24, 39, 0.9);
    border-top: 1px solid var(--card-border);
    padding: 20px 0;
    margin-top: auto;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Main Dashboard Elements */
.page-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 20px 0;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--card-hover-border);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-top: 10px;
    margin-bottom: 5px;
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
}

select.form-control,
select.form-select,
.form-group select {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    line-height: 1.4 !important;
    color: #fff !important;
    background-color: rgba(17, 24, 39, 0.8) !important;
    cursor: pointer;
}

select.form-control option,
select.form-select option,
.form-group select option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    padding: 8px !important;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   Sélecteurs de Dates & Heures Universels en Blanc (Thème Clair & Fond Blanc)
   ========================================================================== */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
.form-control[type="date"],
.form-control[type="datetime-local"],
.form-control[type="time"] {
    color-scheme: light !important;
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
}

/* Texte interne et segments de dates (jour, mois, année, séparateurs) en sombre lisible sur fond blanc */
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="time"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="month"]::-webkit-datetime-edit,
input[type="week"]::-webkit-datetime-edit {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* Segments au focus / actifs */
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus,
input[type="datetime-local"]::-webkit-datetime-edit-day-field:focus,
input[type="datetime-local"]::-webkit-datetime-edit-month-field:focus,
input[type="datetime-local"]::-webkit-datetime-edit-year-field:focus {
    background-color: #e0e7ff !important;
    color: #4338ca !important;
    -webkit-text-fill-color: #4338ca !important;
}

/* Icône du sélecteur calendrier native nette et sombre sur fond blanc */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    filter: none !important;
    cursor: pointer !important;
    opacity: 0.75 !important;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

/* ==========================================================================
   Sélecteur Visuel d'Articles - Modal Flottant Centré & Overlay Flouté
   ========================================================================== */
.btn-article-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 6px;
    color: #34d399;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}
.btn-article-picker:hover {
    background: rgba(16, 185, 129, 0.28);
    border-color: #34d399;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.article-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: pickerOverlayFadeIn 0.2s ease-out;
}
@keyframes pickerOverlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.article-picker-modal {
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    background: #0f172a;
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(16, 185, 129, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pickerModalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pickerModalScale {
    from { opacity: 0; transform: scale(0.94) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.article-picker-header {
    padding: 14px 18px;
    background: rgba(16, 185, 129, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.article-picker-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.article-picker-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s;
}
.article-picker-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}
.article-picker-search-wrap {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}
.article-picker-search {
    width: 100%;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: #fff;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}
.article-picker-search:focus {
    border-color: #34d399;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}
.article-picker-list {
    max-height: 380px;
    overflow-y: auto;
    padding: 6px 0;
}
.article-picker-item {
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.15s;
}
.article-picker-item:last-child {
    border-bottom: none;
}
.article-picker-item:hover {
    background: rgba(16, 185, 129, 0.12);
}
.article-picker-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
}
.article-picker-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #f1f5f9;
}
.article-picker-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    gap: 8px;
    align-items: center;
}
.article-picker-badge-service {
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.article-picker-badge-prod {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.article-picker-badge-stock-out {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.article-picker-price {
    font-size: 13.5px;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
    text-align: right;
}

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

/* Auth Screens */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
    padding: 40px 0;
}

.auth-card {
    max-width: 360px;
    width: 100%;
    padding: 30px;
    box-sizing: border-box;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(244, 63, 94, 0.1);
    color: #f87171;
    border-color: rgba(244, 63, 94, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    margin-bottom: 20px;
    background: rgba(22, 28, 45, 0.3);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

th {
    background: rgba(17, 24, 39, 0.8);
    color: #fff;
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
}

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

tr:hover td {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

/* Lignes de tableaux cliquables avec effet sombre au survol */
tr.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

tr.clickable-row:hover td {
    background-color: rgba(10, 15, 29, 0.92) !important;
    color: #ffffff !important;
}

tr.clickable-row:hover td a:not(.btn) {
    color: #60a5fa !important;
}

tr.clickable-row:hover td:last-child {
    background-color: #0b1120 !important;
}

tr.clickable-row:active td {
    background-color: rgba(3, 7, 18, 0.98) !important;
}

/* BADGES */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #f87171;
}

/* Simulation Sheet Specific */
.simulation-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 30px;
}

.simulation-grid > * {
    min-width: 0;
}

@media (max-width: 1024px) {
    .simulation-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.simulation-sheet {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    width: 100%;
}

.simulation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 15px;
}

.items-table th:nth-child(1) { width: 40%; } /* Article */
.items-table th:nth-child(2) { width: 15%; } /* Qty */
.items-table th:nth-child(3) { width: 15%; } /* Prix HT */
.items-table th:nth-child(4) { width: 20%; } /* Prix Revient */
.items-table th:nth-child(5) { width: 10%; } /* Action */

.row-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.row-action-btn:hover {
    color: var(--danger);
}

/* Add Row Button */
.btn-add-row {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px dashed var(--primary);
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-row:hover {
    background: var(--primary);
    color: #fff;
    border-style: solid;
}

.frais-card-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.frais-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.frais-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.frais-value-input {
    width: 120px;
    text-align: right;
}

/* Autocomplete/Dropdown style enhancements */
.autocomplete-container {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111827;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin-top: 4px;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.autocomplete-item:hover {
    background: var(--primary);
    color: #fff;
}

.autocomplete-item-new {
    border-top: 1px solid var(--card-border);
    color: var(--primary);
    font-weight: 600;
}

/* Dynamic simulation results display */
.cost-price-result {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.cost-price-result-total {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    font-weight: 400;
}

.total-summary-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(192, 132, 252, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.total-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.total-summary-row:last-child {
    border-bottom: none;
    padding-top: 15px;
    margin-top: 5px;
}

.total-summary-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.total-summary-val {
    font-weight: 600;
    color: #fff;
}

.total-summary-big {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Admin Dashboard User Table style */
.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.1);
}

.table-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Simulation view table results */
.alloc-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* --- Chat Styles --- */
.chat-container {
    display: flex;
    height: calc(100vh - 180px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 20px;
    margin-bottom: 20px;
}

.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    background: rgba(17, 24, 39, 0.4);
}

.chat-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    color: #fff;
    font-size: 16px;
}

.chat-threads-list {
    flex: 1;
    overflow-y: auto;
}

.chat-thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: var(--transition);
}

.chat-thread-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-thread-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary);
}

.chat-thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.chat-thread-info {
    flex: 1;
    min-width: 0;
}

.chat-thread-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-thread-lastmsg {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-badge {
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(17, 24, 39, 0.2);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17, 24, 39, 0.4);
}

.chat-header-name {
    font-weight: 600;
    color: #fff;
}

.chat-messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message-bubble {
    max-width: 60%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-bubble.incoming {
    align-self: flex-start;
}

.chat-message-bubble.outgoing {
    align-self: flex-end;
}

.chat-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message-bubble.incoming .chat-message-content {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--card-border);
}

.chat-message-bubble.outgoing .chat-message-content {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 10px;
    color: var(--text-muted);
    align-self: flex-end;
}

.chat-message-bubble.incoming .chat-message-time {
    align-self: flex-start;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--card-border);
    background: rgba(17, 24, 39, 0.4);
}

.chat-input-form {
    display: flex;
    gap: 12px;
}

.chat-input-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.chat-input-field:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-send-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-send-btn:hover {
    background: var(--primary-hover);
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 15px;
}

/* Password Strength Meter */
.password-strength-container {
    margin-top: 8px;
}
.password-strength-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 4px;
}
.password-strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}
.password-strength-text {
    font-size: 11px;
    font-weight: 500;
    display: block;
}

/* Typing Indicator Animation */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    padding: 8px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    margin-bottom: 5px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
    display: inline-block;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Message Status Checkmarks */
.msg-status-icon {
    margin-left: 6px;
    font-size: 11px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}
.msg-status-icon.read {
    color: #34d399; /* Emerald */
}
.msg-status-icon.unread {
    color: var(--text-muted); /* Gray */
}

/* File Upload Progress Bar */
.chat-progress-container {
    padding: 10px 20px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
    display: none;
    flex-direction: column;
    gap: 6px;
}
.chat-progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.chat-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.1s ease;
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.lightbox-modal.show {
    display: flex;
    opacity: 1;
}
.lightbox-content {
    max-width: 90%;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.lightbox-modal.show .lightbox-content {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    font-weight: 300;
}

/* Chart Container */
.chart-container-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
    margin-top: 20px;
}

/* App Context Switcher */
.app-switcher {
    display: inline-flex;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--card-border);
    padding: 3px;
    border-radius: 30px;
    gap: 2px;
    position: relative;
    margin-right: 15px;
    align-items: center;
    animation: appSwitchFade 0.25s ease-out forwards;
}
@keyframes appSwitchFade {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

.app-switch-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.app-switch-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.app-switch-item.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
    transform: none;
}

/* Menu déroulant au survol - Mon Compte */
.nav-dropdown-wrapper {
    position: relative;
    list-style: none;
}

.nav-dropdown-trigger {
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.nav-dropdown-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 270px;
    background: rgba(17, 18, 36, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 8px 0;
    margin: 0;
    list-style: none;
    display: none;
    z-index: 1000;
}

.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.nav-dropdown-wrapper:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li {
    padding: 0;
    margin: 0;
}

.nav-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-dropdown-menu li a svg,
.nav-dropdown-menu li a i {
    flex-shrink: 0;
}

.nav-dropdown-menu li a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-dropdown-menu li.active a {
    color: #fff;
    background: rgba(99, 102, 241, 0.15);
}

/* Radio button style context switcher */
.app-switcher-radio-group {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 30px;
    margin-right: 15px;
}

.app-radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.app-radio-option input[type="radio"] {
    display: none;
}

.radio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    position: relative;
    transition: all 0.2s ease;
}

.app-radio-option.selected .radio-dot {
    border-color: var(--primary);
}

.app-radio-option.selected .radio-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.app-radio-option.selected .radio-text {
    color: #fff;
    font-weight: 600;
}

.app-radio-option:hover .radio-text {
    color: #fff;
}

.dropdown-plus-btn:hover {
    background: #4f46e5 !important;
    transform: rotate(90deg);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.chat-header-btn:hover {
    background: #4f46e5 !important;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
    transform: scale(1.05);
}

/* Header Icon Dock & Action Buttons */
.header-icon-dock {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 30px;
}

.icon-dock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.icon-dock-btn:hover,
.icon-dock-btn.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(129, 140, 248, 0.4);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.icon-dock-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.icon-dock-btn[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Language Dropdown Container & Menu */
.lang-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.lang-dropdown-trigger {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 20px !important;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 0;
}

.lang-dropdown-trigger:hover {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(129, 140, 248, 0.4) !important;
}

.lang-code {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 6px 0;
    min-width: 130px;
    z-index: 2000;
    list-style: none;
    margin: 0;
    text-align: left;
}

.lang-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
}

.lang-dropdown-wrapper:hover .lang-dropdown-menu {
    display: block !important;
}

.lang-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.lang-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.lang-dropdown-menu li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.lang-dropdown-menu li a.active {
    color: #818cf8;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: #f87171;
    text-decoration: none;
    transition: all 0.25s ease;
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: #f43f5e;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.35);
}

/* Mobile Hamburger & Drawer Styles */
.mobile-hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-hamburger-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.mobile-nav-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-backdrop.open {
    display: block;
    opacity: 1;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 290px;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    background: #0f172a;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1100;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mobile-nav-drawer.open {
    right: 0;
}

.mobile-drawer-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-info-mobile .user-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    display: block;
}

.user-info-mobile .user-role {
    font-size: 10px;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.mobile-drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.mobile-drawer-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.mobile-drawer-body {
    padding: 16px 18px 25px 18px;
    padding-bottom: calc(45px + env(safe-area-inset-bottom, 20px));
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-top: 4px;
}

.mobile-lang-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mobile-lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    transition: all 0.2s ease;
}

.mobile-lang-btn:hover,
.mobile-lang-btn.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #818cf8;
    color: #fff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.mobile-app-switcher {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-app-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.mobile-app-item:hover,
.mobile-app-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-nav-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.2s ease;
}

.mobile-nav-links li a:hover,
.mobile-nav-links li a.active {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
}

.btn-logout-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 25px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #f87171;
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-logout-mobile:hover {
    background: rgba(244, 63, 94, 0.3);
    color: #fff;
}

/* Mobile Chat Header Button (Strictly Hidden on Desktop) */
.mobile-chat-header-btn {
    display: none !important;
}

/* Responsive Media Queries (Tablets & Mobile) */
@media (max-width: 992px) {
    .header-container {
        padding: 8px 12px !important;
    }

    .desktop-nav,
    [data-theme="light"] .desktop-nav,
    body.light-theme .desktop-nav,
    .nav-container,
    [data-theme="light"] .nav-container,
    body.light-theme .nav-container,
    .app-switcher,
    [data-theme="light"] .app-switcher,
    body.light-theme .app-switcher,
    .header-icon-dock,
    [data-theme="light"] .header-icon-dock,
    body.light-theme .header-icon-dock,
    .user-info,
    [data-theme="light"] .user-info,
    body.light-theme .user-info,
    .btn-logout,
    [data-theme="light"] .btn-logout,
    body.light-theme .btn-logout,
    .lang-dropdown-wrapper,
    [data-theme="light"] .lang-dropdown-wrapper,
    body.light-theme .lang-dropdown-wrapper {
        display: none !important;
    }
    
    .mobile-chat-header-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 34px !important;
        padding: 0 10px !important;
        border-radius: 20px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: #fff !important;
        position: relative !important;
        text-decoration: none !important;
        flex-shrink: 0 !important;
        transition: all 0.2s ease !important;
    }

    .mobile-chat-header-btn:hover,
    .mobile-chat-header-btn.active {
        background: rgba(99, 102, 241, 0.2) !important;
        border-color: rgba(129, 140, 248, 0.4) !important;
        color: #fff !important;
    }

    .lang-dropdown-wrapper {
        display: flex !important;
    }
    
    .lang-dropdown-trigger {
        height: 34px !important;
        padding: 0 10px !important;
        border-radius: 20px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        font-size: 11px !important;
    }

    .lang-dropdown-trigger:hover {
        background: rgba(99, 102, 241, 0.2) !important;
        border-color: #818cf8 !important;
    }

    .mobile-hamburger-btn,
    [data-theme="light"] .mobile-hamburger-btn,
    body.light-theme .mobile-hamburger-btn {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
    }

    .user-menu {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
}

/* Chat Responsive Adjustments (Mobile & Tablet) */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 130px) !important;
        min-height: 440px !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
        border-radius: 12px !important;
        flex-direction: column !important;
    }

    .chat-sidebar {
        width: 100% !important;
        height: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--card-border) !important;
    }

    .chat-main {
        width: 100% !important;
        height: 100% !important;
    }

    /* En mode mobile, basculer entre la liste et la discussion ouverte */
    .chat-container.mobile-chat-mode .chat-main {
        display: none !important;
    }
    
    .chat-container.mobile-chat-mode.active-thread-open .chat-sidebar {
        display: none !important;
    }
    
    .chat-container.mobile-chat-mode.active-thread-open .chat-main {
        display: flex !important;
    }

    .btn-chat-back-mobile {
        display: inline-flex !important;
    }

    .chat-message-bubble {
        max-width: 85% !important;
    }

    .chat-message-content {
        padding: 10px 14px !important;
        font-size: 13.5px !important;
    }

    .chat-utility-bar {
        padding: 6px 12px !important;
        overflow-x: auto !important;
    }

    .emojis-list {
        overflow-x: auto !important;
        white-space: nowrap !important;
        padding-bottom: 2px !important;
    }

    .chat-input-area {
        padding: 10px 12px !important;
    }

    .chat-input-field {
        padding: 10px 12px !important;
        font-size: 13.5px !important;
    }

    .chat-send-btn {
        padding: 0 14px !important;
    }

    .chat-send-btn span {
        display: none !important;
    }

    .chat-thread-item {
        padding: 12px 15px !important;
    }
}

/* Fix select option color issue (white text on white background in Chrome/Edge) */
select option {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

/* Header Group and Quick Add Button Styles */
.header-left-group {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-quick-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff !important;
    background: #10b981 !important;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
    padding: 0;
    outline: none;
}

.btn-quick-add:hover {
    background: #059669 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.55);
    transform: scale(1.08) translateY(-1px);
}

.btn-quick-add svg {
    transition: transform 0.25s ease;
}

.btn-quick-add:hover svg {
    transform: rotate(90deg);
}

.quick-add-dropdown.open .nav-dropdown-menu {
    display: block !important;
}

.quick-add-dropdown .nav-dropdown-menu {
    min-width: 220px;
}

.quick-add-dropdown .nav-dropdown-menu li a {
    gap: 10px;
}

/* ==========================================================================
   Global Checkbox & Toggle Switch Design System (Pro-Ste Standard)
   ========================================================================== */

/* Universal Checkbox Switch Style */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 34px !important;
    height: 18px !important;
    background-color: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 10px !important;
    cursor: pointer;
    position: relative !important;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-block !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

input[type="checkbox"]::after {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 12px !important;
    height: 12px !important;
    background-color: #cbd5e1 !important;
    border-radius: 50% !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4) !important;
    transform: none !important;
    border: none !important;
}

input[type="checkbox"]:checked {
    background-color: #6366f1 !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.45) !important;
}

input[type="checkbox"]:checked::after {
    background-color: #ffffff !important;
    transform: translateX(16px) !important;
}

input[type="checkbox"]:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* Container & Layout Helpers for Toggle Pills */
.toggle-pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
}

.toggle-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.3);
}

.toggle-pill-block {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.toggle-pill-block:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(129, 140, 248, 0.35);
}

/* Active states for toggle pill containers */
.toggle-pill:has(input:checked) {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(129, 140, 248, 0.4);
}

.toggle-pill-block:has(input:checked) {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(129, 140, 248, 0.35);
}

/* Typography inside Toggle Pills */
.toggle-pill .toggle-pill-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
}

.toggle-pill-block .toggle-pill-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    user-select: none;
}

.toggle-pill input[type="checkbox"]:checked ~ .toggle-pill-text {
    color: #a5b4fc;
    font-weight: 600;
}

.toggle-pill-block input[type="checkbox"]:checked ~ .toggle-pill-text {
    color: #ffffff;
    font-weight: 600;
}

/* ==========================================================================
   Global Dashboard 100% Full Width, 3-Column Grid & Paperclip (Trombone) Pin
   ========================================================================== */

/* Full Width Container Override for Dashboard */
body.page-dashboard .wrapper,
.wrapper.full-width-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* Dashboard 3-Column Grid */
.dashboard-grid-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    width: 100% !important;
    margin-bottom: 30px;
}

/* Dashboard Grid Spans: 1/3 (1 col), 1/2 (2 cols), 1/1 (3 cols / Full Row) */
.dashboard-sub-card[data-span="1/3"] { grid-column: span 1 !important; }
.dashboard-sub-card[data-span="1/2"] { grid-column: span 2 !important; }
.dashboard-sub-card[data-span="1/1"] { grid-column: span 3 !important; }

/* Responsive Adjustments for Mobile & Tablet */
@media (max-width: 900px) {
    .dashboard-grid-container {
        grid-template-columns: 1fr !important;
    }
    .dashboard-sub-card {
        grid-column: span 1 !important;
    }
}
@media (min-width: 901px) and (max-width: 1350px) {
    .dashboard-grid-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .dashboard-sub-card[data-span="1/1"] {
        grid-column: span 2 !important;
    }
}

/* Elegant Paperclip Pin Button (.btn-trombone-pin) */
.btn-trombone-pin {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-trombone-pin:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #38bdf8;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

.btn-trombone-pin:active {
    transform: scale(0.95);
}

/* Trombone Dropdown Menu */
.trombone-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
    z-index: 9999;
    display: none;
    min-width: 270px;
    max-height: 480px;
    overflow-y: auto;
}

.trombone-dropdown.show {
    display: block !important;
}

/* ==========================================================================
   Visual Dashboard Row Builder Styles (admin/settings.php)
   ========================================================================== */
.layout-builder-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 25px;
    width: 100%;
}

.builder-row {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.builder-row.drag-over {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.03);
}

.builder-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px dashed rgba(255,255,255,0.06);
    padding-bottom: 8px;
}

.builder-row-title {
    font-size: 13px;
    font-weight: 700;
    color: #818cf8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.builder-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.builder-block-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 80px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px dashed rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 12px;
    transition: background 0.2s;
}

.builder-block {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    position: relative;
}

.builder-block.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.builder-block.drag-over {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.08);
}

/* Sizes representation inside settings builder */
.builder-block.span-1-3 {
    flex: 1 1 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
    min-width: 180px;
}
.builder-block.span-1-2 {
    flex: 1 1 calc(50% - 6px);
    max-width: calc(50% - 6px);
    min-width: 220px;
}
.builder-block.span-1-1 {
    flex: 1 1 100%;
    max-width: 100%;
}

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

.builder-block-title {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.builder-block-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    border-top: 1px dashed rgba(255,255,255,0.05);
    padding-top: 8px;
}

.builder-btn-span {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.builder-btn-span:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.builder-badge-size {
    font-size: 9px;
    font-weight: 700;
    background: rgba(129, 140, 248, 0.15);
    color: #a5b4fc;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Dashboard Row grid for layout rendering */
.dashboard-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    margin-bottom: 25px;
}

.dashboard-row .dashboard-sub-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

.dashboard-row .dashboard-sub-card.block-hidden,
.dashboard-sub-card.block-hidden {
    display: none !important;
}

.dashboard-sub-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 0;
}

.dashboard-row .dashboard-sub-card[data-span="1/3"] {
    flex: 1 1 calc(33.333% - 14px);
    max-width: calc(33.333% - 14px);
    min-width: 280px;
}

.dashboard-row .dashboard-sub-card[data-span="1/2"] {
    flex: 1 1 calc(50% - 10px);
    max-width: calc(50% - 10px);
    min-width: 320px;
}

.dashboard-row .dashboard-sub-card[data-span="2/3"] {
    flex: 1 1 calc(66.666% - 10px);
    max-width: calc(66.666% - 10px);
    min-width: 320px;
}

.dashboard-row .dashboard-sub-card[data-span="1/1"] {
    flex: 1 1 100%;
    max-width: 100%;
}

@media (max-width: 900px) {
    .dashboard-row {
        flex-direction: column !important;
        gap: 16px !important;
    }
    .dashboard-row .dashboard-sub-card {
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* ==========================================================================
   Sticky Sub-Navigation Bar
   ========================================================================== */
.header-sub-nav-wrapper {
    position: sticky;
    top: 0;
    z-index: 99;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    width: 100%;
    margin-top: 0px;
}

.header-sub-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 20px; /* Marges haut et bas parfaitement égalisées */
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
}

/* ==========================================================================
   Universal Table Pagination Component (20 Rows)
   ========================================================================== */
.table-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.4);
    flex-wrap: wrap;
    gap: 12px;
    border-radius: 0 0 12px 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-info strong {
    color: #fff;
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-decoration: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.pagination-btn.active {
    color: #fff !important;
    background: #6366f1 !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis {
    color: #64748b;
    padding: 0 4px;
    font-size: 12px;
}

/* ==========================================================================
   Document Header Logo Standard (HTML / PRINT / PDF isomorph)
   ========================================================================== */
.document-header-logo,
.company-info-block img,
.invoice-print-card .company-info-block img,
.bl-print-card .company-info-block img,
.estimate-print-card .company-info-block img,
.avoir-print-card .company-info-block img,
.po-print-card .company-info-block img,
.purchase-print-card .company-info-block img,
.print-logo-details img,
#inv-header-block img {
    max-width: 550px !important;
    max-height: 130px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}
/* ==========================================================================
   Menu Hamburger d'Actions pour Tableaux de Données sur Mobile (Responsive)
   ========================================================================== */
.table-actions-cell {
    position: relative;
    white-space: nowrap;
}

/* Vue Bureau (> 768px) : Boutons standards en ligne */
.desktop-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.mobile-actions-wrapper {
    display: none;
    position: relative;
}

/* Vue Mobile (<= 768px) : Masquage des boutons en ligne, affichage du bouton Hamburger (icône seule) */
@media (max-width: 768px) {
    .desktop-actions {
        display: none !important;
    }
    .mobile-actions-wrapper {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        position: relative;
        vertical-align: middle;
    }

    /* Règle d'affichage universelle : Colonne Actions Sticky à droite sur mobile */
    .table-actions,
    th.table-actions,
    td.table-actions,
    th.col-actions,
    td.col-actions,
    .table thead th:last-child,
    .uppercase-table thead th:last-child,
    .stock-report-table thead th:last-child {
        position: sticky !important;
        right: 0 !important;
        z-index: 6 !important;
        background: #111827 !important;
        box-shadow: -3px 0 8px rgba(0, 0, 0, 0.4) !important;
        text-align: center !important;
    }

    td.table-actions,
    td.col-actions,
    td:has(.mobile-actions-wrapper),
    td:has(.btn-mobile-actions-toggle) {
        position: sticky !important;
        right: 0 !important;
        z-index: 5 !important;
        background: #0f172a !important;
        box-shadow: -3px 0 8px rgba(0, 0, 0, 0.4) !important;
        text-align: center !important;
    }

    tr:nth-child(even) td.table-actions,
    tr:nth-child(even) td:has(.mobile-actions-wrapper) {
        background: #131d35 !important;
    }

    tr:hover td.table-actions,
    tr:hover td:has(.mobile-actions-wrapper),
    tr.clickable-row:hover td.table-actions {
        background: #1e293b !important;
    }

    .btn-mobile-actions-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        color: #818cf8;
        background: rgba(99, 102, 241, 0.14);
        border: 1px solid rgba(99, 102, 241, 0.35);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        line-height: 1;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .btn-mobile-actions-toggle svg {
        pointer-events: none;
        width: 16px;
        height: 16px;
    }
    .btn-mobile-actions-toggle:hover,
    .btn-mobile-actions-toggle:active,
    .btn-mobile-actions-toggle.active {
        background: rgba(99, 102, 241, 0.32);
        border-color: #818cf8;
        color: #fff;
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    }
    .mobile-actions-dropdown {
        position: fixed !important;
        left: 50% !important;
        bottom: 20px !important;
        top: auto !important;
        right: auto !important;
        transform: translateX(-50%) translateY(20px) scale(0.95);
        width: calc(100vw - 28px) !important;
        max-width: 380px !important;
        background: #0f172a !important;
        border: 1px solid rgba(99, 102, 241, 0.4) !important;
        border-radius: 18px !important;
        padding: 14px !important;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 25px rgba(99, 102, 241, 0.25) !important;
        z-index: 9999999 !important;
        display: none;
        opacity: 0;
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
        max-height: 82vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mobile-actions-dropdown.show {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        opacity: 1 !important;
        transform: translateX(-50%) translateY(0) scale(1) !important;
    }
    .mobile-actions-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 9999998 !important;
        display: none;
        touch-action: manipulation;
    }
    .mobile-actions-backdrop.show {
        display: block !important;
    }
    .mobile-actions-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 6px 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        margin-bottom: 4px;
    }
    .mobile-actions-title {
        font-size: 13px;
        font-weight: 700;
        color: #818cf8;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-actions-close {
        background: rgba(255, 255, 255, 0.06);
        border: none;
        color: #cbd5e1;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        padding: 4px 10px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-action-item {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #e2e8f0 !important;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-radius: 10px !important;
        text-decoration: none !important;
        transition: all 0.15s ease !important;
        min-height: 42px;
        cursor: pointer;
        width: 100%;
        text-align: left;
    }
    .mobile-action-item:hover,
    .mobile-action-item:active {
        background: rgba(99, 102, 241, 0.18) !important;
        border-color: rgba(99, 102, 241, 0.35) !important;
        color: #fff !important;
    }
    .mobile-action-item.action-danger {
        color: #f87171 !important;
        background: rgba(239, 68, 68, 0.08) !important;
        border-color: rgba(239, 68, 68, 0.2) !important;
    }
    .mobile-action-item.action-danger:hover,
    .mobile-action-item.action-danger:active {
        background: rgba(239, 68, 68, 0.22) !important;
        color: #fff !important;
    }
}

/* ==========================================================================
   HARMONISATION GLOBALE DU MODE CLAIR (LIGHT THEME - DESIGN MODERNE SAAS)
   ========================================================================== */

[data-theme="light"],
body.light-theme {
    --bg-main: #f8fafc !important;
    --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    --card-bg: #ffffff !important;
    --card-border: #e2e8f0 !important;
    --card-hover-border: rgba(79, 70, 229, 0.45) !important;
    --text-primary: #0f172a !important;
    --text-secondary: #334155 !important;
    --text-muted: #64748b !important;
    --primary: #4f46e5 !important;
    --primary-hover: #4338ca !important;
    --primary-glow: rgba(79, 70, 229, 0.15) !important;
    --link-color: #4f46e5 !important;
    --link-hover: #3730a3 !important;
    --link-active: #312e81 !important;
}

[data-theme="light"] body,
body.light-theme,
[data-theme="light"] html,
body.light-theme html {
    background-color: #f8fafc !important;
    background-image: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #0f172a !important;
}

/* 1. Élimination universelle des fonds grisâtres et neutralisation des inlines sombres (Hors documents d'impression) */
[data-theme="light"] .card:not(.invoice-print-card),
[data-theme="light"] .dashboard-sub-card,
[data-theme="light"] .dashboard-sub-card-body,
[data-theme="light"] .dashboard-block,
[data-theme="light"] .stat-card,
[data-theme="light"] .info-card,
[data-theme="light"] .box,
[data-theme="light"] .panel,
[data-theme="light"] .filter-bar,
[data-theme="light"] .filters-container,
[data-theme="light"] .search-bar,
[data-theme="light"] form.filter-bar,
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(15, 23, 42"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(22, 28, 45"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:rgba(15, 23, 42"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:rgba(22, 28, 45"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #0f172a"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#0f172a"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #1e293b"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#1e293b"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #111827"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#111827"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgb(15, 23, 42)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgb(22, 28, 45)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.02)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.03)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.04)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.05)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.06)"],
[data-theme="light"] div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.08)"],
body.light-theme .card:not(.invoice-print-card),
body.light-theme .dashboard-sub-card,
body.light-theme .dashboard-sub-card-body,
body.light-theme .dashboard-block,
body.light-theme .stat-card,
body.light-theme .info-card,
body.light-theme .box,
body.light-theme .panel,
body.light-theme .filter-bar,
body.light-theme .filters-container,
body.light-theme .search-bar,
body.light-theme form.filter-bar,
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(15, 23, 42"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(22, 28, 45"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:rgba(15, 23, 42"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:rgba(22, 28, 45"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #0f172a"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#0f172a"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #1e293b"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#1e293b"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: #111827"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background:#111827"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgb(15, 23, 42)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgb(22, 28, 45)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.02)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.03)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.04)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.05)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.06)"],
body.light-theme div:not(.invoice-print-card):not(.invoice-preview-wrapper):not(.invoice-print-card *):not(.invoice-preview-wrapper *)[style*="background: rgba(255, 255, 255, 0.08)"] {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
}

/* Préservation stricte de l'image de fond et de la feuille des documents en mode clair */
[data-theme="light"] .invoice-print-card,
body.light-theme .invoice-print-card {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
}

[data-theme="light"] .invoice-print-card[style*="background-image"],
body.light-theme .invoice-print-card[style*="background-image"] {
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 100% 100% !important;
}

/* Transparence absolue des conteneurs internes de la feuille pour ne pas masquer le background choisi dans profil-ste */
[data-theme="light"] .invoice-print-card table.print-layout-table,
[data-theme="light"] .invoice-print-card table.print-layout-table thead,
[data-theme="light"] .invoice-print-card table.print-layout-table thead tr,
[data-theme="light"] .invoice-print-card table.print-layout-table thead th,
[data-theme="light"] .invoice-print-card table.print-layout-table thead td,
[data-theme="light"] .invoice-print-card table.print-layout-table tbody,
[data-theme="light"] .invoice-print-card table.print-layout-table tbody tr,
[data-theme="light"] .invoice-print-card table.print-layout-table tbody td,
[data-theme="light"] .invoice-print-card table.print-layout-table tfoot,
[data-theme="light"] .invoice-print-card table.print-layout-table tfoot tr,
[data-theme="light"] .invoice-print-card table.print-layout-table tfoot td,
[data-theme="light"] .invoice-print-card #inv-header-block,
[data-theme="light"] .invoice-print-card #inv-items-block,
[data-theme="light"] .invoice-print-card #inv-last-block,
[data-theme="light"] .invoice-print-card .screen-only-footer,
[data-theme="light"] .invoice-print-card .print-footer-container,
body.light-theme .invoice-print-card table.print-layout-table,
body.light-theme .invoice-print-card table.print-layout-table thead,
body.light-theme .invoice-print-card table.print-layout-table thead tr,
body.light-theme .invoice-print-card table.print-layout-table thead th,
body.light-theme .invoice-print-card table.print-layout-table thead td,
body.light-theme .invoice-print-card table.print-layout-table tbody,
body.light-theme .invoice-print-card table.print-layout-table tbody tr,
body.light-theme .invoice-print-card table.print-layout-table tbody td,
body.light-theme .invoice-print-card table.print-layout-table tfoot,
body.light-theme .invoice-print-card table.print-layout-table tfoot tr,
body.light-theme .invoice-print-card table.print-layout-table tfoot td,
body.light-theme .invoice-print-card #inv-header-block,
body.light-theme .invoice-print-card #inv-items-block,
body.light-theme .invoice-print-card #inv-last-block,
body.light-theme .invoice-print-card .screen-only-footer,
body.light-theme .invoice-print-card .print-footer-container {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
}

[data-theme="light"] .invoice-preview-wrapper,
body.light-theme .invoice-preview-wrapper {
    background: #f1f5f9 !important;
    padding: 20px 0 !important;
    border-radius: 12px !important;
}

/* Blocs d'informations Client / Fournisseur & Dates avec transparence subtile pour laisser transparaître le fond de document */
#inv-client-block > div,
.invoice-print-card #inv-client-block > div,
[data-theme="light"] #inv-client-block > div,
[data-theme="light"] .invoice-print-card #inv-client-block > div,
body.light-theme #inv-client-block > div,
body.light-theme .invoice-print-card #inv-client-block > div {
    background-color: #f8fafc69 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

/* 2. Typographie & Titres en Noir / Ardoise Profond */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6,
[data-theme="light"] .page-title,
[data-theme="light"] .block-title,
[data-theme="light"] .card-title,
[data-theme="light"] .dashboard-title,
[data-theme="light"] .modal-title,
[data-theme="light"] .section-title,
[data-theme="light"] strong,
[data-theme="light"] b,
body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5,
body.light-theme h6,
body.light-theme .page-title,
body.light-theme .block-title,
body.light-theme .card-title,
body.light-theme .dashboard-title,
body.light-theme .modal-title,
body.light-theme .section-title,
body.light-theme strong,
body.light-theme b {
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* Écrasement des inlines de couleur blanche ou délavée */
[data-theme="light"] span[style*="color: #fff"],
[data-theme="light"] span[style*="color:#fff"],
[data-theme="light"] span[style*="color: #ffffff"],
[data-theme="light"] span[style*="color:#ffffff"],
[data-theme="light"] span[style*="color: white"],
[data-theme="light"] span[style*="color: #f8fafc"],
[data-theme="light"] span[style*="color: #e2e8f0"],
[data-theme="light"] span[style*="color: #cbd5e1"],
[data-theme="light"] div[style*="color: #fff"],
[data-theme="light"] div[style*="color:#fff"],
[data-theme="light"] div[style*="color: #ffffff"],
[data-theme="light"] div[style*="color:#ffffff"],
[data-theme="light"] div[style*="color: white"],
[data-theme="light"] div[style*="color: #f8fafc"],
[data-theme="light"] div[style*="color: #e2e8f0"],
[data-theme="light"] div[style*="color: #cbd5e1"],
[data-theme="light"] p[style*="color: #fff"],
[data-theme="light"] p[style*="color:#fff"],
[data-theme="light"] p[style*="color: #ffffff"],
[data-theme="light"] p[style*="color: #f8fafc"],
[data-theme="light"] p[style*="color: #e2e8f0"],
[data-theme="light"] h1[style*="color: #fff"],
[data-theme="light"] h2[style*="color: #fff"],
[data-theme="light"] h3[style*="color: #fff"],
[data-theme="light"] h4[style*="color: #fff"],
[data-theme="light"] h5[style*="color: #fff"],
body.light-theme span[style*="color: #fff"],
body.light-theme span[style*="color:#fff"],
body.light-theme span[style*="color: #ffffff"],
body.light-theme span[style*="color:#ffffff"],
body.light-theme span[style*="color: white"],
body.light-theme span[style*="color: #f8fafc"],
body.light-theme span[style*="color: #e2e8f0"],
body.light-theme span[style*="color: #cbd5e1"],
body.light-theme div[style*="color: #fff"],
body.light-theme div[style*="color:#fff"],
body.light-theme div[style*="color: #ffffff"],
body.light-theme div[style*="color:#ffffff"],
body.light-theme div[style*="color: white"],
body.light-theme div[style*="color: #f8fafc"],
body.light-theme div[style*="color: #e2e8f0"],
body.light-theme div[style*="color: #cbd5e1"],
body.light-theme p[style*="color: #fff"],
body.light-theme p[style*="color:#fff"],
body.light-theme p[style*="color: #ffffff"],
body.light-theme p[style*="color: #f8fafc"],
body.light-theme p[style*="color: #e2e8f0"],
body.light-theme h1[style*="color: #fff"],
body.light-theme h2[style*="color: #fff"],
body.light-theme h3[style*="color: #fff"],
body.light-theme h4[style*="color: #fff"],
body.light-theme h5[style*="color: #fff"] {
    color: #0f172a !important;
}

[data-theme="light"] .text-white,
[data-theme="light"] .text-light,
body.light-theme .text-white,
body.light-theme .text-light {
    color: #0f172a !important;
}

[data-theme="light"] .text-secondary,
[data-theme="light"] .text-muted,
[data-theme="light"] .text-white-50,
body.light-theme .text-secondary,
body.light-theme .text-muted,
body.light-theme .text-white-50 {
    color: #475569 !important;
}

/* 3. Système Universel des Liens (Normal / Survol / Actif) */
[data-theme="light"] a,
body.light-theme a {
    color: #4f46e5;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

[data-theme="light"] a:hover,
body.light-theme a:hover {
    color: #3730a3;
    text-decoration: underline;
}

[data-theme="light"] a:active,
body.light-theme a:active {
    color: #312e81;
}

/* Liens spécifiques des Tableaux (Factures, Devis, BL, Avoirs, Achats, BC, Clients, Fournisseurs, Articles) */
[data-theme="light"] table td a,
[data-theme="light"] table tbody tr td a,
[data-theme="light"] tr.clickable-row td a,
[data-theme="light"] .table-container table td a,
body.light-theme table td a,
body.light-theme table tbody tr td a,
body.light-theme tr.clickable-row td a,
body.light-theme .table-container table td a {
    color: #2563eb !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

[data-theme="light"] table td a:hover,
[data-theme="light"] table tbody tr td a:hover,
[data-theme="light"] tr.clickable-row td a:hover,
body.light-theme table td a:hover,
body.light-theme table tbody tr td a:hover,
body.light-theme tr.clickable-row td a:hover {
    color: #1d4ed8 !important;
    text-decoration: underline !important;
}

[data-theme="light"] table td a:active,
body.light-theme table td a:active {
    color: #1e40af !important;
}

/* Liens des Onglets, Menus et Navigation */
[data-theme="light"] .nav-links a,
[data-theme="light"] .header-sub-nav a,
body.light-theme .nav-links a,
body.light-theme .header-sub-nav a {
    color: #475569 !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    transition: all 0.18s ease !important;
}

[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .header-sub-nav a:hover,
body.light-theme .nav-links a:hover,
body.light-theme .header-sub-nav a:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
    text-decoration: none !important;
}

[data-theme="light"] .nav-links li.active a,
[data-theme="light"] .header-sub-nav a.active,
body.light-theme .nav-links li.active a,
body.light-theme .header-sub-nav a.active {
    color: #4f46e5 !important;
    background: rgba(79, 70, 229, 0.1) !important;
    border: 1px solid rgba(79, 70, 229, 0.3) !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

/* 4. Système Universel des Boutons (Design Moderne SaaS) */
[data-theme="light"] .btn-primary,
body.light-theme .btn-primary {
    background: linear-gradient(135deg, #123f3d 0%, #2f4d51 100%) !important;
    border: 1px solid #decece !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(18, 63, 61, 0.25) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) !important;
    text-decoration: none !important;
    transition: all 0.18s ease !important;
}

[data-theme="light"] .btn-primary:hover,
body.light-theme .btn-primary:hover {
    background: linear-gradient(135deg, #0d2e2c 0%, #233b3e 100%) !important;
    border-color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(18, 63, 61, 0.35) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

[data-theme="light"] .btn-primary:active,
body.light-theme .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="light"] .btn-secondary,
body.light-theme .btn-secondary {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    text-decoration: none !important;
    transition: all 0.18s ease !important;
}

[data-theme="light"] .btn-secondary:hover,
body.light-theme .btn-secondary:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-1px);
}

[data-theme="light"] .btn-secondary:active,
body.light-theme .btn-secondary:active {
    transform: translateY(0);
    background: #e2e8f0 !important;
}

[data-theme="light"] .btn-success,
body.light-theme .btn-success {
    background: #059669 !important;
    border: 1px solid #047857 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25) !important;
}

[data-theme="light"] .btn-success:hover,
body.light-theme .btn-success:hover {
    background: #047857 !important;
    color: #ffffff !important;
}

[data-theme="light"] .btn-danger,
body.light-theme .btn-danger {
    background: #e11d48 !important;
    border: 1px solid #be123c !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25) !important;
}

[data-theme="light"] .btn-danger:hover,
body.light-theme .btn-danger:hover {
    background: #be123c !important;
    color: #ffffff !important;
}

[data-theme="light"] .btn-warning,
body.light-theme .btn-warning {
    background: #d97706 !important;
    border: 1px solid #b45309 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25) !important;
}

[data-theme="light"] .btn-warning:hover,
body.light-theme .btn-warning:hover {
    background: #b45309 !important;
    color: #ffffff !important;
}

/* 5. Tableaux & Grilles de Données (Exhaustif sur les 12 Modules) */
[data-theme="light"] .table-container,
[data-theme="light"] .table-responsive,
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table),
body.light-theme .table-container,
body.light-theme .table-responsive,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
}

[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) thead,
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) thead tr,
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) th,
[data-theme="light"] thead:not(.invoice-print-card thead) th,
[data-theme="light"] .table:not(.invoice-print-card table) th,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) thead,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) thead tr,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) th,
body.light-theme thead:not(.invoice-print-card thead) th,
body.light-theme .table:not(.invoice-print-card table) th {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
    border-top: none !important;
    font-weight: 700 !important;
    font-size: 11.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    padding: 12px 14px !important;
}

[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tbody tr,
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tr,
[data-theme="light"] .table:not(.invoice-print-card table) tr,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tbody tr,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tr,
body.light-theme .table:not(.invoice-print-card table) tr {
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #1e293b !important;
    transition: background 0.12s ease !important;
}

[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:nth-child(even),
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:nth-child(even) td,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:nth-child(even),
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:nth-child(even) td {
    background: #f8fafc !important;
}

[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:hover,
[data-theme="light"] table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:hover td,
[data-theme="light"] tr.clickable-row:hover,
[data-theme="light"] tr.clickable-row:hover td,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:hover,
body.light-theme table:not(.print-layout-table):not(.invoice-print-card table) tbody tr:hover td,
body.light-theme tr.clickable-row:hover,
body.light-theme tr.clickable-row:hover td {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

[data-theme="light"] table tbody tr:hover td *,
[data-theme="light"] tr.clickable-row:hover td *,
[data-theme="light"] tr:hover td *,
body.light-theme table tbody tr:hover td *,
body.light-theme tr.clickable-row:hover td *,
body.light-theme tr:hover td * {
    color: #0f172a !important;
}

[data-theme="light"] table tbody tr:hover td a:not(.btn),
[data-theme="light"] tr.clickable-row:hover td a:not(.btn),
[data-theme="light"] tr:hover td a:not(.btn),
body.light-theme table tbody tr:hover td a:not(.btn),
body.light-theme tr.clickable-row:hover td a:not(.btn),
body.light-theme tr:hover td a:not(.btn) {
    color: #2563eb !important;
}

[data-theme="light"] table td,
[data-theme="light"] .table td,
body.light-theme table td,
body.light-theme .table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    padding: 12px 14px !important;
    font-size: 12.5px !important;
    vertical-align: middle !important;
}

/* Colonnes d'actions collantes (Sticky Actions) */
[data-theme="light"] .table-actions,
[data-theme="light"] th.table-actions,
[data-theme="light"] td.table-actions,
[data-theme="light"] .actions-cell,
body.light-theme .table-actions,
body.light-theme th.table-actions,
body.light-theme td.table-actions,
body.light-theme .actions-cell {
    background: #ffffff !important;
    border-left: 1px solid #e2e8f0 !important;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.04) !important;
    z-index: 2 !important;
}

[data-theme="light"] tr:nth-child(even) td.table-actions,
body.light-theme tr:nth-child(even) td.table-actions {
    background: #f8fafc !important;
}

[data-theme="light"] tr:hover td.table-actions,
[data-theme="light"] tr.clickable-row:hover td.table-actions,
body.light-theme tr:hover td.table-actions,
body.light-theme tr.clickable-row:hover td.table-actions {
    background: #f1f5f9 !important;
}

/* 6. Badges de Statuts Modernes (Pastel doux avec texte contrasté) */
[data-theme="light"] .badge-success,
[data-theme="light"] .badge-paid,
[data-theme="light"] .badge-received,
body.light-theme .badge-success,
body.light-theme .badge-paid,
body.light-theme .badge-received {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1px solid #bbf7d0 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .badge-warning,
[data-theme="light"] .badge-pending,
[data-theme="light"] .badge-low,
body.light-theme .badge-warning,
body.light-theme .badge-pending,
body.light-theme .badge-low {
    background: #fef3c7 !important;
    color: #b45309 !important;
    border: 1px solid #fde68a !important;
    font-weight: 600 !important;
}

[data-theme="light"] .badge-danger,
[data-theme="light"] .badge-unpaid,
[data-theme="light"] .badge-overdue,
[data-theme="light"] .badge-cancelled,
[data-theme="light"] .badge-out,
body.light-theme .badge-danger,
body.light-theme .badge-unpaid,
body.light-theme .badge-overdue,
body.light-theme .badge-cancelled,
body.light-theme .badge-out {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca !important;
    font-weight: 600 !important;
}

[data-theme="light"] .badge-info,
[data-theme="light"] .badge-primary,
[data-theme="light"] .badge-sent,
body.light-theme .badge-info,
body.light-theme .badge-primary,
body.light-theme .badge-sent {
    background: #e0e7ff !important;
    color: #4338ca !important;
    border: 1px solid #c7d2fe !important;
    font-weight: 600 !important;
}

[data-theme="light"] .badge-secondary,
[data-theme="light"] .badge-draft,
body.light-theme .badge-secondary,
body.light-theme .badge-draft {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600 !important;
}

/* 7. Formulaires, Inputs, Selects & Textareas */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="search"],
[data-theme="light"] select,
[data-theme="light"] textarea,
body.light-theme .form-control,
body.light-theme .form-select,
body.light-theme input[type="text"],
body.light-theme input[type="number"],
body.light-theme input[type="email"],
body.light-theme input[type="password"],
body.light-theme input[type="date"],
body.light-theme input[type="search"],
body.light-theme select,
body.light-theme textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus,
body.light-theme .form-control:focus,
body.light-theme .form-select:focus,
body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
    background-color: #ffffff !important;
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
    color: #0f172a !important;
}

[data-theme="light"] .form-control::placeholder,
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder,
body.light-theme .form-control::placeholder,
body.light-theme input::placeholder,
body.light-theme textarea::placeholder {
    color: #94a3b8 !important;
}

[data-theme="light"] .form-label,
[data-theme="light"] label,
body.light-theme .form-label,
body.light-theme label {
    color: #334155 !important;
    font-weight: 600 !important;
}

/* 8. Pagination & Navigation de Page */
[data-theme="light"] .pagination-container,
[data-theme="light"] .pagination,
body.light-theme .pagination-container,
body.light-theme .pagination {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .page-link,
[data-theme="light"] .btn-pagination,
[data-theme="light"] .pagination-btn,
[data-theme="light"] .page-item a,
[data-theme="light"] .pagination-controls a,
[data-theme="light"] .pagination-controls span,
[data-theme="light"] .table-pagination-container .pagination-controls a,
[data-theme="light"] .table-pagination-container .pagination-controls span,
body.light-theme .page-link,
body.light-theme .btn-pagination,
body.light-theme .pagination-btn,
body.light-theme .page-item a,
body.light-theme .pagination-controls a,
body.light-theme .pagination-controls span,
body.light-theme .table-pagination-container .pagination-controls a,
body.light-theme .table-pagination-container .pagination-controls span {
    background: #ffffff !important;
    color: #4c4c4c !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .pagination-btn svg,
[data-theme="light"] .btn-pagination svg,
[data-theme="light"] .page-link svg,
[data-theme="light"] .table-pagination-container svg,
body.light-theme .pagination-btn svg,
body.light-theme .btn-pagination svg,
body.light-theme .page-link svg,
body.light-theme .table-pagination-container svg {
    color: #4c4c4c !important;
    fill: #4c4c4c !important;
    stroke: #4c4c4c !important;
}

[data-theme="light"] .page-link:hover,
[data-theme="light"] .btn-pagination:hover,
[data-theme="light"] .pagination-btn:hover:not(.active),
[data-theme="light"] .page-item a:hover,
[data-theme="light"] .pagination-controls a:hover,
[data-theme="light"] .table-pagination-container .pagination-controls a:hover,
body.light-theme .page-link:hover,
body.light-theme .btn-pagination:hover,
body.light-theme .pagination-btn:hover:not(.active),
body.light-theme .page-item a:hover,
body.light-theme .pagination-controls a:hover,
body.light-theme .table-pagination-container .pagination-controls a:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

[data-theme="light"] .page-item.active .page-link,
[data-theme="light"] .btn-pagination.active,
[data-theme="light"] .pagination-btn.active,
body.light-theme .page-item.active .page-link,
body.light-theme .btn-pagination.active,
body.light-theme .pagination-btn.active {
    background: linear-gradient(135deg, #123f3d 0%, #2f4d51 100%) !important;
    color: #ffffff !important;
    border-color: #decece !important;
    box-shadow: 0 2px 6px rgba(18, 63, 61, 0.25) !important;
}

[data-theme="light"] .pagination-btn:disabled,
[data-theme="light"] .pagination-btn.disabled,
[data-theme="light"] .btn-pagination:disabled,
[data-theme="light"] .page-item.disabled .page-link,
[data-theme="light"] .table-pagination-container .disabled,
body.light-theme .pagination-btn:disabled,
body.light-theme .pagination-btn.disabled,
body.light-theme .btn-pagination:disabled,
body.light-theme .page-item.disabled .page-link,
body.light-theme .table-pagination-container .disabled {
    background: rgba(255, 255, 255, 0.6) !important;
    color: #4c4c4c !important;
    opacity: 0.45 !important;
    border-color: #e2e8f0 !important;
    cursor: not-allowed !important;
}

[data-theme="light"] .pagination-ellipsis,
body.light-theme .pagination-ellipsis {
    color: #4c4c4c !important;
}

/* 9. Modales, Fenêtres Popups & Alertes */
[data-theme="light"] .modal-content,
body.light-theme .modal-content {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .modal-header,
[data-theme="light"] .modal-footer,
body.light-theme .modal-header,
body.light-theme .modal-footer {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .custom-confirm-box,
body.light-theme .custom-confirm-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .custom-confirm-title,
body.light-theme .custom-confirm-title {
    color: #0f172a !important;
}

[data-theme="light"] .custom-confirm-text,
body.light-theme .custom-confirm-text {
    color: #475569 !important;
}

/* 10. Dropdowns & Menus Contextuels */
[data-theme="light"] .dropdown-menu,
body.light-theme .dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .dropdown-item,
body.light-theme .dropdown-item {
    color: #334155 !important;
    font-weight: 500 !important;
}

[data-theme="light"] .dropdown-item:hover,
body.light-theme .dropdown-item:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
}

/* 11. Console Administration Clients Master & Volets */
[data-theme="light"] .clients-main-col,
[data-theme="light"] .clients-sidebar-col,
[data-theme="light"] .client-card-group,
[data-theme="light"] .sidebar-form-container,
body.light-theme .clients-main-col,
body.light-theme .clients-sidebar-col,
body.light-theme .client-card-group,
body.light-theme .sidebar-form-container {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

[data-theme="light"] .client-group-header,
body.light-theme .client-group-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* 12. Profil Entreprise & Tabs */
[data-theme="light"] .profil-ste-nav-tabs button,
body.light-theme .profil-ste-nav-tabs button {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .profil-ste-nav-tabs button.active,
body.light-theme .profil-ste-nav-tabs button.active {
    background: #ffffff !important;
    color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    font-weight: 700 !important;
}

[data-theme="light"] .profil-ste-tab-pane,
body.light-theme .profil-ste-tab-pane {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* 13. Modal Bloquant de la Charte Juridique (Loi 09-08 / RGPD) */
#masterLegalTermsModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

[data-theme="light"] #masterLegalTermsModal > div,
body.light-theme #masterLegalTermsModal > div {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15) !important;
    color: #0f172a !important;
}

[data-theme="light"] #masterLegalTermsModal h2,
body.light-theme #masterLegalTermsModal h2 {
    color: #0f172a !important;
}

/* 14. Composants CalculCost, Autocomplete & Résumés */
[data-theme="light"] .cost-price-result,
body.light-theme .cost-price-result {
    color: #0f172a !important;
}

[data-theme="light"] .cost-price-result-total,
body.light-theme .cost-price-result-total {
    color: #475569 !important;
}

[data-theme="light"] .total-summary-card,
body.light-theme .total-summary-card {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%) !important;
    border: 1px solid #c7d2fe !important;
    color: #0f172a !important;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.08) !important;
}

[data-theme="light"] .autocomplete-list,
body.light-theme .autocomplete-list {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .autocomplete-item,
body.light-theme .autocomplete-item {
    color: #1e293b !important;
}

[data-theme="light"] .autocomplete-item:hover,
body.light-theme .autocomplete-item:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .autocomplete-item-new,
body.light-theme .autocomplete-item-new {
    border-top: 1px solid #e2e8f0 !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .btn-add-row,
body.light-theme .btn-add-row {
    background: rgba(79, 70, 229, 0.06) !important;
    color: #4f46e5 !important;
    border: 1px dashed #4f46e5 !important;
}

[data-theme="light"] .btn-add-row:hover,
body.light-theme .btn-add-row:hover {
    background: #4f46e5 !important;
    color: #ffffff !important;
    border-style: solid !important;
}

[data-theme="light"] .frais-label,
body.light-theme .frais-label {
    color: #334155 !important;
}

/* 15. Header, Switcher de Langue, Thème & Déconnexion */
[data-theme="light"] .lang-dropdown-trigger,
[data-theme="light"] .theme-toggle-btn,
[data-theme="light"] .btn-logout,
/* 15. Menu Principal (Header) & Sous-Menu (Sub-Nav) - Thème Clair Moderne SaaS */
[data-theme="light"] header,
body.light-theme header {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .brand,
body.light-theme .brand {
    color: #4f46e5 !important;
    background: linear-gradient(to right, #4f46e5, #7c3aed) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* Sélecteur d'Applications du Menu Principal (Capsule Unifiée Identique au Mode Sombre) */
[data-theme="light"] .header-container,
body.light-theme .header-container,
[data-theme="light"] .header-left-group,
body.light-theme .header-left-group {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
}

@media (min-width: 993px) {
    [data-theme="light"] .nav-container,
    body.light-theme .nav-container,
    [data-theme="light"] .desktop-nav,
    body.light-theme .desktop-nav {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
    }
}

[data-theme="light"] .app-switcher,
body.light-theme .app-switcher {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 3px !important;
    border-radius: 30px !important;
    gap: 2px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    display: inline-flex !important;
    align-items: center !important;
    margin-right: 15px !important;
    flex-wrap: nowrap !important;
}

[data-theme="light"] .app-switch-item,
body.light-theme .app-switch-item {
    background: transparent !important;
    border: none !important;
    color: #475569 !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    transition: all 0.18s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

[data-theme="light"] .app-switch-item svg,
body.light-theme .app-switch-item svg {
    color: var(--btn-accent, #6366f1) !important;
}

[data-theme="light"] .app-switch-item:hover,
body.light-theme .app-switch-item:hover {
    background: #ffffff !important;
    color: #1e1b4b !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transform: none !important;
}

[data-theme="light"] .app-switch-item:hover svg,
body.light-theme .app-switch-item:hover svg {
    color: var(--btn-accent, #4f46e5) !important;
    transform: scale(1.08) !important;
    transition: transform 0.2s ease !important;
}

[data-theme="light"] .app-switch-item.active,
body.light-theme .app-switch-item.active {
    background: #201d46 !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border-radius: 20px !important;
    box-shadow: 0 2px 8px rgba(32, 29, 70, 0.35) !important;
}

[data-theme="light"] .app-switch-item.active svg,
body.light-theme .app-switch-item.active svg {
    color: #ffffff !important;
}

/* Bouton d'Ajout Rapide (+) */
[data-theme="light"] .btn-quick-add,
body.light-theme .btn-quick-add {
    background: #10b981 !important;
    border: 1px solid #059669 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25) !important;
}

[data-theme="light"] .btn-quick-add:hover,
body.light-theme .btn-quick-add:hover {
    background: #059669 !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
}

/* Docks d'icônes, Outils & Admin du Menu Principal */
[data-theme="light"] .header-icon-dock,
body.light-theme .header-icon-dock {
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .icon-dock-btn,
body.light-theme .icon-dock-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .icon-dock-btn:hover,
body.light-theme .icon-dock-btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

[data-theme="light"] .icon-dock-btn.active,
body.light-theme .icon-dock-btn.active {
    background: rgba(79, 70, 229, 0.1) !important;
    border-color: #4f46e5 !important;
    color: #4f46e5 !important;
}

[data-theme="light"] #chat-notification-dot,
[data-theme="light"] #chat-mobile-header-dot,
body.light-theme #chat-notification-dot,
body.light-theme #chat-mobile-header-dot {
    border: 1.5px solid #ffffff !important;
}

/* Menus Déroulants (Dropdowns de la Navbar & Engrenage Admin) */
[data-theme="light"] .nav-dropdown-menu,
[data-theme="light"] .quick-add-dropdown .nav-dropdown-menu,
body.light-theme .nav-dropdown-menu,
body.light-theme .quick-add-dropdown .nav-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12) !important;
    border-radius: 10px !important;
}

[data-theme="light"] .nav-dropdown-menu li a,
body.light-theme .nav-dropdown-menu li a {
    color: #1e293b !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
}

[data-theme="light"] .nav-dropdown-menu li a:hover,
body.light-theme .nav-dropdown-menu li a:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .nav-dropdown-menu li[style*="border-top"],
[data-theme="light"] .nav-dropdown-menu li[style*="border-bottom"],
body.light-theme .nav-dropdown-menu li[style*="border-top"],
body.light-theme .nav-dropdown-menu li[style*="border-bottom"] {
    border-color: #e2e8f0 !important;
}

/* Zone Utilisateur & Déconnexion */
[data-theme="light"] .user-name,
body.light-theme .user-name {
    color: #0f172a !important;
    font-weight: 700 !important;
}

[data-theme="light"] .user-role,
body.light-theme .user-role {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
    border: 1px solid #e0e7ff !important;
    font-weight: 700 !important;
}

[data-theme="light"] .btn-logout,
body.light-theme .btn-logout {
    background: #ffffff !important;
    border: 1px solid #fecaca !important;
    color: #dc2626 !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .btn-logout:hover,
body.light-theme .btn-logout:hover {
    background: #fee2e2 !important;
    border-color: #f87171 !important;
    color: #b91c1c !important;
}

/* Switcher de Langue & Thème */
[data-theme="light"] .lang-dropdown-trigger,
[data-theme="light"] .theme-toggle-btn,
body.light-theme .lang-dropdown-trigger,
body.light-theme .theme-toggle-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .lang-dropdown-trigger:hover,
[data-theme="light"] .theme-toggle-btn:hover,
body.light-theme .lang-dropdown-trigger:hover,
body.light-theme .theme-toggle-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

[data-theme="light"] .lang-dropdown-menu,
body.light-theme .lang-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .lang-dropdown-menu a,
body.light-theme .lang-dropdown-menu a {
    color: #334155 !important;
}

[data-theme="light"] .lang-dropdown-menu a:hover,
[data-theme="light"] .lang-dropdown-menu a.active,
body.light-theme .lang-dropdown-menu a:hover,
body.light-theme .lang-dropdown-menu a.active {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   SOUS-MENU STICKY (SUB-NAV DOCK) EN MODE CLAIR
   ========================================================================== */
[data-theme="light"] .header-sub-nav-wrapper,
body.light-theme .header-sub-nav-wrapper {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .header-sub-nav-title,
body.light-theme .header-sub-nav-title {
    color: #0f172a !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
}

[data-theme="light"] .header-sub-nav-btn,
body.light-theme .header-sub-nav-btn {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
    border-radius: 6px !important;
    transition: all 0.18s ease !important;
}

[data-theme="light"] .header-sub-nav-btn svg,
body.light-theme .header-sub-nav-btn svg {
    color: var(--btn-accent, #6366f1) !important;
}

[data-theme="light"] .header-sub-nav-btn:hover,
[data-theme="light"] .header-sub-nav a:hover,
body.light-theme .header-sub-nav-btn:hover,
body.light-theme .header-sub-nav a:hover {
    background: #eef2ff !important;
    color: #4338ca !important;
    border-color: #c7d2fe !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.16) !important;
    transform: translateY(-1px) !important;
}

[data-theme="light"] .header-sub-nav-btn:hover svg,
[data-theme="light"] .header-sub-nav a:hover svg,
body.light-theme .header-sub-nav-btn:hover svg,
body.light-theme .header-sub-nav a:hover svg {
    color: #4f46e5 !important;
    stroke: currentColor !important;
    transform: scale(1.08) !important;
    transition: transform 0.2s ease !important;
}

[data-theme="light"] .header-sub-nav-btn.active,
body.light-theme .header-sub-nav-btn.active {
    background: var(--btn-theme, #4f46e5) !important;
    border-color: var(--btn-accent, #6366f1) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px var(--btn-glow, rgba(79, 70, 229, 0.3)) !important;
}

[data-theme="light"] .header-sub-nav-btn.active svg,
body.light-theme .header-sub-nav-btn.active svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

/* Bouton Avoirs du Sous-Menu en Mode Clair */
[data-theme="light"] .header-sub-nav-btn.nav-color-credit-note svg,
body.light-theme .header-sub-nav-btn.nav-color-credit-note svg {
    color: #ef4444 !important;
    stroke: currentColor !important;
}

[data-theme="light"] .header-sub-nav-btn.nav-color-credit-note:hover,
body.light-theme .header-sub-nav-btn.nav-color-credit-note:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #b91c1c !important;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.16) !important;
}

[data-theme="light"] .header-sub-nav-btn.nav-color-credit-note:hover svg,
body.light-theme .header-sub-nav-btn.nav-color-credit-note:hover svg {
    color: #dc2626 !important;
    stroke: currentColor !important;
}

[data-theme="light"] .header-sub-nav-btn.nav-color-credit-note.active,
body.light-theme .header-sub-nav-btn.nav-color-credit-note.active {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
}

[data-theme="light"] .header-sub-nav-btn.nav-color-credit-note.active svg,
body.light-theme .header-sub-nav-btn.nav-color-credit-note.active svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

/* ==========================================================================
   BOUTONS DE CONVERSION EN MODE SOMBRE (DEVIS & BL)
   ========================================================================== */
.btn-convert-bc,
a[href*="purchase_orders.php?action=new&from_estimate_id"] {
    background: rgba(139, 92, 246, 0.18) !important;
    border: 1px solid rgba(139, 92, 246, 0.4) !important;
    color: #c4b5fd !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.btn-convert-bc:hover,
a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover {
    background: rgba(139, 92, 246, 0.35) !important;
    border-color: rgba(139, 92, 246, 0.7) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.35) !important;
}

.btn-convert-bc svg,
a[href*="purchase_orders.php?action=new&from_estimate_id"] svg {
    color: #c4b5fd !important;
    stroke: currentColor !important;
}

.btn-convert-bc:hover svg,
a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover svg {
    color: #ffffff !important;
    stroke: currentColor !important;
}

/* ==========================================================================
   BOUTONS & ICÔNES DE CONVERSION EN MODE CLAIR (DEVIS & BL)
   ========================================================================== */
[data-theme="light"] .btn-convert-bl,
body.light-theme .btn-convert-bl,
[data-theme="light"] a[href*="delivery_notes.php?action=new&from_estimate_id"],
body.light-theme a[href*="delivery_notes.php?action=new&from_estimate_id"] {
    background: #0284c7 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
}
[data-theme="light"] .btn-convert-bl svg,
body.light-theme .btn-convert-bl svg,
[data-theme="light"] a[href*="delivery_notes.php?action=new&from_estimate_id"] svg,
body.light-theme a[href*="delivery_notes.php?action=new&from_estimate_id"] svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

[data-theme="light"] .btn-convert-bc,
body.light-theme .btn-convert-bc,
[data-theme="light"] a[href*="purchase_orders.php?action=new&from_estimate_id"],
body.light-theme a[href*="purchase_orders.php?action=new&from_estimate_id"] {
    background: #f5f3ff !important;
    border: 1px solid #ddd6fe !important;
    color: #7c3aed !important;
}
[data-theme="light"] .btn-convert-bc:hover,
body.light-theme .btn-convert-bc:hover,
[data-theme="light"] a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover,
body.light-theme a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover {
    background: #ede9fe !important;
    border-color: #c4b5fd !important;
    color: #6d28d9 !important;
}
[data-theme="light"] .btn-convert-bc svg,
body.light-theme .btn-convert-bc svg,
[data-theme="light"] a[href*="purchase_orders.php?action=new&from_estimate_id"] svg,
body.light-theme a[href*="purchase_orders.php?action=new&from_estimate_id"] svg {
    color: #7c3aed !important;
    stroke: currentColor !important;
}
[data-theme="light"] .btn-convert-bc:hover svg,
body.light-theme .btn-convert-bc:hover svg,
[data-theme="light"] a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover svg,
body.light-theme a[href*="purchase_orders.php?action=new&from_estimate_id"]:hover svg {
    color: #6d28d9 !important;
    stroke: currentColor !important;
}

[data-theme="light"] .btn-convert-inv,
body.light-theme .btn-convert-inv,
[data-theme="light"] a[href*="invoices.php?action=new&from_delivery_id"],
body.light-theme a[href*="invoices.php?action=new&from_delivery_id"] {
    background: #0ea5e9 !important;
    border: 1px solid #0284c7 !important;
    color: #ffffff !important;
}
[data-theme="light"] .btn-convert-inv:hover,
body.light-theme .btn-convert-inv:hover,
[data-theme="light"] a[href*="invoices.php?action=new&from_delivery_id"]:hover,
body.light-theme a[href*="invoices.php?action=new&from_delivery_id"]:hover {
    background: #0284c7 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
}
[data-theme="light"] .btn-convert-inv svg,
body.light-theme .btn-convert-inv svg,
[data-theme="light"] a[href*="invoices.php?action=new&from_delivery_id"] svg,
body.light-theme a[href*="invoices.php?action=new&from_delivery_id"] svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

[data-theme="light"] a[href*="invoices.php?action=new&from_estimate_id"],
body.light-theme a[href*="invoices.php?action=new&from_estimate_id"] {
    background: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    color: #059669 !important;
}
[data-theme="light"] a[href*="invoices.php?action=new&from_estimate_id"]:hover,
body.light-theme a[href*="invoices.php?action=new&from_estimate_id"]:hover {
    background: #d1fae5 !important;
    border-color: #6ee7b7 !important;
    color: #047857 !important;
}
[data-theme="light"] a[href*="invoices.php?action=new&from_estimate_id"] svg,
body.light-theme a[href*="invoices.php?action=new&from_estimate_id"] svg {
    color: #059669 !important;
    stroke: currentColor !important;
}

/* Bouton CareChat Header Mobile - Thème Clair */
[data-theme="light"] .mobile-chat-header-btn,
body.light-theme .mobile-chat-header-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #4f46e5 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .mobile-chat-header-btn svg,
body.light-theme .mobile-chat-header-btn svg {
    color: #4f46e5 !important;
    stroke: currentColor !important;
}

[data-theme="light"] .mobile-chat-header-btn:hover,
body.light-theme .mobile-chat-header-btn:hover {
    background: #f1f5f9 !important;
    border-color: #818cf8 !important;
    color: #4338ca !important;
}

[data-theme="light"] .mobile-chat-header-btn.active,
body.light-theme .mobile-chat-header-btn.active {
    background: rgba(79, 70, 229, 0.12) !important;
    border-color: #6366f1 !important;
    color: #4338ca !important;
}

/* Menu Hamburger & Drawer Mobile */
[data-theme="light"] .mobile-hamburger-btn,
body.light-theme .mobile-hamburger-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .mobile-nav-drawer,
body.light-theme .mobile-nav-drawer {
    background: #ffffff !important;
    border-left: 1px solid #e2e8f0 !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .mobile-drawer-header,
body.light-theme .mobile-drawer-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .mobile-section-title,
body.light-theme .mobile-section-title {
    color: #0f172a !important;
    font-weight: 700 !important;
}

[data-theme="light"] .mobile-nav-links a,
body.light-theme .mobile-nav-links a {
    color: #334155 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

[data-theme="light"] .mobile-nav-links a:hover,
body.light-theme .mobile-nav-links a:hover {
    background: #f1f5f9 !important;
    color: #4f46e5 !important;
}

[data-theme="light"] .mobile-nav-links a.active,
body.light-theme .mobile-nav-links a.active {
    background: rgba(79, 70, 229, 0.1) !important;
    color: #4f46e5 !important;
    font-weight: 700 !important;
}

[data-theme="light"] .mobile-app-item,
body.light-theme .mobile-app-item {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
}

[data-theme="light"] .mobile-app-item.active,
body.light-theme .mobile-app-item.active {
    background: var(--btn-theme, #4f46e5) !important;
    border-color: var(--btn-accent, #6366f1) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

[data-theme="light"] .mobile-theme-btn,
[data-theme="light"] .mobile-lang-btn,
body.light-theme .mobile-theme-btn,
body.light-theme .mobile-lang-btn {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

[data-theme="light"] .btn-logout-mobile,
body.light-theme .btn-logout-mobile {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border: 1px solid #fca5a5 !important;
}

/* ==========================================================================
   16. Écrans d'Authentification (Login, Register, 2FA) - Mode Clair & Logos
   ========================================================================== */
[data-theme="light"] .auth-card,
body.light-theme .auth-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border-radius: 16px !important;
}

[data-theme="light"] .auth-title,
body.light-theme .auth-title {
    color: #0f172a !important;
    font-weight: 700 !important;
}

[data-theme="light"] .auth-logo,
body.light-theme .auth-logo {
    color: #4f46e5 !important;
}

[data-theme="light"] .auth-footer,
body.light-theme .auth-footer {
    color: #475569 !important;
}

[data-theme="light"] .auth-footer a,
body.light-theme .auth-footer a {
    color: #4f46e5 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .lang-switcher,
body.light-theme .lang-switcher {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .lang-switcher span,
body.light-theme .lang-switcher span {
    color: #cbd5e1 !important;
}

/* Modale de Récupération de Mot de Passe en Mode Clair */
[data-theme="light"] .forgot-modal-content,
body.light-theme .forgot-modal-content {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    color: #1e293b !important;
}

[data-theme="light"] .forgot-modal-content h3,
body.light-theme .forgot-modal-content h3 {
    color: #0f172a !important;
    font-weight: 700 !important;
}

[data-theme="light"] .forgot-modal-content p,
body.light-theme .forgot-modal-content p {
    color: #475569 !important;
}

[data-theme="light"] .forgot-modal-content label,
body.light-theme .forgot-modal-content label {
    color: #334155 !important;
}

[data-theme="light"] .forgot-modal-content .form-control,
body.light-theme .forgot-modal-content .form-control {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] .forgot-modal-content .form-control:focus,
body.light-theme .forgot-modal-content .form-control:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

/* 16. Console de Gestion des Clients APP (admin/clients.php) - Mode Clair */
[data-theme="light"] .clients-page-container,
body.light-theme .clients-page-container {
    margin-bottom: 70px !important;
    padding-bottom: 30px !important;
}

[data-theme="light"] .clients-main-col,
[data-theme="light"] .clients-sidebar-col,
[data-theme="light"] .client-card-group,
[data-theme="light"] .sidebar-form-container,
[data-theme="light"] .clients-table-container,
body.light-theme .clients-main-col,
body.light-theme .clients-sidebar-col,
body.light-theme .client-card-group,
body.light-theme .sidebar-form-container,
body.light-theme .clients-table-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

[data-theme="light"] .clients-sidebar-card,
body.light-theme .clients-sidebar-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

.clients-main-col table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 0px !important;
}

[data-theme="light"] .client-card-tbody,
body.light-theme .client-card-tbody {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    border-radius: 10px !important;
}

[data-theme="light"] .client-row-header td,
body.light-theme .client-row-header td {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    border-bottom: none !important;
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
}

.client-row-header strong,
.client-row-header .client-company-title,
.client-company-title {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="light"] .client-row-header strong,
[data-theme="light"] .client-row-header .client-company-title,
[data-theme="light"] .client-company-title,
[data-theme="light"] .d-flex.align-items-center.gap-2 strong,
body.light-theme .client-row-header strong,
body.light-theme .client-row-header .client-company-title,
body.light-theme .client-company-title,
body.light-theme .d-flex.align-items-center.gap-2 strong {
    color: #393939 !important;
    text-shadow: none !important;
}

[data-theme="light"] #client-search-input,
body.light-theme #client-search-input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] #client-search-counter,
body.light-theme #client-search-counter {
    color: #64748b !important;
}

[data-theme="light"] #client-search-counter strong,
body.light-theme #client-search-counter strong {
    color: #0f172a !important;
}

/* Icône Impersonate (SSO Assistance à distance) en blanc pur */
.btn-client-impersonate svg,
a[href*="?impersonate="] svg,
[data-theme="light"] .btn-client-impersonate svg,
[data-theme="light"] a[href*="?impersonate="] svg,
body.light-theme .btn-client-impersonate svg,
body.light-theme a[href*="?impersonate="] svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

[data-theme="light"] .client-row-card td,
body.light-theme .client-row-card td {
    background: #ffffff !important;
    border-top: none !important;
    border-bottom: none !important;
    color: #1e293b !important;
}

[data-theme="light"] .client-row-card td:first-child,
body.light-theme .client-row-card td:first-child {
    border-left: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .client-row-card td:last-child,
body.light-theme .client-row-card td:last-child {
    border-right: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .client-details-row td,
body.light-theme .client-details-row td {
    background: #f8fafc !important;
    border-top: 1px dashed #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    color: #475569 !important;
}

[data-theme="light"] .client-card-tbody:hover tr.client-row-header td,
[data-theme="light"] .client-card-tbody:hover tr.client-row-card td,
[data-theme="light"] .client-card-tbody:hover tr.client-details-row td,
body.light-theme .client-card-tbody:hover tr.client-row-header td,
body.light-theme .client-card-tbody:hover tr.client-row-card td,
body.light-theme .client-card-tbody:hover tr.client-details-row td {
    background: #f1f5f9 !important;
}

/* 17. Rapports de Stock (stock_entries.php & stock_exits.php) - Mode Clair */
[data-theme="light"] .stock-filter-card,
body.light-theme .stock-filter-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}
[data-theme="light"] .stock-filter-card input,
[data-theme="light"] .stock-filter-card select,
body.light-theme .stock-filter-card input,
body.light-theme .stock-filter-card select {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}
[data-theme="light"] .stock-filter-card input::placeholder,
body.light-theme .stock-filter-card input::placeholder {
    color: #94a3b8 !important;
}
[data-theme="light"] .btn-article-picker,
[data-theme="light"] .btn-supplier-picker,
[data-theme="light"] .btn-customer-picker,
body.light-theme .btn-article-picker,
body.light-theme .btn-supplier-picker,
body.light-theme .btn-customer-picker {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}
[data-theme="light"] .btn-article-picker:hover,
[data-theme="light"] .btn-supplier-picker:hover,
[data-theme="light"] .btn-customer-picker:hover,
body.light-theme .btn-article-picker:hover,
body.light-theme .btn-supplier-picker:hover,
body.light-theme .btn-customer-picker:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
[data-theme="light"] .quick-date-btn,
body.light-theme .quick-date-btn {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}
[data-theme="light"] .quick-date-btn:hover,
body.light-theme .quick-date-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}
[data-theme="light"] .stock-report-table thead tr th,
body.light-theme .stock-report-table thead tr th {
    color: #64748b !important;
}
[data-theme="light"] .stock-report-table tbody tr,
body.light-theme .stock-report-table tbody tr {
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .stock-report-table tbody tr:hover,
body.light-theme .stock-report-table tbody tr:hover {
    background: #f1f5f9 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .stock-report-table tbody tr td,
body.light-theme .stock-report-table tbody tr td {
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}
[data-theme="light"] .stock-report-table tfoot tr td,
body.light-theme .stock-report-table tfoot tr td {
    background: #f8fafc !important;
    border-top: 2px solid #cbd5e1 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}
[data-theme="light"] .stock-report-table tfoot tr td:first-child,
body.light-theme .stock-report-table tfoot tr td:first-child {
    color: #475569 !important;
}

/* 18. Module CareChat (chat.php) - Mode Clair */
[data-theme="light"] .mailing-card,
body.light-theme .mailing-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}
[data-theme="light"] .mailing-card h4,
body.light-theme .mailing-card h4 {
    color: #0f172a !important;
}
[data-theme="light"] .chat-pane-senders,
[data-theme="light"] .chat-pane-conversations,
[data-theme="light"] .chat-pane-detail,
body.light-theme .chat-pane-senders,
body.light-theme .chat-pane-conversations,
body.light-theme .chat-pane-detail {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .chat-pane-header,
body.light-theme .chat-pane-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .chat-pane-title,
body.light-theme .chat-pane-title {
    color: #0f172a !important;
}
[data-theme="light"] .sender-item-card,
[data-theme="light"] .conv-item-card,
body.light-theme .sender-item-card,
body.light-theme .conv-item-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .sender-item-card:hover,
[data-theme="light"] .conv-item-card:hover,
body.light-theme .sender-item-card:hover,
body.light-theme .conv-item-card:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}
[data-theme="light"] .thread-msg-bubble,
body.light-theme .thread-msg-bubble {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .thread-msg-body,
body.light-theme .thread-msg-body {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    box-shadow: none !important;
}
[data-theme="light"] .detail-quick-reply,
body.light-theme .detail-quick-reply {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .compose-card,
body.light-theme .compose-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

/* 19. Menu Gestionnaire Trombone des Blocs (dashboard.php) - Mode Clair */
[data-theme="light"] #btn-manage-trombone,
body.light-theme #btn-manage-trombone {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #4f46e5 !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15) !important;
}
[data-theme="light"] #btn-manage-trombone:hover,
body.light-theme #btn-manage-trombone:hover {
    background: #e0e7ff !important;
    color: #4338ca !important;
}
[data-theme="light"] .trombone-dropdown,
body.light-theme .trombone-dropdown {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="light"] .trombone-header-title,
body.light-theme .trombone-header-title {
    color: #475569 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .trombone-label-item,
body.light-theme .trombone-label-item {
    color: #0f172a !important;
}
[data-theme="light"] .trombone-label-item:hover,
body.light-theme .trombone-label-item:hover {
    background: #f1f5f9 !important;
}
[data-theme="light"] .btn-trombone-pin,
body.light-theme .btn-trombone-pin {
    color: #94a3b8 !important;
}
[data-theme="light"] .btn-trombone-pin:hover,
body.light-theme .btn-trombone-pin:hover {
    color: #ef4444 !important;
    background: #fee2e2 !important;
}

/* 20. Volet Latéral d'Accès Rapide (Dock & Tiroir d'Informations) - Mode Clair */
[data-theme="light"] #quick-dock-sidebar,
body.light-theme #quick-dock-sidebar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-color: #cbd5e1 !important;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] #quick-dock-sidebar.dock-pos-left,
body.light-theme #quick-dock-sidebar.dock-pos-left {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] .quick-dock-btn,
body.light-theme .quick-dock-btn {
    color: #475569 !important;
}
[data-theme="light"] .quick-dock-btn:hover,
[data-theme="light"] .quick-dock-btn.active,
body.light-theme .quick-dock-btn:hover,
body.light-theme .quick-dock-btn.active {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}
[data-theme="light"] #quick-dock-backdrop,
body.light-theme #quick-dock-backdrop {
    background: rgba(15, 23, 42, 0.35) !important;
}
[data-theme="light"] #quick-dock-drawer,
body.light-theme #quick-dock-drawer {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] #quick-dock-drawer.drawer-pos-left,
body.light-theme #quick-dock-drawer.drawer-pos-left {
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .quick-drawer-header,
body.light-theme .quick-drawer-header {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .quick-drawer-tabs,
body.light-theme .quick-drawer-tabs {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .quick-drawer-tab,
body.light-theme .quick-drawer-tab {
    color: #475569 !important;
}
[data-theme="light"] .quick-drawer-tab:hover,
body.light-theme .quick-drawer-tab:hover {
    color: #0f172a !important;
    background: #e2e8f0 !important;
}
[data-theme="light"] .quick-drawer-close,
body.light-theme .quick-drawer-close {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}
[data-theme="light"] .quick-drawer-close:hover,
body.light-theme .quick-drawer-close:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
}
[data-theme="light"] .quick-drawer-search-bar,
body.light-theme .quick-drawer-search-bar {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .quick-search-input,
body.light-theme .quick-search-input {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}
[data-theme="light"] .quick-search-input:focus,
body.light-theme .quick-search-input:focus {
    background: #ffffff !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
[data-theme="light"] .quick-subfilter-btn,
body.light-theme .quick-subfilter-btn {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
}
[data-theme="light"] .quick-subfilter-btn.active,
[data-theme="light"] .quick-subfilter-btn:hover,
body.light-theme .quick-subfilter-btn.active,
body.light-theme .quick-subfilter-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}
[data-theme="light"] .quick-item-card,
body.light-theme .quick-item-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .quick-item-card:hover,
body.light-theme .quick-item-card:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .quick-item-title,
body.light-theme .quick-item-title {
    color: #0f172a !important;
}
[data-theme="light"] .quick-item-meta,
body.light-theme .quick-item-meta {
    color: #64748b !important;
}
[data-theme="light"] .quick-copy-chip,
body.light-theme .quick-copy-chip {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}
[data-theme="light"] .quick-copy-chip:hover,
body.light-theme .quick-copy-chip:hover {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #4338ca !important;
}
[data-theme="light"] .quick-drawer-footer,
body.light-theme .quick-drawer-footer {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    color: #64748b !important;
}

/* 21. Module Articles & Prestations (articles.php) - Mode Clair */
[data-theme="light"] .articles-main-col .card,
body.light-theme .articles-main-col .card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}

[data-theme="light"] .articles-main-col h2,
body.light-theme .articles-main-col h2 {
    color: #0f172a !important;
}

[data-theme="light"] .articles-main-col .card > div.card,
body.light-theme .articles-main-col .card > div.card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
}

[data-theme="light"] #articlesFilterForm label,
body.light-theme #articlesFilterForm label {
    color: #64748b !important;
}

[data-theme="light"] #articlesFilterForm input,
[data-theme="light"] #articlesFilterForm select,
body.light-theme #articlesFilterForm input,
body.light-theme #articlesFilterForm select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .uppercase-table th,
body.light-theme .uppercase-table th {
    background: #f8fafc !important;
    color: #64748b !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

[data-theme="light"] .uppercase-table tbody tr,
body.light-theme .uppercase-table tbody tr {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .uppercase-table tbody tr td,
body.light-theme .uppercase-table tbody tr td {
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .uppercase-table tbody tr:hover,
body.light-theme .uppercase-table tbody tr:hover {
    background: #f1f5f9 !important;
}

[data-theme="light"] .designation-scroll-container,
body.light-theme .designation-scroll-container {
    color: #0f172a !important;
}

[data-theme="light"] .uppercase-table tbody tr.clickable-row.is-editing td,
body.light-theme .uppercase-table tbody tr.clickable-row.is-editing td {
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

[data-theme="light"] #form-container,
body.light-theme #form-container {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] #form-title,
body.light-theme #form-title {
    color: #0f172a !important;
}

[data-theme="light"] #form-container label,
[data-theme="light"] #form-container span,
body.light-theme #form-container label,
body.light-theme #form-container span {
    color: #334155 !important;
}

[data-theme="light"] #form-container .form-control,
[data-theme="light"] #form-container input,
[data-theme="light"] #form-container select,
[data-theme="light"] #form-container textarea,
body.light-theme #form-container .form-control,
body.light-theme #form-container input,
body.light-theme #form-container select,
body.light-theme #form-container textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] #article-is-service,
body.light-theme #article-is-service {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] #image-preview-wrapper,
body.light-theme #image-preview-wrapper {
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
}

[data-theme="light"] .table-pagination-container,
body.light-theme .table-pagination-container {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
}

[data-theme="light"] .table-pagination-container .pagination-info,
body.light-theme .table-pagination-container .pagination-info {
    color: #475569 !important;
}

[data-theme="light"] .table-pagination-container .pagination-info strong,
body.light-theme .table-pagination-container .pagination-info strong {
    color: #0f172a !important;
}

[data-theme="light"] .table-pagination-container select,
body.light-theme .table-pagination-container select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .table-pagination-container .pagination-btn,
[data-theme="light"] .table-pagination-container a.btn-secondary,
[data-theme="light"] .table-pagination-container a.pagination-btn,
[data-theme="light"] .table-pagination-container span.pagination-btn,
body.light-theme .table-pagination-container .pagination-btn,
body.light-theme .table-pagination-container a.btn-secondary,
body.light-theme .table-pagination-container a.pagination-btn,
body.light-theme .table-pagination-container span.pagination-btn {
    color: #4c4c4c !important;
}

[data-theme="light"] .table-pagination-container .pagination-btn.active,
body.light-theme .table-pagination-container .pagination-btn.active {
    color: #ffffff !important;
}

/* Modale Statistiques Article */
[data-theme="light"] #stats-modal .card,
body.light-theme #stats-modal .card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    color: #0f172a !important;
}

[data-theme="light"] #stats-modal h3,
[data-theme="light"] #stats-modal h4,
body.light-theme #stats-modal h3,
body.light-theme #stats-modal h4 {
    color: #0f172a !important;
}

[data-theme="light"] #stats-modal div[style*="background: rgba(15, 23, 42"],
body.light-theme #stats-modal div[style*="background: rgba(15, 23, 42"] {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #stats-modal input,
body.light-theme #stats-modal input {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] #stats-modal table,
body.light-theme #stats-modal table {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] #stats-modal table th,
body.light-theme #stats-modal table th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

[data-theme="light"] #stats-modal table td,
body.light-theme #stats-modal table td {
    color: #1e293b !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* 22. Module Règlements Fournisseurs (purchase_payments.php) - Mode Clair */
[data-theme="light"] .pp-stat-card,
body.light-theme .pp-stat-card {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .pp-stat-label,
body.light-theme .pp-stat-label {
    color: #64748b !important;
}

[data-theme="light"] .pp-filter-card,
body.light-theme .pp-filter-card {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 15px 20px !important;
    margin-bottom: 20px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .pp-filter-card label,
body.light-theme .pp-filter-card label {
    color: #64748b !important;
}

[data-theme="light"] .pp-filter-card input,
[data-theme="light"] .pp-filter-card select,
body.light-theme .pp-filter-card input,
body.light-theme .pp-filter-card select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .pp-table-card,
body.light-theme .pp-table-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] #purchase-payments-table thead tr,
body.light-theme #purchase-payments-table thead tr {
    background: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

[data-theme="light"] #purchase-payments-table thead tr th,
body.light-theme #purchase-payments-table thead tr th {
    color: #64748b !important;
}

[data-theme="light"] #purchase-payments-table tbody tr,
body.light-theme #purchase-payments-table tbody tr {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] #purchase-payments-table tbody tr td,
body.light-theme #purchase-payments-table tbody tr td {
    color: #1e293b !important;
}

[data-theme="light"] #purchase-payments-table tbody tr:hover,
body.light-theme #purchase-payments-table tbody tr:hover {
    background: #f1f5f9 !important;
}

/* 23. Documents Commerciaux & Formulaires de Pièces (Mode Clair) */

/* 1- Infobulles / Boutons d'actions rapides */
[data-theme="light"] .btn-orphan-picker,
body.light-theme .btn-orphan-picker {
    background: #f3e8ff !important;
    border: 1px solid #d8b4fe !important;
    color: #7e22ce !important;
}
[data-theme="light"] .btn-orphan-picker:hover,
body.light-theme .btn-orphan-picker:hover {
    background: #e9d5ff !important;
    border-color: #c084fc !important;
    color: #6b21a8 !important;
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.2) !important;
}

[data-theme="light"] .btn-quick-new-cust,
body.light-theme .btn-quick-new-cust {
    background: #e0f2fe !important;
    border: 1px solid #bae6fd !important;
    color: #0369a1 !important;
}
[data-theme="light"] .btn-quick-new-cust:hover,
body.light-theme .btn-quick-new-cust:hover {
    background: #bae6fd !important;
    border-color: #7dd3fc !important;
    color: #0284c7 !important;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.2) !important;
}

[data-theme="light"] .btn-article-picker,
body.light-theme .btn-article-picker {
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
    color: #4338ca !important;
}
[data-theme="light"] .btn-article-picker:hover,
body.light-theme .btn-article-picker:hover {
    background: #e0e7ff !important;
    border-color: #a5b4fc !important;
    color: #3730a3 !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2) !important;
}

[data-theme="light"] .btn-quick-new-art,
body.light-theme .btn-quick-new-art {
    background: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    color: #047857 !important;
}
[data-theme="light"] .btn-quick-new-art:hover,
body.light-theme .btn-quick-new-art:hover {
    background: #d1fae5 !important;
    border-color: #6ee7b7 !important;
    color: #065f46 !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2) !important;
}

/* Modales Catalogue Articles & Nouveaux Éléments */
[data-theme="light"] #articleCatalogModal .modal-content,
[data-theme="light"] .article-picker-modal,
body.light-theme #articleCatalogModal .modal-content,
body.light-theme .article-picker-modal {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="light"] #articleCatalogModal h3,
[data-theme="light"] .article-picker-header,
body.light-theme #articleCatalogModal h3,
body.light-theme .article-picker-header {
    color: #0f172a !important;
    border-bottom-color: #e2e8f0 !important;
}
[data-theme="light"] #articleCatalogModal input,
[data-theme="light"] .article-picker-search,
body.light-theme #articleCatalogModal input,
body.light-theme .article-picker-search {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}
[data-theme="light"] #articleCatalogModal table,
[data-theme="light"] .article-picker-list,
body.light-theme #articleCatalogModal table,
body.light-theme .article-picker-list {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}
[data-theme="light"] #articleCatalogModal table th,
body.light-theme #articleCatalogModal table th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}
[data-theme="light"] #articleCatalogModal table td,
[data-theme="light"] .article-picker-item,
body.light-theme #articleCatalogModal table td,
body.light-theme .article-picker-item {
    color: #000000 !important;
    border-bottom: 1px solid #f1f5f9 !important;
}
[data-theme="light"] .article-picker-name,
body.light-theme .article-picker-name,
[data-theme="light"] #catalogTableBody tr td,
body.light-theme #catalogTableBody tr td {
    color: #000000 !important;
    font-weight: 600 !important;
}
[data-theme="light"] .article-picker-price,
body.light-theme .article-picker-price {
    color: #059669 !important;
    font-weight: 700 !important;
}
[data-theme="light"] .article-picker-item:hover,
[data-theme="light"] #articleCatalogModal table tbody tr:hover,
body.light-theme .article-picker-item:hover,
body.light-theme #articleCatalogModal table tbody tr:hover {
    background: #f1f5f9 !important;
}

/* Modales d'action rapide (Numéros orphelins, Nouveau client, Nouveau fournisseur) */
.orphan-item-btn {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #c084fc;
}
.orphan-item-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    transform: translateY(-2px);
}
.orphan-item-seq {
    color: #a855f7;
}

[data-theme="light"] .quick-modal-content,
[data-theme="light"] #orphanInvoicesModal .quick-modal-content,
[data-theme="light"] #quickCustomerModal .quick-modal-content,
[data-theme="light"] #newSupplierModal .quick-modal-content,
[data-theme="light"] #quickArticleModal .quick-modal-content,
body.light-theme .quick-modal-content,
body.light-theme #orphanInvoicesModal .quick-modal-content,
body.light-theme #quickCustomerModal .quick-modal-content,
body.light-theme #newSupplierModal .quick-modal-content,
body.light-theme #quickArticleModal .quick-modal-content {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .quick-modal-content h2,
[data-theme="light"] .quick-modal-content h3,
[data-theme="light"] #orphanInvoicesModal h2,
[data-theme="light"] #orphanInvoicesModal h3,
body.light-theme .quick-modal-content h2,
body.light-theme .quick-modal-content h3,
body.light-theme #orphanInvoicesModal h2,
body.light-theme #orphanInvoicesModal h3 {
    color: #0f172a !important;
    border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .quick-modal-content label,
body.light-theme .quick-modal-content label {
    color: #334155 !important;
    font-weight: 600 !important;
}

[data-theme="light"] .quick-modal-content input,
[data-theme="light"] .quick-modal-content select,
[data-theme="light"] .quick-modal-content textarea,
body.light-theme .quick-modal-content input,
body.light-theme .quick-modal-content select,
body.light-theme .quick-modal-content textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

[data-theme="light"] .orphan-item-btn,
body.light-theme .orphan-item-btn {
    background: #f3e8ff !important;
    border: 1px solid #d8b4fe !important;
    color: #7e22ce !important;
}
[data-theme="light"] .orphan-item-btn:hover,
body.light-theme .orphan-item-btn:hover {
    background: #e9d5ff !important;
    border-color: #c084fc !important;
    color: #6b21a8 !important;
}
[data-theme="light"] .orphan-item-seq,
body.light-theme .orphan-item-seq {
    color: #9333ea !important;
}

/* 2- Résumé Financier (Sous-totaux et Totaux en NOIR / BLACK) */
[data-theme="light"] .total-summary-label,
body.light-theme .total-summary-label {
    color: #000000 !important;
    font-weight: 600 !important;
}
[data-theme="light"] .total-summary-val,
[data-theme="light"] #summary-subtotal-ht,
[data-theme="light"] #summary-ht,
[data-theme="light"] #summary-tva,
[data-theme="light"] #summary-discount-amount,
body.light-theme .total-summary-val,
body.light-theme #summary-subtotal-ht,
body.light-theme #summary-ht,
body.light-theme #summary-tva,
body.light-theme #summary-discount-amount {
    color: #000000 !important;
    font-weight: 700 !important;
}
[data-theme="light"] .total-summary-row,
body.light-theme .total-summary-row {
    border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .total-summary-big,
[data-theme="light"] #summary-ttc,
body.light-theme .total-summary-big,
body.light-theme #summary-ttc {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    font-weight: 800 !important;
}
[data-theme="light"] .total-summary-card span[style*="color: #fff"],
[data-theme="light"] .total-summary-row span[style*="color: #fff"],
body.light-theme .total-summary-card span[style*="color: #fff"],
body.light-theme .total-summary-row span[style*="color: #fff"] {
    color: #000000 !important;
}

/* 3- Onglet "ONGLETS & CHAMPS SPÉCIFIQUES" et cases après dévoilement */
[data-theme="light"] .specific-fields-accordion,
body.light-theme .specific-fields-accordion {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
}
[data-theme="light"] .specific-fields-accordion summary,
body.light-theme .specific-fields-accordion summary {
    background: transparent !important;
    color: #000000 !important;
}
[data-theme="light"] .specific-fields-accordion summary span,
[data-theme="light"] .specific-fields-accordion summary span:first-child span,
body.light-theme .specific-fields-accordion summary span,
body.light-theme .specific-fields-accordion summary span:first-child span {
    color: #000000 !important;
    font-weight: 700 !important;
}
[data-theme="light"] .specific-fields-accordion summary span:last-child,
[data-theme="light"] .specific-fields-accordion summary span:last-child span,
body.light-theme .specific-fields-accordion summary span:last-child,
body.light-theme .specific-fields-accordion summary span:last-child span {
    color: #000000 !important;
    font-weight: 600 !important;
}
[data-theme="light"] .specific-fields-accordion > div,
body.light-theme .specific-fields-accordion > div {
    background: transparent !important;
    border-top: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .specific-fields-accordion > div > div > div,
body.light-theme .specific-fields-accordion > div > div > div {
    background: rgb(30 41 59 / 8%) !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
}
[data-theme="light"] .specific-fields-accordion label,
body.light-theme .specific-fields-accordion label {
    color: #000000 !important;
    font-weight: 600 !important;
}
[data-theme="light"] .specific-fields-accordion input,
body.light-theme .specific-fields-accordion input {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* 4- Marge de séparation avec le footer pour les DEUX modes (Clair & Sombre) */
.simulation-sheet,
form.simulation-sheet,
.invoice-form-container,
.purchase-sheet,
.pp-table-card,
.pp-stats-grid {
    margin-bottom: 70px !important;
}

/* Basculement Automatique & Instantané du Logo Header selon le Thème */
.header-logo-dark, .header-logo-light {
    max-width: 140px !important;
    max-height: 55px !important;
    height: 55px !important;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}
html[data-theme="dark"] .header-logo-light,
html:not([data-theme="light"]) .header-logo-light,
body:not(.light-theme) .header-logo-light {
    display: none !important;
}
html[data-theme="dark"] .header-logo-dark,
html:not([data-theme="light"]) .header-logo-dark,
body:not(.light-theme) .header-logo-dark {
    display: inline-block !important;
}

html[data-theme="light"] .header-logo-dark,
body.light-theme .header-logo-dark {
    display: none !important;
}
html[data-theme="light"] .header-logo-light,
body.light-theme .header-logo-light {
    display: inline-block !important;
}

/* ==========================================================================
   NOUVEAUX BLOCS D'ÉCHÉANCES DASHBOARD : CRÉANCES & DETTES
   ========================================================================== */
.echeance-kpi-container {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}
[data-theme="light"] .echeance-kpi-container,
body.light-theme .echeance-kpi-container {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.echeance-kpi-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 10px;
}

.echeance-kpi-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 4px;
}

.echeance-kpi-amount {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.echeance-kpi-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Ruban de Balance Âgée (Aging Balance Bar) */
.echeance-aging-track {
    height: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .echeance-aging-track,
body.light-theme .echeance-aging-track {
    background: #e2e8f0;
}

.echeance-aging-segment {
    height: 100%;
    transition: width 0.4s ease;
    position: relative;
}
.echeance-aging-segment.crit { background: #ef4444; }
.echeance-aging-segment.recent { background: #f97316; }
.echeance-aging-segment.soon { background: #eab308; }
.echeance-aging-segment.safe { background: #10b981; }

.echeance-aging-legend {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
}
.echeance-legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}
.echeance-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-bottom: 2px;
}
.echeance-legend-dot.crit { background: #ef4444; }
.echeance-legend-dot.recent { background: #f97316; }
.echeance-legend-dot.soon { background: #eab308; }
.echeance-legend-dot.safe { background: #10b981; }

/* Smart Feed Cards */
.echeance-feed-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.echeance-card-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s ease;
}
.echeance-card-item:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .echeance-card-item,
body.light-theme .echeance-card-item {
    background: #ffffff;
    border-color: #e2e8f0;
}
[data-theme="light"] .echeance-card-item:hover,
body.light-theme .echeance-card-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.echeance-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.echeance-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11.5px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.echeance-avatar.invoices {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.echeance-avatar.purchases {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.echeance-card-info {
    min-width: 0;
    flex: 1;
}

.echeance-partner-name {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
[data-theme="light"] .echeance-partner-name,
body.light-theme .echeance-partner-name {
    color: #0f172a;
}

.echeance-doc-meta {
    font-size: 10.5px;
    color: var(--text-secondary, #94a3b8);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.echeance-card-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.echeance-amount-box {
    text-align: right;
}

.echeance-remaining-amount {
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.2;
}
.echeance-remaining-amount.invoices { color: #10b981; }
.echeance-remaining-amount.purchases { color: #818cf8; }

.echeance-due-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1.5px 6px;
    border-radius: 6px;
    display: inline-block;
}
.echeance-due-badge.crit {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.echeance-due-badge.recent {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}
.echeance-due-badge.soon {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.echeance-due-badge.safe {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-echeance-action {
    font-size: 10.5px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-echeance-action.invoices {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.btn-echeance-action.invoices:hover {
    background: #10b981;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-echeance-action.purchases {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.35);
}
.btn-echeance-action.purchases:hover {
    background: #6366f1;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

@media (max-width: 480px) {
    .echeance-card-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    .echeance-card-right {
        width: 100%;
        justify-content: space-between;
        border-top: 1px dashed rgba(255, 255, 255, 0.08);
        padding-top: 8px;
        margin-top: 2px;
    }
    [data-theme="light"] .echeance-card-right,
    body.light-theme .echeance-card-right {
        border-top-color: #e2e8f0;
    }
}

/* 15. Décalage automatique des flèches de navigation de documents par rapport au Quick Dock */
body.dock-pos-right .invoice-side-nav-next,
body:has(#quick-dock-sidebar.dock-pos-right) .invoice-side-nav-next {
    right: 68px !important;
}

body.dock-pos-left .invoice-side-nav-prev,
body:has(#quick-dock-sidebar.dock-pos-left) .invoice-side-nav-prev {
    left: 68px !important;
}
