/* 
   Style personnalisé pour le Dashboard des Contrôles Périodiques (VGP)
   Design System Moderne (Outfit/Inter, Glassmorphism, animations et thèmes variables)
*/

:root {
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sidebar-width: 268px;
    --sidebar-collapsed-width: 88px;
    
    /* Couleurs Thème Clair (défaut) */
    --bg-app: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(148, 163, 184, 0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    
    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 35px -8px rgba(0,0,0,0.08);

    /* Pont Bootstrap : Bootstrap garde les composants, ce fichier garde le style */
    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
    --bs-emphasis-color: var(--text-primary);
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-bg: rgba(255, 255, 255, 0.62);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 79, 70, 229;
    --bs-success: var(--success);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-border-color: var(--border-color);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: #4338ca;
    --bs-card-bg: var(--bg-card);
    --bs-modal-bg: var(--bg-card);
    --bs-dropdown-bg: var(--bg-card);
    --bs-dropdown-link-color: var(--text-secondary);
    --bs-dropdown-link-hover-color: var(--text-primary);
    --bs-dropdown-link-hover-bg: rgba(99, 102, 241, 0.08);
}

/* Chargement des vues qui demandent un peu plus de temps à BLG. */
.page-loading-indicator {
    position: fixed;
    inset: 0;
    z-index: 1200;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: transparent;
    transition: opacity 0.16s ease, background-color 0.16s ease, visibility 0s linear 0.16s;
}

.page-navigation-loading .page-loading-indicator {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.08);
    transition-delay: 0s;
}

.page-loading-progress {
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    overflow: hidden;
    background: rgba(79, 70, 229, 0.16);
}

.page-loading-progress::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -38%;
    width: 38%;
    content: '';
    border-radius: 0 999px 999px 0;
    background: linear-gradient(90deg, #4f46e5, #06b6d4, #4f46e5);
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.78);
    animation: page-loading-indeterminate 1.05s ease-in-out infinite;
}

.page-loading-message {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.8rem;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.2);
}

.page-loading-spinner {
    width: 0.95rem;
    height: 0.95rem;
    flex: 0 0 0.95rem;
    border: 2px solid rgba(255, 255, 255, 0.34);
    border-top-color: #fff;
    border-radius: 50%;
    animation: page-loading-spin 0.75s linear infinite;
}

@keyframes page-loading-indeterminate {
    0% { transform: translateX(0); }
    100% { transform: translateX(365%); }
}

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

@media (max-width: 575.98px) {
    .page-loading-message {
        top: 0.8rem;
        right: 0.8rem;
        left: 0.8rem;
        justify-content: center;
    }
}

/* Variables Thème Sombre */
[data-bs-theme="dark"] {
    --bg-app: #090d16;
    --bg-card: rgba(22, 29, 49, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.2);
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 35px -8px rgba(0,0,0,0.4);

    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
    --bs-emphasis-color: var(--text-primary);
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-bg: rgba(15, 23, 42, 0.72);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 99, 102, 241;
    --bs-success: var(--success);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-border-color: var(--border-color);
    --bs-link-color: #a5b4fc;
    --bs-link-hover-color: #c4b5fd;
    --bs-card-bg: var(--bg-card);
    --bs-modal-bg: var(--bg-card);
    --bs-dropdown-bg: var(--bg-card);
    --bs-dropdown-link-color: var(--text-secondary);
    --bs-dropdown-link-hover-color: var(--text-primary);
    --bs-dropdown-link-hover-bg: rgba(99, 102, 241, 0.14);
}

body {
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.04), transparent 32%),
        linear-gradient(180deg, rgba(14, 165, 233, 0.04), transparent 38%),
        var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: background-color 0.3s ease, color 0.3s ease, padding-left 0.25s ease;
    min-height: 100vh;
}

body.has-dashboard-sidebar {
    padding-left: var(--sidebar-width);
}

