/* Styles principaux de l'application (extraits de l'ancien index.html, inchangés). */
        /* ============== VARIABLES CSS POUR THÈMES ============== */
        :root {
            /* === THEME "CARNET DE ROUTE" — signalétique routière === */
            /* Bleu cartographique : navigation, info, éléments interactifs secondaires */
            --primary: #2B6E8F;
            --primary-light: #5C97B5;
            --primary-dark: #1D506A;
            /* Orange signalisation : actions principales et alertes — à utiliser avec parcimonie */
            --secondary: #E8590C;
            --accent: #E8590C;

            --background: #F7F6F2;
            --background-light: #FFFFFF;
            --card: #FFFFFF;
            --card-hover: #F2F0EA;

            --text: #15263D;
            --text-secondary: #5B6B7E;
            --text-light: #44546A;

            --border: #DDD9CF;
            --border-light: #E8E5DD;

            --success: #2F9E44;
            --success-light: #E3F4E7;
            --warning: #E8590C;
            --warning-light: #FDEBE0;
            --danger: #D9352B;
            --danger-light: #FBE5E3;
            --info: #2B6E8F;
            --info-light: #E2EEF4;

            --shadow: 0 1px 3px rgba(21, 38, 61, 0.10);
            --shadow-hover: 0 4px 12px rgba(21, 38, 61, 0.14);
            --radius: 10px;
            --radius-sm: 6px;

            --header-bg: #15263D;
            --modal-overlay: rgba(21, 38, 61, 0.55);
            --font-display: 'Archivo', 'Inter', sans-serif;
        }

        /* Thème sombre */
        [data-theme="dark"] {
            /* === THEME SOMBRE "ROUTE DE NUIT" === */
            --primary: #6BB3D6;
            --primary-light: #9CCCE4;
            --primary-dark: #4A92B5;
            --secondary: #FF7A33;
            --accent: #FF7A33;

            --background: #10171F;
            --background-light: #1A2430;
            --card: #1A2430;
            --card-hover: #222F3F;

            --text: #E9EEF4;
            --text-secondary: #8FA1B5;
            --text-light: #B4C2D2;

            --border: #2C3A4C;
            --border-light: #222F3F;

            --success: #51CF66;
            --success-light: rgba(81, 207, 102, 0.16);
            --warning: #FF7A33;
            --warning-light: rgba(255, 122, 51, 0.16);
            --danger: #FF6B5E;
            --danger-light: rgba(255, 107, 94, 0.16);
            --info: #6BB3D6;
            --info-light: rgba(107, 179, 214, 0.16);

            --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
            --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.5);

            --header-bg: #0B1118;
            --modal-overlay: rgba(0, 0, 0, 0.75);
        }

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

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--background);
            color: var(--text);
            min-height: 100vh;
            line-height: 1.6;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        /* ============== THEME TOGGLE ============== */
        .theme-toggle {
            position: fixed;
            bottom: 1.25rem;
            right: 1.25rem;
            z-index: 999;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.1rem;
            box-shadow: var(--shadow-hover);
            transition: all 0.3s ease;
        }
        .settings-toggle {
            position: fixed;
            bottom: 1.25rem;
            right: 4.5rem;
            z-index: 999;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.1rem;
            box-shadow: var(--shadow-hover);
            transition: all 0.3s ease;
            color: var(--text);
        }
        .settings-toggle:hover {
            transform: scale(1.1) rotate(45deg);
            color: var(--primary);
        }

        .theme-toggle:hover {
            transform: scale(1.1);
            box-shadow: var(--shadow-hover);
        }

        .theme-toggle .sun { display: none; }
        .theme-toggle .moon { display: block; }
        
        [data-theme="dark"] .theme-toggle .sun { display: block; }
        [data-theme="dark"] .theme-toggle .moon { display: none; }

        /* ============== LOGIN SCREEN ============== */
        .login-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--header-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2000;
        }

        .login-container {
            background: var(--card);
            padding: 2.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow-hover);
            width: 100%;
            max-width: 420px;
            margin: 1rem;
        }

        .login-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .login-header i {
            font-size: 3rem;
            color: var(--primary);
            margin-bottom: 1rem;
        }

        .login-header h2 {
            color: var(--text);
            margin-bottom: 0.5rem;
        }

        .login-header p {
            color: var(--text-secondary);
        }

        .login-error {
            display: none;
            padding: 1rem;
            background: var(--danger-light);
            color: var(--danger);
            border-radius: var(--radius-sm);
            margin-bottom: 1rem;
            align-items: center;
            gap: 0.5rem;
        }

        .login-error.show {
            display: flex;
        }

        .form-input.error {
            border-color: var(--danger);
        }

        .attempts-warning {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem;
            background: var(--warning-light);
            color: var(--warning);
            border-radius: var(--radius-sm);
            margin-bottom: 1rem;
            font-size: 0.9rem;
        }

        .login-btn {
            width: 100%;
        }

        .login-locked {
            text-align: center;
            padding: 2rem;
        }

        .login-locked i {
            font-size: 3rem;
            color: var(--danger);
            margin-bottom: 1rem;
        }

        .unlock-time {
            font-size: 2rem;
            font-weight: 700;
            color: var(--danger);
            margin-top: 1rem;
        }

        /* ============== HEADER ============== */
        .header {
            background: var(--header-bg);
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: white;
            box-shadow: var(--shadow);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        [data-theme="dark"] .header {
            border-bottom: 1px solid var(--border);
        }

        .header h1 {
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-weight: 600;
        }

        .header h1 i {
            font-size: 1.8rem;
        }

        .header-actions {
            display: flex;
            gap: 0.75rem;
            align-items: center;
        }

        .save-status {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.85rem;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            backdrop-filter: blur(10px);
        }

        .save-status.unsaved {
            background: rgba(255, 255, 255, 0.3);
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }

        .save-indicator {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.5rem 0.9rem;
            border-radius: 20px;
            font-size: 0.8rem;
            background: rgba(22, 163, 74, 0.25);
            color: white;
            cursor: pointer;
            transition: background 0.15s;
        }
        .save-indicator:hover { background: rgba(22, 163, 74, 0.4); }
        .save-indicator i { font-size: 0.85rem; }
        .save-indicator b { font-weight: 700; }

        /* Panneau diagnostic sauvegarde */
        .storage-diag-overlay {
            position: fixed; inset: 0; z-index: 10000;
            background: rgba(0,0,0,0.5);
            display: none; align-items: center; justify-content: center;
            padding: 1rem;
        }
        .storage-diag-overlay.active { display: flex; }
        .storage-diag {
            background: white; border-radius: 14px;
            max-width: 540px; width: 100%;
            padding: 1.5rem; max-height: 85vh; overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        .storage-diag h2 {
            margin: 0 0 0.3rem; font-size: 1.3rem; color: #1e293b;
            display: flex; align-items: center; gap: 0.5rem;
        }
        .storage-diag h2 i { color: #2563eb; }
        .storage-diag-sub { color: #64748b; font-size: 0.9rem; margin-bottom: 1rem; }
        .storage-diag-row {
            display: flex; justify-content: space-between; align-items: center;
            padding: 0.7rem 0; border-bottom: 1px solid #f1f5f9;
        }
        .storage-diag-row:last-of-type { border-bottom: none; }
        .storage-diag-label { font-size: 0.9rem; color: #475569; display: flex; align-items: center; gap: 0.5rem; }
        .storage-diag-value { font-weight: 700; font-size: 0.9rem; }
        .storage-diag-value.ok { color: #16a34a; }
        .storage-diag-value.warn { color: #d97706; }
        .storage-diag-value.err { color: #dc2626; }
        .storage-diag-actions { display: flex; gap: 0.5rem; margin-top: 1.2rem; flex-wrap: wrap; }
        .storage-diag-actions button {
            flex: 1; min-width: 140px; padding: 0.7rem 1rem; border-radius: 8px;
            border: none; font-weight: 600; cursor: pointer; font-size: 0.88rem;
        }
        .storage-diag-bar {
            height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden;
            margin-top: 0.3rem;
        }
        .storage-diag-bar-fill { height: 100%; background: #2563eb; transition: width 0.3s; }

        /* ============== NAVIGATION ============== */
        .nav {
            display: flex;
            background: var(--background-light);
            border-bottom: 1px solid var(--border);
            overflow-x: auto;
            padding: 0 1rem;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
        }

        .nav-item {
            padding: 1rem 1.25rem;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            white-space: nowrap;
            color: var(--text-secondary);
            transition: all 0.3s ease;
            font-weight: 500;
            font-size: 0.9rem;
        }

        .nav-item:hover {
            background: var(--background);
            color: var(--primary);
        }

        .nav-item.active {
            border-bottom-color: var(--primary);
            color: var(--primary);
            background: linear-gradient(to bottom, rgba(0, 122, 255, 0.05), transparent);
        }

        /* ============== MAIN ============== */
        .main {
            padding: 2rem;
            max-width: 1600px;
            margin: 0 auto;
        }

        /* ============== BUTTONS ============== */
        .btn {
            padding: 0.75rem 1.5rem;
            border-radius: var(--radius-sm);
            border: none;
            cursor: pointer;
            font-size: 0.95rem;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            transition: all 0.3s ease;
            text-decoration: none;
        }

        .btn-primary {
            background: var(--primary);
            color: white;
            box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
        }

        .btn-primary:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
        }

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

        .btn-success:hover {
            filter: brightness(1.1);
            transform: translateY(-2px);
        }

        .btn-warning {
            background: var(--warning);
            color: white;
        }

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

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

        .btn-secondary:hover {
            background: var(--border-light);
        }

        .btn-sm {
            padding: 0.5rem 1rem;
            font-size: 0.85rem;
        }

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

        .btn-facture {
            background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
            color: white;
        }

        .btn-outline {
            background: transparent;
            border: 2px solid var(--primary);
            color: var(--primary);
        }

        .btn-outline:hover {
            background: var(--primary);
            color: white;
        }

        /* ============== CARDS ============== */
        .card {
            background: var(--card);
            border-radius: var(--radius);
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            box-shadow: var(--shadow);
            border: 1px solid var(--border-light);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

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

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
            gap: 1rem;
        }

        .card-title {
            font-size: 1.25rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            color: var(--primary);
        }

        /* ============== STATS ============== */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }

        .stat-card {
            background: var(--card);
            border-radius: var(--radius);
            padding: 1.5rem;
            text-align: center;
            border: 1px solid var(--border-light);
            box-shadow: var(--shadow);
            transition: all 0.3s ease;
        }

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

        .stat-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: var(--primary);
        }

        .stat-value {
            font-size: 2.5rem;
            font-weight: 800;
            color: var(--primary);
            line-height: 1;
            margin-bottom: 0.5rem;
        }

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

        /* ============== FORMS ============== */
        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 600;
            font-size: 0.95rem;
            color: var(--text);
        }

        .form-input, .form-select {
            width: 100%;
            padding: 0.875rem 1rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--background-light);
            color: var(--text);
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .form-input:focus, .form-select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
        }

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

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

        .form-hint {
            font-size: 0.85rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
        }

        /* ============== TABS ============== */
        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* ============== UPLOAD ZONE ============== */
        .upload-zone {
            border: 2px dashed var(--border);
            border-radius: var(--radius);
            padding: 3rem 2rem;
            text-align: center;
            background: var(--background-light);
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 2rem;
        }

        .upload-zone:hover, .upload-zone.drag-over {
            border-color: var(--primary);
            background: rgba(0, 122, 255, 0.05);
        }

        .upload-zone i {
            font-size: 3rem;
            color: var(--primary);
            margin-bottom: 1rem;
        }

        /* ============== MODALS ============== */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--modal-overlay);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1500;
            padding: 1rem;
            backdrop-filter: blur(4px);
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal {
            background: var(--card);
            border-radius: var(--radius);
            padding: 2rem;
            width: 100%;
            max-width: 600px;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: var(--shadow-hover);
        }

        .modal-lg {
            max-width: 900px;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-light);
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text);
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-secondary);
            padding: 0;
            line-height: 1;
        }

        .modal-close:hover {
            color: var(--danger);
        }

        .modal-actions {
            display: flex;
            gap: 1rem;
            justify-content: flex-end;
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border-light);
        }

        /* ============== TOAST ============== */
        .toast-container {
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            z-index: 2000;
        }

        .toast {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 1rem 1.5rem;
            background: var(--card);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-hover);
            margin-top: 0.75rem;
            animation: slideIn 0.3s ease;
            border-left: 4px solid var(--primary);
        }

        .toast.success { border-left-color: var(--success); }
        .toast.error { border-left-color: var(--danger); }
        .toast.warning { border-left-color: var(--warning); }

        @keyframes slideIn {
            from { transform: translateX(100%); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }

        /* ============== TABLES ============== */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 0.875rem 1rem;
            text-align: left;
            border-bottom: 1px solid var(--border-light);
        }

        th {
            background: var(--background);
            font-weight: 600;
            color: var(--text);
        }

        tr:hover {
            background: var(--card-hover);
        }

        /* ============== BADGES ============== */
        .badge {
            display: inline-flex;
            align-items: center;
            gap: 0.25rem;
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .badge-success {
            background: var(--success-light);
            color: var(--success);
        }

        .badge-danger {
            background: var(--danger-light);
            color: var(--danger);
        }

        .badge-warning {
            background: var(--warning-light);
            color: var(--warning);
        }

        .badge-primary {
            background: rgba(0, 122, 255, 0.15);
            color: var(--primary);
        }

        .badge-autoentrepreneur {
            background: rgba(0, 122, 255, 0.15);
            color: var(--primary);
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .badge-salarie {
            background: rgba(52, 199, 89, 0.15);
            color: var(--success);
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        /* ============== DRAG & DROP ============== */
        .drag-drop-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 1.5rem;
            margin-top: 1.5rem;
        }

        .livreur-drop-zone {
            background: var(--card);
            border-radius: var(--radius);
            padding: 1.25rem;
            border: 2px solid var(--border-light);
            transition: all 0.3s ease;
            box-shadow: var(--shadow);
        }

        .livreur-drop-zone.drag-over {
            border-color: var(--primary);
            background: rgba(0, 122, 255, 0.05);
        }

        .drop-zone-header {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-light);
        }

        .drop-zone-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
            font-weight: 700;
            color: white;
            margin-right: 1rem;
        }

        .drop-zone-info { flex: 1; }

        .drop-zone-name {
            font-weight: 700;
            font-size: 1.1rem;
            color: var(--text);
        }

        .drop-zone-count {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .drop-zone-total {
            font-size: 1.5rem;
            font-weight: 800;
        }

        .drop-zone-total.optimal { color: var(--success); }
        .drop-zone-total.warning { color: var(--warning); }
        .drop-zone-total.danger { color: var(--danger); }

        .secteurs-drop-area {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            min-height: 80px;
            padding: 1rem;
            background: var(--background);
            border-radius: var(--radius-sm);
            border: 2px dashed var(--border);
        }

        .secteur-draggable {
            background: var(--primary);
            padding: 0.5rem 0.75rem;
            border-radius: var(--radius-sm);
            font-size: 0.85rem;
            cursor: grab;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: white;
            font-weight: 600;
        }

        .secteur-draggable:hover {
            transform: translateY(-2px);
        }

        .secteur-draggable.dragging {
            opacity: 0.7;
            cursor: grabbing;
        }

        .secteur-colis {
            background: rgba(255, 255, 255, 0.3);
            padding: 0.125rem 0.375rem;
            border-radius: 4px;
            font-size: 0.75rem;
        }

        .remove-secteur {
            background: none;
            border: none;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            padding: 0;
            font-size: 0.9rem;
        }

        .remove-secteur:hover {
            color: white;
        }

        .add-secteur-inline {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }

        .add-secteur-inline input {
            flex: 1;
            padding: 0.5rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--background-light);
            color: var(--text);
            font-size: 0.85rem;
        }

        /* ============== LIVREUR CONFIG ============== */
        .livreur-config-section {
            background: var(--background);
            border-radius: var(--radius-sm);
            padding: 1rem;
            margin-top: 1rem;
        }

        .config-tabs {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
            border-bottom: 1px solid var(--border);
            padding-bottom: 0.5rem;
        }

        .config-tab {
            padding: 0.5rem 1rem;
            border: none;
            background: none;
            cursor: pointer;
            color: var(--text-secondary);
            font-weight: 500;
            border-radius: var(--radius-sm);
            transition: all 0.3s ease;
        }

        .config-tab:hover {
            background: var(--background-light);
        }

        .config-tab.active {
            background: var(--primary);
            color: white;
        }

        /* ============== HISTORIQUE ============== */
        .historique-livreur-card {
            background: var(--card);
            border-radius: var(--radius);
            margin-bottom: 1rem;
            border: 1px solid var(--border-light);
            overflow: hidden;
        }

        .historique-livreur-header {
            display: flex;
            align-items: center;
            padding: 1.25rem;
            cursor: pointer;
            transition: background 0.3s ease;
        }

        .historique-livreur-header:hover {
            background: var(--card-hover);
        }

        .historique-livreur-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: white;
            margin-right: 1rem;
        }

        .historique-livreur-info { flex: 1; }

        .historique-livreur-name {
            font-weight: 700;
            font-size: 1.1rem;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .historique-livreur-subtitle {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .historique-livreur-stats {
            display: flex;
            gap: 2rem;
            margin-right: 1rem;
        }

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

        .historique-stat-value {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text);
        }

        .historique-stat-label {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .historique-livreur-toggle {
            color: var(--text-secondary);
            transition: transform 0.3s ease;
        }

        .historique-livreur-card.expanded .historique-livreur-toggle {
            transform: rotate(180deg);
        }

        .historique-livreur-details {
            display: none;
            border-top: 1px solid var(--border-light);
            padding: 1.5rem;
            background: var(--background);
        }

        .historique-livreur-card.expanded .historique-livreur-details {
            display: block;
        }

        .salaire-display {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--success);
        }

        .historique-day-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 1rem;
            font-size: 0.9rem;
        }

        .historique-day-table th {
            background: var(--background-light);
            padding: 0.75rem;
            text-align: left;
            font-weight: 600;
        }

        .historique-day-table td {
            padding: 0.75rem;
            border-bottom: 1px solid var(--border-light);
        }

        .historique-total-row {
            background: var(--background-light);
            font-weight: 700;
        }

        .salaire-cell {
            color: var(--success);
            font-weight: 600;
        }

        .historique-actions {
            display: flex;
            gap: 0.75rem;
            margin-top: 1rem;
        }

        /* ============== FACTURE ============== */
        .modal-facture {
            max-width: 900px;
        }

        /* ===== FORMULAIRE D'EDITION FACTURE ===== */
        .facture-edit-form {
            background: var(--background);
            border-radius: var(--radius);
            padding: 1.25rem;
            margin-bottom: 1.5rem;
            border: 1px solid var(--border);
        }
        .facture-edit-form h4 {
            color: var(--primary);
            font-size: 0.95rem;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .facture-edit-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.75rem 1rem;
        }
        .facture-edit-grid .full-width { grid-column: 1 / -1; }
        .facture-edit-label {
            display: block;
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 0.25rem;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }
        .facture-edit-input {
            width: 100%;
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--background-light);
            color: var(--text);
            font-size: 0.9rem;
        }
        .facture-edit-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(0,122,255,0.15);
        }
        .facture-sections {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 1rem;
            flex-wrap: wrap;
        }
        .facture-section-btn {
            padding: 0.4rem 0.9rem;
            border-radius: 20px;
            border: 1.5px solid var(--border);
            background: var(--background-light);
            color: var(--text-secondary);
            font-size: 0.82rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .facture-section-btn.active {
            border-color: var(--primary);
            background: rgba(0,122,255,0.08);
            color: var(--primary);
        }

        /* ===== DOCUMENT FACTURE (rendu) ===== */
        .facture-container {
            background: white;
            color: #1a1a2e;
            padding: 2.5rem;
            border-radius: 4px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            font-size: 0.9rem;
            line-height: 1.5;
            border: 1px solid #e8e8e8;
            position: relative;
        }
        .facture-filigrane {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) rotate(-35deg);
            font-size: 5rem;
            font-weight: 900;
            color: rgba(0,0,0,0.04);
            pointer-events: none;
            white-space: nowrap;
            z-index: 0;
            letter-spacing: 0.1em;
        }
        /* Adresse émetteur (haut gauche) */
        .facture-emetteur {
            font-size: 0.82rem;
            color: #444;
            line-height: 1.6;
            margin-bottom: 2rem;
        }
        /* Destinataire (haut droite) */
        .facture-destinataire {
            text-align: right;
            font-size: 0.88rem;
            font-weight: 700;
            color: #1a1a2e;
            line-height: 1.6;
            margin-bottom: 2rem;
        }
        .facture-top-row {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 2rem;
        }
        /* Titre AVOIR / FACTURE */
        .facture-titre-bloc {
            margin-bottom: 0.25rem;
        }
        .facture-avoir-label {
            font-size: 1.1rem;
            font-weight: 800;
            color: #1a1a2e;
        }
        .facture-sous-titre {
            color: #5856D6;
            font-size: 0.88rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }
        .facture-meta {
            font-size: 0.82rem;
            color: #555;
            display: flex;
            gap: 2rem;
            margin-bottom: 1.5rem;
            flex-wrap: wrap;
        }
        /* Tableau principal */
        .facture-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 1rem;
            font-size: 0.88rem;
        }
        .facture-table thead tr {
            background: #5856D6;
            color: white;
        }
        .facture-table thead th {
            padding: 0.75rem 1rem;
            text-align: left;
            font-weight: 600;
            color: white;
            border: none;
        }
        .facture-table thead th:last-child { text-align: right; }
        .facture-table tbody td {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid #eee;
            color: #1a1a2e;
        }
        .facture-table tbody tr:last-child td { border-bottom: none; }
        /* Totaux */
        .facture-totaux {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 1.5rem;
        }
        .facture-totaux-bloc {
            min-width: 240px;
            border: 1px solid #e8e8e8;
            border-radius: 6px;
            overflow: hidden;
        }
        .facture-total-line {
            display: flex;
            justify-content: space-between;
            padding: 0.5rem 1rem;
            font-size: 0.88rem;
            color: #555;
            border-bottom: 1px solid #eee;
        }
        .facture-total-line:last-child { border-bottom: none; }
        .facture-total-line.total-ttc {
            background: #5856D6;
            color: white;
            font-weight: 700;
            font-size: 0.95rem;
        }
        /* Pied de page */
        .facture-footer {
            border-top: 1px solid #e8e8e8;
            margin-top: 1.5rem;
            padding-top: 1rem;
            font-size: 0.78rem;
            color: #777;
            line-height: 1.6;
        }
        .facture-footer-center {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.75rem;
            color: #999;
        }
        /* Détail journalier */
        .facture-detail-toggle {
            cursor: pointer;
            color: #5856D6;
            font-weight: 600;
            font-size: 0.85rem;
            margin-bottom: 0.75rem;
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            background: none;
            border: none;
            padding: 0;
        }

        /* Print */
        @media print {
            .modal-overlay, .modal-header, .modal-actions, .no-print,
            .facture-edit-form, .facture-sections, nav, header, footer { display: none !important; }
            .facture-container { border: none; padding: 1rem; box-shadow: none; }
            body { background: white; }
        }
        .rapport-stats {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 1rem;
            margin-bottom: 2rem;
        }

        .rapport-stat-item {
            background: var(--card);
            padding: 1.25rem;
            border-radius: var(--radius-sm);
            text-align: center;
            border: 1px solid var(--border-light);
        }

        .rapport-stat-value {
            font-size: 1.75rem;
            font-weight: 800;
            color: var(--primary);
        }

        .rapport-stat-label {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 0.25rem;
        }

        .rapport-livreur-card {
            background: var(--card);
            border-radius: var(--radius-sm);
            padding: 1rem;
            margin-bottom: 0.75rem;
            border-left: 4px solid var(--border);
        }

        .rapport-livreur-card.optimal {
            border-left-color: var(--success);
        }

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

        .rapport-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .rapport-card-name {
            font-weight: 700;
            color: var(--text);
        }

        .rapport-card-total {
            font-weight: 700;
            color: var(--primary);
        }

        .rapport-card-secteurs {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .rapport-secteur-badge {
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .rapport-secteur-badge.rouge {
            background: rgba(255, 59, 48, 0.15);
            color: #FF3B30;
        }

        .rapport-secteur-badge.vert {
            background: rgba(52, 199, 89, 0.15);
            color: #34C759;
        }

        .rapport-secteur-badge.bleu {
            background: rgba(0, 122, 255, 0.15);
            color: #007AFF;
        }

        .colis-count {
            opacity: 0.8;
            font-size: 0.75rem;
        }

        /* ============== DATA MANAGER ============== */
        .data-manager-list {
            max-height: 400px;
            overflow-y: auto;
        }

        .data-item {
            display: flex;
            align-items: center;
            padding: 1rem;
            background: var(--background-light);
            border-radius: var(--radius-sm);
            margin-bottom: 0.5rem;
            border: 1px solid var(--border-light);
        }

        .data-item-info { flex: 1; }

        .data-item-title {
            font-weight: 600;
            color: var(--text);
        }

        .data-item-meta {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .data-item-actions {
            display: flex;
            gap: 0.5rem;
        }

        /* ============== SHARE SECTION ============== */
        .share-section {
            background: var(--background);
            border-radius: var(--radius);
            padding: 1.5rem;
            margin-top: 1.5rem;
        }

        .qr-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 1.5rem;
            background: white;
            border-radius: var(--radius-sm);
            margin: 1rem 0;
        }

        .share-link {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            background: var(--background-light);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            margin: 1rem 0;
            word-break: break-all;
        }

        .share-link input {
            flex: 1;
            border: none;
            background: none;
            color: var(--text);
            font-size: 0.9rem;
        }

        /* ============== EMPTY STATE ============== */
        .empty-state {
            text-align: center;
            padding: 3rem 2rem;
            color: var(--text-secondary);
        }

        .empty-state i {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        .empty-state h4 {
            margin-bottom: 0.5rem;
            color: var(--text);
        }

        /* ============== ALERTS ============== */
        .alert {
            padding: 1rem 1.25rem;
            border-radius: var(--radius-sm);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .alert-warning {
            background: var(--warning-light);
            color: var(--warning);
            border: 1px solid var(--warning);
        }

        .alert-danger {
            background: var(--danger-light);
            color: var(--danger);
            border: 1px solid var(--danger);
        }

        .alert-success {
            background: var(--success-light);
            color: var(--success);
            border: 1px solid var(--success);
        }

        .alert-info {
            background: var(--info-light);
            color: var(--info);
            border: 1px solid var(--info);
        }

        /* ============== IMPORT RESULTS ============== */
        .import-results {
            background: var(--success-light);
            border: 1px solid var(--success);
            border-radius: var(--radius);
            padding: 1.5rem;
            margin-bottom: 1.5rem;
        }

        .import-results h4 {
            color: var(--success);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .import-summary {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1rem;
        }

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

        .import-stat .value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text);
        }

        .import-stat .label {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        /* ============== PREVISIONS ============== */
        .prevision-item {
            display: flex;
            align-items: center;
            padding: 0.75rem 1rem;
            background: var(--background-light);
            border-radius: var(--radius-sm);
            margin-bottom: 0.5rem;
            border: 1px solid var(--border-light);
        }

        .prevision-cp {
            font-weight: 700;
            color: var(--primary);
            min-width: 80px;
        }

        .prevision-colis {
            flex: 1;
            color: var(--text);
        }

        .prevision-delete {
            background: none;
            border: none;
            color: var(--danger);
            cursor: pointer;
            padding: 0.25rem;
        }

        /* ============== FOOTER ============== */
        .app-footer {
            background: var(--card);
            border-top: 1px solid var(--border);
            padding: 1.5rem 2rem;
            text-align: center;
            margin-top: 2rem;
        }

        .copyright-main {
            font-weight: 600;
            color: var(--text);
            margin-bottom: 0.25rem;
        }

        .copyright-sub {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        /* ============== PRINT STYLES ============== */
        @media print {
            .no-print {
                display: none !important;
            }
            
            body {
                background: white !important;
            }
            
            .facture-container {
                box-shadow: none;
            }
        }

        /* ============== RESPONSIVE ============== */
        @media (max-width: 768px) {
            .header {
                padding: 0.75rem 1rem;
                flex-wrap: wrap;
                gap: 0.5rem;
            }
            .header h1 { font-size: 1.1rem; }
            .header h1 i { font-size: 1.3rem; }
            .save-status span { display: none; }
            .header-actions { gap: 0.4rem; }
            .btn { padding: 0.6rem 1rem; font-size: 0.85rem; }
            .btn-sm { padding: 0.4rem 0.7rem; font-size: 0.78rem; }

            .nav { padding: 0 0.25rem; }
            .nav-item {
                padding: 0.65rem 0.6rem;
                font-size: 0.72rem;
                flex-direction: column;
                gap: 0.25rem;
                text-align: center;
            }
            .nav-item i { font-size: 1rem; }

            .main { padding: 0.75rem; }

            .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
            .stat-value { font-size: 1.8rem; }

            .rapport-stats { grid-template-columns: repeat(2, 1fr); }
            .historique-livreur-stats { display: none; }

            .form-row { grid-template-columns: 1fr; }

            .modal {
                padding: 1.25rem;
                margin: 0.5rem;
                max-height: 95vh;
            }
            .modal-lg { max-width: 100%; }

            .facture-info-grid { grid-template-columns: 1fr; }

            .theme-toggle {
                top: auto;
                bottom: 1rem;
                right: 1rem;
                width: 42px;
                height: 42px;
            }

            /* Drag & drop: cartes full width sur mobile */
            .drag-drop-container { grid-template-columns: 1fr; }

            /* Table overflow horizontal */
            .table-container { -webkit-overflow-scrolling: touch; }
            table { font-size: 0.82rem; }
            th, td { padding: 0.6rem 0.5rem; }

            /* Livreurs grid */
            #livreursGrid > div { grid-template-columns: 1fr !important; }

            /* Card headers stack sur petits écrans */
            .card-header { flex-direction: column; align-items: flex-start; }
            .card { padding: 1rem; }

            /* Historique */
            .historique-livreur-header { flex-wrap: wrap; gap: 0.5rem; }

            /* Login */
            .login-container { padding: 1.5rem; margin: 0.75rem; }

            /* Toast en bas au centre sur mobile */
            .toast-container {
                bottom: 1rem;
                right: 0.5rem;
                left: 0.5rem;
            }
            .toast { font-size: 0.85rem; }
        }

        @media (max-width: 480px) {
            .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
            .stat-card { padding: 1rem; }
            .stat-value { font-size: 1.5rem; }
            .nav-item span { display: none; }
        }

        /* ============== SEARCH ============== */
        .search-container {
            position: relative;
            margin-bottom: 1.5rem;
        }

        .search-input {
            width: 100%;
            padding: 0.875rem 1rem 0.875rem 3rem;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--background-light);
            color: var(--text);
            font-size: 1rem;
        }

        .search-icon {
            position: absolute;
            left: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }

        /* ============== TUTORIEL ============== */
        .tutorial-step {
            display: flex;
            gap: 1rem;
            padding: 1rem;
            background: var(--background-light);
            border-radius: var(--radius-sm);
            margin-bottom: 1rem;
            border-left: 4px solid var(--primary);
        }

        .tutorial-number {
            width: 32px;
            height: 32px;
            background: var(--primary);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            flex-shrink: 0;
        }

        .tutorial-content h4 {
            color: var(--text);
            margin-bottom: 0.25rem;
        }

        .tutorial-content p {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }
    
        /* ============== TUTORIEL ONBOARDING ============== */
        .tutorial-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.7); z-index: 9998; display: none;
            backdrop-filter: blur(2px);
        }
        .tutorial-overlay.show { display: block; }

        .tutorial-spotlight {
            position: fixed; border-radius: 12px;
            box-shadow: 0 0 0 9999px rgba(0,0,0,0.7), 0 0 30px rgba(0,122,255,0.5);
            border: 3px solid var(--primary); z-index: 9999;
            pointer-events: none; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            display: none;
        }
        .tutorial-spotlight.show { display: block; }

        .tutorial-tooltip {
            position: fixed; background: var(--card); color: var(--text);
            border-radius: var(--radius); padding: 1.5rem;
            max-width: 380px; min-width: 300px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.4);
            z-index: 10000; border: 2px solid var(--primary); display: none;
        }
        .tutorial-tooltip.show { display: block; }

        .tutorial-step-badge {
            display: inline-block; background: var(--primary); color: white;
            padding: 0.25rem 0.75rem; border-radius: 12px;
            font-size: 0.75rem; font-weight: 700; margin-bottom: 0.75rem;
            letter-spacing: 0.5px;
        }
        .tutorial-tooltip h4 {
            margin-bottom: 0.5rem; color: var(--text); font-size: 1.15rem;
            display: flex; align-items: center; gap: 0.5rem;
        }
        .tutorial-tooltip h4 i { color: var(--primary); }
        .tutorial-tooltip p {
            color: var(--text-secondary); line-height: 1.6;
            margin-bottom: 1rem; font-size: 0.95rem;
        }
        .tutorial-actions {
            display: flex; gap: 0.5rem; justify-content: space-between;
            align-items: center; margin-top: 1rem; padding-top: 1rem;
            border-top: 1px solid var(--border);
        }
        .tutorial-progress {
            font-size: 0.8rem; color: var(--text-secondary); font-weight: 600;
        }
        .tutorial-tooltip button {
            padding: 0.5rem 1rem; border-radius: var(--radius-sm);
            border: none; cursor: pointer; font-size: 0.9rem;
            font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem;
        }
        .tutorial-btn-skip { background: transparent; color: var(--text-secondary); }
        .tutorial-btn-skip:hover { color: var(--text); }
        .tutorial-btn-prev {
            background: var(--background); color: var(--text);
            border: 1px solid var(--border) !important;
        }
        .tutorial-btn-next { background: var(--primary); color: white; }
        .tutorial-btn-next:hover { background: var(--primary-dark); }

        .tutorial-welcome {
            position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            background: var(--card); border-radius: var(--radius);
            padding: 2.5rem; max-width: 520px; width: 90%;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            z-index: 10000; text-align: center; display: none;
            border: 2px solid var(--primary);
        }
        .tutorial-welcome.show { display: block; }
        .tutorial-welcome i.welcome-icon {
            font-size: 4rem; color: var(--primary);
            margin-bottom: 1rem; display: block;
        }
        .tutorial-welcome h2 { color: var(--text); margin-bottom: 0.75rem; font-size: 1.6rem; }
        .tutorial-welcome p { color: var(--text-secondary); line-height: 1.7; margin-bottom: 1.5rem; }
        .tutorial-welcome ul {
            text-align: left; margin: 1rem 0 1.5rem;
            padding-left: 1.5rem; color: var(--text);
        }
        .tutorial-welcome ul li { margin-bottom: 0.5rem; }
        .tutorial-welcome .welcome-actions {
            display: flex; gap: 0.75rem; justify-content: center;
        }
        @media (max-width: 600px) {
            .tutorial-tooltip { max-width: 90vw; min-width: 280px; }
            .tutorial-welcome { padding: 1.5rem; }
        }

    
        /* ============== AMELIORATIONS V8 - DESIGN MODERNE ============== */
        body {
            background-image:
                radial-gradient(circle at 20% 0%, rgba(15, 184, 154, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 80% 100%, rgba(255, 138, 101, 0.03) 0%, transparent 50%);
            background-attachment: fixed;
        }
        [data-theme="dark"] body {
            background-image:
                radial-gradient(circle at 20% 0%, rgba(123, 239, 211, 0.06) 0%, transparent 50%),
                radial-gradient(circle at 80% 100%, rgba(255, 171, 145, 0.04) 0%, transparent 50%);
            background-color: var(--background);
        }

        /* Grille subtile en arriere plan (style Verve) */
        [data-theme="dark"] body::before {
            content: '';
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background-image:
                linear-gradient(rgba(123, 239, 211, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(123, 239, 211, 0.03) 1px, transparent 1px);
            background-size: 60px 60px;
            pointer-events: none;
            z-index: 0;
        }
        [data-theme="dark"] .header,
        [data-theme="dark"] .main,
        [data-theme="dark"] .nav,
        [data-theme="dark"] .login-overlay {
            position: relative;
            z-index: 1;
        }

        /* Cards : bord plus fin, hover lift + glow */
        .card {
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                        border-color 0.3s ease;
        }
        .card:hover {
            transform: translateY(-2px);
        }
        [data-theme="dark"] .card:hover {
            border-color: rgba(123, 239, 211, 0.3);
            box-shadow: 0 8px 32px rgba(123, 239, 211, 0.08);
        }

        /* Boutons primary : effet glow */
        .btn-primary {
            position: relative;
            overflow: hidden;
        }
        .btn-primary::after {
            content: '';
            position: absolute;
            top: 0; left: -100%;
            width: 100%; height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: left 0.5s ease;
        }
        .btn-primary:hover::after {
            left: 100%;
        }
        [data-theme="dark"] .btn-primary {
            color: #0B1F1C;
            font-weight: 700;
            box-shadow: 0 0 20px rgba(123, 239, 211, 0.3);
        }
        [data-theme="dark"] .btn-primary:hover {
            box-shadow: 0 0 30px rgba(123, 239, 211, 0.5);
        }

        /* Stats values : typo bold, taille augmentee */
        .stat-value {
            font-weight: 800 !important;
            letter-spacing: -0.02em;
        }

        /* Header h1 : un peu plus moderne */
        .header h1 {
            letter-spacing: -0.02em;
            font-weight: 700;
        }

        /* Nav active : indicateur plus marque */
        .nav-item.active {
            font-weight: 700;
        }
        [data-theme="dark"] .nav-item.active {
            background: linear-gradient(to bottom, rgba(123, 239, 211, 0.1), transparent);
        }

        /* Login overlay - background avec gradient subtil */
        [data-theme="dark"] .login-overlay {
            background:
                radial-gradient(circle at 50% 0%, rgba(123, 239, 211, 0.15), transparent 60%),
                linear-gradient(135deg, #0B1F1C 0%, #0F2421 100%);
        }

        /* Login container : look premium */
        .login-container {
            border: 1px solid var(--border);
            backdrop-filter: blur(10px);
        }
        [data-theme="dark"] .login-container {
            background: rgba(20, 40, 38, 0.95);
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                        0 0 0 1px rgba(123, 239, 211, 0.1) inset;
        }

        /* Inputs : focus glow turquoise */
        .form-input:focus, .form-select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(15, 184, 154, 0.15);
        }
        [data-theme="dark"] .form-input:focus,
        [data-theme="dark"] .form-select:focus {
            box-shadow: 0 0 0 3px rgba(123, 239, 211, 0.2);
        }

        /* Animation d'entree des cards en grille */
        @keyframes cardSlideIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        #livreursGrid .card,
        #rapportCardsGrid .rapport-livreur-card {
            animation: cardSlideIn 0.4s ease-out backwards;
        }

        /* Badges */
        .badge {
            font-weight: 600;
            letter-spacing: 0.02em;
        }

        /* Save status - look plus discret */
        .save-status {
            font-weight: 500;
            letter-spacing: 0.02em;
        }

        /* Toast - glassmorphism */
        .toast {
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255,255,255,0.1);
        }

        /* ============== LANDING MESSAGE LOGIN ============== */
        .login-landing {
            text-align: center;
            margin-bottom: 2rem;
            padding-bottom: 2rem;
            border-bottom: 1px solid var(--border);
        }
        .login-landing-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.4rem 1rem;
            background: rgba(15, 184, 154, 0.1);
            color: var(--primary);
            border-radius: 20px;
            font-size: 0.78rem;
            font-weight: 600;
            margin-bottom: 1rem;
            border: 1px solid rgba(15, 184, 154, 0.2);
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }
        [data-theme="dark"] .login-landing-badge {
            background: rgba(123, 239, 211, 0.1);
            border-color: rgba(123, 239, 211, 0.2);
        }
        .login-landing h1 {
            font-size: 1.85rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            line-height: 1.15;
            margin-bottom: 0.75rem;
            color: var(--text);
        }
        .login-landing h1 .accent {
            color: var(--primary);
            display: inline-block;
        }
        .login-landing p {
            color: var(--text-secondary);
            font-size: 0.95rem;
            line-height: 1.6;
            max-width: 380px;
            margin: 0 auto;
        }
        .login-landing-features {
            display: flex;
            justify-content: center;
            gap: 1.25rem;
            margin-top: 1.25rem;
            flex-wrap: wrap;
        }
        .login-landing-feature {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.8rem;
            color: var(--text-secondary);
            font-weight: 500;
        }
        .login-landing-feature i {
            color: var(--primary);
            font-size: 0.9rem;
        }

        /* ============== ALERTE PLANIFICATION J+1 ============== */
        .planning-alert {
            position: sticky;
            top: 0;
            z-index: 90;
            background: linear-gradient(135deg, rgba(255, 138, 101, 0.15), rgba(15, 184, 154, 0.1));
            border-bottom: 1px solid var(--border);
            padding: 0.6rem 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            font-size: 0.88rem;
            color: var(--text);
            font-weight: 500;
            backdrop-filter: blur(10px);
        }
        [data-theme="dark"] .planning-alert {
            background: linear-gradient(135deg, rgba(255, 171, 145, 0.12), rgba(123, 239, 211, 0.08));
        }
        .planning-alert i {
            color: var(--secondary);
            font-size: 1rem;
        }
        .planning-alert strong {
            color: var(--primary);
            font-weight: 700;
        }
        .planning-alert button {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text);
            padding: 0.3rem 0.7rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 0.8rem;
            font-weight: 500;
            margin-left: 0.5rem;
            transition: all 0.2s ease;
        }
        .planning-alert button:hover {
            background: var(--card-hover);
            border-color: var(--primary);
        }

        /* ============== NOUVEAU FORMAT RAPPORT EN CARDS ============== */
        .rapport-cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
            gap: 1.25rem;
            margin-top: 1.5rem;
        }
        .rapport-livreur-card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1.25rem;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .rapport-livreur-card:hover {
            border-color: var(--primary);
            transform: translateY(-2px);
            box-shadow: var(--shadow-hover);
        }
        .rapport-livreur-card.optimal {
            border-left: 4px solid var(--accent);
        }
        .rapport-livreur-card.warning {
            border-left: 4px solid var(--secondary);
        }
        .rapport-livreur-card.empty {
            opacity: 0.5;
        }

        .rapport-card-top {
            display: flex;
            align-items: center;
            gap: 0.85rem;
        }
        .rapport-card-avatar {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 700;
            font-size: 1.2rem;
            flex-shrink: 0;
        }
        [data-theme="dark"] .rapport-card-avatar {
            color: #0B1F1C;
        }
        .rapport-card-identity {
            flex: 1;
            min-width: 0;
        }
        .rapport-card-name {
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 0.15rem;
            letter-spacing: -0.01em;
        }
        .rapport-card-meta {
            font-size: 0.78rem;
            color: var(--text-secondary);
        }
        .rapport-card-total {
            text-align: right;
            flex-shrink: 0;
        }
        .rapport-card-total-value {
            font-size: 1.6rem;
            font-weight: 800;
            color: var(--primary);
            line-height: 1;
            letter-spacing: -0.02em;
        }
        .rapport-card-total-label {
            font-size: 0.7rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-top: 0.2rem;
        }

        .rapport-card-section-title {
            font-size: 0.7rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        .rapport-secteurs-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
            gap: 0.5rem;
        }
        .rapport-secteur-box {
            background: var(--background);
            border: 1px solid var(--border-light);
            border-radius: var(--radius-sm);
            padding: 0.6rem 0.4rem;
            text-align: center;
            transition: all 0.2s ease;
            cursor: default;
        }
        .rapport-secteur-box:hover {
            border-color: var(--primary);
            background: var(--card-hover);
        }
        .rapport-secteur-box.empty {
            opacity: 0.4;
        }
        .rapport-secteur-box.rouge { border-left: 3px solid #EF4444; }
        .rapport-secteur-box.vert { border-left: 3px solid #10B981; }
        .rapport-secteur-box.bleu { border-left: 3px solid #3B82F6; }
        [data-theme="dark"] .rapport-secteur-box {
            background: rgba(123, 239, 211, 0.04);
        }
        .rapport-secteur-cp {
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--text);
            font-variant-numeric: tabular-nums;
        }
        .rapport-secteur-colis {
            font-size: 0.7rem;
            color: var(--text-secondary);
            margin-top: 0.15rem;
            font-weight: 600;
        }

        .rapport-card-footer {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding-top: 0.85rem;
            border-top: 1px solid var(--border-light);
            font-size: 0.85rem;
        }
        .rapport-charge-bar {
            flex: 1;
            height: 6px;
            background: var(--border-light);
            border-radius: 3px;
            overflow: hidden;
        }
        .rapport-charge-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--primary-light));
            border-radius: 3px;
            transition: width 0.5s ease;
        }
        .rapport-charge-fill.warning {
            background: linear-gradient(90deg, var(--secondary), #FFB088);
        }
        .rapport-charge-fill.danger {
            background: linear-gradient(90deg, var(--danger), #FF6B6B);
        }
        .rapport-card-stat {
            color: var(--text-secondary);
            font-weight: 500;
        }
        .rapport-card-stat strong {
            color: var(--text);
            font-weight: 700;
        }

        @media (max-width: 600px) {
            .rapport-cards-grid {
                grid-template-columns: 1fr;
            }
            .login-landing h1 {
                font-size: 1.5rem;
            }
        }

    
        /* ============== ONGLET CARTE ============== */
        #map-container {
            position: relative;
            width: 100%;
            height: 600px;
            border-radius: var(--radius);
            overflow: hidden;
            border: 1px solid var(--border);
            background: var(--card);
            margin-bottom: 1.5rem;
        }
        #map-leaflet {
            width: 100%;
            height: 100%;
            background: var(--background);
        }
        [data-theme="dark"] #map-leaflet {
            filter: brightness(0.85) contrast(1.1);
        }
        .map-legend {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 1rem;
            margin-bottom: 1rem;
        }
        .map-legend-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 0.5rem;
            margin-top: 0.75rem;
        }
        .map-legend-item {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.5rem 0.75rem;
            background: var(--background);
            border-radius: var(--radius-sm);
            font-size: 0.88rem;
            border: 1px solid var(--border-light);
        }
        .map-legend-color {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            flex-shrink: 0;
            border: 2px solid white;
            box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
        }
        .map-legend-label {
            flex: 1;
            font-weight: 600;
            color: var(--text);
        }
        .map-legend-stats {
            color: var(--text-secondary);
            font-size: 0.78rem;
        }
        .map-popup {
            font-family: inherit;
            min-width: 180px;
        }
        .map-popup-cp {
            font-weight: 800;
            font-size: 1.05rem;
            color: var(--primary);
            margin-bottom: 0.25rem;
        }
        .map-popup-commune {
            font-size: 0.85rem;
            color: #555;
            margin-bottom: 0.5rem;
        }
        .map-popup-livreur {
            font-weight: 600;
            color: #222;
            margin-bottom: 0.2rem;
        }
        .map-popup-colis {
            display: inline-block;
            background: rgba(15, 184, 154, 0.15);
            color: #0a7060;
            padding: 0.15rem 0.5rem;
            border-radius: 12px;
            font-size: 0.8rem;
            font-weight: 700;
        }
        .map-popup-empty {
            color: #999;
            font-style: italic;
        }
        .map-controls {
            display: flex;
            gap: 0.75rem;
            align-items: center;
            margin-bottom: 1rem;
            flex-wrap: wrap;
        }
        .map-stat-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 20px;
            font-size: 0.88rem;
            color: var(--text-secondary);
            font-weight: 500;
        }
        .map-stat-pill strong {
            color: var(--primary);
            font-weight: 700;
            font-size: 1rem;
        }
        .map-empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--text-secondary);
        }
        .map-empty-state i {
            font-size: 3rem;
            margin-bottom: 1rem;
            opacity: 0.4;
        }
        .map-empty-state h3 {
            color: var(--text);
            margin-bottom: 0.5rem;
        }

    
        /* ============== IMPORT MULTI-MÉTHODES ============== */
        .import-tabs {
            display: flex;
            gap: 0.25rem;
            margin-bottom: 1rem;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
        }
        .import-tab-btn {
            padding: 0.65rem 1rem;
            background: none;
            border: none;
            border-bottom: 3px solid transparent;
            color: var(--text-secondary);
            font-weight: 600;
            cursor: pointer;
            font-size: 0.9rem;
            font-family: inherit;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .import-tab-btn:hover { color: var(--primary); }
        .import-tab-btn.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }
        .import-method { animation: fadeIn 0.25s ease; }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(4px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .upload-hint {
            color: var(--text-secondary);
            font-size: 0.82rem;
            margin-top: 0.65rem;
            line-height: 1.4;
        }
        .upload-hint code {
            background: var(--card-hover);
            padding: 0.1rem 0.35rem;
            border-radius: 3px;
            font-size: 0.85em;
            font-family: 'Courier New', monospace;
        }
        .paste-info {
            padding: 0.85rem 1rem;
            background: rgba(15, 184, 154, 0.08);
            border-left: 3px solid var(--primary);
            border-radius: var(--radius-sm);
            font-size: 0.85rem;
            color: var(--text-secondary);
            margin-bottom: 0.75rem;
            line-height: 1.5;
        }
        .paste-info code {
            background: rgba(15, 184, 154, 0.12);
            color: var(--primary);
            padding: 0.1rem 0.4rem;
            border-radius: 3px;
            font-family: 'Courier New', monospace;
            font-size: 0.92em;
        }
        .import-paste-textarea {
            width: 100%;
            min-height: 220px;
            padding: 1rem;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            font-family: 'Courier New', 'Consolas', monospace;
            font-size: 0.85rem;
            resize: vertical;
            background: var(--card);
            color: var(--text);
            line-height: 1.5;
            transition: border-color 0.2s ease;
        }
        .import-paste-textarea:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(15, 184, 154, 0.15);
        }
        .tournee-card {
            display: flex;
            gap: 0.85rem;
            align-items: flex-start;
            padding: 0.9rem 1rem;
            background: var(--background);
            border: 1.5px solid var(--border);
            border-radius: var(--radius-sm);
            cursor: pointer;
            margin-bottom: 0.6rem;
            transition: all 0.2s ease;
        }
        .tournee-card:hover {
            border-color: var(--primary);
            background: var(--card-hover);
        }
        .tournee-card input[type="checkbox"] {
            margin-top: 0.2rem;
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: var(--primary);
            flex-shrink: 0;
        }
        .tournee-card-name {
            font-weight: 700;
            color: var(--text);
            font-size: 1rem;
            margin-bottom: 0.25rem;
        }
        .tournee-card-name i {
            color: var(--primary);
            margin-right: 0.4rem;
        }
        .tournee-card-meta {
            color: var(--text-secondary);
            font-size: 0.85rem;
            margin-bottom: 0.4rem;
        }
        .tournee-card-cps {
            color: var(--text-secondary);
            font-size: 0.78rem;
            font-family: 'Courier New', monospace;
            opacity: 0.85;
            line-height: 1.5;
        }
        .tournee-coherence-warn {
            color: var(--warning);
            font-weight: 600;
        }


        /* ═══════════════════════════════════════════════════════════
           DESIGN "CARNET DE ROUTE" — surcouche v22
           Signature : la ligne de route en pointillés orange
           ═══════════════════════════════════════════════════════════ */

        h1, h2, h3, .card-title, .modal-title, .logo {
            font-family: var(--font-display);
            letter-spacing: -0.01em;
        }

        /* Header : panneau navy + ligne de route */
        .header::after {
            content: '';
            position: absolute;
            left: 0; right: 0; bottom: 0;
            height: 3px;
            background-image: linear-gradient(90deg, var(--secondary) 0 14px, transparent 14px 24px);
            background-size: 24px 3px;
        }

        /* Navigation : onglets bordereau, actif souligné en tracé d'itinéraire */
        .nav-item { font-weight: 600; }
        .nav-item:hover { color: var(--text); background: var(--card-hover); }
        .nav-item.active {
            color: var(--secondary);
            border-bottom-color: transparent;
            background: none;
            background-image: linear-gradient(90deg, var(--secondary) 0 10px, transparent 10px 17px);
            background-size: 17px 3px;
            background-repeat: repeat-x;
            background-position: bottom;
        }

        /* Boutons : l'orange signalisation porte l'action principale */
        .btn { font-weight: 600; }
        .btn-primary {
            background: var(--secondary);
            box-shadow: none;
            border: 1px solid transparent;
        }
        .btn-primary:hover {
            background: #C94A08;
            transform: none;
            box-shadow: 0 2px 8px rgba(232, 89, 12, 0.35);
        }
        [data-theme="dark"] .btn-primary { background: var(--secondary); color: #10171F; }
        [data-theme="dark"] .btn-primary:hover { background: #FF8C4D; }

        /* Cartes : bordure nette, survol sobre */
        .card { transition: box-shadow 0.2s ease; border: 1px solid var(--border); }
        .card:hover { box-shadow: var(--shadow-hover); transform: none; }

        /* Stats : chiffres en Archivo, encre, étiquette en capitales */
        .stat-value {
            font-family: var(--font-display);
            color: var(--text);
            font-weight: 800;
            font-variant-numeric: tabular-nums;
        }
        .stat-label {
            text-transform: uppercase;
            letter-spacing: 0.06em;
            font-size: 0.72rem;
            font-weight: 600;
        }
        .stat-card { border-left: 3px solid var(--primary); }

        /* Connexion : carte sobre, ligne de route en tête */
        .login-container {
            border: 1px solid var(--border);
            border-top: 4px solid var(--secondary);
            box-shadow: var(--shadow-hover);
        }

        /* Accessibilité : focus clavier visible partout */
        .btn:focus-visible, .nav-item:focus-visible, .form-input:focus-visible,
        a:focus-visible, button:focus-visible {
            outline: 2px solid var(--secondary);
            outline-offset: 2px;
        }

        /* Mouvement réduit respecté */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                transition-duration: 0.01ms !important;
            }
        }

/* Éléments réservés à l'administrateur : affichage uniquement (la sécurité est côté Supabase). */
        /* Éléments réservés à l'administrateur : masqués par défaut.
           Affichés uniquement quand le body porte la classe "is-admin". */
        .admin-only { display: none !important; }
        body.is-admin .admin-only { display: revert !important; }
        /* Cas particulier : la section Partage est une "card" en flux normal */
        body.is-admin .card.admin-only { display: block !important; }
        body.is-admin .config-tab.admin-only { display: inline-flex !important; }
