        /* ========================================================================
           CONVENTION TYPOGRAPHIQUE DASHBOARD (à respecter pour tout nouveau composant)
           ----------------------------------------------------------------------
           font-weight: 400 — texte courant / paragraphes (par défaut Nunito 400)
           font-weight: 500 — labels, valeurs de formulaire, items de listes, filtres
           font-weight: 600 — titres de section (h2/h3), boutons d'action, métadonnées
                            mises en avant
           font-weight: 700 — page-title (h1), valeurs métriques mises en exergue
           font-weight: 800 — RÉSERVÉ aux logos / branding Inter (filia logo) — éviter
                            ailleurs

           Couleurs texte :
           color: #1E2A35 (text-dark)   — corps principal
           color: var(--text-light)     — secondaire / labels uppercase
           color: var(--primary)        — accent / liens / titres bleus
           NE PAS utiliser #000 noir pur — utiliser #1E2A35.
           ======================================================================== */
        :root {
            --primary: #488CBC;
            --primary-dark: #3a7ab0;
            --primary-light: #e8f4fd;
            --secondary: #00798C;
            --success: #43C59E;
            --warning: #F4A261;
            --coral: #F07167;
            --background: #FFFFFF;
            --surface: #F7FAFC;
            --white: #FFFFFF;
            --text-dark: #1A202C;
            --text-light: #718096;
            --border: #EDF2F7;
            --sidebar-width: 270px;
            --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
            --shadow-md: 0 4px 16px rgba(72,140,188,0.08);
            --shadow-lg: 0 8px 30px rgba(72,140,188,0.12);
        }

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

        body {
            font-family: 'Nunito', sans-serif;
            background: var(--background);
            color: var(--text-dark);
            min-height: 100vh;
        }

        /* ==========================================
           LOGIN PAGE
           ========================================== */
        .login-page {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #5a9fd4 0%, var(--primary) 50%, var(--primary-dark) 100%);
        }

        .login-card {
            background: white;
            border-radius: 24px;
            padding: 48px 40px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.15);
        }

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

        .login-logo img { height: 52px; width: auto; }
        .login-logo span { font-size: 1.8rem; font-weight: 800; color: var(--primary); }

        .login-subtitle {
            text-align: center;
            color: var(--text-light);
            font-size: 0.95rem;
            margin-bottom: 32px;
        }

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

        .form-group label {
            display: block;
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 6px;
        }

        .form-group input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.95rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .form-group input:focus { border-color: var(--primary); }

        .login-btn {
            width: 100%;
            padding: 14px;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 12px;
            font-family: 'Nunito', sans-serif;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s;
            margin-top: 8px;
        }

        .login-btn:hover { background: var(--primary-dark); }
        .login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

        .login-error {
            background: rgba(240, 113, 103, 0.1);
            color: var(--coral);
            padding: 10px 14px;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 600;
            margin-bottom: 16px;
            display: none;
        }

        .login-back {
            display: block;
            text-align: center;
            margin-top: 20px;
            color: var(--text-light);
            font-size: 0.85rem;
            text-decoration: none;
        }

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

        /* ==========================================
           DASHBOARD LAYOUT
           ========================================== */
        .app-layout {
            display: none;
            min-height: 100vh;
        }

        .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: var(--sidebar-width);
            height: 100vh;
            background: linear-gradient(180deg, #1a3a5c 0%, #0d2740 100%);
            display: flex;
            flex-direction: column;
            z-index: 100;
        }

        .sidebar-brand {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 28px 24px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-brand img { height: 32px; width: auto; }
        .sidebar-brand span { font-size: 1.4rem; font-weight: 800; color: white; }

        .sidebar-nav {
            flex: 1;
            padding: 20px 14px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 13px 18px;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 600;
            font-size: 0.9rem;
            color: rgba(255,255,255,0.6);
            border: none;
            background: none;
            width: 100%;
            text-align: left;
            font-family: 'Nunito', sans-serif;
        }

        .nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
        .nav-item.active { background: rgba(72,140,188,0.3); color: white; }
        .nav-item .material-symbols-outlined { font-size: 22px; }

        .sidebar-footer {
            padding: 16px 14px;
            border-top: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-user {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            margin-bottom: 8px;
        }

        .sidebar-user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: rgba(72,140,188,0.3);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .sidebar-user-avatar .material-symbols-outlined { font-size: 20px; color: rgba(255,255,255,0.85); }

        .sidebar-user-info { flex: 1; min-width: 0; }
        .sidebar-user-name { font-size: 0.85rem; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .sidebar-user-role { font-size: 0.75rem; color: rgba(255,255,255,0.5); }

        .logout-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 10px 16px;
            border: none;
            background: none;
            border-radius: 10px;
            cursor: pointer;
            font-family: 'Nunito', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            color: rgba(240, 113, 103, 0.85);
            transition: background 0.2s;
        }

        .logout-btn:hover { background: rgba(240, 113, 103, 0.1); }
        .logout-btn .material-symbols-outlined { font-size: 20px; }

        /* Main Content */
        .main-content {
            margin-left: var(--sidebar-width);
            padding: 36px 44px;
            min-height: 100vh;
            background: var(--background);
        }

        .page-header {
            margin-bottom: 32px;
        }

        .page-title {
            font-size: 1.7rem;
            font-weight: 800;
            color: var(--text-dark);
            margin-bottom: 4px;
        }

        .page-subtitle {
            font-size: 0.95rem;
            color: var(--text-light);
        }

        /* ==========================================
           DASHBOARD CARDS
           ========================================== */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 32px;
        }
        .stats-grid-5 { grid-template-columns: repeat(5, 1fr); }

        .stat-card {
            background: white;
            border-radius: 16px;
            padding: 24px;
            box-shadow: var(--shadow-md);
            border: none;
            transition: transform 0.15s, box-shadow 0.15s;
        }

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

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

        .stat-card-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .stat-card-icon .material-symbols-outlined { font-size: 24px; }
        .stat-card-icon.blue { background: var(--primary-light); }
        .stat-card-icon.blue .material-symbols-outlined { color: var(--primary); }
        .stat-card-icon.green { background: rgba(67, 197, 158, 0.15); }
        .stat-card-icon.green .material-symbols-outlined { color: var(--success); }
        .stat-card-icon.coral { background: rgba(240, 113, 103, 0.15); }
        .stat-card-icon.coral .material-symbols-outlined { color: var(--coral); }
        .stat-card-icon.yellow { background: rgba(244, 211, 94, 0.2); }
        .stat-card-icon.yellow .material-symbols-outlined { color: #c49a1a; }

        .stat-card-value {
            font-size: 2rem;
            font-weight: 800;
            color: var(--text-dark);
            line-height: 1;
        }

        .stat-card-label {
            font-size: 0.85rem;
            color: var(--text-light);
            margin-top: 4px;
        }

        /* ==========================================
           MON AGENCE — REDESIGN
           ========================================== */
        .ag-welcome {
            margin-bottom: 28px;
        }
        .ag-welcome-greeting {
            font-size: 0.9rem;
            color: var(--text-light);
            font-weight: 500;
        }
        .ag-welcome-name {
            font-family: 'Inter', sans-serif;
            font-size: 1.4rem;
            font-weight: 800;
            letter-spacing: 0.5px;
            color: #488CBC;
        }

        /* Metric tiles row */
        .ag-metrics {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 14px;
            margin-bottom: 28px;
        }
        .ag-metric {
            border-radius: 16px;
            padding: 20px 16px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        .ag-metric::before {
            content: "";
            position: absolute;
            top: -20px; right: -20px;
            width: 60px; height: 60px;
            border-radius: 50%;
            background: rgba(255,255,255,0.15);
        }
        .ag-metric-icon {
            width: 40px; height: 40px;
            border-radius: 12px;
            background: rgba(255,255,255,0.25);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 10px;
        }
        .ag-metric-icon .material-symbols-outlined { font-size: 22px; color: white; }
        .ag-metric-value {
            font-size: 2rem;
            font-weight: 800;
            color: white;
            line-height: 1;
        }
        .ag-metric-label {
            font-size: 0.75rem;
            color: rgba(255,255,255,0.85);
            font-weight: 600;
            margin-top: 4px;
        }
        .ag-metric.m1 { background: linear-gradient(135deg, #5a9fd4, var(--primary-dark)); }
        .ag-metric.m2 { background: linear-gradient(135deg, #3d8db8, #2a7a9e); }
        .ag-metric.m3 { background: linear-gradient(135deg, #1aa3b5, var(--secondary)); }
        .ag-metric.m4 { background: linear-gradient(135deg, #20a89a, #188a7e); }
        .ag-metric.m5 { background: linear-gradient(135deg, #3cb896, #2a9e7e); }

        /* Incidents section */
        .ag-incidents { margin-bottom: 28px; }
        .ag-section-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .ag-section-title .material-symbols-outlined { font-size: 20px; }
        .ag-incidents-grid {
            column-count: 2;
            column-gap: 10px;
        }
        .ag-incidents-grid .ag-incident-group {
            break-inside: avoid;
            margin-bottom: 10px;
        }
        .ag-incident-group {
            background: white;
            border-radius: 12px;
            border-left: 3px solid rgba(155,89,182,0.4);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
        }
        .ag-incident-group-header {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 18px;
            cursor: pointer;
            user-select: none;
        }
        .ag-incident-group-header:hover { background: rgba(0,0,0,0.015); }
        .ag-incident-group-patient {
            font-weight: 600;
            font-size: 0.88rem;
            color: var(--text-dark);
            flex: 1;
        }
        .ag-incident-group-count {
            font-size: 0.72rem;
            font-weight: 600;
            color: #9B59B6;
            background: rgba(155,89,182,0.1);
            width: 22px; height: 22px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .ag-incident-group-chevron {
            color: var(--text-light);
            transition: transform 0.2s;
        }
        .ag-incident-group.open .ag-incident-group-chevron { transform: rotate(180deg); }
        .ag-incident-group-body {
            display: none;
            border-top: 1px solid var(--border);
        }
        .ag-incident-group.open .ag-incident-group-body { display: block; }
        .ag-incident-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 18px;
            border-bottom: 1px solid var(--border);
        }
        .ag-incident-item:last-child { border-bottom: none; }
        .ag-incident-item-icon {
            width: 32px; height: 32px;
            border-radius: 8px;
            background: rgba(155,89,182,0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .ag-incident-item-icon .material-symbols-outlined { font-size: 16px; color: #9B59B6; }
        .ag-incident-item-body { flex: 1; min-width: 0; }
        .ag-incident-item-type {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text-dark);
        }
        .ag-incident-item-desc {
            font-size: 0.82rem; color: var(--text-light); margin-top: 2px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .ag-incident-item-meta { font-size: 0.72rem; color: var(--text-light); margin-top: 2px; }
        .ag-no-incidents {
            background: white;
            border-radius: 12px;
            padding: 32px;
            text-align: center;
            color: var(--text-light);
            box-shadow: var(--shadow-sm);
        }
        .ag-no-incidents .material-symbols-outlined { font-size: 40px; color: var(--success); display: block; margin-bottom: 8px; }

        /* Agency info bar */
        .ag-info-bar {
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-md);
            padding: 20px 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            flex-wrap: wrap;
        }
        .ag-info-items { display: flex; gap: 28px; flex-wrap: wrap; flex: 1; }
        .ag-info-item { display: flex; align-items: center; gap: 8px; }
        .ag-info-item .material-symbols-outlined { font-size: 18px; color: var(--secondary); }
        .ag-info-item-text {}
        .ag-info-item-label { font-size: 0.68rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
        .ag-info-item-value { font-size: 0.88rem; color: var(--text-dark); font-weight: 600; }

        /* ==========================================
           TABLES & LISTS
           ========================================== */
        .card {
            background: white;
            border-radius: 16px;
            box-shadow: var(--shadow-md);
            border: none;
            margin-bottom: 24px;
        }

        .card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 22px 28px;
            border-bottom: 1px solid var(--border);
        }

        .card-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-dark);
        }

        .card-body { padding: 0; }

        .btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            border-radius: 10px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            border: none;
            transition: all 0.2s;
        }

        .btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; box-shadow: 0 2px 8px rgba(72,140,188,0.3); }
        .btn-primary:hover { box-shadow: 0 4px 14px rgba(72,140,188,0.4); transform: translateY(-1px); }
        .btn-outline { background: white; color: var(--primary); border: 2px solid var(--primary); }
        .btn-outline:hover { background: var(--primary-light); }
        .btn-danger { background: rgba(240, 113, 103, 0.1); color: var(--coral); }
        .btn-danger:hover { background: rgba(240, 113, 103, 0.2); }
        .btn-success { background: rgba(67, 197, 158, 0.15); color: var(--success); }
        .btn-sm { padding: 6px 12px; font-size: 0.8rem; }
        .btn .material-symbols-outlined { font-size: 18px; }

        .table-container { overflow-x: auto; }

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

        table th {
            text-align: left;
            padding: 14px 28px;
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: #ffffff;
            background: #1a3a5c;
            border-bottom: none;
        }
        table thead tr th:first-child { border-radius: 8px 0 0 0; }
        table thead tr th:last-child { border-radius: 0 8px 0 0; }

        table td {
            padding: 16px 28px;
            font-size: 0.9rem;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
        }

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

        table tr:hover td { background: var(--primary-light); }

        .badge {
            display: inline-flex;
            align-items: center;
            padding: 4px 10px;
            border-radius: 50px;
            font-size: 0.75rem;
            font-weight: 700;
        }

        .badge-blue { background: var(--primary-light); color: var(--primary); }
        .badge-green { background: rgba(67, 197, 158, 0.15); color: #2a9d6f; }
        .badge-yellow { background: rgba(244, 211, 94, 0.2); color: #a17e10; }
        .badge-coral { background: rgba(240, 113, 103, 0.15); color: var(--coral); }
        .badge-grey { background: rgba(113, 128, 150, 0.15); color: var(--text-light); }
        .badge-teal { background: rgba(0, 121, 140, 0.12); color: var(--secondary); }

        .empty-state {
            text-align: center;
            padding: 48px 24px;
            color: var(--text-light);
        }

        .empty-state .material-symbols-outlined { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
        .empty-state p { font-size: 0.95rem; }

        .actions-cell { display: flex; gap: 6px; align-items: center; }

        /* ==========================================
           MODAL
           ========================================== */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(13,39,64,0.5);
            backdrop-filter: blur(4px);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

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

        .modal {
            background: white;
            border-radius: 20px;
            width: 100%;
            max-width: 480px;
            padding: 32px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.2);
        }

        .modal h3 {
            font-size: 1.2rem;
            font-weight: 800;
            color: var(--text-dark);
            margin-bottom: 20px;
        }

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

        .modal .form-group select {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.95rem;
            outline: none;
            background: white;
            cursor: pointer;
        }

        .modal .form-group select:focus { border-color: var(--primary); }

        .modal-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            margin-top: 24px;
        }

        /* ==========================================
           TOAST
           ========================================== */
        .toast {
            position: fixed;
            bottom: 32px;
            right: 32px;
            padding: 14px 24px;
            border-radius: 12px;
            font-size: 0.9rem;
            font-weight: 600;
            color: white;
            z-index: 2000;
            box-shadow: 0 8px 30px rgba(0,0,0,0.15);
            transform: translateY(100px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .toast.visible { transform: translateY(0); opacity: 1; }
        .toast.success { background: var(--success); }
        .toast.error { background: var(--coral); }

        /* ==========================================
           PAGE SECTIONS (hidden by default)
           ========================================== */
        .page-section { display: none; }
        .page-section.active { display: block; }

        /* Loading spinner */
        .spinner {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255,255,255,0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.6s linear infinite;
        }

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

        .loading-page {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 300px;
            color: var(--text-light);
            gap: 12px;
        }

        .loading-page .spinner {
            border-color: var(--border);
            border-top-color: var(--primary);
        }

        /* Invitation link box */
        .invite-link-box {
            display: flex;
            align-items: center;
            gap: 8px;
            background: var(--surface);
            padding: 10px 14px;
            border-radius: 10px;
            margin-top: 12px;
        }

        .invite-link-box input {
            flex: 1;
            border: none;
            background: none;
            font-family: 'Nunito', sans-serif;
            font-size: 0.85rem;
            color: var(--text-dark);
            outline: none;
        }

        .invite-link-box .btn { flex-shrink: 0; }

        /* Patient expand row */
        .patient-families {
            background: var(--surface);
            padding: 16px 24px 16px 48px;
        }

        .family-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 0;
        }

        .family-item + .family-item { border-top: 1px solid var(--border); }

        /* ==========================================
           DASHBOARD SECTIONS (alerts, team, etc.)
           ========================================== */
        .section-title {
            font-size: 1.15rem;
            font-weight: 800;
            color: var(--text-dark);
            margin-bottom: 16px;
            margin-top: 8px;
        }

        .alerts-container {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 28px;
        }

        .alert-card {
            display: flex;
            align-items: center;
            background: white;
            border-radius: 14px;
            border-left: 4px solid;
            box-shadow: var(--shadow-sm);
            padding: 16px 20px;
            gap: 14px;
        }

        .alert-card .material-symbols-outlined { font-size: 26px; flex-shrink: 0; }
        .alert-card-content { flex: 1; }

        .alert-card-title {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--text-dark);
        }

        .alert-card-subtitle {
            font-size: 0.85rem;
            color: var(--text-light);
            margin-top: 2px;
        }

        .alert-warning {
            border-color: var(--warning);
            background: rgba(244, 211, 94, 0.08);
        }

        .alert-warning .material-symbols-outlined { color: var(--warning); }

        .alert-danger {
            border-color: var(--coral);
            background: rgba(240, 113, 103, 0.08);
        }

        .alert-danger .material-symbols-outlined { color: var(--coral); }

        /* Team activity */
        .team-activity-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 14px;
            margin-bottom: 28px;
        }

        .team-member-card {
            display: flex;
            align-items: center;
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
            padding: 16px 20px;
            gap: 14px;
            transition: box-shadow 0.15s, transform 0.15s;
        }

        .team-member-card:hover {
            box-shadow: var(--shadow-md);
            transform: translateY(-1px);
        }

        .team-member-icon {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .team-member-icon .material-symbols-outlined { font-size: 22px; color: var(--primary); }
        .team-member-info { flex: 1; min-width: 0; }
        .team-member-name { font-size: 0.95rem; font-weight: 700; color: var(--primary); }
        .team-member-role { font-size: 0.8rem; color: var(--text-light); }

        .team-member-stats {
            display: flex;
            gap: 16px;
            flex-shrink: 0;
        }

        .team-member-stat { text-align: center; }

        .team-member-stat-number {
            font-size: 1.2rem;
            font-weight: 800;
            color: var(--primary);
            line-height: 1;
        }

        .team-member-stat-number.highlight { color: var(--success); }

        .team-member-stat-label {
            font-size: 0.7rem;
            color: var(--text-light);
            margin-top: 2px;
        }

        /* Visit/incident list items */
        .visit-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 28px;
        }

        .visit-item {
            display: flex;
            align-items: center;
            background: white;
            border-radius: 12px;
            box-shadow: var(--shadow-sm);
            padding: 14px 18px;
            gap: 14px;
        }

        .visit-item-icon {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .visit-item-icon .material-symbols-outlined { font-size: 20px; color: white; }
        .visit-item-info { flex: 1; min-width: 0; }

        .visit-item-patient {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--primary);
        }

        .visit-item-meta {
            font-size: 0.82rem;
            color: var(--text-light);
            margin-top: 2px;
        }

        .visit-item-label {
            font-size: 0.8rem;
            font-weight: 700;
            margin-top: 2px;
        }

        .visit-yellow {
            border-color: var(--warning);
            background: rgba(244, 211, 94, 0.06);
        }

        .visit-red {
            border-color: var(--coral);
            background: rgba(240, 113, 103, 0.06);
        }

        .visit-purple {
            border-color: #9B59B6;
            background: rgba(155, 89, 182, 0.06);
        }

        .dashboard-empty-state {
            text-align: center;
            padding: 32px 24px;
            color: var(--text-light);
        }

        .dashboard-empty-state .material-symbols-outlined {
            font-size: 44px;
            margin-bottom: 8px;
            opacity: 0.35;
        }

        .dashboard-empty-state p {
            font-size: 0.9rem;
        }

        /* ==========================================
           PATIENTÈLE
           ========================================== */
        .patient-detail-header {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 24px;
        }
        .patient-detail-header h1 {
            font-size: 1.6rem;
            font-weight: 800;
            color: var(--text-dark);
        }
        .patient-tabs {
            display: flex;
            margin-bottom: 28px;
            gap: 0;
            overflow-x: auto;
            scrollbar-width: none;
            background: #1a3a5c;
            border-radius: 8px;
            padding: 0;
        }
        .patient-tabs::-webkit-scrollbar { display: none; }
        .patient-tab {
            padding: 12px 22px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.8rem;
            font-weight: 700;
            color: rgba(255,255,255,0.6);
            background: none;
            border: none;
            border-radius: 0;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .patient-tab:first-child { border-radius: 8px 0 0 8px; }
        .patient-tab:last-child { border-radius: 0 8px 8px 0; }
        .patient-tab:hover { color: #ffffff; background: rgba(255,255,255,0.1); }
        .patient-tab.active { color: #ffffff; background: rgba(255,255,255,0.18); }
        .patient-tab-content { display: none; }
        .patient-tab-content.active { display: block; }

        /* ==========================================
           AUTONOMIE TAB
           ========================================== */
        .autonomie-scores {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
            margin-bottom: 28px;
        }
        .autonomie-score-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 16px rgba(72,140,188,0.08);
            padding: 24px;
            text-align: center;
        }
        .autonomie-score-circle {
            width: 72px;
            height: 72px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 12px;
        }
        .autonomie-score-circle span {
            color: white;
            font-size: 1.5rem;
            font-weight: 800;
        }
        .autonomie-score-label {
            font-size: 0.8rem;
            font-weight: 700;
            color: #1E2A35;
            margin-bottom: 4px;
        }
        .autonomie-score-sublabel {
            font-size: 0.75rem;
            color: #8A9BAD;
            font-weight: 600;
        }
        .autonomie-radar-wrap {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 16px rgba(72,140,188,0.08);
            padding: 28px;
            margin-bottom: 28px;
            text-align: center;
        }
        .autonomie-radar-title {
            font-size: 0.95rem;
            font-weight: 800;
            color: #1E2A35;
            margin-bottom: 20px;
        }
        .autonomie-section-title {
            font-size: 0.82rem;
            font-weight: 700;
            color: #8A9BAD;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 12px;
        }
        .autonomie-var-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 8px;
            margin-bottom: 24px;
        }
        .autonomie-var-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 14px;
            background: #F7F9FB;
            border-radius: 10px;
            border: 1px solid #E4EEF5;
        }
        .autonomie-var-name {
            font-size: 0.85rem;
            font-weight: 600;
            color: #1E2A35;
        }
        .autonomie-var-badge {
            display: inline-block;
            padding: 3px 12px;
            border-radius: 20px;
            font-size: 0.78rem;
            font-weight: 700;
        }
        .autonomie-var-badge.badge-a { color: #43C59E; background: #EDFAF5; }
        .autonomie-var-badge.badge-b { color: #F4A261; background: #FEF3E8; }
        .autonomie-var-badge.badge-c { color: #F07167; background: #FEEDED; }
        .autonomie-disclaimer {
            font-size: 0.78rem;
            color: #8A9BAD;
            font-style: italic;
            text-align: center;
            margin-top: 8px;
            padding: 16px;
            background: #F7F9FB;
            border-radius: 10px;
            border: 1px solid #E4EEF5;
        }

        .search-box { margin-bottom: 20px; }
        .search-box input {
            width: 100%;
            max-width: 400px;
            padding: 10px 16px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.9rem;
            outline: none;
            transition: border-color 0.2s;
        }
        .search-box input:focus { border-color: var(--primary); }

        .eval-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-bottom: 24px;
        }
        .eval-section {
            background: white;
            border-radius: 14px;
            box-shadow: 0 4px 20px rgba(26,58,92,0.08);
            padding: 0;
            transition: all 0.3s;
            overflow: hidden;
        }
        .eval-section:hover { box-shadow: 0 8px 30px rgba(26,58,92,0.14); transform: translateY(-2px); }
        .eval-section h3 {
            font-size: 0.88rem;
            font-weight: 800;
            color: #ffffff;
            margin: 0;
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 8px;
            background: #1a3a5c;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .eval-section h3 .material-symbols-outlined { font-size: 18px; color: rgba(255,255,255,0.7); }
        .eval-section-body { padding: 16px 20px; }
        .eval-field {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 0;
            border-bottom: 1px solid #f0f2f5;
        }
        .eval-field:last-child { border-bottom: none; }
        .eval-field-label { font-size: 0.85rem; color: var(--text-light); font-weight: 600; }
        .eval-field-value { font-size: 0.85rem; font-weight: 700; color: var(--text-dark); }

        .incident-card {
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
            padding: 18px 20px;
            margin-bottom: 12px;
        }
        .incident-card.active-incident { box-shadow: 0 2px 12px rgba(155, 89, 182, 0.15); background: rgba(155, 89, 182, 0.04); border-left: 3px solid #9B59B6; }
        .incident-card.resolved { opacity: 0.7; }
        .incident-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
        .incident-card-header .material-symbols-outlined { font-size: 22px; color: #9B59B6; }
        .incident-card-title { font-size: 0.95rem; font-weight: 700; color: var(--text-dark); }
        .incident-card-meta { font-size: 0.82rem; color: var(--text-light); margin-bottom: 4px; }
        .incident-card-desc { font-size: 0.9rem; color: var(--text-dark); margin-bottom: 10px; }
        .incident-card-actions { display: flex; gap: 8px; }

        .plaie-card {
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
            padding: 18px 20px;
            margin-bottom: 12px;
        }
        .plaie-card.active-plaie { box-shadow: 0 2px 12px rgba(240, 113, 103, 0.15); background: rgba(240, 113, 103, 0.04); border-left: 3px solid var(--coral); }
        .plaie-card.cicatrisee { box-shadow: 0 2px 12px rgba(67, 197, 158, 0.15); background: rgba(67, 197, 158, 0.04); border-left: 3px solid var(--success); }
        .plaie-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
        .plaie-card-title { font-size: 0.95rem; font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
        .plaie-card-meta { font-size: 0.82rem; color: var(--text-light); margin-bottom: 10px; }
        .plaie-card-actions { display: flex; gap: 8px; }

        .ordonnance-card {
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
            padding: 18px 20px;
            margin-bottom: 12px;
        }
        .ordonnance-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
        .ordonnance-card-title { font-size: 0.95rem; font-weight: 700; color: var(--text-dark); }
        .ordonnance-card-meta { font-size: 0.82rem; color: var(--text-light); margin-bottom: 10px; }

        /* Visite cards */
        .visite-card {
            background: white;
            border-radius: 14px;
            box-shadow: var(--shadow-sm);
            margin-bottom: 10px;
            overflow: hidden;
            transition: box-shadow 0.15s;
        }
        .visite-card:hover { box-shadow: var(--shadow-md); }
        .visite-card-header {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 16px 20px;
            cursor: pointer;
            user-select: none;
        }
        .visite-card-dot {
            width: 10px; height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .visite-card-date {
            font-weight: 700;
            font-size: 0.9rem;
            color: var(--text-dark);
            min-width: 140px;
        }
        .visite-card-soignant {
            font-size: 0.85rem;
            color: var(--text-light);
            flex: 1;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .visite-card-badges { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
        .visite-card-chevron {
            color: var(--text-light);
            transition: transform 0.2s;
            flex-shrink: 0;
        }
        .visite-card.open .visite-card-chevron { transform: rotate(180deg); }
        .visite-card-body {
            display: none;
            padding: 0 20px 20px;
            border-top: 1px solid var(--border);
        }
        .visite-card.open .visite-card-body { display: block; }
        .cr-section { margin-top: 16px; }
        .cr-section-title {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--primary);
            text-transform: uppercase;
            letter-spacing: 0.4px;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .cr-section-title .material-symbols-outlined { font-size: 18px; }
        .cr-pills { display: flex; flex-wrap: wrap; gap: 6px; }
        .cr-pill {
            background: var(--primary-light);
            color: var(--primary);
            font-size: 0.8rem;
            font-weight: 500;
            padding: 4px 10px;
            border-radius: 8px;
        }
        .cr-pill.green { background: rgba(67,197,158,0.12); color: #2d9d78; }
        .cr-pill.yellow { background: rgba(244,211,94,0.2); color: #9a7b0a; }
        .cr-pill.coral { background: rgba(240,113,103,0.12); color: #c0392b; }
        /* Category row — icon + label + pills inline */
        .cr-category-row {
            display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap;
        }
        .cr-category-label {
            font-size: 0.85rem; font-weight: 700; color: var(--text-dark); min-width: 100px; flex-shrink: 0;
        }
        /* Chips for multi-select */
        .chips-container { display: flex; flex-wrap: wrap; gap: 8px; }
        .chip {
            display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px;
            font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; user-select: none; border: 1.5px solid var(--border);
        }
        .chip.active { background: var(--primary); color: white; border-color: var(--primary); }
        .chip:not(.active) { background: white; color: var(--text-dark); }
        .chip:not(.active):hover { border-color: var(--primary); color: var(--primary); }
        .chip .chip-remove { font-size: 14px; margin-left: 2px; opacity: 0.7; }
        .chip .chip-remove:hover { opacity: 1; }
        .cr-field { display: flex; gap: 8px; margin-bottom: 6px; font-size: 0.88rem; }
        .cr-field-label { color: var(--text-light); font-weight: 500; min-width: 100px; }
        .cr-field-value { color: var(--text-dark); font-weight: 600; }
        .cr-notes {
            background: #f8f9fb;
            border-radius: 10px;
            padding: 12px 16px;
            font-size: 0.88rem;
            color: var(--text-dark);
            line-height: 1.5;
            margin-top: 8px;
            white-space: pre-wrap;
        }

        .modal-large { max-width: 720px; max-height: 85vh; overflow-y: auto; }

        .form-section {
            background: var(--surface);
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 16px;
        }
        .form-section-title {
            font-size: 0.95rem;
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 12px;
        }
        .form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

        .form-group textarea {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid var(--border);
            border-radius: 12px;
            font-family: 'Nunito', sans-serif;
            font-size: 0.95rem;
            outline: none;
            resize: vertical;
            min-height: 80px;
        }
        .form-group textarea:focus { border-color: var(--primary); }

        .checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border: 2px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
            transition: all 0.2s;
        }
        .checkbox-item.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
        .checkbox-item input[type="checkbox"] { display: none; }

        .suivi-timeline { padding: 16px 0; }
        .suivi-entry { border-left: 3px solid var(--primary); padding-left: 20px; padding-bottom: 20px; position: relative; }
        .suivi-entry::before { content: ''; position: absolute; left: -7px; top: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--primary); }
        .suivi-entry:last-child { border-left-color: transparent; padding-bottom: 0; }
        .suivi-date { font-size: 0.82rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
        .suivi-detail { font-size: 0.85rem; color: var(--text-dark); margin-bottom: 2px; }

        table .clickable-row { cursor: pointer; }
        table .clickable-row:hover td { background: var(--primary-light); }

        /* ==========================================
           RESPONSIVE
           ========================================== */
        @media (max-width: 1100px) {
            .stats-grid { grid-template-columns: repeat(2, 1fr); }
            .eval-grid { grid-template-columns: repeat(2, 1fr); }
            .ag-metrics { grid-template-columns: repeat(3, 1fr); }
        }

        @media (max-width: 768px) {
            .sidebar { display: none; }
            .main-content { margin-left: 0; padding: 20px 16px; }
            .stats-grid { grid-template-columns: 1fr; }
            .eval-grid { grid-template-columns: 1fr; }
            .form-row { grid-template-columns: 1fr; }
            .ag-metrics { grid-template-columns: repeat(2, 1fr); }
            .ag-incidents-grid { column-count: 1; }
            .ag-info-bar { flex-direction: column; align-items: flex-start; }
            .ag-info-items { flex-direction: column; gap: 12px; }
            .modal-large { max-width: 95vw !important; }
            table { font-size: 13px; }
            td, th { padding: 8px 10px !important; }
        }

        /* ==========================================
           PLANNING HEBDOMADAIRE (V1)
           ========================================== */
        .planning-header {
            display: flex; justify-content: space-between; align-items: flex-end;
            margin-bottom: 18px; gap: 16px; flex-wrap: wrap;
        }
        .planning-week-nav {
            display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
        }
        .planning-week-nav .btn {
            border-radius: 10px;
            background: #fff;
            border: 1.5px solid #cdd9e3;
            color: #1E2A35 !important;
            font-weight: 500 !important;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
            transition: all 0.15s ease;
        }
        .planning-week-nav .btn:hover {
            border-color: var(--primary);
            color: var(--primary) !important;
            box-shadow: 0 2px 8px rgba(72,140,188,0.12);
            transform: translateY(-1px);
        }
        #section-planning.agenda-dark .planning-week-nav .btn {
            background: rgba(255,255,255,0.06);
            border-color: rgba(255,255,255,0.12);
            color: #E5E7EB;
            box-shadow: none;
        }
        #section-planning.agenda-dark .planning-week-nav .btn:hover {
            background: rgba(72,140,188,0.2);
            border-color: var(--primary);
            color: #fff;
        }
        .planning-layout {
            display: grid; grid-template-columns: 160px 1fr; gap: 16px;
            background: #fff; border: 1px solid #E4EEF5; border-radius: 10px;
            padding: 14px; min-height: 600px;
        }
        .planning-sidebar {
            border-right: 1px solid #E4EEF5; padding-right: 12px;
            max-height: calc(100vh - 220px); overflow-y: auto;
        }
        .planning-sidebar-title {
            font-weight: 600; font-size: 13px; color: #5a6b7a;
            text-transform: uppercase; letter-spacing: 0.5px;
            margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #E4EEF5;
        }
        .planning-patient-card {
            background: #fff;
            border: 2px solid var(--patient-color, #488CBC);
            border-radius: 8px;
            padding: 8px 10px; margin-bottom: 6px; cursor: grab;
            font-size: 13px; color: #1E2A35;
            box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
            transition: transform 0.12s ease, box-shadow 0.12s ease;
            user-select: none;
        }
        .planning-patient-card:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
        }
        .planning-patient-card:active { cursor: grabbing; opacity: 0.7; }
        .planning-patient-card .pc-name { font-weight: 600; color: var(--patient-color, #1E2A35); }
        .planning-patient-card .pc-meta { font-size: 11px; color: #7a8a99; margin-top: 2px; }

        .planning-grid-wrap { position: relative; overflow: auto; max-height: calc(100vh - 220px); }
        .planning-grid {
            display: grid;
            grid-template-columns: 50px repeat(7, 1fr);
            grid-auto-rows: 28px;
            border-top: 1px solid #E4EEF5; border-left: 1px solid #E4EEF5;
            min-width: 720px;
        }
        .pg-cell { border-right: 1px solid #E4EEF5; border-bottom: 1px solid #E4EEF5; position: relative; }
        .pg-day-header {
            background: #F5FAFD; padding: 6px 8px; text-align: center;
            font-size: 12px; color: #2c3e50; font-weight: 600;
            border-right: 1px solid #E4EEF5; border-bottom: 1px solid #E4EEF5;
            position: sticky; top: 0; z-index: 3;
        }
        .pg-day-header.today { background: #E9C46A; color: #fff; }
        .pg-day-header.pg-corner { background: #fff; }
        .pg-day-header .pg-day-name { display: block; font-size: 11px; text-transform: uppercase; opacity: 0.8; }
        .pg-day-header .pg-day-num { display: block; font-size: 14px; }
        .pg-hour-label {
            font-size: 11px; color: #7a8a99; text-align: right; padding: 2px 6px 0 0;
            border-right: 1px solid #E4EEF5; border-bottom: 1px dashed #EEF3F7;
            background: #fff;
        }
        .pg-slot { border-bottom: 1px dashed #EEF3F7; }
        .pg-slot.hour-line { border-bottom: 1px solid #E4EEF5; }
        .pg-slot.drop-target { background: rgba(72, 140, 188, 0.15); }
        .pg-day-col { position: relative; }
        .pg-day-col.today-col { background: rgba(233, 196, 106, 0.04); }

        .pg-visit {
            position: absolute; left: 2px; right: 2px;
            background: #fff;
            border: 2px solid var(--patient-color, #488CBC);
            color: #1E2A35;
            border-radius: 8px;
            padding: 16px 8px 6px; font-size: 12px; cursor: grab;
            overflow: hidden;
            user-select: none; z-index: 2;
        }
        .pg-visit:active { cursor: grabbing; opacity: 0.7; }
        .pg-visit .pgv-name { font-weight: 600; padding-right: 16px; line-height: 1.2; color: var(--patient-color, #1E2A35); }
        .pg-visit .pgv-time { font-size: 11px; color: #5a6b7a; margin-top: 2px; }
        .pg-visit .pgv-aux { font-size: 11px; color: #5a6b7a; margin-top: 2px; line-height: 1.15; }
        .pg-visit .pgv-aux.unassigned { font-style: italic; color: #7a8a99; }

        /* Filtres planning (patient + auxiliaire) — style Filia */
        .planning-filter-select {
            appearance: none;
            -webkit-appearance: none;
            padding: 10px 36px 10px 14px;
            border: 1.5px solid #cdd9e3;
            border-radius: 10px;
            background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23488CBC' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
            background-size: 12px;
            font-size: 14px;
            color: #1E2A35 !important;
            cursor: pointer;
            min-width: 180px;
            font-family: 'Nunito', sans-serif;
            font-weight: 500 !important;
            box-shadow: 0 1px 2px rgba(0,0,0,0.04);
            transition: all 0.15s ease;
        }
        .planning-filter-select option { color: #1E2A35; font-weight: 500; }
        .planning-filter-select:hover {
            border-color: var(--primary);
            box-shadow: 0 2px 8px rgba(72,140,188,0.12);
        }
        .planning-filter-select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(72,140,188,0.15);
        }
        #section-planning.agenda-dark .planning-filter-select {
            background-color: rgba(255,255,255,0.06);
            border-color: rgba(255,255,255,0.12);
            color: #E5E7EB;
            box-shadow: none;
        }
        #section-planning.agenda-dark .planning-filter-select option {
            background: #1F2937;
            color: #E5E7EB;
        }
        #section-planning.agenda-dark .planning-filter-select:hover,
        #section-planning.agenda-dark .planning-filter-select:focus {
            border-color: var(--primary);
            background-color: rgba(72,140,188,0.1);
        }

        /* Modal édition visite — style Filia */
        .vem-overlay {
            position: fixed; inset: 0; z-index: 10002;
            background: rgba(30, 42, 53, 0.55);
            backdrop-filter: blur(4px);
            display: flex; align-items: center; justify-content: center;
            padding: 20px;
            animation: vemFadeIn 0.2s ease;
        }
        @keyframes vemFadeIn { from { opacity: 0; } to { opacity: 1; } }
        @keyframes vemSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        .vem-card {
            background: #fff;
            border-radius: 16px;
            padding: 0;
            max-width: 460px;
            width: 100%;
            box-shadow: 0 20px 60px rgba(0,0,0,0.25);
            animation: vemSlideUp 0.25s ease;
            overflow: hidden;
        }
        .vem-header {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: #fff;
            padding: 18px 22px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .vem-header h2 {
            margin: 0;
            font-size: 17px;
            font-family: 'Nunito', sans-serif;
            font-weight: 700;
        }
        .vem-close {
            background: rgba(255,255,255,0.18);
            border: none;
            width: 30px; height: 30px;
            border-radius: 50%;
            color: #fff;
            font-size: 18px;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: background 0.15s ease;
        }
        .vem-close:hover { background: rgba(255,255,255,0.3); }
        .vem-body {
            padding: 22px;
            display: flex; flex-direction: column; gap: 16px;
        }
        .vem-field { display: flex; flex-direction: column; gap: 6px; }
        .vem-label {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            font-weight: 700;
            color: var(--text-light);
        }
        .vem-input {
            appearance: none;
            -webkit-appearance: none;
            padding: 12px 38px 12px 14px;
            border: 1.5px solid var(--border);
            border-radius: 10px;
            background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23488CBC' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
            background-size: 12px;
            font-size: 14px;
            font-family: 'Nunito', sans-serif;
            color: var(--text-dark);
            font-weight: 600;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .vem-input:hover { border-color: var(--primary); }
        .vem-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(72,140,188,0.15);
        }
        .vem-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        .vem-footer {
            padding: 16px 22px;
            background: var(--surface);
            border-top: 1px solid var(--border);
            display: flex; justify-content: space-between; gap: 10px;
        }
        .vem-btn {
            padding: 11px 18px;
            border-radius: 10px;
            border: none;
            font-family: 'Nunito', sans-serif;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.15s ease;
            display: flex; align-items: center; gap: 6px;
        }
        .vem-btn-delete {
            background: rgba(240,113,103,0.1);
            color: var(--coral);
        }
        .vem-btn-delete:hover { background: rgba(240,113,103,0.2); }
        .vem-btn-cancel {
            background: var(--border);
            color: var(--text-light);
        }
        .vem-btn-cancel:hover { background: #d8e3ed; color: var(--text-dark); }
        .vem-btn-save {
            background: var(--primary);
            color: #fff;
            box-shadow: 0 2px 8px rgba(72,140,188,0.3);
        }
        .vem-btn-save:hover {
            background: var(--primary-dark);
            box-shadow: 0 4px 12px rgba(72,140,188,0.4);
            transform: translateY(-1px);
        }
        .vem-actions-right { display: flex; gap: 8px; }

        /* Auxiliaire popup */
        .pg-aux-popup {
            position: fixed; z-index: 10001; background: #fff;
            border: 1px solid #E4EEF5; border-radius: 8px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.15);
            padding: 14px; min-width: 240px;
            font-family: 'Nunito', sans-serif;
        }
        .pg-aux-popup .pap-label {
            font-size: 12px; color: #5a6b7a; font-weight: 600;
            margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px;
            font-family: inherit;
        }
        .pg-aux-popup select,
        .pg-aux-popup button {
            font-family: inherit;
        }
        .pg-aux-popup select {
            width: 100%; padding: 7px 10px; border: 1px solid #E4EEF5;
            border-radius: 6px; font-size: 13px; color: #2c3e50; background: #fff;
            margin-bottom: 12px;
        }
        .pg-aux-popup .pap-actions {
            display: flex; gap: 8px; justify-content: flex-end;
        }
        .pg-aux-popup .pap-actions .btn { font-size: 12px; padding: 6px 12px; }
        .pg-visit .pgv-close {
            position: absolute; top: 3px; right: 4px; width: 16px; height: 16px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; color: #999; background: transparent;
            font-size: 14px; line-height: 1;
            border-radius: 3px;
            transition: color 0.12s ease;
        }
        .pg-visit .pgv-close:hover { color: #F07167; }
        .pg-visit .pgv-resize {
            position: absolute; left: 0; right: 0; height: 6px;
            cursor: ns-resize;
            background: transparent;
            transition: background 0.12s ease;
        }
        .pg-visit .pgv-resize-top { top: 0; }
        .pg-visit .pgv-resize-bottom { bottom: 0; }
        .pg-visit:hover .pgv-resize { background: var(--patient-color, #488CBC); opacity: 0.4; }
        .pg-visit .pgv-resize:hover { opacity: 0.8; }

        .planning-empty-hint {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            color: #7a8a99; font-size: 14px; font-style: italic; text-align: center;
            pointer-events: none; max-width: 80%;
        }

        /* ============================================
           AGENDA DARK MODE — toggle via .agenda-dark sur #section-planning
           ============================================ */
        #section-planning.agenda-dark .planning-grid-wrap {
            background: #1F2937;
            border-radius: 12px;
            padding: 8px;
        }
        #section-planning.agenda-dark .planning-grid {
            border-top-color: rgba(255, 255, 255, 0.06);
            border-left-color: rgba(255, 255, 255, 0.06);
        }
        #section-planning.agenda-dark .pg-cell {
            border-right-color: rgba(255, 255, 255, 0.06);
            border-bottom-color: rgba(255, 255, 255, 0.06);
        }
        #section-planning.agenda-dark .pg-day-header {
            background: #111827;
            color: #E5E7EB;
            border-right-color: rgba(255, 255, 255, 0.08);
            border-bottom-color: rgba(255, 255, 255, 0.08);
        }
        #section-planning.agenda-dark .pg-day-header.today {
            background: #E9C46A;
            color: #1F2937;
        }
        #section-planning.agenda-dark .pg-day-header.pg-corner {
            background: #1F2937;
        }
        #section-planning.agenda-dark .planning-layout {
            background: #1F2937;
            border-color: rgba(255, 255, 255, 0.08);
        }
        #section-planning.agenda-dark .planning-sidebar {
            border-right-color: rgba(255, 255, 255, 0.08);
        }
        #section-planning.agenda-dark .planning-sidebar-title {
            color: #9CA3AF;
            border-bottom-color: rgba(255, 255, 255, 0.08);
        }
        #section-planning.agenda-dark .planning-patient-card {
            background: var(--patient-color, #488CBC);
            color: #fff;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        }
        #section-planning.agenda-dark .planning-patient-card:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }
        #section-planning.agenda-dark .planning-patient-card .pc-name {
            color: #fff;
        }
        #section-planning.agenda-dark .planning-patient-card .pc-meta {
            color: rgba(255, 255, 255, 0.85);
        }
        #section-planning.agenda-dark .pg-hour-label {
            background: #1F2937;
            color: #9CA3AF;
            border-right-color: rgba(255, 255, 255, 0.08);
            border-bottom-color: rgba(255, 255, 255, 0.05);
        }
        #section-planning.agenda-dark .pg-slot {
            border-bottom-color: rgba(255, 255, 255, 0.04);
        }
        #section-planning.agenda-dark .pg-slot.hour-line {
            border-bottom-color: rgba(255, 255, 255, 0.08);
        }
        #section-planning.agenda-dark .pg-slot.drop-target {
            background: rgba(233, 196, 106, 0.15);
            border: 1px dashed #E9C46A;
        }
        #section-planning.agenda-dark .pg-day-col.today-col {
            background: rgba(233, 196, 106, 0.06);
        }
        #section-planning.agenda-dark .pg-visit {
            background: var(--patient-color, #488CBC);
            color: #fff;
            border-color: var(--patient-color, #488CBC);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        }
        #section-planning.agenda-dark .pg-visit .pgv-name {
            color: #fff;
        }
        #section-planning.agenda-dark .pg-visit .pgv-time,
        #section-planning.agenda-dark .pg-visit .pgv-aux {
            color: rgba(255, 255, 255, 0.85);
        }
        #section-planning.agenda-dark .pg-visit .pgv-close {
            color: rgba(255, 255, 255, 0.7);
        }
        #section-planning.agenda-dark .pg-visit .pgv-close:hover {
            color: #fff;
        }
        #section-planning.agenda-dark .planning-empty-hint {
            color: #9CA3AF;
        }

        #dragBadge {
            position: fixed; display: none; z-index: 10000; pointer-events: none;
            background: #2c3e50; color: #fff; padding: 6px 10px; border-radius: 6px;
            font-size: 12px; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }
/* ============================================
   Impression du planning
   ============================================ */
@media print {
    body.printing-planning .sidebar,
    body.printing-planning .planning-week-nav,
    body.printing-planning .planning-sidebar,
    body.printing-planning .planning-empty-hint,
    body.printing-planning #dragBadge,
    body.printing-planning .toast {
        display: none !important;
    }
    body.printing-planning .planning-header {
        margin-bottom: 8px;
    }
    body.printing-planning .planning-layout {
        grid-template-columns: 1fr !important;
        background: #fff !important;
        border: none !important;
        padding: 0 !important;
    }
    body.printing-planning .planning-grid-wrap {
        max-height: none !important;
        overflow: visible !important;
    }
    body.printing-planning .app-layout {
        display: block !important;
    }
    body.printing-planning .main-content {
        padding: 0 !important;
    }
    body.printing-planning #section-planning.agenda-dark .planning-grid-wrap,
    body.printing-planning #section-planning.agenda-dark .planning-layout {
        background: #fff !important;
    }
    body.printing-planning #section-planning.agenda-dark .pg-day-header,
    body.printing-planning #section-planning.agenda-dark .pg-hour-label {
        background: #fff !important;
        color: #000 !important;
    }
    body.printing-planning #section-planning.agenda-dark .pg-visit {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid var(--patient-color, #488CBC) !important;
        box-shadow: none !important;
    }
    body.printing-planning #section-planning.agenda-dark .pg-visit .pgv-name {
        color: var(--patient-color, #1E2A35) !important;
    }
    body.printing-planning #section-planning.agenda-dark .pg-visit .pgv-time,
    body.printing-planning #section-planning.agenda-dark .pg-visit .pgv-aux {
        color: #5a6b7a !important;
    }
    body.printing-planning .pg-visit .pgv-close,
    body.printing-planning .pg-visit .pgv-resize {
        display: none !important;
    }
    @page { size: landscape; margin: 1cm; }
}

/* ============================================
   Allègement typographique global (toned down)
   ============================================ */
.page-title,
.ag-welcome-name,
.ag-metric-value,
.team-member-name,
.modal h3,
h1, h2, h3 {
    font-weight: 700 !important;
}
.btn, .nav-item, .sidebar-user-name,
.form-group label,
.ag-section-title,
.ag-info-item-label {
    font-weight: 600 !important;
}
.page-subtitle,
.sidebar-user-role,
.ag-info-item-value,
.ag-metric-label,
.team-member-meta,
p {
    font-weight: 500 !important;
}
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