html.sidebar-collapsed body.has-dashboard-sidebar {
    padding-left: var(--sidebar-collapsed-width);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.3s ease, 
                border-color 0.3s ease, 
                background-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Bootstrap global skin : composants Bootstrap, rendu visuel conservé */
.card,
.modal-content,
.dropdown-menu,
.list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.card,
.modal-content {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
}

.modal-header,
.modal-footer,
.card-header,
.card-footer {
    border-color: var(--border-color);
}

.modal-title,
.card-title,
.navbar-brand {
    color: var(--text-primary);
}

.navbar.bg-body-tertiary {
    background: var(--bg-card) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.dropdown-menu {
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.dropdown-item {
    color: var(--text-secondary);
    font-weight: 600;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(99, 102, 241, 0.16);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-hover-bg: rgba(99, 102, 241, 0.04);
    --bs-table-hover-color: var(--text-primary);
}

.alert {
    border-color: var(--border-color);
    border-radius: 16px;
}

.form-text {
    color: var(--text-muted);
}

/* Header & Titres */
.dashboard-header {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(99, 102, 241, 0.03) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 2.5rem 0;
    margin-bottom: 2rem;
}

.gradient-text {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

[data-bs-theme="dark"] .gradient-text {
    background: linear-gradient(135deg, #818cf8 0%, #a5b4fc 50%, #7dd3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Statistiques */
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Tableaux */
.table-responsive {
    border-radius: 16px;
    overflow: visible;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.custom-table {
    margin-bottom: 0;
    background-color: transparent;
}

.custom-table th {
    background-color: rgba(99, 102, 241, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover td {
    background-color: rgba(99, 102, 241, 0.02);
}

.custom-table tbody tr.row-selected td {
    background-color: rgba(79, 70, 229, 0.08);
}

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

.custom-table th:last-child,
.custom-table td:last-child {
    min-width: 132px;
    overflow: visible;
    white-space: nowrap;
    width: 132px;
}

.select-column {
    width: 48px;
}

/* Formulaires & Filtres */
.filter-bar {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-shell {
    display: block;
}

.dashboard-content {
    min-width: 0;
}

.dashboard-sidebar {
    background: #0f1828;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    bottom: 0;
    box-shadow: 10px 0 28px rgba(15, 23, 42, 0.2);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    left: 0;
    padding: 1.25rem 1rem;
    position: fixed;
    top: 0;
    transition: width 0.25s ease, padding 0.25s ease;
    width: var(--sidebar-width);
    z-index: 1040;
}

.sidebar-brand {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    min-height: 48px;
    margin-bottom: 2rem;
}

.sidebar-logo {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    display: flex;
    flex: 0 0 44px;
    height: 44px;
    justify-content: center;
    overflow: hidden;
    width: 44px;
}

.sidebar-logo img {
    max-height: 32px;
    max-width: 34px;
    object-fit: contain;
}

.sidebar-logo span {
    color: #fff;
    font-weight: 900;
}

.sidebar-brand-text {
    display: grid;
    line-height: 1.15;
    min-width: 0;
}

.sidebar-brand-text strong {
    color: #fff;
    font-size: 1.05rem;
}

.sidebar-brand-text span {
    color: #94a3b8;
    font-size: 0.78rem;
}

.sidebar-kicker {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin: 0 0 0.65rem 0.35rem;
    text-transform: uppercase;
}

.dashboard-tabs {
    gap: 0.35rem;
}

.dashboard-tabs .nav-link,
.sidebar-link {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #aab5c5;
    display: flex;
    font-weight: 700;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 46px;
    padding: 0.68rem 0.75rem;
    position: relative;
    text-align: left;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
    width: 100%;
}

.dashboard-tabs .nav-link:hover,
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-nav-main,
.sidebar-link {
    align-items: center;
    display: inline-flex;
    gap: 0.75rem;
    min-width: 0;
}

.sidebar-nav-main i,
.sidebar-link i {
    color: #38bdf8;
    flex: 0 0 22px;
    font-size: 1.05rem;
    text-align: center;
}

.dashboard-tabs .nav-link.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.55), rgba(56, 189, 248, 0.18));
    border-color: rgba(129, 140, 248, 0.65);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.25);
    color: #fff;
    transform: translateX(4px);
}

.dashboard-tabs .nav-link.active::before {
    background: linear-gradient(180deg, #ff5c79, #38bdf8);
    border-radius: 999px;
    bottom: 10px;
    box-shadow: 0 0 14px rgba(255, 92, 121, 0.55);
    content: "";
    left: -1px;
    position: absolute;
    top: 10px;
    width: 4px;
}

.dashboard-tabs .nav-link.active i {
    color: #ff5c79;
}

.dashboard-tabs .nav-link.active .sidebar-count {
    background: #fff !important;
    color: #4f46e5 !important;
}

.sidebar-count {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
}

.light-icon-only {
    display: none;
}

[data-bs-theme="dark"] .dark-icon-only {
    display: none;
}

[data-bs-theme="dark"] .light-icon-only {
    display: inline-block;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 1rem;
}

.sidebar-toggle {
    cursor: pointer;
}

html.sidebar-collapsed .dashboard-sidebar {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    width: var(--sidebar-collapsed-width);
}

html.sidebar-collapsed .sidebar-brand {
    justify-content: center;
}

html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .sidebar-kicker,
html.sidebar-collapsed .sidebar-label,
html.sidebar-collapsed .sidebar-count {
    display: none !important;
}

html.sidebar-collapsed .dashboard-tabs .nav-link,
html.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

html.sidebar-collapsed .dashboard-tabs .nav-link.active {
    transform: none;
}

html.sidebar-collapsed .sidebar-nav-main,
html.sidebar-collapsed .sidebar-link {
    justify-content: center;
}

html.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

@media (max-width: 992px) {
    body.has-dashboard-sidebar,
    html.sidebar-collapsed body.has-dashboard-sidebar {
        padding-left: 0;
    }

    .dashboard-sidebar {
        border-radius: 0;
        bottom: auto;
        box-shadow: none;
        left: auto;
        margin: 0 -1.5rem 1.5rem;
        padding: 0.85rem 1rem;
        position: static;
        right: auto;
        top: auto;
        width: auto;
    }

    html.sidebar-collapsed .dashboard-sidebar {
        padding-left: 1rem;
        padding-right: 1rem;
        width: auto;
    }

    .sidebar-brand,
    .sidebar-kicker {
        display: none;
    }

    .dashboard-tabs {
        flex-direction: row !important;
        overflow-x: auto;
    }

    .dashboard-tabs .nav-item {
        min-width: 190px;
    }

    .dashboard-tabs .nav-link.active {
        transform: translateY(-2px);
    }

    /* Les actions de session restent disponibles lorsque la sidebar devient
       une navigation horizontale sur tablette et mobile. */
    .sidebar-footer {
        border-top: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }

    .sidebar-footer .sidebar-link {
        flex: 1 1 150px;
        justify-content: center;
        padding: 0.6rem 0.7rem;
        width: auto;
    }

    .sidebar-footer .sidebar-toggle {
        display: none;
    }

    html.sidebar-collapsed .sidebar-label,
    html.sidebar-collapsed .sidebar-count {
        display: inline-flex !important;
    }
}

.form-select, .form-control {
    background-color: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.625rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .form-select, 
[data-bs-theme="dark"] .form-control {
    background-color: rgba(15, 23, 42, 0.4);
}

.form-select:focus, .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Badges */
.badge-custom {
    padding: 0.4em 0.8em;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-warning {
    background-color: rgba(234, 179, 8, 0.15);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.25);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-info {
    background-color: rgba(56, 189, 248, 0.15);
    color: #0284c7;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

[data-bs-theme="dark"] .badge-info {
    color: #38bdf8;
}

.badge-neutral {
    background-color: rgba(100, 116, 139, 0.14);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.25);
}

.rental-cell {
    min-width: 180px;
}

.machine-meta {
    display: grid;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.25;
}

.machine-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.machine-link,
.planning-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
}

.machine-link:hover,
.planning-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Boutons */
.btn,
.btn-action {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-action {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary,
.btn-primary-custom {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: none;
    color: white;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary-custom:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    color: white;
}

.btn-secondary,
.btn-secondary-custom {
    background-color: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary-custom:hover {
    background-color: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
}

.btn-danger-soft {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.22);
    color: var(--danger);
}

.btn-danger-soft:hover {
    background-color: rgba(239, 68, 68, 0.16);
    color: var(--danger);
}

.row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.customer-group.overflow-hidden,
.subcontract-group.overflow-hidden {
    overflow: visible !important;
}

.action-dropdown {
    align-items: center;
    display: inline-flex;
    min-width: max-content;
    position: relative;
    z-index: 5;
}

.machine-actions-cell {
    min-width: 132px;
    position: relative;
    vertical-align: middle !important;
    white-space: nowrap;
}

.machine-actions-cell > .action-dropdown,
.machine-actions-cell > .mobile-action-trigger {
    margin-left: auto;
    margin-right: auto;
    vertical-align: middle;
}

.action-dropdown .dropdown-toggle {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
    justify-content: center;
    line-height: 1;
    min-height: 36px;
    min-width: 104px;
    white-space: nowrap;
}

.action-dropdown .dropdown-menu,
.dropdown-menu-portal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 210px;
    padding: 0.35rem;
    z-index: 1060;
}

.dropdown-menu-portal {
    position: fixed !important;
    z-index: 2000 !important;
}

.action-dropdown .dropdown-item,
.dropdown-menu-portal .dropdown-item {
    align-items: center;
    border-radius: 8px;
    display: flex;
    font-weight: 600;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
}

.banned-panel {
    margin-bottom: 2rem;
    border-color: rgba(239, 68, 68, 0.18);
}

.subcontract-panel {
    margin-bottom: 2rem;
}

.subcontract-group {
    border-color: rgba(79, 70, 229, 0.18);
}

.subcontract-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(79, 70, 229, 0.04);
}

.sector-map-layout {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.sector-map-card,
.sector-map-side {
    min-height: 100%;
}

.sector-map {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    height: 620px;
    overflow: hidden;
    width: 100%;
}

.map-toolbar {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.map-legend {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.map-legend span {
    align-items: center;
    color: var(--text-muted);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 700;
    gap: 0.35rem;
}

.map-legend-dot {
    border-radius: 999px;
    display: inline-block;
    height: 10px;
    width: 10px;
}

.map-legend-overdue {
    background: var(--danger);
}

.map-legend-to-plan {
    background: var(--warning);
}

.map-legend-completed {
    background: var(--success);
}

.map-empty-state {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    height: 100%;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.map-summary-grid {
    display: grid;
    gap: 0.75rem;
}

.map-summary-grid > div {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem;
}

.map-summary-number {
    color: var(--text-primary);
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.map-summary-label {
    color: var(--text-muted);
    display: block;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.map-sector-filter,
.map-zone-search {
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem;
}

.map-zone-search {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(56, 189, 248, 0.05));
    border-color: rgba(99, 102, 241, 0.24);
    padding: 1rem;
}

.map-control-heading {
    align-items: flex-start;
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.map-control-step {
    align-items: center;
    background: var(--accent);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 24px;
    font-size: 0.78rem;
    font-weight: 800;
    height: 24px;
    justify-content: center;
    line-height: 1;
    margin-top: 0.1rem;
    width: 24px;
}

.map-zone-search .btn-outline-primary {
    border-color: rgba(99, 102, 241, 0.32);
    color: var(--text-secondary);
    font-weight: 700;
}

.map-zone-search .btn-check:checked + .btn-outline-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.18);
}

.map-radius-presets {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(4, 1fr);
}

.map-radius-presets .btn {
    font-weight: 800;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.map-zone-status {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.7rem 0.8rem;
}

.client-map-marker {
    align-items: center;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
    color: #fff;
    display: flex;
    font-weight: 800;
    justify-content: center;
}

.client-map-marker span {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    width: 100%;
}

.map-marker-overdue {
    background: var(--danger);
}

.map-marker-to-plan {
    background: var(--warning);
}

.map-marker-completed {
    background: var(--success);
}

.map-popup {
    min-width: 240px;
}

.map-popup-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 0.15rem;
}

.map-popup-subtitle,
.map-popup-location,
.map-popup-count,
.map-machine-meta,
.map-popup-overflow {
    color: #475569;
    font-size: 0.78rem;
}

.map-popup ul {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.map-popup li {
    border-top: 1px solid #e5e7eb;
    padding: 0.4rem 0;
}

.map-machine-title {
    display: block;
    font-weight: 800;
}

.map-machine-meta {
    display: block;
}

.map-results-panel {
    border-color: rgba(79, 70, 229, 0.16);
}

.map-results-list {
    display: grid;
    gap: 0.9rem;
}

.map-results-accordion {
    display: grid;
    gap: 0.9rem;
}

.map-result-client-actions {
    align-items: center;
    background: rgba(99, 102, 241, 0.03);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.map-result-machines {
    display: grid;
}

.map-result-machine {
    align-items: center;
    border-top: 1px solid var(--border-color);
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(160px, 1fr) minmax(220px, auto);
    padding: 0.75rem 1rem;
}

.map-result-machine strong,
.map-result-machine span {
    display: block;
}

.map-result-machine span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.map-result-machine-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.map-result-action {
    align-items: center;
    display: inline-flex;
    gap: 0.3rem;
    text-decoration: none;
}

.map-result-machine.map-status-overdue {
    border-left: 4px solid var(--danger);
}

.map-result-machine.map-status-to-plan {
    border-left: 4px solid var(--warning);
}

.map-result-machine.map-status-completed {
    border-left: 4px solid var(--success);
}

@media (max-width: 768px) {
    .subcontract-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 1200px) {
    .sector-map-layout {
        grid-template-columns: 1fr;
    }

    .sector-map {
        height: 520px;
    }

    .map-result-machine {
        grid-template-columns: 1fr;
    }

    .map-result-machine-meta {
        justify-content: flex-start;
    }
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* Cartes statistiques filtrables */
.stat-card {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

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

.stat-card.active-filter {
    border-width: 2px !important;
}

.stat-card.active-filter[data-status="to_plan"] {
    border-color: var(--warning) !important;
    background-color: rgba(234, 179, 8, 0.08) !important;
}

.stat-card.active-filter[data-status="overdue"] {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
}

.stat-card.active-filter[data-status="completed"] {
    border-color: var(--success) !important;
    background-color: rgba(34, 197, 94, 0.08) !important;
}

/* Accordion Overrides */
.accordion-button:not(.collapsed) {
    background-color: rgba(99, 102, 241, 0.05);
    color: var(--text-primary);
    box-shadow: none;
}

.accordion-button {
    background-color: transparent;
    color: var(--text-primary);
    box-shadow: none;
    border: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.accordion-button::after {
    filter: var(--accordion-arrow-filter);
}

:root {
    --accordion-arrow-filter: none;
}

[data-bs-theme="dark"] {
    --accordion-arrow-filter: invert(1);
}

.dashboard-kpis .stat-card {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.64));
    border-radius: 22px;
    min-height: 138px;
    overflow: hidden;
    position: relative;
}

[data-bs-theme="dark"] .dashboard-kpis .stat-card {
    background:
        radial-gradient(circle at top right, rgba(129, 140, 248, 0.12), transparent 42%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.72));
}

.dashboard-kpis .stat-card::after {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.16), transparent);
    content: "";
    inset: auto 0 0 0;
    height: 3px;
    position: absolute;
}

.dashboard-workbench {
    border-radius: 24px;
    box-shadow: 0 18px 38px -24px rgba(15, 23, 42, 0.45), var(--shadow-sm);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 1rem;
    z-index: 1025;
}

.dashboard-filter-form > .col-12:last-child {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    margin-top: 0.25rem;
    padding-top: 0.95rem;
}

.filter-toolbar {
    align-items: center;
}

.filter-toolbar .btn-action {
    box-shadow: 0 8px 18px -14px rgba(15, 23, 42, 0.45);
}

.filter-toolbar-meta {
    border-top: 1px dashed rgba(148, 163, 184, 0.18);
    margin-top: 0.85rem !important;
    padding-top: 0.8rem;
}

#blg-freshness-indicator {
    align-items: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.09), rgba(56, 189, 248, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
}

[data-bs-theme="dark"] #blg-freshness-indicator {
    box-shadow: none;
}

#selection-summary {
    align-items: center;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    display: inline-flex;
    min-height: 38px;
    padding: 0.45rem 0.8rem;
}

.customer-accordion {
    display: grid;
    gap: 1rem;
}

.customer-group-card {
    border-color: rgba(99, 102, 241, 0.16);
    border-radius: 24px;
    overflow: hidden;
}

.customer-group-toggle {
    background:
        linear-gradient(180deg, rgba(79, 70, 229, 0.05), rgba(255, 255, 255, 0)) !important;
    padding: 1rem 1.35rem !important;
}

.customer-group .accordion-collapse {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.02), transparent 14%);
}

.customer-group-title {
    font-size: 1.02rem;
    letter-spacing: -0.01em;
}

.customer-group-badges {
    flex-wrap: wrap;
    gap: 0.45rem !important;
    justify-content: flex-end;
}

.machine-cell {
    min-width: 240px;
    position: relative;
}

.vgp-row[data-status="overdue"] .machine-cell,
.subcontract-row[data-status="overdue"] .machine-cell {
    box-shadow: inset 4px 0 0 rgba(239, 68, 68, 0.65);
}

.vgp-row[data-status="to_plan"] .machine-cell,
.subcontract-row[data-status="to_plan"] .machine-cell {
    box-shadow: inset 4px 0 0 rgba(234, 179, 8, 0.75);
}

.vgp-row[data-status="completed"] .machine-cell,
.subcontract-row[data-status="completed"] .machine-cell {
    box-shadow: inset 4px 0 0 rgba(34, 197, 94, 0.65);
}

.machine-note-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.machine-table thead th,
.subcontract-machine-table thead th {
    background-color: rgba(99, 102, 241, 0.08);
    box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

.machine-table tbody tr:nth-child(2n) td,
.subcontract-machine-table tbody tr:nth-child(2n) td {
    background-color: rgba(99, 102, 241, 0.018);
}

.machine-table tbody tr.row-selected td,
.subcontract-machine-table tbody tr.row-selected td {
    background-color: rgba(79, 70, 229, 0.11);
    box-shadow: inset 0 1px 0 rgba(99, 102, 241, 0.14), inset 0 -1px 0 rgba(99, 102, 241, 0.14);
}

.machine-table td,
.subcontract-machine-table td {
    vertical-align: top;
}

.machine-cell .fw-bold {
    font-size: 0.97rem;
    line-height: 1.15;
}

.machine-cell > .small.text-muted {
    display: block;
    font-size: 0.82rem;
    margin-top: 0.12rem;
}

.machine-meta {
    grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
    gap: 0.45rem 0.55rem;
    margin-top: 0.65rem !important;
}

.machine-meta span {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.32rem 0.58rem;
}

[data-bs-theme="dark"] .machine-meta span {
    background: rgba(148, 163, 184, 0.08);
}

.machine-note-flags .badge-custom {
    font-size: 0.7rem;
    padding: 0.38em 0.72em;
}

.rental-cell {
    min-width: 190px;
}

.rental-cell .small {
    line-height: 1.25;
}

.action-dropdown .dropdown-toggle {
    min-width: 94px;
}

.note-text-prewrap {
    white-space: pre-wrap;
    word-break: break-word;
}

.selection-action-bar[hidden] {
    display: none !important;
}

.selection-action-bar {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 20px;
    bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    left: calc(var(--sidebar-width) + 1.5rem);
    padding: 1rem 1.1rem;
    position: fixed;
    right: 1.5rem;
    z-index: 1040;
}

[data-bs-theme="dark"] .selection-action-bar {
    background: rgba(9, 13, 22, 0.9);
}

html.sidebar-collapsed .selection-action-bar {
    left: calc(var(--sidebar-collapsed-width) + 1.5rem);
}

body.has-selection-action-bar {
    padding-bottom: 8rem;
}

.selection-action-summary {
    display: grid;
    gap: 0.2rem;
    min-width: 220px;
}

.selection-action-summary strong {
    font-size: 1rem;
}

.selection-action-summary span {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.selection-action-buttons {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
}

.selection-action-buttons .dropdown-menu {
    min-width: 240px;
}

.action-confirm-summary,
.note-editor-context,
.client-note-card,
.client-kpi-card,
.journal-section {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
}

.action-confirm-summary {
    display: grid;
    gap: 0.65rem;
}

.action-confirm-line {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.action-confirm-line strong {
    color: var(--text-primary);
}

.action-confirm-line ul {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
}

.client-journal-accordion {
    display: grid;
    gap: 1rem;
}

.client-journal-group {
    border-color: rgba(14, 165, 233, 0.16);
}

.client-journal-summary-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
}

.client-note-card,
.client-kpi-card {
    height: 100%;
}

.client-note-body {
    color: var(--text-secondary);
}

.client-kpi-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.journal-section {
    padding: 1rem;
}

.journal-table th {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.client-history-list {
    display: grid;
    gap: 0.75rem;
}

.client-history-item {
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: grid;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
}

[data-bs-theme="dark"] .client-history-item {
    background: rgba(15, 23, 42, 0.28);
}

.client-history-meta {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: space-between;
}

.client-history-meta span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.client-history-body {
    display: grid;
    gap: 0.35rem;
}

.mobile-action-trigger {
    display: none;
}

.mobile-action-sheet .offcanvas-body {
    padding-top: 0;
}

.mobile-action-sheet-body {
    display: grid;
    gap: 0.75rem;
}

.mobile-action-sheet-body .dropdown-divider {
    margin: 0.15rem 0;
}

.mobile-action-sheet-body .dropdown-item {
    align-items: center;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    gap: 0.55rem;
    justify-content: flex-start;
    padding: 0.95rem 1rem;
    width: 100%;
}

.mobile-action-sheet-body form {
    margin: 0;
}

html.dashboard-compact .dashboard-header {
    margin-bottom: 1rem;
    padding: 1.15rem 0;
}

html.dashboard-compact .dashboard-header p {
    display: none;
}

html.dashboard-compact .dashboard-kpis {
    margin-bottom: 1rem !important;
}

html.dashboard-compact .dashboard-kpis .stat-card {
    border-radius: 18px;
    min-height: 92px;
    padding: 0.9rem 1rem;
}

html.dashboard-compact .dashboard-kpis .stat-card > div:last-child {
    border-radius: 16px !important;
    font-size: 1.45rem !important;
    padding: 0.8rem !important;
}

html.dashboard-compact .stat-number {
    font-size: 1.85rem;
}

html.dashboard-compact .stat-label {
    font-size: 0.76rem;
}

html.dashboard-compact .dashboard-workbench {
    border-radius: 18px;
    margin-bottom: 1rem;
    top: 0.6rem;
}

html.dashboard-compact .filter-bar {
    padding: 0.9rem;
}

html.dashboard-compact .workbench-sticky-bar {
    gap: 0.55rem;
}

html.dashboard-compact .workbench-toggle {
    min-height: 40px;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

html.dashboard-compact .workbench-mini-chip {
    font-size: 0.72rem;
    padding: 0.45rem 0.7rem;
}

html.dashboard-compact .dashboard-filter-form {
    --bs-gutter-x: 0.7rem;
    --bs-gutter-y: 0.6rem;
}

html.dashboard-compact .filter-bar .form-label {
    font-size: 0.7rem;
    margin-bottom: 0.18rem;
}

html.dashboard-compact .filter-bar .form-control,
html.dashboard-compact .filter-bar .form-select {
    border-radius: 9px;
    font-size: 0.8rem;
    min-height: 38px;
    padding-bottom: 0.45rem;
    padding-top: 0.45rem;
}

html.dashboard-compact .filter-toolbar .btn-action {
    font-size: 0.76rem;
    gap: 0.38rem;
    padding: 0.4rem 0.7rem;
}

html.dashboard-compact #blg-freshness-indicator,
html.dashboard-compact #selection-summary {
    font-size: 0.72rem;
    min-height: 32px;
    padding: 0.32rem 0.62rem;
}

html.dashboard-compact .glass-card {
    border-radius: 16px;
}

html.dashboard-compact .customer-accordion {
    gap: 0.7rem;
}

html.dashboard-compact .customer-group-card,
html.dashboard-compact .subcontract-group,
html.dashboard-compact .client-journal-group {
    border-radius: 18px;
}

html.dashboard-compact .customer-group-toggle,
html.dashboard-compact .subcontract-group .accordion-button {
    padding: 0.72rem 0.9rem !important;
}

html.dashboard-compact .customer-group-title {
    font-size: 0.9rem;
}

html.dashboard-compact .customer-group-badges {
    gap: 0.32rem !important;
}

html.dashboard-compact .customer-group-badges .badge,
html.dashboard-compact .subcontract-group .badge {
    font-size: 0.68rem;
    padding: 0.32rem 0.5rem;
}

html.dashboard-compact .custom-table th,
html.dashboard-compact .custom-table td {
    font-size: 0.79rem;
    padding: 0.42rem 0.5rem;
}

html.dashboard-compact .custom-table th {
    letter-spacing: 0.03em;
}

html.dashboard-compact .machine-table th:last-child,
html.dashboard-compact .machine-table td:last-child,
html.dashboard-compact .subcontract-machine-table th:last-child,
html.dashboard-compact .subcontract-machine-table td:last-child {
    min-width: 118px;
    width: 118px;
}

html.dashboard-compact .machine-cell {
    min-width: 210px;
}

html.dashboard-compact .machine-cell .fw-bold,
html.dashboard-compact .machine-cell > .small.text-muted {
    display: inline;
    font-size: 0.82rem;
    line-height: 1.1;
}

html.dashboard-compact .machine-cell > .small.text-muted::before {
    color: var(--text-muted);
    content: "· ";
    margin-left: 0.22rem;
}

html.dashboard-compact .machine-meta {
    display: none;
}

html.dashboard-compact .machine-note-flags {
    gap: 0.24rem;
    margin-top: 0.28rem !important;
}

html.dashboard-compact .machine-note-flags .badge-custom {
    font-size: 0;
    justify-content: center;
    min-width: 1.55rem;
    padding: 0.34rem;
}

html.dashboard-compact .machine-note-flags .badge-custom i {
    font-size: 0.72rem;
    margin: 0;
}

html.dashboard-compact .machine-link,
html.dashboard-compact code {
    font-size: 0.78rem;
}

html.dashboard-compact .rental-cell {
    min-width: 110px;
}

html.dashboard-compact .rental-cell .small,
html.dashboard-compact .rental-cell .fw-bold.mt-1,
html.dashboard-compact .rental-cell .text-muted {
    display: none;
}

html.dashboard-compact .rental-cell .badge-custom {
    font-size: 0.67rem;
    padding: 0.28rem 0.5rem;
}

html.dashboard-compact .action-dropdown .dropdown-toggle {
    font-size: 0.75rem;
    min-width: 102px;
    padding: 0.35rem 0.65rem;
    width: auto;
}

html.dashboard-compact .journal-table .btn {
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
}

@media (max-width: 991.98px) {
    .dashboard-workbench {
        position: static;
    }

    .customer-group-toggle,
    .subcontract-group .accordion-button {
        align-items: flex-start !important;
        flex-wrap: wrap;
    }

    .customer-group-title {
        max-width: none !important;
        width: 100%;
    }

    .customer-group-badges {
        justify-content: flex-start;
        margin-right: 0 !important;
    }

    .desktop-action-menu {
        display: none !important;
    }

    .mobile-action-trigger {
        align-items: center;
        border-radius: 12px;
        display: inline-flex !important;
        height: 38px;
        justify-content: center;
        padding: 0;
        width: 42px;
    }

    .selection-action-bar {
        align-items: stretch;
        flex-direction: column;
        left: 1rem;
        right: 1rem;
    }

    .selection-action-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .selection-action-buttons .btn,
    .selection-action-buttons .dropdown,
    .selection-action-buttons .dropdown .btn {
        width: 100%;
    }

    .client-journal-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .selection-action-buttons {
        grid-template-columns: 1fr;
    }

    .client-history-meta {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
        padding-left: 0;
    }

    nav,
    .dashboard-sidebar,
    .dashboard-header,
    .filter-bar,
    .stat-card,
    .banned-panel,
    .selection-action-bar,
    .mobile-action-trigger,
    .mobile-action-sheet,
    .row-actions,
    .select-column,
    .custom-table th:last-child,
    .custom-table td:last-child {
        display: none !important;
    }

    main.container-fluid {
        padding: 0 !important;
    }

    .glass-card {
        border: none;
        box-shadow: none;
        padding: 0;
        break-inside: avoid;
    }

    .accordion-collapse {
        display: block !important;
    }

    .custom-table th,
    .custom-table td {
        padding: 0.45rem;
        font-size: 11px;
    }
}

/* Refonte visuelle 2026 */
:root {
    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'IBM Plex Mono', "SFMono-Regular", ui-monospace, monospace;
    --sidebar-width: 292px;
    --sidebar-collapsed-width: 94px;
    --bg-app: #f2ece2;
    --bg-card: rgba(255, 249, 240, 0.78);
    --bg-card-hover: rgba(255, 252, 247, 0.92);
    --border-color: rgba(34, 53, 82, 0.12);
    --text-primary: #14263f;
    --text-secondary: #39506f;
    --text-muted: #6b7d93;
    --accent: #c65d2e;
    --accent-glow: rgba(198, 93, 46, 0.16);
    --accent-strong: #a6481f;
    --accent-cool: #0f766e;
    --success: #207a49;
    --warning: #b8691f;
    --danger: #c43d34;
    --shadow-sm: 0 18px 40px -32px rgba(16, 31, 52, 0.42);
    --shadow-md: 0 36px 80px -46px rgba(16, 31, 52, 0.34);
    --shadow-lg: 0 54px 110px -54px rgba(16, 31, 52, 0.42);
    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
    --bs-emphasis-color: var(--text-primary);
    --bs-secondary-color: var(--text-secondary);
    --bs-tertiary-bg: rgba(255, 250, 244, 0.72);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 198, 93, 46;
    --bs-success: var(--success);
    --bs-warning: var(--warning);
    --bs-danger: var(--danger);
    --bs-border-color: var(--border-color);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent-strong);
    --bs-card-bg: var(--bg-card);
    --bs-modal-bg: var(--bg-card);
    --bs-dropdown-bg: var(--bg-card);
}

[data-bs-theme="dark"] {
    --bg-app: #0b1320;
    --bg-card: rgba(12, 22, 38, 0.78);
    --bg-card-hover: rgba(18, 31, 51, 0.92);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #edf3fb;
    --text-secondary: #c8d5e3;
    --text-muted: #8fa1b7;
    --accent: #e07a3f;
    --accent-glow: rgba(224, 122, 63, 0.18);
    --accent-strong: #ff9d61;
    --accent-cool: #4dc3b5;
    --success: #4cb36d;
    --warning: #e3a44d;
    --danger: #ef6f66;
    --shadow-sm: 0 18px 40px -30px rgba(0, 0, 0, 0.55);
    --shadow-md: 0 36px 80px -42px rgba(0, 0, 0, 0.62);
    --shadow-lg: 0 60px 120px -56px rgba(0, 0, 0, 0.72);
    --bs-primary-rgb: 224, 122, 63;
    --bs-link-color: #ffb686;
    --bs-link-hover-color: #ffd2b0;
}

body {
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    isolation: isolate;
    letter-spacing: -0.01em;
}

body::before,
body::after {
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
    z-index: -2;
}

body::before {
    background:
        radial-gradient(circle at top left, rgba(198, 93, 46, 0.16), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(15, 118, 110, 0.12), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 42%);
}

body::after {
    background-image:
        linear-gradient(rgba(20, 38, 63, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 38, 63, 0.04) 1px, transparent 1px);
    background-position: center center;
    background-size: 24px 24px;
    opacity: 0.45;
    z-index: -1;
}

h1,
h2,
h3,
h4,
h5,
h6,
.display-6,
.navbar-brand,
.dashboard-hero-title,
.workbench-title,
.section-title,
.app-title {
    font-family: var(--font-display);
    letter-spacing: -0.04em;
}

code,
pre,
.machine-link code {
    font-family: var(--font-mono);
}

.glass-card,
.card,
.modal-content,
.dropdown-menu,
.list-group-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    box-shadow: var(--shadow-md);
}

.glass-card,
.card,
.modal-content {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.glass-card:hover {
    border-color: rgba(198, 93, 46, 0.22);
    box-shadow: var(--shadow-lg);
}

.dashboard-header {
    background: transparent;
    border-bottom: none;
    margin-bottom: 1.5rem;
    padding: 2rem 0 1.2rem;
}

.dashboard-hero {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.42), transparent 34%),
        linear-gradient(135deg, rgba(198, 93, 46, 0.12), rgba(15, 118, 110, 0.1) 58%, rgba(255, 255, 255, 0.12));
    border-radius: 32px;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
    overflow: hidden;
    padding: clamp(1.5rem, 3vw, 2.3rem);
    position: relative;
}

.dashboard-hero.glass-card:hover {
    transform: none;
}

.dashboard-hero::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), transparent);
    content: "";
    height: 1px;
    inset: 0 0 auto;
    position: absolute;
}

.dashboard-hero-copy,
.dashboard-hero-panel {
    position: relative;
    z-index: 1;
}

.hero-kicker,
.workbench-kicker,
.section-kicker,
.login-eyebrow,
.login-form-kicker,
.hero-panel-label {
    color: var(--text-muted);
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.dashboard-hero-title {
    font-size: clamp(2.3rem, 5vw, 3.7rem);
    line-height: 0.95;
    margin: 0.55rem 0 0.85rem;
    max-width: 12ch;
}

.gradient-text {
    background: linear-gradient(135deg, #c65d2e 0%, #ff9c5a 42%, #0f766e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-bs-theme="dark"] .gradient-text {
    background: linear-gradient(135deg, #ffb177 0%, #ffd0ad 40%, #6ce4d2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-hero-text,
.workbench-text,
.hero-panel-copy,
.login-hero-copy {
    color: var(--text-secondary);
    margin: 0;
}

.dashboard-hero-text {
    font-size: 1.03rem;
    max-width: 64ch;
}

.hero-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.hero-chip {
    align-items: center;
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.68rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.hero-chip i {
    color: var(--accent-cool);
}

.hero-chip-danger {
    background: rgba(196, 61, 52, 0.08);
    border-color: rgba(196, 61, 52, 0.14);
    color: var(--danger);
}

.hero-chip-danger i {
    color: inherit;
}

[data-bs-theme="dark"] .hero-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.dashboard-hero-panel {
    background: linear-gradient(180deg, rgba(20, 38, 63, 0.08), rgba(255, 255, 255, 0.18));
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 26px;
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
}

[data-bs-theme="dark"] .dashboard-hero-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border-color: rgba(255, 255, 255, 0.07);
}

.hero-panel-period {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3vw, 1.75rem);
    line-height: 1.02;
}

.hero-panel-grid,
.workbench-stats {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-panel-item,
.workbench-stats > div {
    background: rgba(255, 255, 255, 0.44);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 18px;
    display: grid;
    gap: 0.15rem;
    padding: 0.85rem 0.95rem;
}

[data-bs-theme="dark"] .hero-panel-item,
[data-bs-theme="dark"] .workbench-stats > div {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
}

.hero-panel-item span,
.workbench-stats span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-panel-item strong,
.workbench-stats strong {
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 1;
}

.workbench-stats {
    gap: 0.6rem;
    grid-template-columns: repeat(3, minmax(88px, 1fr));
}

.workbench-stats > div {
    border-radius: 16px;
    padding: 0.55rem 0.72rem;
}

.workbench-stats span {
    font-size: 0.66rem;
    letter-spacing: 0.1em;
}

.workbench-stats strong {
    font-size: 1.15rem;
}

.dashboard-kpis {
    margin-bottom: 1.5rem !important;
}

.dashboard-kpis .stat-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 252, 247, 0.64)),
        linear-gradient(135deg, rgba(198, 93, 46, 0.12), rgba(15, 118, 110, 0.08));
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 28px;
    min-height: 156px;
    overflow: hidden;
    padding: 1.45rem;
    position: relative;
}

[data-bs-theme="dark"] .dashboard-kpis .stat-card {
    background:
        linear-gradient(180deg, rgba(17, 30, 49, 0.94), rgba(10, 21, 37, 0.82)),
        linear-gradient(135deg, rgba(224, 122, 63, 0.1), rgba(77, 195, 181, 0.08));
    border-color: rgba(255, 255, 255, 0.07);
}

.dashboard-kpis .stat-card::after {
    background: linear-gradient(90deg, rgba(198, 93, 46, 0.65), rgba(15, 118, 110, 0.42));
    height: 4px;
}

.dashboard-kpis .stat-card > div:last-child {
    align-items: center;
    background: rgba(20, 38, 63, 0.06) !important;
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 22px !important;
    display: inline-flex;
    justify-content: center;
    min-height: 72px;
    min-width: 72px;
}

[data-bs-theme="dark"] .dashboard-kpis .stat-card > div:last-child {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.07);
}

.stat-number {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 4vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.05em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.filter-bar,
.dashboard-workbench {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.52)),
        linear-gradient(135deg, rgba(198, 93, 46, 0.07), rgba(15, 118, 110, 0.06));
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 28px;
    box-shadow: var(--shadow-md);
}

[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .dashboard-workbench {
    background:
        linear-gradient(180deg, rgba(16, 27, 44, 0.92), rgba(12, 22, 38, 0.84)),
        linear-gradient(135deg, rgba(224, 122, 63, 0.08), rgba(77, 195, 181, 0.05));
    border-color: rgba(255, 255, 255, 0.07);
}

.dashboard-workbench {
    padding: 1rem 1.1rem 1.1rem;
    position: static;
    z-index: 1030;
}

.dashboard-workbench.is-collapsed {
    margin-bottom: 1rem;
    position: sticky;
    top: 0.85rem;
}

.workbench-sticky-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
}

.workbench-toggle {
    align-items: center;
    display: inline-flex;
    gap: 0.65rem;
    min-height: 46px;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
}

.workbench-toggle-chevron {
    font-size: 0.78rem;
    transition: transform 0.2s ease;
}

.dashboard-workbench.is-open .workbench-toggle-chevron {
    transform: rotate(180deg);
}

.workbench-mini-summary {
    align-items: center;
    display: flex;
    flex: 1 1 320px;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
}

.workbench-mini-chip {
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-flex;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.6rem 0.8rem;
}

.workbench-mini-chip i {
    color: var(--accent-cool);
}

.workbench-mini-chip-danger {
    background: rgba(196, 61, 52, 0.08);
    border-color: rgba(196, 61, 52, 0.14);
    color: var(--danger);
}

.workbench-mini-chip-danger i {
    color: inherit;
}

[data-bs-theme="dark"] .workbench-mini-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.workbench-panel {
    margin-top: 0.95rem;
}

.dashboard-workbench.is-collapsed .workbench-panel {
    display: none;
}

.dashboard-workbench.is-collapsed .workbench-sticky-bar {
    margin-bottom: 0;
}

.workbench-heading {
    align-items: center;
    border-bottom: 1px solid rgba(20, 38, 63, 0.08);
    column-gap: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 0.9rem;
    padding-bottom: 0.8rem;
    row-gap: 0.75rem;
}

[data-bs-theme="dark"] .workbench-heading {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.workbench-heading > div:first-child {
    display: grid;
    gap: 0.16rem;
}

.workbench-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
}

.workbench-title {
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1;
    margin: 0.05rem 0 0.12rem;
}

.workbench-text {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.4;
    max-width: 50ch;
}

.dashboard-filter-form {
    --bs-gutter-x: 0.9rem;
    --bs-gutter-y: 0.8rem;
}

.filter-bar .input-group {
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
    padding: 0 0.4rem;
}

[data-bs-theme="dark"] .filter-bar .input-group {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.filter-bar .input-group .input-group-text,
.filter-bar .input-group .form-control {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.form-select,
.form-control {
    background-color: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 16px;
    color: var(--text-primary);
    min-height: 48px;
    padding: 0.72rem 0.95rem;
}

[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.form-select:focus,
.form-control:focus {
    background-color: var(--bg-card-hover);
    border-color: rgba(198, 93, 46, 0.48);
    box-shadow: 0 0 0 4px rgba(198, 93, 46, 0.12);
}

.dashboard-filter-form > .col-12:last-child {
    border-top: 1px solid rgba(20, 38, 63, 0.08);
    margin-top: 0.15rem;
    padding-top: 0.8rem;
}

[data-bs-theme="dark"] .dashboard-filter-form > .col-12:last-child {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.filter-toolbar-meta {
    border-top-style: solid;
    border-top-color: rgba(20, 38, 63, 0.08);
}

[data-bs-theme="dark"] .filter-toolbar-meta {
    border-top-color: rgba(255, 255, 255, 0.08);
}

#blg-freshness-indicator,
#selection-summary {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 999px;
}

[data-bs-theme="dark"] #blg-freshness-indicator,
[data-bs-theme="dark"] #selection-summary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.dashboard-sidebar {
    background: linear-gradient(180deg, #0a1322 0%, #101a2c 48%, #0b1423 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 16px 0 48px rgba(8, 14, 24, 0.24);
    padding: 1.35rem 1rem;
}

.sidebar-logo {
    background: linear-gradient(135deg, rgba(198, 93, 46, 0.4), rgba(15, 118, 110, 0.3));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.sidebar-brand-text strong {
    font-family: var(--font-display);
    font-size: 1.08rem;
}

.dashboard-tabs .nav-link,
.sidebar-link {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    min-height: 52px;
    padding: 0.78rem 0.85rem;
}

.dashboard-tabs .nav-link:hover,
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-nav-main i,
.sidebar-link i {
    color: #ffb177;
}

.dashboard-tabs .nav-link.active {
    background: linear-gradient(135deg, rgba(198, 93, 46, 0.28), rgba(15, 118, 110, 0.2));
    border-color: rgba(255, 177, 119, 0.28);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
    transform: translateX(6px);
}

.dashboard-tabs .nav-link.active::before {
    background: linear-gradient(180deg, #ffb177, #5fe1d2);
    box-shadow: 0 0 16px rgba(255, 177, 119, 0.4);
}

.dashboard-tabs .nav-link.active i {
    color: #fff3eb;
}

.sidebar-count {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-custom {
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 0.48em 0.84em;
}

.badge-success {
    background-color: rgba(32, 122, 73, 0.1);
    border-color: rgba(32, 122, 73, 0.18);
    color: var(--success);
}

.badge-warning {
    background-color: rgba(184, 105, 31, 0.1);
    border-color: rgba(184, 105, 31, 0.18);
    color: var(--warning);
}

.badge-danger {
    background-color: rgba(196, 61, 52, 0.1);
    border-color: rgba(196, 61, 52, 0.18);
    color: var(--danger);
}

.badge-info {
    background-color: rgba(15, 118, 110, 0.1);
    border-color: rgba(15, 118, 110, 0.18);
    color: var(--accent-cool);
}

.badge-neutral {
    background-color: rgba(20, 38, 63, 0.06);
    border-color: rgba(20, 38, 63, 0.1);
    color: var(--text-secondary);
}

[data-bs-theme="dark"] .badge-neutral {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn,
.btn-action {
    border-radius: 16px;
    font-weight: 700;
}

.btn-primary,
.btn-primary-custom,
.btn-submit {
    background: linear-gradient(135deg, #d9773f 0%, #c65d2e 58%, #0f766e 100%);
    border: none;
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary-custom:hover,
.btn-submit:hover {
    background: linear-gradient(135deg, #ca6e3a 0%, #b45023 58%, #0d6a63 100%);
    box-shadow: 0 16px 30px -20px rgba(198, 93, 46, 0.9);
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary,
.btn-secondary-custom {
    background-color: rgba(20, 38, 63, 0.05);
    border: 1px solid rgba(20, 38, 63, 0.08);
    color: var(--text-secondary);
}

[data-bs-theme="dark"] .btn-secondary,
[data-bs-theme="dark"] .btn-secondary-custom {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary-custom:hover {
    background-color: rgba(20, 38, 63, 0.1);
    color: var(--text-primary);
}

[data-bs-theme="dark"] .btn-secondary:hover,
[data-bs-theme="dark"] .btn-secondary:focus,
[data-bs-theme="dark"] .btn-secondary-custom:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-danger-soft {
    background-color: rgba(196, 61, 52, 0.1);
    border-color: rgba(196, 61, 52, 0.18);
    color: var(--danger);
}

.dashboard-section-heading {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0 0.15rem;
}

.section-title {
    font-size: clamp(1.35rem, 2.8vw, 1.85rem);
    margin: 0.32rem 0 0;
}

.section-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.customer-group-card,
.subcontract-group,
.client-journal-group,
.map-results-panel,
.sector-map-card,
.sector-map-side {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5)),
        linear-gradient(135deg, rgba(198, 93, 46, 0.04), rgba(15, 118, 110, 0.04));
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 28px;
}

[data-bs-theme="dark"] .customer-group-card,
[data-bs-theme="dark"] .subcontract-group,
[data-bs-theme="dark"] .client-journal-group,
[data-bs-theme="dark"] .map-results-panel,
[data-bs-theme="dark"] .sector-map-card,
[data-bs-theme="dark"] .sector-map-side {
    background:
        linear-gradient(180deg, rgba(14, 24, 40, 0.92), rgba(10, 20, 35, 0.82)),
        linear-gradient(135deg, rgba(224, 122, 63, 0.05), rgba(77, 195, 181, 0.04));
    border-color: rgba(255, 255, 255, 0.07);
}

.customer-group-toggle,
.subcontract-group .accordion-button {
    padding: 1rem 1.25rem !important;
}

.table-responsive {
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 22px;
    overflow: visible;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

[data-bs-theme="dark"] .table-responsive {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: none;
}

.custom-table th {
    background-color: rgba(20, 38, 63, 0.05);
    color: var(--text-muted);
    font-size: 0.71rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.custom-table td {
    border-bottom-color: rgba(20, 38, 63, 0.08);
    padding: 0.95rem 1.05rem;
}

[data-bs-theme="dark"] .custom-table td {
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

.custom-table tbody tr:hover td {
    background-color: rgba(15, 118, 110, 0.04);
}

.machine-meta span {
    background: rgba(20, 38, 63, 0.04);
    border: 1px solid rgba(20, 38, 63, 0.08);
}

[data-bs-theme="dark"] .machine-meta span {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.machine-link,
.planning-link {
    color: var(--accent);
}

.selection-action-bar {
    background: rgba(255, 248, 239, 0.88);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

[data-bs-theme="dark"] .selection-action-bar {
    background: rgba(11, 19, 32, 0.88);
    border-color: rgba(255, 255, 255, 0.07);
}

.client-history-item,
.action-confirm-summary,
.note-editor-context,
.client-note-card,
.client-kpi-card,
.journal-section,
.map-zone-search,
.map-sector-filter {
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 20px;
}

[data-bs-theme="dark"] .client-history-item,
[data-bs-theme="dark"] .action-confirm-summary,
[data-bs-theme="dark"] .note-editor-context,
[data-bs-theme="dark"] .client-note-card,
[data-bs-theme="dark"] .client-kpi-card,
[data-bs-theme="dark"] .journal-section,
[data-bs-theme="dark"] .map-zone-search,
[data-bs-theme="dark"] .map-sector-filter {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
}

.map-zone-search {
    background:
        linear-gradient(135deg, rgba(198, 93, 46, 0.08), rgba(15, 118, 110, 0.08)),
        rgba(255, 255, 255, 0.46);
}

.map-summary-grid > div,
.map-zone-status {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(20, 38, 63, 0.08);
    border-radius: 18px;
}

[data-bs-theme="dark"] .map-summary-grid > div,
[data-bs-theme="dark"] .map-zone-status {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.07);
}

.action-dropdown .dropdown-menu,
.dropdown-menu-portal,
.mobile-action-sheet-body .dropdown-item,
.modal-content,
.offcanvas {
    border-radius: 24px;
}

.modal-content,
.offcanvas {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.navbar {
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
    margin: 1rem 1rem 0;
}

.navbar.bg-body-tertiary {
    background: rgba(255, 249, 241, 0.78) !important;
}

[data-bs-theme="dark"] .navbar.bg-body-tertiary {
    background: rgba(12, 22, 38, 0.78) !important;
}

body.login-screen {
    display: block;
    min-height: 100vh;
    padding: 1rem;
}

body.login-screen::before {
    background:
        radial-gradient(circle at top left, rgba(224, 122, 63, 0.26), transparent 32%),
        radial-gradient(circle at 82% 14%, rgba(77, 195, 181, 0.18), transparent 26%),
        linear-gradient(135deg, #09111d 0%, #10182a 52%, #0f1e2d 100%);
}

body.login-screen::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    opacity: 0.28;
}

.login-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr);
    min-height: calc(100vh - 2rem);
}

.login-showcase,
.login-card {
    overflow: hidden;
    position: relative;
}

.login-showcase {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.12), transparent 28%),
        linear-gradient(135deg, rgba(224, 122, 63, 0.2), rgba(14, 26, 43, 0.72) 42%, rgba(77, 195, 181, 0.18) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    color: #f5f8fc;
    display: flex;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.login-showcase-inner {
    display: grid;
    gap: 1rem;
    max-width: 680px;
}

.login-hero-title {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(2.7rem, 6vw, 4.9rem);
    letter-spacing: -0.06em;
    line-height: 0.92;
    margin: 0;
    max-width: 10ch;
}

.login-hero-copy {
    color: rgba(230, 238, 248, 0.82);
    font-size: 1.02rem;
    max-width: 56ch;
}

.login-showcase-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: auto;
}

.login-showcase-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    display: grid;
    gap: 0.4rem;
    padding: 1rem;
}

.login-showcase-card i {
    color: #ffb177;
    font-size: 1.1rem;
}

.login-showcase-card strong {
    font-family: var(--font-display);
    font-size: 1rem;
}

.login-showcase-card span {
    color: rgba(230, 238, 248, 0.72);
    font-size: 0.88rem;
}

.login-card {
    align-self: center;
    background: rgba(11, 19, 32, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px;
    color: #eef3fb;
    margin-left: auto;
    max-width: 460px;
    padding: 2.2rem;
    width: 100%;
}

.logo-container {
    margin-bottom: 1.35rem;
    text-align: left;
}

.logo-img {
    max-height: 42px;
}

.login-form-kicker {
    margin-bottom: 0.7rem;
}

.app-title {
    background: none;
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.45rem;
    text-align: left;
    -webkit-text-fill-color: initial;
}

.app-subtitle {
    color: rgba(226, 236, 247, 0.74);
    font-size: 0.95rem;
    margin-bottom: 1.8rem;
    text-align: left;
}

.login-card .form-label {
    color: rgba(226, 236, 247, 0.82);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f5f8fc;
    min-height: 52px;
}

.login-card .form-control::placeholder {
    color: rgba(226, 236, 247, 0.42);
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 177, 119, 0.4);
    box-shadow: 0 0 0 4px rgba(224, 122, 63, 0.14);
    color: #fff;
}

.btn-submit {
    border-radius: 18px;
    min-height: 52px;
}

.alert-custom {
    background: rgba(196, 61, 52, 0.16);
    border: 1px solid rgba(239, 111, 102, 0.28);
    border-radius: 18px;
    color: #ffc2bd;
    margin-bottom: 1.4rem;
    padding: 0.85rem 1rem;
}

@media (max-width: 1200px) {
    .dashboard-hero,
    .admin-hero,
    .login-layout {
        grid-template-columns: 1fr;
    }

    .workbench-heading {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }

    .workbench-stats,
    .hero-panel-grid {
        width: 100%;
    }

    .workbench-text {
        max-width: none;
    }

    .workbench-mini-summary {
        justify-content: flex-start;
    }

    .login-card {
        margin-left: 0;
        max-width: none;
    }
}

@media (max-width: 991.98px) {
    .dashboard-header {
        padding-top: 1.2rem;
    }

    .dashboard-hero,
    .admin-hero,
    .dashboard-workbench,
    .filter-bar {
        border-radius: 26px;
    }

    .dashboard-workbench.is-collapsed {
        position: static;
    }

    .dashboard-sidebar {
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 24px;
        margin: 0 0 1.25rem;
        padding: 0.95rem;
    }

    .dashboard-tabs .nav-item {
        min-width: 220px;
    }

    .navbar {
        margin: 0.9rem 0.9rem 0;
    }
}

@media (max-width: 768px) {
    body.login-screen {
        padding: 0.75rem;
    }

    .login-layout {
        min-height: calc(100vh - 1.5rem);
    }

    .login-showcase,
    .login-card,
    .dashboard-hero,
    .admin-hero,
    .filter-bar,
    .dashboard-workbench,
    .customer-group-card,
    .subcontract-group,
    .client-journal-group {
        border-radius: 24px;
    }

    .hero-chip-row,
    .section-meta {
        justify-content: flex-start;
    }

    .hero-chip {
        width: 100%;
    }

    .workbench-sticky-bar,
    .workbench-mini-summary {
        justify-content: flex-start;
    }

    .workbench-toggle {
        width: 100%;
    }

    .hero-panel-grid,
    .login-showcase-grid {
        grid-template-columns: 1fr;
    }

    .workbench-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-filter-form {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.7rem;
    }

    .dashboard-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-hero-title,
    .login-hero-title {
        max-width: none;
    }

    .app-title {
        font-size: 1.75rem;
    }

    .navbar {
        border-radius: 18px;
        margin: 0.75rem 0.75rem 0;
    }
}

@media (max-width: 575.98px) {
    .workbench-mini-summary {
        flex-direction: column;
        width: 100%;
    }

    .workbench-mini-chip {
        width: 100%;
    }

    .workbench-stats {
        grid-template-columns: 1fr;
    }

    .workbench-stats > div {
        width: 100%;
    }
}
/* Import global d'un rapport de contrôle PDF */
.global-pdf-import-button {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1025;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 0.85rem 2rem rgba(15, 61, 104, 0.28);
}

.global-pdf-import-button:focus-visible {
    outline: 3px solid rgba(13, 110, 253, 0.3);
    outline-offset: 3px;
}

#blg-pdf-analysis-status[data-state="loading"] i {
    animation: fa-spin 1s linear infinite;
}

@media (max-width: 575.98px) {
    .global-pdf-import-button {
        right: 0.8rem;
        bottom: 0.8rem;
        padding: 0.8rem;
    }

    .global-pdf-import-button span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Navigation mobile : la sidebar est placée après le contenu dans le DOM.
   Elle devient donc un panneau ouvrable pour rester atteignable à tout moment. */
.mobile-dashboard-menu-toggle,
.sidebar-mobile-close,
.mobile-dashboard-menu-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-dashboard-menu-toggle {
        align-items: center;
        background: #0f1828;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 999px;
        box-shadow: 0 0.7rem 1.8rem rgba(15, 23, 42, 0.24);
        color: #fff;
        display: inline-flex;
        font-weight: 800;
        gap: 0.5rem;
        left: 1rem;
        padding: 0.72rem 0.95rem;
        position: fixed;
        top: 1rem;
        z-index: 1075;
    }

    .mobile-dashboard-menu-backdrop {
        background: rgba(15, 23, 42, 0.48);
        border: 0;
        bottom: 0;
        display: block;
        left: 0;
        opacity: 0;
        pointer-events: none;
        position: fixed;
        right: 0;
        top: 0;
        transition: opacity 0.25s ease;
        z-index: 1060;
    }

    .dashboard-sidebar,
    html.sidebar-collapsed .dashboard-sidebar {
        border-radius: 0 24px 24px 0;
        bottom: 0;
        box-shadow: 1rem 0 2.5rem rgba(15, 23, 42, 0.3);
        left: 0;
        margin: 0;
        max-width: 370px;
        overflow-y: auto;
        padding: 1.25rem 1rem;
        pointer-events: none;
        position: fixed;
        right: auto;
        top: 0;
        transform: translateX(-105%);
        transition: transform 0.25s ease, visibility 0.25s ease;
        visibility: hidden;
        width: min(88vw, 370px);
        z-index: 1070;
    }

    html.mobile-dashboard-menu-open {
        overflow: hidden;
    }

    html.mobile-dashboard-menu-open .dashboard-sidebar {
        pointer-events: auto;
        transform: translateX(0);
        visibility: visible;
    }

    html.mobile-dashboard-menu-open .mobile-dashboard-menu-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    html.mobile-dashboard-menu-open .mobile-dashboard-menu-toggle {
        opacity: 0;
        pointer-events: none;
    }

    .sidebar-brand {
        display: flex;
        margin-bottom: 1.25rem;
        padding-right: 2.5rem;
    }

    .sidebar-kicker {
        display: block;
    }

    .sidebar-mobile-close {
        align-items: center;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        color: #fff;
        display: inline-flex;
        height: 38px;
        justify-content: center;
        position: absolute;
        right: 1rem;
        top: 1.25rem;
        width: 38px;
    }

    .dashboard-tabs {
        flex-direction: column !important;
        overflow: visible;
    }

    .dashboard-tabs .nav-item {
        min-width: 0;
        width: 100%;
    }

    .dashboard-tabs .nav-link.active {
        transform: translateX(4px);
    }

    .sidebar-footer {
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        display: grid;
        gap: 0.35rem;
        margin-top: auto;
        padding-top: 1rem;
    }

    .sidebar-footer .sidebar-link {
        flex: initial;
        justify-content: space-between;
        padding: 0.68rem 0.75rem;
        width: 100%;
    }

    .sidebar-footer .sidebar-toggle {
        display: none;
    }
}
