/* Plus Jakarta Sans chargé via includes/head_assets.php */

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --accent: #10b981;
    --accent-light: #d1fae5;
    --sidebar-bg: #0c4a8a;
    --sidebar-bg-deep: #0a3d72;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: #38bdf8;
    --sidebar-text: #dbeafe;
    --sidebar-text-muted: #93c5fd;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 272px;
    --sidebar-collapsed-width: 72px;
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow: visible;
    border-right: 1px solid rgba(255,255,255,0.08);
    box-shadow: 4px 0 24px rgba(8, 47, 73, 0.12);
    transition: width 0.22s ease;
}

@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
        transform: none;
        pointer-events: auto;
        visibility: visible;
        overflow: visible;
        background: #fff !important;
        color: #0f172a;
        border-right: 1px solid #e2e8f0;
        box-shadow: 2px 0 16px rgba(15, 23, 42, 0.06);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    html.sidebar-collapsed .sidebar::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    html.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        align-items: center;
        padding: 0.75rem 0.7rem 0.55rem;
        gap: 0;
        border-bottom: 1px solid #e2e8f0;
    }

    html.sidebar-collapsed .sidebar-brand-main,
    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .brand-sub,
    html.sidebar-collapsed .brand-version,
    html.sidebar-collapsed .nav-label,
    html.sidebar-collapsed .nav-chevron,
    html.sidebar-collapsed .nav-section,
    html.sidebar-collapsed .sidebar-specialite,
    html.sidebar-collapsed .sidebar-logout-label {
        display: none !important;
    }

    html.sidebar-collapsed .sidebar-toggle-btn--sidebar {
        margin: 0;
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 12px;
        background: #fff;
        border: 1px solid #cbd5e1;
        color: #0284c7;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    html.sidebar-collapsed .sidebar-toggle-btn--sidebar:hover {
        background: #e0f2fe;
        border-color: #0ea5e9;
        color: #0369a1;
    }

    html.sidebar-collapsed .sidebar-nav {
        padding: 0.5rem 0.7rem 0.85rem;
        overflow-x: hidden;
        overflow-y: hidden;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        scrollbar-color: transparent transparent;
    }

    html.sidebar-collapsed .sidebar-nav::-webkit-scrollbar,
    html.sidebar-collapsed .sidebar-nav::-webkit-scrollbar-thumb,
    html.sidebar-collapsed .sidebar-nav::-webkit-scrollbar-track {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    html.sidebar-collapsed .nav-link,
    html.sidebar-collapsed .nav-group-toggle {
        width: 2.75rem;
        min-width: 2.75rem;
        margin: 0 auto 0.35rem;
        padding: 0.28rem;
        gap: 0;
        justify-content: center;
        border-radius: 12px;
        background: #fff;
        border: 1px solid #cbd5e1;
        color: #0284c7;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    html.sidebar-collapsed .nav-link:hover,
    html.sidebar-collapsed .nav-group-toggle:hover {
        background: #e0f2fe;
        border-color: #0ea5e9;
        color: #0369a1;
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.18);
        transform: none;
    }

    html.sidebar-collapsed .nav-link.active,
    html.sidebar-collapsed .nav-group.open > .nav-group-toggle,
    html.sidebar-collapsed .nav-group-toggle.active {
        background: linear-gradient(135deg, #0ea5e9, #0284c7);
        border-color: transparent;
        color: #fff;
        box-shadow: 0 6px 14px rgba(2, 132, 199, 0.28);
        transform: none;
    }

    html.sidebar-collapsed .nav-link-inner {
        flex: 0 0 auto;
        justify-content: center;
        gap: 0;
        min-width: 0;
    }

    html.sidebar-collapsed .nav-icon,
    html.sidebar-collapsed .nav-link:hover .nav-icon,
    html.sidebar-collapsed .nav-group-toggle:hover .nav-icon {
        margin: 0;
        background: transparent;
        color: inherit;
        border: none;
        box-shadow: none;
    }

    html.sidebar-collapsed .nav-link.active .nav-icon,
    html.sidebar-collapsed .nav-group.open > .nav-group-toggle .nav-icon,
    html.sidebar-collapsed .nav-group-toggle.active .nav-icon {
        margin: 0;
        background: transparent;
        color: #fff;
        border: none;
        box-shadow: none;
    }

    html.sidebar-collapsed .nav-icon svg {
        stroke: currentColor;
        color: inherit;
    }

    html.sidebar-collapsed .sidebar-footer {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.5rem 0.7rem;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        gap: 0;
    }

    html.sidebar-collapsed .sidebar-logout {
        width: 2.75rem;
        min-width: 2.75rem;
        height: 2.75rem;
        margin: 0;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: #fff;
        border: 1px solid #fecaca;
        color: #dc2626;
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }

    html.sidebar-collapsed .sidebar-logout:hover {
        background: #fef2f2;
        border-color: #dc2626;
        color: #b91c1c;
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.16);
    }

    html.sidebar-collapsed .sidebar-logout-icon {
        width: 1.15rem;
        height: 1.15rem;
        display: block;
    }

    html.sidebar-collapsed .sidebar-logout-icon svg {
        width: 1.15rem;
        height: 1.15rem;
        stroke: currentColor;
        fill: none;
    }

    html.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

    .page-header .sidebar-toggle-btn {
        display: none !important;
    }
}

.sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.625rem;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-main {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
    flex: 1;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    color: #fff;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-transform: uppercase;
}

.cabinet-nom-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.brand-sub { font-size: 0.7rem; color: var(--sidebar-text-muted); font-weight: 500; margin-top: 0.1rem; }

.brand-version {
    font-size: 0.68rem;
    color: #bfdbfe;
    font-weight: 600;
    margin-top: 0.2rem;
    letter-spacing: 0.06em;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.75rem 0.875rem;
    overflow-y: hidden;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar,
    html.sidebar-collapsed .sidebar-nav {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    html.sidebar-collapsed .sidebar::-webkit-scrollbar,
    html.sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
}

.nav-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    padding: 0.85rem 0.75rem 0.45rem;
    font-weight: 600;
}

.nav-link,
.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.52rem 0.65rem;
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-text-muted);
    transition: all var(--transition);
}

.nav-icon svg,
.brand-icon svg,
.nav-chevron svg,
.nav-flyout-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-muted);
    opacity: 0.85;
    transition: transform var(--transition), color var(--transition);
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.nav-chevron svg {
    width: 16px;
    height: 16px;
}

.nav-group.open .nav-chevron { transform: rotate(180deg); }

.nav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    font-size: 0.8125rem;
    line-height: 1.25;
}

.nav-link:hover,
.nav-group-toggle:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.nav-link:hover .nav-icon,
.nav-group-toggle:hover .nav-icon {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.nav-link.active,
.nav-group.open > .nav-group-toggle,
.nav-group-toggle.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(255, 255, 255, 0.06));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-link.active .nav-icon,
.nav-group.open > .nav-group-toggle .nav-icon,
.nav-group-toggle.active .nav-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.nav-group.open > .nav-group-toggle .nav-chevron {
    color: #fff;
}

.sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.18);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.sidebar-specialite {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-specialite-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
}

.sidebar-specialite-label svg {
    width: 0.85rem;
    height: 0.85rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-specialite-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.55rem 2rem 0.55rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: rgba(255, 255, 255, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%94a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 0.95rem;
    color: #f8fafc;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-specialite-select:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-specialite-select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.7);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

.sidebar-specialite-select:disabled {
    opacity: 0.65;
    cursor: wait;
}

.sidebar-specialite-select option {
    color: #0f172a;
    background: #fff;
}

.sidebar-footer .btn-outline {
    margin-top: 0;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 2.5rem 2rem;
    min-height: 100vh;
    transition: margin-left 0.22s ease;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 80;
    margin: 0 -2.5rem 1.25rem;
    padding: 0.85rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.page-header-start {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
    background: var(--primary-light);
}

.sidebar-toggle-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sidebar-toggle-btn svg {
    width: 1.15rem;
    height: 1.15rem;
}

.sidebar-toggle-btn .icon-panel-open {
    display: none;
}

html.sidebar-collapsed .sidebar-toggle-btn .icon-panel-close {
    display: none;
}

html.sidebar-collapsed .sidebar-toggle-btn .icon-panel-open {
    display: block;
}

.sidebar-toggle-btn--sidebar {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sidebar-toggle-btn--sidebar:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
}

.sidebar-toggle-btn--sidebar svg {
    width: 1.15rem;
    height: 1.15rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.75rem 0.35rem 0.45rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    flex-shrink: 0;
}

.topbar-user-info {
    text-align: right;
    line-height: 1.25;
}

.topbar-user-info strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.topbar-user-info small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.page-header-start h1,
.page-header h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
    line-height: 1.25;
    margin: 0;
}

.page-header .page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    transition: box-shadow var(--transition);
}

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

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.options-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.options-page .card form {
    padding: 0 0 0.25rem;
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

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

.stat-card:hover::before { opacity: 1; }

.stat-card:nth-child(1) .stat-icon-wrap { background: var(--primary-light); color: var(--primary); }
.stat-card:nth-child(2) .stat-icon-wrap { background: var(--accent-light); color: var(--accent); }
.stat-card:nth-child(3) .stat-icon-wrap { background: #fef3c7; color: #d97706; }
.stat-card:nth-child(4) .stat-icon-wrap { background: #ede9fe; color: #7c3aed; }
.stat-card-quota {
    --quota-sphere-light: #93c5fd;
    --quota-sphere-dark: #1d4ed8;
    --quota-sphere-liquid-top: #60a5fa;
    --quota-sphere-liquid-bottom: #1e40af;
    --quota-sphere-ring: #2563eb;
}

.stat-card-quota--is-warn {
    --quota-sphere-light: #fcd34d;
    --quota-sphere-dark: #b45309;
    --quota-sphere-liquid-top: #fbbf24;
    --quota-sphere-liquid-bottom: #d97706;
    --quota-sphere-ring: #d97706;
}

.stat-card-quota--is-danger,
.stat-card-quota--is-full {
    --quota-sphere-light: #fca5a5;
    --quota-sphere-dark: #b91c1c;
    --quota-sphere-liquid-top: #f87171;
    --quota-sphere-liquid-bottom: #dc2626;
    --quota-sphere-ring: #dc2626;
}

.stat-card-quota--is-unlimited {
    --quota-sphere-light: #7dd3fc;
    --quota-sphere-dark: #0369a1;
    --quota-sphere-liquid-top: #38bdf8;
    --quota-sphere-liquid-bottom: #0284c7;
    --quota-sphere-ring: #0284c7;
}

.stat-quota-sphere {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
}

.stat-quota-sphere-svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.12));
}

.stat-quota-sphere-track {
    stroke: #e2e8f0;
}

.stat-quota-sphere-ring {
    stroke: var(--quota-sphere-ring);
    transition: stroke-dashoffset 0.45s ease;
}

.stat-quota-sphere-ball {
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 0.6;
}

.stat-quota-sphere-fill {
    transition: y 0.45s ease;
}

.stat-quota-sphere-wave {
    fill: rgba(255, 255, 255, 0.28);
}

.stat-quota-sphere-shine {
    fill: rgba(255, 255, 255, 0.55);
    pointer-events: none;
}

.stat-quota-sphere-label {
    font-size: 7px;
    font-weight: 800;
    fill: #ffffff;
    paint-order: stroke;
    stroke: rgba(15, 23, 42, 0.35);
    stroke-width: 0.8px;
    pointer-events: none;
}

.stat-info-quota {
    flex: 1;
    min-width: 0;
}

.stat-quota-detail {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.15rem;
}

.main-content:has(#dashboard-charts) .stats-grid {
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.main-content:has(#dashboard-charts) .stat-card {
    padding: 0.65rem 0.85rem;
    align-items: center;
    gap: 0.65rem;
}

.main-content:has(#dashboard-charts) .stat-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 1rem;
}

.main-content:has(#dashboard-charts) .stat-quota-sphere {
    width: 44px;
    height: 44px;
}

.main-content:has(#dashboard-charts) .stat-quota-sphere-label {
    font-size: 6px;
}

.main-content:has(#dashboard-charts) .stat-value {
    font-size: 1.35rem;
}

.main-content:has(#dashboard-charts) .stat-label {
    font-size: 0.72rem;
    margin-top: 0.05rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
}

.dashboard-charts {
    margin-bottom: 2rem;
}

.dashboard-chart-loading {
    z-index: 1200;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.32);
}

.dashboard-chart-loading-dialog {
    max-width: 360px;
    padding: 1.75rem 1.5rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.97);
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(14, 165, 233, 0.08);
}

.dashboard-chart-loading-spinner {
    position: relative;
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1.25rem;
}

.dashboard-chart-loading-ring {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary, #0ea5e9);
    border-right-color: rgba(14, 165, 233, 0.35);
    animation: dashboardChartLoadingSpin 0.85s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.dashboard-chart-loading-bar {
    margin-top: 1.15rem;
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.dashboard-chart-loading-bar span {
    display: block;
    height: 100%;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--primary, #0ea5e9), transparent);
    animation: dashboardChartLoadingBar 1.35s ease-in-out infinite;
}

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

@keyframes dashboardChartLoadingBar {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.dashboard-stats-card {
    padding: 0;
    overflow: hidden;
}

.dashboard-tabs {
    flex-wrap: wrap;
    border-radius: 0;
}

.dashboard-tab-panels {
    padding: 1rem 1.25rem 1.25rem;
}

.dashboard-stats-card .chart-card {
    padding: 0;
    box-shadow: none;
    border: none;
    background: transparent;
}

.dashboard-tab-placeholder {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.dashboard-tab-placeholder p {
    margin: 0;
}

.dashboard-patients-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dashboard-medicaments-search-field .form-control {
    min-width: 220px;
}

.dashboard-patients-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-mini-chart-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.dashboard-mini-chart-card-wide {
    grid-column: 1 / -1;
}

.dashboard-mini-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.dashboard-mini-chart-head h3 {
    margin: 0;
    font-size: 0.92rem;
    letter-spacing: -0.02em;
}

.chart-canvas-wrap-medium {
    height: 260px;
}

.chart-canvas-wrap-top-patients {
    height: 320px;
}

@media (max-width: 900px) {
    .dashboard-patients-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-mini-chart-card-wide {
        grid-column: auto;
    }
}

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

.dashboard-charts-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.chart-card-year {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.chart-card-year .form-control {
    width: auto;
    min-width: 5.5rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
}

.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.chart-card {
    padding: 1rem 1rem 0.75rem;
}

.chart-card-wide {
    grid-column: 1 / -1;
}

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

.chart-card-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.chart-card-sub {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.chart-card-sub strong {
    color: var(--text);
}

.chart-card-sub-hint {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 400;
}

.chart-canvas-wrap {
    position: relative;
    height: 240px;
}

.chart-canvas-wrap-tall {
    height: 320px;
}

.chart-donut-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-donut-wrap > canvas#chart-patients-outer {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

.chart-donut-inner {
    position: absolute;
    width: 46%;
    height: 46%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.chart-donut-inner canvas {
    pointer-events: auto;
}

.chart-legend-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    vertical-align: middle;
    margin-right: 0.15rem;
}

.chart-legend-dot-month {
    background: linear-gradient(135deg, #0ea5e9, #10b981);
}

.chart-legend-dot-year {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

/* Onglets */
.tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem 1rem 0;
    border-bottom: 1.5px solid var(--border);
    background: #f8fafc;
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn {
    padding: 0.65rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1.5px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.6); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #fff;
}

.tab-panel { display: none; padding: 1rem 0 0; }
.tab-panel.active { display: block; }

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table.table-resizable.has-column-widths,
.sa-table.table-resizable.has-column-widths {
    table-layout: fixed;
    width: 100%;
}

.table.table-resizable th,
.sa-table.table-resizable th {
    position: relative;
    overflow: visible;
}

.table.table-resizable .sa-cell,
.sa-table.table-resizable .sa-cell {
    max-width: 100%;
}

.col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    z-index: 4;
}

.col-resize-handle:hover,
.col-resize-handle.is-active {
    background: rgba(59, 130, 246, 0.35);
}

body.col-resize-active {
    cursor: col-resize !important;
    user-select: none;
}

body.col-resize-active * {
    cursor: col-resize !important;
}

.table th, .table td {
    padding: 0.875rem 1.125rem;
    text-align: left;
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.table td {
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text);
    letter-spacing: 0.01em;
}

.form-group label:has(+ [required]),
.form-group label.label-required {
    color: #dc2626;
    font-weight: 700;
}

.form-group label.label-info {
    color: var(--primary-dark);
    font-weight: 700;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

.form-control::placeholder { color: var(--text-light); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
}

.btn-outline {
    background: #fff;
    border: 1.5px solid var(--border);
    color: var(--text);
}

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

.sidebar-footer .btn-outline {
    background: transparent;
    border-color: rgba(255,255,255,0.2);
    color: var(--sidebar-text-muted);
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.sidebar-logout-icon {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logout-icon svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
}

.sidebar-footer .btn-outline:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.55rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    opacity: 0.7;
}

.btn-icon:hover {
    background: var(--primary-light);
    opacity: 1;
    transform: scale(1.05);
}

.users-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

.users-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--primary-dark, #0369a1);
}

.users-action-btn svg {
    width: 1rem;
    height: 1rem;
}

.users-action-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    transform: none;
}

.users-action-btn:disabled:hover {
    background: transparent;
    transform: none;
}

.users-action-btn-danger {
    color: #dc2626;
}

.users-action-btn-danger:hover:not(:disabled) {
    background: #fef2f2;
}

#users-table .sa-td-actions {
    min-width: 8.5rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-planifie { background: #e0f2fe; color: #0369a1; }
.badge-confirme { background: #d1fae5; color: #047857; }
.badge-en_cours { background: #fef3c7; color: #b45309; }
.badge-termine { background: #ede9fe; color: #6d28d9; }
.badge-valider { background: #e0e7ff; color: #4338ca; }
.badge-annule { background: #fee2e2; color: #b91c1c; }
.badge-absent { background: #f1f5f9; color: #475569; }

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

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

.toolbar-filters { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.toolbar-filters .form-control { width: auto; min-width: 160px; }
.search-box .form-control { min-width: 280px; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.2);
    border: 1px solid var(--border);
    animation: modalIn 0.25s ease;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 920px; width: 95%; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

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

.modal-content form { padding: 1.75rem; }

.modal-body { padding: 1.25rem 1.75rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

/* Login — voir public/css/login.css */

/* Alerts & Toast */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

.toast-success { background: linear-gradient(135deg, #10b981, #059669); }
.toast-error { background: linear-gradient(135deg, #ef4444, #dc2626); }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }

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

#presence-container {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 12500;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.55rem;
    max-width: min(340px, calc(100vw - 2rem));
    pointer-events: none;
}

.presence-popup {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    animation: presenceIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.presence-popup--logout {
    border-left-color: #64748b;
}

.presence-popup--logout .presence-popup-avatar {
    background: #64748b;
}

.presence-popup--logout .presence-popup-action {
    color: #475569;
}

.presence-popup-out {
    animation: presenceOut 0.28s ease forwards;
}

.presence-popup-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-light), #bae6fd);
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.presence-popup-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.presence-popup-name {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.2;
}

.presence-popup-meta,
.presence-popup-action {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.presence-popup-action {
    color: var(--primary-dark);
    font-weight: 600;
}

.presence-popup-close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    align-self: flex-start;
}

.presence-popup-close:hover {
    background: #e2e8f0;
    color: var(--text);
}

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

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

@keyframes presenceOut {
    to { transform: translateX(110%); opacity: 0; }
}

#dossier-notify-container {
    position: fixed;
    right: 1.25rem;
    bottom: 5.75rem;
    z-index: 3040;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.55rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

#sa-collab-notify-container,
#dossier-notify-mobile-container {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 3040;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.55rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

#dossier-notify-mobile-container {
    bottom: 1.35rem;
    z-index: 3050;
    max-width: min(400px, calc(100vw - 2rem));
}

.dossier-notify-popup {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.75) inset,
        0 16px 36px rgba(15, 23, 42, 0.14);
    animation: dossierNotifyIn 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.dossier-notify-popup.is-open {
    border-left: 4px solid #0ea5e9;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.dossier-notify-popup.is-validate {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.dossier-notify-popup.is-constantes {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.dossier-notify-popup-out {
    animation: dossierNotifyOut 0.28s ease forwards;
}

.dossier-notify-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.dossier-notify-popup.is-open .dossier-notify-icon {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
}

.dossier-notify-popup.is-validate .dossier-notify-icon {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #047857;
}

.dossier-notify-popup.is-constantes .dossier-notify-icon {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #6d28d9;
}

.dossier-notify-popup.is-patient .dossier-notify-icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.dossier-notify-popup.is-analyses .dossier-notify-icon {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}

.dossier-notify-popup.is-documents .dossier-notify-icon {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #7c3aed;
}

.dossier-notify-popup.is-sa-fields {
    border-left: 4px solid #0c4a8a;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.dossier-notify-popup.is-sa-fields .dossier-notify-icon {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #0c4a8a;
}

.dossier-notify-popup.is-mobile-open {
    border-left: 4px solid #0d9488;
    background: linear-gradient(145deg, #ffffff 0%, #f0fdfa 58%, #ecfeff 100%);
    box-shadow:
        0 0 0 1px rgba(13, 148, 136, 0.08) inset,
        0 18px 40px rgba(15, 118, 110, 0.16);
}

.dossier-notify-popup.is-mobile-open .dossier-notify-icon {
    background: linear-gradient(145deg, #5eead4, #0d9488);
    color: #fff;
    box-shadow: 0 8px 16px rgba(13, 148, 136, 0.28);
}

.dossier-notify-message {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}

.dossier-notify-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.dossier-notify-changes {
    list-style: none;
    margin: 0.35rem 0 0.15rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.dossier-notify-change-item {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
    background: rgba(12, 74, 138, 0.06);
}

.dossier-notify-change-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0c4a8a;
}

.dossier-notify-change-values {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.78rem;
    line-height: 1.3;
}

.dossier-notify-change-old {
    color: #64748b;
    text-decoration: line-through;
    opacity: 0.9;
}

.dossier-notify-change-arrow {
    color: #94a3b8;
    font-weight: 700;
}

.dossier-notify-change-new {
    color: #0f172a;
    font-weight: 700;
}

.dossier-notify-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.dossier-notify-title {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.2;
}

.dossier-notify-actor {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}

.dossier-notify-action {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.dossier-notify-patient {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    margin-top: 0.08rem;
}

.dossier-notify-patient-code {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.08rem 0.38rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
    vertical-align: middle;
}

.dossier-notify-close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dossier-notify-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
}

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

@keyframes dossierNotifyOut {
    to { transform: translateX(108%); opacity: 0; }
}

#sa-collab-notify-container .dossier-notify-popup,
#dossier-notify-mobile-container .dossier-notify-popup {
    animation-name: saCollabNotifyIn;
}

#sa-collab-notify-container .dossier-notify-popup-out,
#dossier-notify-mobile-container .dossier-notify-popup-out {
    animation-name: saCollabNotifyOut;
}

@keyframes saCollabNotifyIn {
    from { transform: translateX(-108%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes saCollabNotifyOut {
    to { transform: translateX(-108%); opacity: 0; }
}

#sonnerie-container {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    left: auto;
    z-index: 3100;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.sonnerie-popup {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: #fffbeb;
    border: 2px solid #f59e0b;
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(180, 83, 9, 0.28);
    animation: sonneriePulse 0.45s ease;
}

.sonnerie-popup-out {
    animation: sonnerieOut 0.28s ease forwards;
}

.sonnerie-popup-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sonnerieBell 0.5s ease 3;
}

.sonnerie-popup-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sonnerie-popup-title {
    font-size: 0.95rem;
    color: #92400e;
    line-height: 1.2;
}

.sonnerie-popup-meta,
.sonnerie-popup-action {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.sonnerie-popup-action {
    color: #b45309;
    font-weight: 700;
}

.sonnerie-popup-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    align-self: flex-start;
}

.sonnerie-popup-close:hover {
    background: #fde68a;
}

@keyframes sonneriePulse {
    0% { transform: scale(0.92); opacity: 0.4; }
    60% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes sonnerieBell {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-14deg); }
    40% { transform: rotate(14deg); }
    60% { transform: rotate(-10deg); }
    80% { transform: rotate(10deg); }
}

#patient-suivant-container {
    position: fixed;
    right: 1.25rem;
    bottom: 7.5rem;
    left: auto;
    z-index: 3100;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.patient-suivant-popup {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.22);
    animation: sonneriePulse 0.45s ease;
}

.patient-suivant-popup-out {
    animation: sonnerieOut 0.28s ease forwards;
}

.patient-suivant-popup-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1d4ed8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.patient-suivant-popup-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.patient-suivant-popup-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.patient-suivant-popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.patient-suivant-popup-meta,
.patient-suivant-popup-action {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.patient-suivant-popup-action {
    font-weight: 600;
    color: #1d4ed8;
}

.patient-suivant-popup-close {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
}

.patient-suivant-popup-close:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 1.75rem;
}

.detail-item label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
}

.detail-item p { margin-top: 0.35rem; font-size: 0.9rem; }
.detail-full { grid-column: 1 / -1; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

/* Menu déroulant */
.nav-group { margin-bottom: 2px; }

.nav-group-toggle {
    justify-content: space-between;
}

.nav-link-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 0.35rem;
    margin-top: 2px;
}

.nav-group.open .nav-submenu { max-height: 240px; }

.nav-sublink {
    display: block;
    padding: 0.48rem 0.75rem 0.48rem 3rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin: 1px 0;
    transition: all var(--transition);
    border-left: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.nav-sublink.active {
    color: #fff;
    border-left-color: var(--sidebar-active);
    background: rgba(255, 255, 255, 0.1);
}

/* Popup flyout (Sonnerie, Outils) */
.nav-group-flyout { position: relative; }

.nav-flyout {
    position: fixed;
    z-index: 250;
    min-width: 210px;
    padding: 0.4rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    pointer-events: none;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.nav-flyout::-webkit-scrollbar {
    width: 6px;
}

.nav-flyout::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

.nav-group-flyout.open .nav-flyout,
.nav-flyout.nav-flyout--portal {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}

.nav-flyout.nav-flyout--portal {
    z-index: 5000;
}

.nav-flyout-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

button.nav-flyout-item {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

button.nav-flyout-item.is-offline,
button.nav-flyout-item:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.nav-flyout-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--bg);
    color: var(--primary-dark);
    transition: background var(--transition), color var(--transition);
}

.nav-flyout-icon svg {
    width: 16px;
    height: 16px;
}

.nav-flyout-empty {
    margin: 0;
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
}

.nav-flyout-icon-initials {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nav-flyout-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
}

.nav-flyout-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.nav-flyout-item:hover .nav-flyout-icon {
    background: rgba(14, 165, 233, 0.15);
    color: var(--primary-dark);
}

.nav-flyout-item.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.nav-flyout-item.active .nav-flyout-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.nav-group-flyout.open > .nav-group-toggle .nav-chevron {
    transform: rotate(180deg);
}

/* Sous-menus Outils (Système / Gestion / Addins) */
.nav-flyout-submenu {
    position: relative;
}

.nav-flyout-submenu-toggle {
    position: relative;
}

.nav-flyout-submenu-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    color: var(--text-muted, #64748b);
    flex-shrink: 0;
}

.nav-flyout-submenu-chevron svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-flyout-submenu.open > .nav-flyout-submenu-toggle,
.nav-flyout-submenu.is-active > .nav-flyout-submenu-toggle {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.nav-flyout-nested {
    position: absolute;
    left: calc(100% + 6px);
    top: 0;
    min-width: 230px;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    padding: 0.4rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    z-index: 5100;
}

.nav-flyout-submenu.open > .nav-flyout-nested {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.nav-flyout-nested.nav-flyout-nested--left {
    left: auto;
    right: calc(100% + 6px);
    transform: translateX(4px);
}

.nav-flyout-submenu.open > .nav-flyout-nested.nav-flyout-nested--left {
    transform: none;
}

@media (max-width: 768px) {
    .nav-flyout {
        min-width: 0;
        transform: translateY(-4px);
    }

    .nav-group-flyout.open .nav-flyout {
        transform: translateY(0);
    }

    .nav-flyout-nested {
        position: static;
        left: auto;
        right: auto;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        pointer-events: none;
        transform: none;
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0 0 0 0.35rem;
        background: transparent;
    }

    .nav-flyout-submenu.open > .nav-flyout-nested {
        max-height: 480px;
        pointer-events: auto;
        padding: 0.15rem 0 0.25rem;
        overflow-y: auto;
    }

    .nav-flyout-submenu-chevron {
        transform: rotate(90deg);
    }

    .nav-flyout-submenu.open > .nav-flyout-submenu-toggle .nav-flyout-submenu-chevron {
        transform: rotate(-90deg);
    }
}

.sonnerie-card { text-align: center; padding: 3rem 2rem; }
.sonnerie-icon { font-size: 4rem; margin-bottom: 1rem; }
.sonnerie-card .btn-lg { margin-top: 1.5rem; padding: 0.85rem 2.5rem; }

.patient-suivant-card { text-align: center; padding: 2rem; }
.patient-suivant-display {
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin: 1.5rem 0;
}
.patient-suivant-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.patient-suivant-name { font-size: 2rem; font-weight: 800; }

.chat-card { display: flex; flex-direction: column; height: calc(100vh - 160px); min-height: 420px; padding: 0; overflow: hidden; }

.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 0;
    height: 100%;
}

.chat-contacts {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: #f8fafc;
    min-height: 0;
}

.chat-contacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.chat-contacts-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.chat-unread-total {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem;
}

.chat-contacts-empty {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
}

.chat-contact-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.7rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background var(--transition);
}

.chat-contact-item:hover,
.chat-contact-item.active {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--border);
}

.chat-contact-item.active {
    background: var(--primary-light);
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.25);
}

.chat-contact-avatar,
.chat-thread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.chat-contact-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.chat-contact-top {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-contact-top strong {
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-meta,
.chat-contact-preview {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-contact-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.chat-contact-dot.online {
    background: #22c55e;
}

.chat-contact-unread {
    margin-left: auto;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.chat-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.chat-thread-peer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.chat-thread-peer strong {
    display: block;
    font-size: 0.92rem;
    color: var(--text);
}

.chat-thread-peer small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-peer-online {
    font-size: 0.72rem;
    font-weight: 600;
    color: #16a34a;
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.65rem 4% 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: #fff;
    scroll-behavior: smooth;
}

.chat-msg {
    max-width: 82%;
    display: flex;
    flex-direction: column;
    animation: chatMsgIn 0.18s ease;
}

@keyframes chatMsgIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.chat-msg-system {
    align-self: center;
    max-width: 90%;
    padding: 0.38rem 0.75rem;
    background: rgba(255, 244, 201, 0.92);
    border-radius: 7px;
    color: #54656f;
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.08);
    line-height: 1.35;
}

.chat-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg-peer {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg-bubble {
    position: relative;
    padding: 0.38rem 0.48rem 0.32rem 0.55rem;
    font-size: 0.875rem;
    line-height: 1.35;
    word-break: break-word;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    overflow: hidden;
}

.chat-msg-user .chat-msg-bubble {
    background: #d9fdd3;
    color: #111b21;
    border-radius: 7.5px;
    border-top-right-radius: 0;
    margin-right: 6px;
}

.chat-msg-user .chat-msg-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #d9fdd3;
    border-right: 6px solid transparent;
}

.chat-msg-peer .chat-msg-bubble {
    background: #f0f2f5;
    color: #111b21;
    border-radius: 7.5px;
    border-top-left-radius: 0;
    margin-left: 6px;
}

.chat-msg-peer .chat-msg-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #f0f2f5;
    border-left: 6px solid transparent;
}

.chat-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-msg-meta {
    float: right;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0.15rem 0 -0.15rem 0.55rem;
    vertical-align: bottom;
}

.chat-msg-time {
    font-size: 0.65rem;
    font-weight: 400;
    line-height: 1;
    color: #667781;
    white-space: nowrap;
}

.chat-msg-user .chat-msg-time {
    color: #667781;
}

.chat-input-bar {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-top: 1px solid var(--border);
    background: #fff;
}

.chat-input-bar .form-control {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    border-radius: 999px;
    padding-left: 1rem;
    padding-right: 1rem;
    border-color: #dbe3ec;
    background: #f8fafc;
}

.chat-input-bar .form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
    outline: none;
}

.chat-input-bar .btn-primary {
    border-radius: 999px;
    padding-left: 1rem;
    padding-right: 1rem;
    white-space: nowrap;
}

.chat-attach-btn {
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #dbe3ec;
    background: #f8fafc;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.chat-attach-btn:hover:not(:disabled) {
    background: #eef2f7;
    color: var(--primary);
    border-color: #c7d2e0;
}

.chat-attach-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chat-attach-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-msg-attachment {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.25rem;
}

.chat-msg-image img {
    display: block;
    max-width: min(220px, 100%);
    max-height: 180px;
    border-radius: 6px;
    object-fit: cover;
}

.chat-msg-file {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.08);
    min-width: 140px;
    max-width: 240px;
}

.chat-msg-user .chat-msg-file {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(15, 23, 42, 0.1);
}

.chat-msg-file-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.chat-msg-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-msg-file-name {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
}

.chat-msg-file-size {
    font-size: 0.68rem;
    color: #667781;
}

.chat-msg-bubble .chat-msg-text + .chat-msg-meta,
.chat-msg-bubble .chat-msg-attachment + .chat-msg-text {
    margin-top: 0.2rem;
}

.nav-link-btn {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.chat-popup-root {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1200;
}

.chat-popup-fab {
    width: 3.35rem;
    height: 3.35rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform var(--transition), box-shadow var(--transition);
}

.chat-popup-fab svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-popup-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(14, 165, 233, 0.42);
}

.chat-popup-fab.active {
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.28);
}

.chat-popup-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.chat-popup-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    width: min(720px, calc(100vw - 2rem));
    height: min(520px, calc(100vh - 6rem));
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-popup-panel[hidden] {
    display: none !important;
}

.chat-popup-panel.is-open {
    display: flex;
}

.chat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}

.chat-popup-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-popup-header-title strong {
    font-size: 0.92rem;
    color: var(--text);
}

.chat-popup-close {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.chat-popup-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

.chat-popup-layout {
    flex: 1;
    min-height: 0;
    height: auto;
    grid-template-columns: 240px 1fr;
}

.chat-popup-layout .chat-contacts {
    min-height: 0;
}

.chat-popup-layout .chat-thread {
    min-height: 0;
}

@media (max-width: 768px) {
    .chat-popup-root {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .chat-popup-panel {
        width: calc(100vw - 1.5rem);
        height: min(70vh, 520px);
    }

    .chat-popup-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 180px 1fr;
    }

    .chat-popup-layout .chat-contacts {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
.print-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
    padding: 1.5rem 1rem; background: #f8fafc; border: 1.5px solid var(--border);
    border-radius: var(--radius); cursor: pointer; font-family: inherit;
    font-size: 0.85rem; font-weight: 600; color: var(--text); transition: all var(--transition);
}
.print-item:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); }
a.print-item { text-decoration: none; color: inherit; }
.print-icon { font-size: 2rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* Salle d'attente — tables compactes */
.sa-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.sa-toolbar-info { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.sa-toolbar-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.sa-toolbar-hint { font-size: 0.8rem; }

/* Salle d'attente — statistiques en en-tête */
.page-header-start:has(.sa-header-extra) {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

.page-header-start:has(.sa-header-extra) h1 {
    flex-shrink: 0;
}

.page-header .sa-header-extra {
    flex: 0 0 30%;
    max-width: 30%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: 0.35rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--border);
    flex-wrap: wrap;
}

.page-header .sa-header-stats {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
}

.page-header .sa-header-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    max-width: none;
    padding: 0.22rem 0.25rem;
    border-radius: 10px;
    border: none;
    line-height: 1.15;
    flex-shrink: 1;
    color: #fff;
}

.page-header .sa-header-stat.is-waiting {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.32);
}

.page-header .sa-header-stat.is-seen {
    background: linear-gradient(135deg, var(--accent), #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.32);
}

.page-header .sa-header-stat.is-total {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.32);
}

.page-header .sa-header-stat.is-type {
    background: linear-gradient(135deg, var(--sa-stat-from, #6366f1), var(--sa-stat-to, #4f46e5));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--sa-stat-from, #6366f1) 38%, transparent);
}

.page-header .sa-header-stat.is-type .sa-header-stat-kicker {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header .sa-header-stats-types {
    display: contents;
}

.page-header .sa-header-stat .sa-header-stat-kicker {
    font-size: calc(0.58rem * 0.75);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    text-align: center;
}

.page-header .sa-header-stat .sa-header-stat-value {
    font-size: calc(1.05rem * 0.75);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

.sa-stats-types-empty {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    font-style: italic;
    white-space: nowrap;
    align-self: center;
    padding: 0.22rem 0;
}

@media (max-width: 900px) {
    .page-header .sa-header-extra {
        flex: 1 1 100%;
        max-width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0;
        margin-top: 0;
        border-top: none;
    }

    .page-header .sa-header-stats {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .page-header .sa-header-stat {
        flex: 1 1 calc(50% - 0.15rem);
        width: calc(50% - 0.15rem);
        min-width: calc(50% - 0.15rem);
        padding: 0.15rem 0.3rem;
    }
}

.sa-badge-poste {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: #fef3c7;
    color: #b45309;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.sa-poste-select-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-poste-select {
    width: auto;
    min-width: 140px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.sa-date-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-date-field {
    display: inline-flex;
    align-items: stretch;
}

.sa-date-input,
.sa-date-field input.flatpickr-input.form-control,
.sa-date-field input[type="date"].form-control + input.form-control {
    width: 10.25rem;
    min-width: 10.25rem;
    max-width: 10.25rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sa-date-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    flex-shrink: 0;
    padding: 0;
    border: 1.5px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--card-bg);
    color: var(--primary-dark);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.sa-date-calendar-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-date-calendar-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.sa-date-calendar-btn:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.sa-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sa-btn-label-short {
    display: none;
}

.sa-refresh-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-refresh-btn.is-loading svg {
    animation: sa-refresh-spin 0.75s linear infinite;
}

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

/* Ancien patient — modal */
.modal-content.sa-ep-modal {
    position: relative;
    max-width: min(98vw, 1020px);
    width: calc(100% - 2rem);
    max-height: min(94vh, 900px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.modal-content.sa-ep-modal.has-saved-layout {
    width: min(98vw, var(--sa-ep-modal-width, 1020px));
    height: min(94vh, var(--sa-ep-modal-height, 900px));
}

.sa-ep-modal-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    z-index: 4;
    opacity: 0.55;
}

.sa-ep-modal-resize-handle::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
}

.sa-ep-modal-resize-handle:hover,
.sa-ep-modal-resize-handle.is-active {
    opacity: 1;
}

.sa-ep-results-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: row-resize;
    z-index: 2;
}

.sa-ep-results-resize-handle:hover,
.sa-ep-results-resize-handle.is-active {
    background: rgba(14, 165, 233, 0.18);
}

body.sa-ep-layout-resizing {
    cursor: nwse-resize;
    user-select: none;
}

body.sa-ep-results-resizing {
    cursor: row-resize;
    user-select: none;
}

/* Ancien patient — popup fiche parallèle */
#sa-ep-patient-preview-modal.modal {
    z-index: 1001;
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#sa-ep-patient-preview-modal.modal.active {
    display: flex;
}

#sa-ep-patient-preview-modal .sa-ep-preview-panel {
    pointer-events: auto;
    position: fixed;
    top: 50%;
    left: calc(50% + min(49vw, 510px) + 0.65rem);
    width: min(92vw, 360px);
    max-width: 360px;
    max-height: min(88vh, 680px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 18px;
    background: #fff;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.75) inset,
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 8px 16px rgba(2, 132, 199, 0.08);
    transform: translateY(-50%) scale(0.94);
    opacity: 0;
}

#sa-ep-patient-preview-modal.modal.active .sa-ep-preview-panel {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

#sa-ep-patient-preview-modal.modal.active .sa-ep-preview-panel.is-entering {
    animation: saEpPreviewPanelIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes saEpPreviewPanelIn {
    0% {
        opacity: 0;
        transform: translateY(calc(-50% + 14px)) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.sa-ep-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.95rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 55%, #fff 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-ep-preview-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sa-ep-preview-avatar {
    flex-shrink: 0;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(135deg, #0284c7 0%, #059669 100%);
    box-shadow: 0 8px 18px rgba(2, 132, 199, 0.28);
}

.sa-ep-preview-head-text {
    min-width: 0;
}

.sa-ep-preview-kicker {
    margin: 0 0 0.12rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0284c7;
}

.sa-ep-preview-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    word-break: break-word;
}

.sa-ep-preview-sub {
    margin: 0.18rem 0 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-ep-preview-sub[hidden] {
    display: none;
}

.sa-ep-preview-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sa-ep-preview-close svg {
    width: 1rem;
    height: 1rem;
}

.sa-ep-preview-close:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.05);
}

.sa-ep-preview-body {
    padding: 0.85rem 0.9rem 1rem;
    overflow: auto;
    background: #f8fafc;
}

.sa-ep-preview-sections {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sa-ep-preview-section-title {
    margin: 0 0 0.4rem 0.15rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}

.sa-ep-preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
}

.sa-ep-preview-grid.is-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sa-ep-preview-grid.is-cols-2 .sa-ep-preview-card.is-wide {
    grid-column: 1 / -1;
}

.sa-ep-preview-grid.is-stagger .sa-ep-preview-card {
    animation: saEpPreviewCardIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: var(--sa-ep-preview-delay, 0ms);
}

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

.sa-ep-preview-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.8rem;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    min-width: 0;
}

.sa-ep-preview-card.is-compact {
    padding: 0.6rem 0.65rem;
    gap: 0.5rem;
}

.sa-ep-preview-card.is-compact .sa-ep-preview-card-icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 9px;
}

.sa-ep-preview-card.is-compact .sa-ep-preview-card-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.sa-ep-preview-card.is-compact .sa-ep-preview-label {
    font-size: 0.62rem;
}

.sa-ep-preview-card.is-compact .sa-ep-preview-value {
    font-size: 0.8rem;
}

.sa-ep-preview-card.is-wide {
    grid-column: 1 / -1;
}

.sa-ep-preview-card:hover {
    border-color: #bae6fd;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.1);
    transform: translateY(-1px);
}

.sa-ep-preview-card-icon {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    background: #eff6ff;
}

.sa-ep-preview-card-icon.is-user { color: #0284c7; background: #eff6ff; }
.sa-ep-preview-card-icon.is-calendar { color: #7c3aed; background: #f5f3ff; }
.sa-ep-preview-card-icon.is-clock { color: #0891b2; background: #ecfeff; }
.sa-ep-preview-card-icon.is-briefcase { color: #b45309; background: #fffbeb; }
.sa-ep-preview-card-icon.is-id { color: #0f766e; background: #ecfdf5; }
.sa-ep-preview-card-icon.is-phone { color: #059669; background: #ecfdf5; }
.sa-ep-preview-card-icon.is-home { color: #c2410c; background: #fff7ed; }
.sa-ep-preview-card-icon.is-users { color: #6366f1; background: #eef2ff; }
.sa-ep-preview-card-icon.is-mutuelle { color: #0369a1; background: #e0f2fe; }

.sa-ep-preview-card-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.sa-ep-preview-card-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sa-ep-preview-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.sa-ep-preview-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    line-height: 1.35;
}

.sa-ep-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 2rem 1rem;
    color: var(--primary-dark);
    font-size: 0.84rem;
}

.sa-ep-preview-spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid #bae6fd;
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: saEpPreviewSpin 0.75s linear infinite;
}

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

.sa-ep-preview-empty {
    margin: 0;
    padding: 1.5rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.sa-ep-preview-empty.sa-ep-preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #b91c1c;
}

.sa-ep-preview-error-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
}

.sa-ep-preview-error-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

@media (max-width: 1280px) {
    #sa-ep-patient-preview-modal .sa-ep-preview-panel {
        left: auto;
        right: 1rem;
    }
}

@media (max-width: 900px) {
    #sa-ep-patient-preview-modal .sa-ep-preview-panel {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
        max-width: none;
        transform: translateY(12px) scale(0.96);
    }

    #sa-ep-patient-preview-modal.modal.active .sa-ep-preview-panel {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    #sa-ep-patient-preview-modal.modal.active .sa-ep-preview-panel.is-entering {
        animation: saEpPreviewPanelInMobile 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes saEpPreviewPanelInMobile {
        0% {
            opacity: 0;
            transform: translateY(20px) scale(0.96);
        }
        100% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

/* Ancien patient — popup dernière visite parallèle (gauche) */
#sa-ep-visite-preview-modal.modal {
    z-index: 1001;
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#sa-ep-visite-preview-modal.modal.active {
    display: flex;
}

#sa-ep-visite-preview-modal .sa-ep-visite-panel {
    pointer-events: auto;
    position: fixed;
    top: 50%;
    left: calc(50% - min(49vw, 510px) - 0.65rem - min(92vw, 360px));
    width: min(92vw, 360px);
    max-width: 360px;
    max-height: min(88vh, 680px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 18px;
    background: #fff;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.75) inset,
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 8px 16px rgba(124, 58, 237, 0.1);
    transform: translateY(-50%) scale(0.94);
    opacity: 0;
}

#sa-ep-visite-preview-modal.modal.active .sa-ep-visite-panel {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

#sa-ep-visite-preview-modal.modal.active .sa-ep-visite-panel.is-entering {
    animation: saEpVisitePanelIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes saEpVisitePanelIn {
    0% {
        opacity: 0;
        transform: translateY(calc(-50% + 14px)) scale(0.94) translateX(-16px);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1) translateX(0);
    }
}

.sa-ep-visite-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.95rem;
    background: linear-gradient(135deg, #f5f3ff 0%, #fff7ed 55%, #fff 100%);
    border-bottom: 1px solid rgba(167, 139, 250, 0.22);
}

.sa-ep-visite-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sa-ep-visite-avatar {
    flex-shrink: 0;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed 0%, #ea580c 100%);
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
}

.sa-ep-visite-avatar svg {
    width: 1.25rem;
    height: 1.25rem;
}

.sa-ep-visite-head-text {
    min-width: 0;
}

.sa-ep-visite-kicker {
    margin: 0 0 0.12rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7c3aed;
}

.sa-ep-visite-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    word-break: break-word;
}

.sa-ep-visite-sub {
    margin: 0.18rem 0 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-ep-visite-sub[hidden] {
    display: none;
}

.sa-ep-visite-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sa-ep-visite-close svg {
    width: 1rem;
    height: 1rem;
}

.sa-ep-visite-close:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.05);
}

.sa-ep-visite-body {
    padding: 0.85rem 0.9rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    background: #faf5ff;
}

#sa-ep-visite-preview-modal .sa-ep-visite-preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    width: 100%;
}

#sa-ep-visite-preview-modal .sa-ep-visite-preview-grid.is-stagger .sa-ep-visite-card {
    animation: saEpVisiteCardIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: var(--sa-ep-visite-delay, 0ms);
}

@keyframes saEpVisiteCardIn {
    from {
        opacity: 0;
        transform: translateY(8px) translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

.sa-ep-visite-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.8rem;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.sa-ep-visite-card:hover {
    transform: translateY(-1px);
}

.sa-ep-visite-card.is-tone-date {
    border-color: #ddd6fe;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
}

.sa-ep-visite-card.is-tone-date:hover {
    border-color: #c4b5fd;
}

.sa-ep-visite-card.is-tone-recent {
    border-color: #a7f3d0;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

.sa-ep-visite-card.is-tone-recent:hover {
    border-color: #6ee7b7;
}

.sa-ep-visite-card.is-tone-warm {
    border-color: #fde68a;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.1);
}

.sa-ep-visite-card.is-tone-warm:hover {
    border-color: #fcd34d;
}

.sa-ep-visite-card.is-tone-old {
    border-color: #fecaca;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.08);
}

.sa-ep-visite-card.is-tone-old:hover {
    border-color: #fca5a5;
}

.sa-ep-visite-card.is-tone-type {
    border-color: #99f6e4;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.08);
}

.sa-ep-visite-card.is-tone-type:hover {
    border-color: #5eead4;
}

.sa-ep-visite-card.is-tone-count-low {
    border-color: #bfdbfe;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.sa-ep-visite-card.is-tone-count-mid {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.sa-ep-visite-card.is-tone-count-high {
    border-color: #ddd6fe;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.12);
}

.sa-ep-visite-card.is-tone-credit {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe4e6 100%);
    border-color: #fecaca;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.1);
}

.sa-ep-visite-card.is-tone-credit:hover {
    border-color: #fca5a5;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.14);
}

.sa-ep-visite-card-icon {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-ep-visite-card-icon.is-date { color: #7c3aed; background: #f5f3ff; }
.sa-ep-visite-card-icon.is-timer { color: #059669; background: #ecfdf5; }
.sa-ep-visite-card-icon.is-timer-warm { color: #d97706; background: #fffbeb; }
.sa-ep-visite-card-icon.is-timer-old { color: #dc2626; background: #fef2f2; }
.sa-ep-visite-card-icon.is-type { color: #0d9488; background: #ecfdf5; }
.sa-ep-visite-card-icon.is-count { color: #2563eb; background: #eff6ff; }
.sa-ep-visite-card-icon.is-count-mid { color: #4f46e5; background: #eef2ff; }
.sa-ep-visite-card-icon.is-count-high { color: #6d28d9; background: #f5f3ff; }
.sa-ep-visite-card-icon.is-credit { color: #dc2626; background: #fef2f2; }

.sa-ep-visite-card.is-tone-warm .sa-ep-visite-card-icon.is-timer { color: #d97706; background: #fffbeb; }
.sa-ep-visite-card.is-tone-old .sa-ep-visite-card-icon.is-timer { color: #dc2626; background: #fef2f2; }

.sa-ep-visite-card-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.sa-ep-visite-card-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sa-ep-visite-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.3;
}

.sa-ep-visite-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.sa-ep-visite-value.is-accent-date { color: #6d28d9; }
.sa-ep-visite-value.is-accent-recent { color: #059669; }
.sa-ep-visite-value.is-accent-warm { color: #d97706; }
.sa-ep-visite-value.is-accent-old { color: #dc2626; }
.sa-ep-visite-value.is-accent-type { color: #0f766e; }
.sa-ep-visite-value.is-accent-count { color: #2563eb; }
.sa-ep-visite-value.is-accent-count-mid { color: #4f46e5; }
.sa-ep-visite-value.is-accent-count-high { color: #6d28d9; }
.sa-ep-visite-value.is-accent-credit { color: #dc2626; }

.sa-ep-visite-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 2rem 1rem;
    color: #7c3aed;
    font-size: 0.84rem;
}

.sa-ep-visite-spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid #ddd6fe;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: saEpVisiteSpin 0.75s linear infinite;
}

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

.sa-ep-visite-empty {
    margin: 0;
    padding: 1.5rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.sa-ep-visite-empty.sa-ep-visite-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #b91c1c;
}

.sa-ep-visite-error-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
}

.sa-ep-visite-error-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

@media (max-width: 1280px) {
    #sa-ep-visite-preview-modal .sa-ep-visite-panel {
        left: 1rem;
        right: auto;
    }
}

@media (max-width: 900px) {
    #sa-ep-visite-preview-modal .sa-ep-visite-panel {
        top: 1rem;
        bottom: auto;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-width: none;
        transform: translateY(-8px) scale(0.96);
    }

    #sa-ep-visite-preview-modal.modal.active .sa-ep-visite-panel {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    #sa-ep-visite-preview-modal.modal.active .sa-ep-visite-panel.is-entering {
        animation: saEpVisitePanelInMobile 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes saEpVisitePanelInMobile {
        0% {
            opacity: 0;
            transform: translateY(-12px) scale(0.96);
        }
        100% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

.sa-ep-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sa-ep-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-ep-badge {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    background: var(--primary-light);
}

.sa-ep-badge svg {
    width: 1.15rem;
    height: 1.15rem;
}

.sa-ep-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.sa-ep-sub {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sa-ep-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sa-ep-close:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

.sa-ep-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.25rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #fff;
}

/* Onglets */
.sa-ep-tab-bar {
    flex-shrink: 0;
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.sa-ep-tab-btn {
    padding: 0.7rem 1rem;
    margin-bottom: -1px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
}

.sa-ep-tab-btn:hover {
    color: var(--text);
}

.sa-ep-tab-btn.active {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-dark);
}

.sa-ep-tab-panels {
    flex-shrink: 0;
    min-height: 0;
}

.sa-ep-tab-panel {
    display: none;
}

.sa-ep-tab-panel.active {
    display: block;
}

.sa-ep-tab-panel .sa-ep-card-search,
.sa-ep-tab-panel .sa-ep-card-visite {
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.sa-ep-tab-panel .sa-ep-card-visite {
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.sa-ep-search-actions {
    display: flex;
    gap: 0.4rem;
}

.sa-ep-search-actions .btn {
    flex: 1;
}

.sa-ep-empty-hint {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.sa-ep-empty-hint.sa-ep-loading {
    color: var(--primary-dark);
}

.sa-ep-empty-hint.sa-ep-error {
    color: #b91c1c;
}

.sa-ep-info-sheet {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.sa-ep-info-item {
    margin: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
}

.sa-ep-info-item:nth-child(3n) {
    border-right: none;
}

.sa-ep-info-item.is-wide {
    grid-column: 1 / -1;
    border-right: none;
}

.sa-ep-info-label {
    margin: 0 0 0.2rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sa-ep-info-value {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.sa-ep-visites-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.sa-ep-visites-table {
    width: 100%;
    min-width: 720px;
}

.sa-ep-visites-table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.6rem 0.65rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.sa-ep-visites-table tbody td {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.sa-ep-visites-table tbody tr:last-child td {
    border-bottom: none;
}

.sa-ep-visites-table tbody tr:hover td {
    background: #fafbfc;
}

.sa-ep-td-montant {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.sa-ep-state-badge {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.sa-ep-state-badge-oui {
    color: #047857;
    background: var(--accent-light);
}

.sa-ep-state-badge-non {
    color: #92400e;
    background: #fef3c7;
}

.sa-ep-state-badge-muted {
    color: var(--text-muted);
    background: #f1f5f9;
}

.sa-ep-visite-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
    min-width: 9.25rem;
}

.sa-ep-td-actions {
    vertical-align: top;
    width: 9.5rem;
}

.sa-ep-visite-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 1.9rem;
    padding: 0.32rem 0.55rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sa-ep-visite-action-btn--mutuelle {
    color: #0f766e;
    background: linear-gradient(180deg, #f0fdfa 0%, #ecfdf5 100%);
    border-color: #99f6e4;
}

.sa-ep-visite-action-btn--mutuelle:hover:not(:disabled) {
    background: #ccfbf1;
    border-color: #5eead4;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12);
}

.sa-ep-visite-action-btn--credit {
    color: #1d4ed8;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
}

.sa-ep-visite-action-btn--credit:hover:not(:disabled) {
    background: #bfdbfe;
    border-color: #60a5fa;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.sa-ep-visite-action-btn--print {
    color: #475569;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: #cbd5e1;
}

.sa-ep-visite-action-btn--print:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.sa-ep-visite-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.sa-ep-visites-table tfoot .sa-ep-visites-total-row td {
    position: sticky;
    bottom: 0;
    z-index: 1;
    background: #f8fafc;
    border-top: 2px solid #cbd5e1;
    font-weight: 700;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.sa-ep-visites-total-label {
    color: #0f172a;
    font-size: 0.8rem;
}

.sa-ep-td-total {
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.sa-ep-visites-table .sa-ep-td-montant {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sa-ep-results {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.sa-ep-results-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.sa-ep-results-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
}

.sa-ep-results-head .sa-ep-results-count {
    margin-left: auto;
}

.sa-ep-type-visite-bar {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.sa-ep-fields-bar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
}

.sa-ep-fields-bar .sa-ep-search-grid {
    width: 100%;
}

.sa-ep-fields-bar .sa-ep-motif-combo-wrap {
    width: 100%;
    min-width: 0;
}

.sa-ep-motif-selected-row {
    width: 100%;
    min-width: 0;
}

.sa-ep-motif-selected-textarea {
    width: 100%;
    display: block;
    box-sizing: border-box;
    resize: vertical;
}

.sa-ep-fields-bar .sa-ep-credit-notice {
    width: 100%;
    min-width: 0;
}

.sa-ep-type-visite-bar .sa-ep-type-visite-field {
    flex: 0 0 auto;
    min-width: 10rem;
    max-width: 14rem;
    margin: 0;
}

.sa-ep-card {
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sa-ep-card-results {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sa-ep-card-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.sa-ep-card-icon {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
}

.sa-ep-card-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    text-transform: none;
}

.sa-ep-results-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.sa-ep-results-count.is-pending::after {
    content: ' …';
    opacity: 0.75;
}

#sa-existing-patients-table.is-searching tbody {
    opacity: 0.72;
    transition: opacity 0.12s ease;
}

#sa-existing-patients-table.is-searching tbody tr.is-selected td {
    opacity: 1;
}

.sa-ep-search-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.sa-ep-visite-layout,
.sa-motif-visite-layout {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.sa-ep-visite-stack {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.sa-ep-type-visite-field {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    max-width: 280px;
}

.sa-ep-motif-combo-wrap {
    min-width: 0;
}

.sa-ep-motif-content-row {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.sa-ep-motif-content-col {
    flex: 0 0 50%;
    max-width: 50%;
    min-width: 0;
}

.sa-ep-credit-notice {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.sa-ep-credit-notice[hidden] {
    display: none !important;
}

.sa-ep-credit-notice-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    min-height: 4.25rem;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe4e6 100%);
    border: 1px solid rgba(239, 68, 68, 0.22);
    box-shadow: 0 8px 22px rgba(220, 38, 38, 0.1);
}

.sa-ep-credit-notice-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: #dc2626;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.08);
}

.sa-ep-credit-notice-body {
    min-width: 0;
}

.sa-ep-credit-notice-title {
    display: block;
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #b91c1c;
}

.sa-ep-credit-notice-message {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #991b1b;
}

.sa-ep-credit-regler-btn {
    margin-top: 0.65rem;
    min-width: 5.5rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.16);
}

.sa-ep-credit-regler-btn[hidden] {
    display: none !important;
}

#sa-existing-patient-modal .sa-ep-visite-stack .sa-motif-combo-field-head .dm-motif-head {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem;
    align-items: center;
}

#sa-existing-patient-modal .sa-ep-motif-content-col .sa-motif-visite-textarea {
    width: 100%;
}

.sa-motif-visite-row {
    display: grid;
    grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: end;
}

.sa-motif-visite-row-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
}

.sa-motif-visite-row-inline .sa-visite-field-label {
    margin: 0;
}

.sa-motif-visite-row-inline .sa-visite-type-select {
    width: 100%;
    max-width: 100%;
}

.sa-visite-field-label {
    margin: 0;
    white-space: nowrap;
}

.sa-visite-type-label,
.sa-visite-type-label .dm-interro-label-text {
    color: #dc2626;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    text-transform: none;
}

.sa-visite-type-select {
    min-height: 2.05rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
}

.sa-motif-visite-row-inline .sa-motif-visite-combo {
    min-width: 0;
}

.sa-motif-visite-row-inline .sa-motif-combo-field-head {
    width: 100%;
}

.sa-motif-visite-row-inline .sa-motif-combo-field-head .dm-motif-head {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem;
}

#sa-edit-motif-modal .sa-motif-visite-row-inline .sa-motif-combo-field-head .dm-motif-head,
#sa-edit-motif-modal .sa-motif-combo-field-head .dm-motif-head,
#sa-edit-motif-modal .dm-interro-field-motif .dm-motif-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: none;
    gap: 0.28rem;
}

#sa-edit-motif-modal .sa-motif-combo-field-head .dm-interro-label,
#sa-edit-motif-modal .sa-motif-combo-field-head .dm-interro-label-text {
    color: #dc2626;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    text-transform: none;
    margin: 0;
}

.sa-motif-visite-type {
    min-width: 0;
}

.sa-motif-visite-type .sa-ep-label,
.sa-motif-visite-type .sa-motif-label {
    display: block;
    margin-bottom: 0.28rem;
}

.sa-motif-combo-field-head {
    margin-bottom: 0;
}

.sa-motif-combo-field-head .dm-motif-head {
    margin-bottom: 0;
    align-items: center;
    grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
}

.sa-motif-visite-textarea {
    width: 100%;
    min-height: 4.25rem;
    font-size: 0.84rem;
    border-radius: 8px;
}

#sa-edit-motif-modal .sa-motif-visite-textarea {
    min-height: 7rem;
}

#sa-existing-patient-modal .sa-ep-visite-grid,
#sa-edit-motif-modal .sa-ep-visite-grid {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
}

.sa-motif-combo-hint {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

#sa-existing-patient-modal .sa-motif-combo-field,
#sa-edit-motif-modal .sa-motif-combo-field {
    margin-bottom: 0;
}

#sa-existing-patient-modal .sa-motif-combo-field .dm-interro-input,
#sa-edit-motif-modal .sa-motif-combo-field .dm-interro-input,
#sa-existing-patient-modal .sa-motif-visite-textarea,
#sa-edit-motif-modal .sa-motif-visite-textarea {
    width: 100%;
    min-height: 4.25rem;
    margin-top: 0;
    font-size: 0.84rem;
    border-radius: 8px;
}

#sa-existing-patient-modal .sa-motif-combo-field .dm-interro-input,
#sa-existing-patient-modal .sa-motif-visite-textarea {
    min-height: 1.85rem;
    padding: 0.28rem 0.5rem;
    line-height: 1.25;
}

#sa-existing-patient-modal .dm-motif-combo-bar .dm-motif-suggestions,
#sa-edit-motif-modal .dm-motif-combo-bar .dm-motif-suggestions {
    z-index: 1200;
}

#sa-edit-motif-modal .sa-motif-combo-field .dm-interro-input,
#sa-edit-motif-modal .sa-motif-visite-textarea {
    min-height: 7rem;
}

.sa-ep-field {
    min-width: 0;
}

.sa-ep-field-action,
.sa-ep-field-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.sa-ep-label {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.01em;
    text-transform: none;
}

.sa-ep-label-hidden {
    visibility: hidden;
}

.sa-ep-label-gsm {
    color: #2563eb;
    font-weight: 800;
}

.sa-ep-control {
    font-size: 0.84rem;
    padding: 0.42rem 0.6rem;
    border-radius: 8px;
    border-color: #cbd5e1;
}

.sa-ep-control:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.sa-ep-reset-btn {
    width: 100%;
    border: none;
    font-weight: 700;
    min-height: 2.05rem;
}

/* Ancien patient — zones recherche + visite ultra-compactes */
#sa-existing-patient-modal .sa-ep-body {
    gap: 0.85rem;
    padding: 0.85rem 1.15rem 1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#sa-existing-patient-modal .sa-ep-tab-bar {
    padding: 0 1.15rem;
}

#sa-existing-patient-modal .sa-ep-tab-btn {
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
}

#sa-existing-patient-modal .sa-ep-info-sheet {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#sa-existing-patient-modal .sa-ep-info-item {
    padding: 0.55rem 0.75rem;
}

#sa-existing-patient-modal .sa-ep-tab-panel[data-sa-ep-panel="recherche"] {
    display: none !important;
    padding: 0;
    margin: 0;
    min-height: 0;
}

#sa-existing-patient-modal .sa-ep-fields-bar {
    padding: 0.55rem 0.75rem;
    gap: 0.45rem;
}

#sa-existing-patient-modal .sa-ep-fields-bar .sa-ep-search-mode-row {
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
}

.sa-ep-contains-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    padding: 0.2rem 0.15rem;
}

.sa-ep-contains-check .sa-ep-contains-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.sa-ep-contains-box {
    width: 1.05rem;
    height: 1.05rem;
    border: 1.5px solid #94a3b8;
    border-radius: 4px;
    background: #fff;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sa-ep-contains-check .sa-ep-contains-input:checked + .sa-ep-contains-box {
    border-color: #2563eb;
    background: #2563eb;
}

.sa-ep-contains-check .sa-ep-contains-input:checked + .sa-ep-contains-box::after {
    content: '';
    position: absolute;
    left: 0.28rem;
    top: 0.08rem;
    width: 0.28rem;
    height: 0.55rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sa-ep-contains-check:hover .sa-ep-contains-box {
    border-color: #64748b;
}

#sa-existing-patient-modal .sa-ep-field-search-mode {
    max-width: 280px;
}

#sa-existing-patient-modal .sa-ep-fields-bar .sa-ep-search-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem 0.4rem;
}

#sa-existing-patient-modal .sa-ep-fields-bar .sa-ep-motif-combo-wrap {
    flex: 1 1 100%;
    min-width: 0;
}

#sa-existing-patient-modal .sa-ep-motif-selected-textarea {
    min-height: 3.24rem;
    max-height: 5.68rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.35;
}

#sa-existing-patient-modal .sa-ep-label {
    margin-bottom: 0.1rem;
    font-size: 0.66rem;
    line-height: 1.15;
}

#sa-existing-patient-modal .sa-ep-control {
    font-size: 0.78rem;
    padding: 0.28rem 0.45rem;
    min-height: 2.06rem;
    line-height: 1.2;
}

#sa-existing-patient-modal .sa-ep-reset-btn {
    min-height: 2.06rem;
    padding: 0.23rem 0.45rem;
    font-size: 0.74rem;
}

#sa-existing-patient-modal .sa-ep-search-btn {
    min-height: 2.06rem;
    padding: 0.23rem 0.45rem;
    font-size: 0.74rem;
}

#sa-existing-patient-modal .sa-ep-search-actions .btn {
    min-height: 2.06rem;
}

#sa-existing-patient-modal .sa-ep-info-item {
    padding: 0.55rem 0.75rem;
}

#sa-existing-patient-modal .sa-ep-tab-bar {
    padding: 0 0.85rem;
}

#sa-existing-patient-modal .sa-ep-tab-btn {
    padding: 0.42rem 0.55rem;
    font-size: 0.76rem;
}

#sa-existing-patient-modal .sa-ep-fields-bar .sa-motif-combo-field-head .dm-motif-head {
    gap: 0.3rem;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr);
}

#sa-existing-patient-modal .sa-ep-type-visite-bar {
    padding: 0.55rem 0.75rem;
}

#sa-existing-patient-modal .sa-ep-type-visite-bar .sa-ep-type-visite-field {
    flex: 0 0 auto;
    max-width: 12rem;
    min-width: 9rem;
    gap: 0.15rem;
}

#sa-existing-patient-modal .sa-motif-combo-field-head .dm-interro-label-text {
    font-size: 0.66rem;
    line-height: 1.15;
}

#sa-existing-patient-modal .sa-visite-type-label,
#sa-existing-patient-modal .sa-visite-type-label .dm-interro-label-text {
    font-size: 0.66rem;
    line-height: 1.15;
}

#sa-existing-patient-modal .sa-ep-type-visite-bar .sa-visite-type-select,
#sa-existing-patient-modal .sa-visite-type-select {
    min-height: 2.06rem;
    padding: 0.25rem 0.45rem;
    font-size: 0.78rem;
}

#sa-existing-patient-modal .sa-ep-fields-bar .dm-motif-combo-bar .dm-motif-combo-input-wrap .dm-motif-combo-input,
#sa-existing-patient-modal .sa-ep-fields-bar .dm-motif-combo-bar .dm-rich-modele-input {
    min-height: 2.06rem;
    padding: 0.28rem 0.45rem;
    font-size: 0.78rem;
}

#sa-existing-patient-modal .sa-ep-fields-bar .dm-motif-combo-bar .dm-rich-modele-btn {
    width: 2.06rem;
    min-width: 2.06rem;
    height: 2.06rem;
    min-height: 2.06rem;
    font-size: 0.82rem;
}

#sa-existing-patient-modal .sa-ep-motif-combo-wrap {
    flex: 1 1 100%;
    min-width: 0;
}

#sa-existing-patient-modal .sa-motif-combo-field-head .dm-motif-head {
    grid-template-columns: auto minmax(0, 1fr);
}

#sa-existing-patient-modal .sa-ep-credit-notice-inner {
    min-height: 0;
    padding: 0.45rem 0.55rem;
}

#sa-existing-patient-modal .sa-ep-credit-notice-icon {
    width: 1.45rem;
    height: 1.45rem;
    font-size: 0.78rem;
}

#sa-existing-patient-modal .sa-ep-credit-notice-title {
    margin-bottom: 0.1rem;
    font-size: 0.68rem;
}

#sa-existing-patient-modal .sa-ep-credit-notice-message {
    font-size: 0.74rem;
    line-height: 1.3;
}

@media (max-width: 900px) {
    #sa-existing-patient-modal .sa-ep-fields-bar .sa-ep-search-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #sa-existing-patient-modal .sa-ep-info-sheet {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #sa-existing-patient-modal .sa-ep-fields-bar .sa-ep-search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #sa-existing-patient-modal .sa-ep-info-sheet {
        grid-template-columns: 1fr;
    }

    #sa-existing-patient-modal .sa-ep-info-item {
        border-right: none;
    }

    #sa-existing-patient-modal .sa-ep-type-visite-bar .sa-ep-type-visite-field {
        max-width: none;
        min-width: 0;
        width: 100%;
    }

    #sa-existing-patient-modal .sa-ep-motif-selected-textarea {
        flex: 1 1 auto;
        max-width: none;
    }
}

.sa-ep-motif-text {
    min-height: 4.5rem;
    resize: vertical;
}

.sa-ep-hint {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

.sa-existing-patients-wrap {
    flex: 1;
    min-height: 140px;
    max-height: min(38vh, 300px);
    margin-top: 0;
    border: none;
    border-radius: 0;
    overflow: auto;
    background: #fff;
}

.sa-existing-patients-wrap.has-saved-height {
    flex: 0 0 auto;
    max-height: none;
    height: var(--sa-ep-results-height, 260px);
}

.sa-ep-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.01em;
    border-bottom: 1px solid var(--border);
}

.sa-ep-table tbody tr.is-selected td {
    background: #eff6ff !important;
    box-shadow: inset 3px 0 0 var(--primary-dark);
}

.sa-ep-patient-row {
    cursor: pointer;
}

.sa-ep-patient-row:hover td {
    background: #fafbfc;
}

.sa-ep-code-pill {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--primary-light);
}

.sa-ep-name {
    font-weight: 600;
    color: #0f172a;
}

.sa-ep-muted {
    color: #64748b;
}

.sa-ep-row-action {
    display: flex;
    justify-content: flex-end;
}

.sa-ep-select-btn {
    border-radius: 8px;
    font-size: 0.78rem;
    padding: 0.28rem 0.65rem;
}

@media (max-width: 768px) {
    .sa-ep-search-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sa-ep-motif-content-row {
        flex-direction: column;
    }

    .sa-ep-motif-content-col {
        flex: 1 1 auto;
        max-width: 100%;
    }

    .sa-motif-visite-row-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .sa-motif-visite-row-inline .sa-visite-type-select {
        width: 100%;
    }

    .sa-ep-type-visite-field {
        max-width: none;
    }
}

@media (max-width: 520px) {
    .sa-ep-search-grid {
        grid-template-columns: 1fr;
    }
}

.sa-patient-search .form-control {
    font-size: 0.85rem;
}

.modal-content.sa-patient-modal {
    max-height: 98vh;
    height: 92vh;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    padding: 0;
}

.sa-patient-modal-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-content.sa-patient-modal > .modal-header,
.sa-patient-modal-main > .modal-header {
    flex-shrink: 0;
}

.modal-content.sa-patient-modal form,
.sa-patient-modal-main > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

.sa-patient-modal .sa-patient-form-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.55rem 0.85rem 0.65rem;
}

.sa-patient-modal .modal-footer {
    flex-shrink: 0;
    margin-top: 0;
    padding: 0.5rem 0.85rem;
}

.sa-np-age-display,
.pf-age-display {
    flex-shrink: 0;
    margin: 0.35rem 0 0;
    padding: 0;
    text-align: left;
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    color: #dc2626;
    line-height: 1.3;
}

.sa-np-age-display[hidden],
.pf-age-display[hidden] {
    display: none !important;
}

.pf-dn-age-group .pf-age-display {
    min-height: 0;
}

.pf-form-sidebar {
    flex: 0 0 50px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0.75rem 0.35rem;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.pf-form-sidebar-hint {
    margin: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    color: #ef4444;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.35;
    white-space: nowrap;
    text-align: center;
    animation: pf-sidebar-blink 1.1s ease-in-out infinite;
}

.pf-sidebar-star {
    color: inherit;
    font-weight: 800;
}

@keyframes pf-sidebar-blink {
    0%, 100% {
        color: #ef4444;
    }
    50% {
        color: #ffffff;
    }
}

.sa-form-hint {
    font-size: 0.64rem;
    font-weight: 700;
    color: #dc2626;
    margin: 0 0 0.4rem;
    line-height: 1.3;
}

.pf-uppercase {
    text-transform: uppercase;
}

.pf-visite-type-footer {
    margin-top: 0.65rem;
    padding: 0.55rem 0 0;
    border-top: 1px solid #e2e8f0;
}

.pf-visite-type-footer .form-group {
    margin-bottom: 0;
    max-width: 280px;
}

.pf-visite-type-footer label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.pf-visite-type-footer label.label-required,
.pf-visite-type-footer label:has(+ [required]) {
    color: #dc2626;
    font-weight: 700;
}

/* Sections formulaire patient */
.sa-patient-form-body .pf-section {
    position: relative;
    margin-bottom: 0.85rem;
    padding-left: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.sa-patient-form-body .pf-section::before {
    display: none;
}

.sa-patient-form-body .pf-section:last-child {
    margin-bottom: 0;
}

.pf-section-id {
    border-color: #eff6ff;
}

.pf-section-coord {
    border-color: #ecfeff;
}

.pf-section-parente {
    border-color: #fdf2f8;
}

.pf-section-medical {
    border-color: #eef2ff;
}

.pf-section-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.15;
    margin: 0;
    padding: 0.28rem 0.65rem;
    border-bottom: 1px solid #e2e8f0;
    border-left-width: 3px;
    border-left-style: solid;
}

.pf-section-id .pf-section-title {
    color: #1d4ed8;
    background: #eff6ff;
    border-left-color: #3b82f6;
    border-bottom-color: #eff6ff;
}

.pf-section-id .pf-section-body {
    padding: 0.32rem 0.65rem 0.38rem;
}

.pf-section-coord .pf-section-title {
    color: #0e7490;
    background: #ecfeff;
    border-left-color: #06b6d4;
    border-bottom-color: #ecfeff;
}

.pf-section-coord .pf-section-body {
    padding: 0.32rem 0.65rem 0.38rem;
}

.pf-coord-address-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.35rem 0.75rem;
    align-items: stretch;
}

.pf-coord-address-col,
.pf-coord-contact-col {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.pf-coord-contact-col {
    gap: 0.22rem;
}

.pf-coord-address-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 100%;
}

.pf-coord-adresse {
    flex: 1;
    min-height: 6.4rem;
    resize: none;
    overflow-y: hidden;
    line-height: 1.35;
}

.pf-coord-extra-row {
    margin-top: 0.35rem;
}

.sa-patient-modal.pf-compact .pf-coord-address-layout {
    gap: 0.28rem 0.55rem;
}

.sa-patient-modal.pf-compact .pf-coord-contact-col {
    gap: 0.18rem;
}

.sa-patient-modal.pf-compact .pf-coord-adresse {
    min-height: 5.85rem;
}

.sa-patient-modal.pf-compact .pf-coord-extra-row {
    margin-top: 0.28rem;
}

.pf-section-parente .pf-section-title {
    color: #be185d;
    background: #fdf2f8;
    border-left-color: #ec4899;
    border-bottom-color: #fdf2f8;
}

.pf-section-medical .pf-section-title {
    color: #4f46e5;
    background: #eef2ff;
    border-left-color: #6366f1;
    border-bottom-color: #eef2ff;
}

.pf-section-title::before {
    display: none;
}

.pf-section-body {
    padding: 0.55rem 0.75rem 0.65rem;
    background: #fff;
    border: none;
    border-radius: 0;
}

.pf-section-parente .pf-section-body {
    padding: 0.32rem 0.65rem 0.38rem;
}

.pf-section-medical .pf-section-body {
    padding: 0.32rem 0.65rem 0.38rem;
}

.sa-patient-modal.pf-compact .pf-section-parente {
    margin-bottom: 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .pf-section-title {
    padding: 0.18rem 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .form-row {
    gap: 0.22rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .form-group {
    margin-bottom: 0.2rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .form-group label {
    margin-bottom: 0.05rem;
    font-size: 0.64rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .form-control {
    min-height: 1.72rem;
    padding: 0.26rem 0.45rem;
    font-size: 0.78rem;
}

.sa-patient-modal.pf-compact .pf-section-parente .ref-combo-btn {
    width: 1.72rem;
    min-height: 1.72rem;
}

.sa-patient-modal.pf-compact .pf-section-id {
    margin-bottom: 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-id .pf-section-title {
    padding: 0.18rem 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-id .pf-section-body {
    padding: 0.22rem 0.5rem 0.26rem;
}

.sa-patient-modal.pf-compact .pf-id-layout {
    gap: 0.45rem;
    align-items: stretch;
}

.sa-patient-modal.pf-compact .pf-section-id .form-row {
    gap: 0.22rem;
}

.sa-patient-modal.pf-compact .pf-section-id .form-group {
    margin-bottom: 0.2rem;
}

.sa-patient-modal.pf-compact .pf-section-id .form-group label {
    margin-bottom: 0.05rem;
    font-size: 0.64rem;
}

.sa-patient-modal.pf-compact .pf-section-id .form-control {
    min-height: 1.72rem;
    padding: 0.26rem 0.45rem;
    font-size: 0.78rem;
}

.sa-patient-modal.pf-compact .pf-section-id .ref-combo-btn {
    width: 1.72rem;
    min-height: 1.72rem;
}

.sa-patient-modal.pf-compact .pf-section-id .patient-photo-group {
    flex: 0 0 92px;
    padding: 0.28rem;
    gap: 0.2rem;
}

.sa-patient-modal.pf-compact .pf-section-id .patient-photo-box {
    width: 64px;
    height: 64px;
}

.sa-patient-modal.pf-compact .pf-section-id .patient-photo-add,
.sa-patient-modal.pf-compact .pf-section-id .patient-photo-remove {
    padding: 0.2rem 0.3rem;
    font-size: 0.64rem;
    line-height: 1.15;
}

.sa-patient-modal.pf-compact .pf-section-id .cin-field-row .cin-scan-btn {
    padding: 0.26rem 0.45rem;
    font-size: 0.72rem;
}

.sa-patient-modal.pf-compact .pf-section-medical {
    margin-bottom: 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-medical .pf-section-title {
    padding: 0.18rem 0.55rem;
}

.sa-patient-modal.pf-compact .pf-section-medical .pf-section-body {
    padding: 0.22rem 0.5rem 0.26rem;
}

.sa-patient-modal.pf-compact .pf-medical-tab-bar .tab-btn {
    padding: 0.24rem 0.55rem;
    font-size: 0.66rem;
}

.sa-patient-modal.pf-compact .pf-medical-tab-panels {
    padding: 0.22rem 0 0;
    min-height: 3.5rem;
}

.sa-patient-modal.pf-compact .pf-medical-tab-panel .form-group {
    padding-left: 0.4rem;
}

.sa-patient-modal.pf-compact .pf-medical-tab-panel .form-group label {
    font-size: 0.62rem;
    margin-bottom: 0.1rem;
}

.pf-section-body .form-group:last-child {
    margin-bottom: 0.2rem;
}

.pf-textarea-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
}

/* Suivi médical — onglets par champ */
.pf-medical-section {
    padding: 0;
}

.pf-section-parents .pf-section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.pf-section-parents .pf-section-title svg {
    flex-shrink: 0;
}

.pf-parents-tabs .pf-medical-tab-bar .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pf-parents-tabs .pf-medical-tab-bar .tab-btn svg {
    flex-shrink: 0;
}

.pf-pediatrie-only[hidden],
.pf-non-pediatrie-only[hidden] {
    display: none !important;
}

.pf-medical-tabs {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pf-medical-tab-bar.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 0;
}

.pf-medical-tab-bar .tab-btn {
    padding: 0.32rem 0.65rem;
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: -1px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: #64748b;
    box-shadow: none;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.pf-medical-tab-bar .tab-btn:hover {
    color: #0f172a;
    background: #f8fafc;
    border-color: transparent;
}

.pf-medical-tab-bar .tab-btn.active {
    color: var(--primary);
    background: #fff;
    border-bottom-color: var(--primary);
    box-shadow: none;
}

.pf-medical-tab-panels {
    padding: 0.3rem 0 0;
    min-height: 4rem;
    background: transparent;
    border: none;
    border-radius: 0;
}

.pf-medical-tab-panel {
    padding: 0;
}

.pf-medical-tab-panel .form-group {
    margin-bottom: 0;
    padding-left: 0.65rem;
}

.pf-medical-tab-panel .form-group label {
    font-size: 0.66rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.22rem;
}

.pf-medical-field {
    min-height: 4.25rem;
    resize: none;
    overflow-y: hidden;
    line-height: 1.35;
}

.pf-medical-field-select {
    min-height: 2.05rem;
}

.sa-patient-modal.pf-compact .pf-medical-field {
    min-height: 3.15rem;
    padding: 0.28rem 0.4rem;
    font-size: 0.76rem;
    line-height: 1.3;
}

.sa-patient-modal.pf-compact .pf-medical-field-select {
    min-height: 1.72rem;
    padding: 0.26rem 0.45rem;
    font-size: 0.78rem;
}

.pf-id-layout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.pf-id-fields {
    flex: 1;
    min-width: 0;
}

.patient-photo-group {
    flex: 0 0 118px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.45rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    box-shadow: var(--shadow);
}

.patient-photo-label {
    display: block;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 0.02em;
}

.patient-photo-box {
    width: 84px;
    height: 84px;
    margin: 0 auto;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.patient-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.patient-photo-preview[hidden] {
    display: none !important;
}

.patient-photo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    font-size: 0;
    line-height: 0;
    color: transparent;
}

.patient-photo-file {
    display: none;
}

.patient-photo-add,
.patient-photo-remove {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.patient-photo-remove {
    margin-top: -0.1rem;
    background: var(--danger);
    color: #fff;
    border: 1px solid var(--danger);
}

.patient-photo-remove:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.cin-field-row {
    display: flex;
    gap: 0.3rem;
    align-items: stretch;
}

.cin-field-row .form-control {
    flex: 1;
    min-width: 0;
}

.cin-field-row .cin-scan-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
}

.sa-patient-modal.pf-compact .cin-field-row .cin-scan-btn {
    padding: 0.42rem 0.75rem;
    font-size: 0.82rem;
}

.cin-scan-modal-content .modal-body {
    padding: 1rem 1.25rem;
}

.cin-scan-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.cin-scan-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.cin-scan-tab {
    padding: 0.35rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.cin-scan-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cin-scan-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25);
}

.cin-scan-panel {
    display: none;
    margin-bottom: 0.65rem;
}

.cin-scan-panel.active {
    display: block;
}

.cin-scan-device-group {
    margin-bottom: 0.45rem;
}

.cin-scan-device-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    display: block;
}

.cin-scan-panel-hint {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.cin-scan-diag-list {
    margin: 0.5rem 0 0 1.1rem;
    padding: 0;
}

.cin-scan-diag-list li {
    margin-bottom: 0.25rem;
}

.cin-scan-bridge-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #f8fafc;
}

.cin-scan-bridge-status {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
}

.cin-scan-bridge-on {
    color: var(--success);
}

.cin-scan-bridge-off {
    color: var(--danger);
}

#cin-scan-panel-local .btn + .btn {
    margin-left: 0.35rem;
}

.cin-scan-preview-wrap {
    position: relative;
    width: 100%;
    min-height: 220px;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--border);
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.cin-scan-video,
.cin-scan-preview {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
    background: #0f172a;
}

.cin-scan-placeholder {
    font-size: 3rem;
    color: #94a3b8;
}

.cin-scan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.cin-scan-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-height: 1.1rem;
}

.cin-scan-status-success {
    color: var(--success);
    font-weight: 600;
}

.cin-scan-status-error {
    color: var(--danger);
    font-weight: 600;
}

.cin-scan-status-warning {
    color: #b45309;
    font-weight: 600;
}

/* Asprise Scanner.js : dialogues au-dessus des modales cabinet */
.asprise-web-scan-dialog-wrapper,
.asprise-web-scan-dialog-display,
#asprise-web-scan-setup-dialog-wrapper {
    z-index: 15000 !important;
}

#asprise-web-scan-setup-dialog-overlay {
    z-index: 14999 !important;
}

body.asprise-scan-active .modal.active {
    z-index: 900;
    opacity: 0.15;
    pointer-events: none;
}

.cin-scan-result {
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
}

.cin-scan-result-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
    margin-bottom: 0.45rem;
}

.cin-scan-result-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.cin-scan-result-row:last-child {
    border-bottom: none;
}

.cin-scan-result-row span {
    color: var(--text-muted);
}

.cin-scan-result-row strong {
    color: var(--text);
    text-align: right;
}

/* Champs formulaire patient (modal) */
.sa-patient-modal.pf-compact .form-group {
    margin-bottom: 0.38rem;
}

.sa-patient-modal.pf-compact .form-group label {
    margin-bottom: 0.12rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.sa-patient-modal.pf-compact .form-group label:has(+ [required]),
.sa-patient-modal.pf-compact .form-group label.label-required {
    color: #dc2626;
    font-weight: 700;
}

.sa-patient-modal.pf-compact .form-group label.label-info {
    color: #0f172a;
    font-weight: 700;
}

.sa-patient-modal.pf-compact .form-control {
    padding: 0.42rem 0.55rem;
    font-size: 0.82rem;
    min-height: 2.05rem;
    border-width: 1px;
    border-color: #e2e8f0;
    border-radius: 4px;
}

.sa-patient-modal.pf-compact .form-control:focus {
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.sa-patient-modal.pf-compact select.form-control {
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
}

.sa-patient-modal.pf-compact textarea.form-control,
.sa-patient-modal.pf-compact .pf-textarea {
    min-height: 3.2rem;
    padding: 0.42rem 0.55rem;
    line-height: 1.35;
    resize: none;
    overflow-y: hidden;
}

.sa-patient-modal.pf-compact .form-row {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 0.3rem;
}

.sa-patient-modal.pf-compact .modal-header {
    padding: 0.35rem 0.75rem;
    min-height: 0;
}

.sa-patient-modal .modal-header h2 {
    color: var(--primary-dark);
    font-weight: 700;
    line-height: 1.2;
}

.sa-patient-modal.pf-compact .modal-header h2 {
    font-size: 0.85rem;
    color: var(--primary-dark);
    font-weight: 700;
}

.sa-patient-modal.pf-compact .modal-close {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
}

.sa-patient-modal.pf-compact .modal-footer {
    padding: 0.5rem 0.85rem;
}

.sa-patient-modal.pf-compact .modal-footer .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.sa-patient-modal.pf-compact .patient-photo-add,
.sa-patient-modal.pf-compact .patient-photo-remove {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.sa-patient-modal.pf-compact input.flatpickr-input.form-control,
.sa-patient-modal.pf-compact input[type="date"].form-control + input.form-control {
    min-height: 2.05rem;
    font-size: 0.82rem;
}

/* Combos référentiels (ville, profession, mutuelle) */
.ref-combo-row {
    display: flex;
    gap: 0.25rem;
    align-items: stretch;
}

.ref-combo-select-like {
    position: relative;
}

.ref-combo-select-like .ref-combo-input {
    width: 100%;
    padding-right: 2.25rem;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

select.form-control {
    appearance: none;
    padding-right: 2.25rem;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    cursor: pointer;
}

.ref-combo-input {
    flex: 1;
    min-width: 0;
}

.ref-combo-btn {
    flex-shrink: 0;
    width: 1.65rem;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ref-combo-btn:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
}

.ref-combo-add:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #059669;
}

.ref-combo-del:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}

.ref-combo-edit:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.sa-patient-modal.pf-compact .ref-combo-btn {
    width: 2.05rem;
    min-height: 2.05rem;
}

.charge-document-block {
    padding-top: 0.25rem;
}

.charge-document-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.charge-document-kind {
    display: flex;
    gap: 1rem;
}

.charge-doc-radio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.charge-document-hint {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.charge-document-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.65rem;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.84rem;
}

.charge-document-current a {
    color: var(--primary);
    font-weight: 600;
}

.ref-combo-popup-box {
    width: min(360px, 92vw);
    text-align: left;
}

.ref-combo-popup-body .form-group {
    margin-bottom: 0.55rem;
}

.ref-combo-popup-body .form-group:last-child {
    margin-bottom: 0;
}

.ref-combo-popup-body label {
    font-size: 0.72rem;
    margin-bottom: 0.15rem;
}

.ref-combo-popup-body .form-control {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.ref-combo-popup-body .ref-combo-input {
    width: 100%;
}

.sa-badge-role {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.sa-card { padding: 0; overflow: hidden; }
.sa-card .tab-panel { padding: 0.5rem 0.75rem 0.75rem; }
.sa-tabs { padding: 0.5rem 0.75rem 0; }

.sa-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    line-height: 1.3;
}

.sa-table th,
.sa-table td {
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
}

.sa-table th {
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
    text-align: center;
    hyphens: auto;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Charges / Gestion crédit / Clinique — même en-tête que la SA */
.charges-page .sa-table thead th,
.gc-page .sa-table thead th,
.clinique-page .sa-table thead th,
.charges-page .sa-table thead th.sa-th-actions,
.gc-page .sa-table thead th.sa-th-actions,
.clinique-page .sa-table thead th.sa-th-actions {
    background: #1980e6 !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.18);
}

.clinique-page .sa-table thead th input[type="checkbox"] {
    accent-color: #ffffff;
}

.sa-table td {
    white-space: nowrap;
}

.sa-th-actions,
.sa-td-actions {
    background: #f8fafc !important;
    color: var(--text) !important;
    text-align: center;
    min-width: 10.5rem;
    width: 10.5rem;
    white-space: nowrap;
    position: sticky;
    right: 0;
    z-index: 2;
    box-shadow: -4px 0 8px rgba(0,0,0,0.04);
}

.sa-cell {
    display: inline-block;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.sa-cell-patient {
    display: inline;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.sa-table th.sa-th-patient,
.sa-table td.sa-td-patient {
    white-space: normal;
    min-width: 11rem;
}

/* SA — carte mobile design 09 « Métriques » (masquée sur desktop) */
.sa-wm-card {
    display: none;
}

@media (max-width: 768px) {
    .sa-patient-desktop {
        display: none !important;
    }

    .sa-wm-card {
        display: block;
        width: 100%;
        overflow: hidden;
        border-radius: var(--radius-lg, 16px);
        background: var(--card-bg, #fff);
        border: 1px solid var(--border, #e2e8f0);
        box-shadow: var(--shadow-lg, 0 8px 30px rgba(15, 23, 42, 0.1));
    }

    .sa-wm-main {
        width: 100%;
        min-width: 0;
        padding: 0.75rem 0.85rem 0.75rem;
    }

    .sa-wm-top {
        display: flex;
        align-items: flex-start;
        gap: 0.7rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border, #e2e8f0);
    }

    .sa-wm-avatar {
        flex-shrink: 0;
        width: 3.1rem;
        height: 3.1rem;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        font-weight: 800;
        color: var(--primary-dark, #0284c7);
        background: linear-gradient(135deg, var(--primary-light, #e0f2fe), #bae6fd);
        border: 2px solid rgba(14, 165, 233, 0.28);
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.16);
    }

    .sa-wm-identity {
        min-width: 0;
        flex: 1 1 auto;
        padding-right: 0.15rem;
    }

    .sa-wm-name {
        margin: 0;
        font-size: 0.9rem;
        font-weight: 800;
        line-height: 1.25;
        color: var(--text, #0f172a);
        word-break: break-word;
    }

    .sa-wm-sub {
        margin: 0.18rem 0 0;
        font-size: 0.76rem;
        color: var(--text-muted, #64748b);
        line-height: 1.3;
    }

    .sa-wm-mutuelle {
        margin: 0.2rem 0 0;
        font-size: 0.8rem;
        font-weight: 800;
        line-height: 1.3;
        color: #dc2626;
        word-break: break-word;
    }

    .sa-wm-badge {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 0.28rem;
        margin-left: auto;
        padding: 0.22rem 0.55rem;
        border-radius: 999px;
        font-size: 0.68rem;
        font-weight: 700;
        white-space: nowrap;
        color: #047857;
        background: var(--accent-light, #d1fae5);
        border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .sa-wm-badge svg {
        width: 0.85rem;
        height: 0.85rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        flex-shrink: 0;
    }

    .sa-wm-metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .sa-wm-tile {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        min-width: 0;
        min-height: 0;
        padding: 0.4rem 0.4rem 0.5rem;
        border-radius: 12px;
        background: #f8fafc;
        border: 1px solid var(--border, #e2e8f0);
    }

    .sa-wm-tile-head {
        display: flex;
        align-items: center;
        gap: 0.3rem;
        min-width: 0;
        width: 100%;
    }

    .sa-wm-tile-icon {
        width: 1.35rem;
        height: 1.35rem;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: var(--primary-light, #e0f2fe);
        color: var(--primary, #0ea5e9);
    }

    .sa-wm-tile-icon svg {
        width: 0.75rem;
        height: 0.75rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .sa-wm-tile-label {
        font-size: 0.68rem;
        font-weight: 600;
        color: var(--text-muted, #64748b);
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sa-wm-tile-value {
        font-size: 0.88rem;
        font-weight: 800;
        color: var(--primary-dark, #0284c7);
        line-height: 1.15;
        max-width: 100%;
        padding-bottom: 0.2rem;
    }

    .sa-wm-tile-value-type {
        font-size: 0.72rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        word-break: break-word;
    }

    .sa-wm-tile-bar {
        display: block;
        width: 100%;
        height: 2px;
        margin-top: 0.05rem;
        border-radius: 999px;
        background: linear-gradient(90deg, var(--primary, #0ea5e9), var(--accent, #10b981));
        opacity: 0.85;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row {
        padding: 0.35rem 0.15rem !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td {
        filter: none !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td:not(.sa-td-patient):not(.rg-card-actions):not(.sa-td-actions) {
        display: none !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.sa-td-patient::before,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.rg-card-actions::before,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.sa-td-actions::before {
        display: none !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.sa-td-patient {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        color: inherit !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.rg-card-actions,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row > td.sa-td-actions {
        margin-top: 0.35rem;
        padding: 0.55rem 0.15rem 0.15rem !important;
        border-top: none !important;
        background: transparent !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected > td.sa-td-patient,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected > td.rg-card-actions,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected > td.sa-td-actions {
        background: transparent !important;
        color: inherit !important;
        box-shadow: none !important;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-card {
        border-color: var(--primary, #0ea5e9);
        box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.22), var(--shadow-lg, 0 8px 30px rgba(15, 23, 42, 0.1));
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-name,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-sub,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-mutuelle,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-tile-label,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-tile-value {
        color: inherit;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-name {
        color: var(--text, #0f172a);
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-sub,
    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-tile-label {
        color: var(--text-muted, #64748b);
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-mutuelle {
        color: #dc2626;
        font-weight: 800;
    }

    #table-en_attente.rg-table-cards > tbody > tr.rg-card-row.is-selected .sa-wm-tile-value {
        color: var(--primary-dark, #0284c7);
    }
}

.sa-table tbody tr[data-row-id],
.sa-table tbody tr[data-sa-id] {
    cursor: pointer;
}

.sa-table tbody tr.menu-config-group-row {
    cursor: default;
}

.sa-table tbody tr:nth-child(even) td:not(.sa-td-actions) {
    filter: brightness(0.97);
}

/* Patients vus — dernier dossier validé : triangle rose avant la 1re colonne */
.sa-vus-valide-marker {
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 0.4rem;
    vertical-align: middle;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 9px solid #ec4899;
    flex-shrink: 0;
}

.sa-table tbody tr[data-row-id]:not(.is-selected):hover td,
.sa-table tbody tr[data-sa-id]:not(.is-selected):hover td {
    filter: brightness(0.94);
}

.sa-table tbody tr.is-selected td {
    background: var(--primary-dark) !important;
    color: #fff !important;
    filter: none !important;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.18);
}

.sa-table tbody tr.is-selected td .sa-cell,
.sa-table tbody tr.is-selected td .sa-cell-patient,
.sa-table tbody tr.is-selected td .sa-cell-motif,
.sa-table tbody tr.is-selected td .sa-cell-montant,
.sa-table tbody tr.is-selected td .sa-attente-live {
    background: transparent !important;
    background-color: transparent !important;
    color: #fff !important;
}

.sa-table tbody tr.is-selected td.sa-td-actions {
    background: var(--primary-dark) !important;
    color: #fff !important;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.12);
}

.sa-table tbody tr.is-selected:hover td {
    background: #0369a1 !important;
    filter: none !important;
}

.sa-table tbody tr.is-selected:hover td .sa-cell,
.sa-table tbody tr.is-selected:hover td .sa-cell-patient,
.sa-table tbody tr.is-selected:hover td .sa-cell-motif,
.sa-table tbody tr.is-selected:hover td .sa-cell-montant,
.sa-table tbody tr.is-selected:hover td .sa-attente-live {
    background: transparent !important;
    color: #fff !important;
}

.sa-table tbody tr.is-selected td a {
    color: #fff;
    text-decoration: underline;
}

.sa-table tbody tr.sa-row-draggable {
    cursor: grab;
}

.sa-table tbody tr.sa-row-draggable.is-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.sa-table tbody tr.sa-row-draggable.is-drag-over td {
    box-shadow: inset 0 3px 0 var(--primary);
}

.sa-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.25rem !important;
    font-size: 0.82rem;
}

.sa-error { color: #dc2626; }

.sa-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.25rem;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    width: 100%;
}

.sa-td-actions .sa-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
}

.sa-td-actions .sa-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.sa-btn {
    padding: 0.2rem 0.45rem;
    border: none;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--transition);
}

.sa-btn:hover { opacity: 0.85; }
.sa-btn-primary { background: #0ea5e9; color: #fff; }
.sa-btn-warn { background: #f59e0b; color: #fff; }
.sa-btn-danger { background: #ef4444; color: #fff; }
.sa-btn-success { background: #22c55e; color: #fff; }
.sa-btn-outline {
    background: #fff;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.sa-btn-icon {
    min-width: 2rem;
    padding: 0.35rem 0.55rem;
    font-weight: 700;
    line-height: 1;
}
/* Boutons Historique / Dossier : visibles uniquement en mode smartphone */
.sa-btn-mobile-only {
    display: none;
}
.sa-btn-mobile-only .sa-btn-ico {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.sa-btn-mobile-only .sa-btn-ico svg {
    width: 100%;
    height: 100%;
}
.sa-actions-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.sa-actions-menu-popover {
    position: fixed;
    z-index: 1200;
    margin: 0;
    padding: 0;
    filter: drop-shadow(0 16px 32px rgba(15, 23, 42, 0.14));
}

.sa-actions-menu-popover[hidden] {
    display: none !important;
}

.sa-actions-menu-popover:not([hidden]) .sa-actions-menu-box {
    animation: saActionsMenuIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes saActionsMenuIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sa-actions-menu-box {
    max-width: 340px;
    min-width: 280px;
    text-align: left;
    padding: 0;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.7) inset,
        0 18px 40px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.sa-actions-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.85rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-actions-menu-badge {
    flex-shrink: 0;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.sa-actions-menu-head-text {
    min-width: 0;
}

.sa-actions-menu-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.sa-actions-menu-sub {
    margin: 0.15rem 0 0;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-actions-menu-list {
    list-style: none;
    margin: 0;
    padding: 0.45rem;
    background: #fff;
}

.sa-actions-menu-list li + li {
    margin-top: 0.2rem;
}

.sa-actions-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.58rem 0.65rem;
    border: none;
    border-radius: calc(var(--radius-sm) + 2px);
    background: transparent;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    color: #334155;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sa-actions-menu-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #475569;
    transition: background 0.16s ease, color 0.16s ease;
}

.sa-actions-menu-icon svg {
    width: 1rem;
    height: 1rem;
}

.sa-actions-menu-icon-doc { background: #eff6ff; color: #0284c7; }
.sa-actions-menu-icon-image { background: #fdf4ff; color: #a21caf; }
.sa-actions-menu-icon-lab { background: #ecfdf5; color: #059669; }
.sa-actions-menu-icon-vitals { background: #fff7ed; color: #ea580c; }
.sa-actions-menu-icon-user { background: #fef3c7; color: #b45309; }
.sa-actions-menu-icon-calendar { background: #e0f2fe; color: #0369a1; }
.sa-actions-menu-icon-edit { background: #f5f3ff; color: #7c3aed; }
.sa-actions-menu-icon-history { background: #ecfdf5; color: #0f766e; }
.sa-actions-menu-icon-folder { background: #fff7ed; color: #c2410c; }
.sa-actions-menu-icon-payment { background: #ecfdf5; color: #047857; }
.sa-actions-menu-icon-whatsapp { background: #dcfce7; color: #15803d; }

.sa-actions-menu-label {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.sa-actions-menu-chevron {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: #cbd5e1;
    transition: color 0.16s ease, transform 0.16s ease;
}

.sa-actions-menu-item:hover,
.sa-actions-menu-item:focus {
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transform: translateX(2px);
}

.sa-actions-menu-item:hover .sa-actions-menu-chevron,
.sa-actions-menu-item:focus .sa-actions-menu-chevron {
    color: var(--primary);
    transform: translateX(2px);
}

.sa-actions-menu-item:hover .sa-actions-menu-icon,
.sa-actions-menu-item:focus .sa-actions-menu-icon {
    filter: brightness(0.97);
}

.sa-actions-menu-item.is-disabled,
.sa-actions-menu-item:disabled {
    opacity: 0.55;
    cursor: wait;
    pointer-events: none;
}

/* Constantes et mesures — modal moderne */
.modal-content.sa-vitals-modal {
    max-width: 760px;
    width: calc(100% - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.sa-vitals-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 1rem;
    background: linear-gradient(135deg, #fff7ed 0%, #f0f9ff 52%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-vitals-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-vitals-badge {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ea580c 0%, #0284c7 100%);
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.28);
}

.sa-vitals-head-text {
    min-width: 0;
}

.sa-vitals-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.sa-vitals-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-vitals-updated {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

.sa-vitals-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sa-vitals-close:hover {
    background: #fff;
    color: #0f172a;
}

.sa-vitals-body {
    padding: 1rem 1.25rem 0.5rem;
    background: #f8fafc;
}

.sa-vitals-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.sa-vitals-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.8rem;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sa-vitals-card:focus-within {
    border-color: rgba(14, 165, 233, 0.45);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.sa-vitals-card-wide {
    grid-column: 1 / -1;
}

.sa-vitals-card-icon {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-vitals-card-icon svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-vitals-card-ta .sa-vitals-card-icon { background: #fef2f2; color: #dc2626; }
.sa-vitals-card-pouls .sa-vitals-card-icon { background: #fdf2f8; color: #db2777; }
.sa-vitals-card-temp .sa-vitals-card-icon { background: #fff7ed; color: #ea580c; }
.sa-vitals-card-spo2 .sa-vitals-card-icon { background: #eff6ff; color: #0284c7; }
.sa-vitals-card-poids .sa-vitals-card-icon { background: #ecfdf5; color: #059669; }
.sa-vitals-card-taille .sa-vitals-card-icon { background: #f5f3ff; color: #7c3aed; }
.sa-vitals-card-glycemie .sa-vitals-card-icon { background: #fefce8; color: #ca8a04; }
.sa-vitals-card-fr .sa-vitals-card-icon { background: #ecfeff; color: #0891b2; }
.sa-vitals-card-imc .sa-vitals-card-icon { background: #f1f5f9; color: #475569; }

.sa-vitals-card-content {
    flex: 1;
    min-width: 0;
}

.sa-vitals-card-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: none;
    letter-spacing: 0.01em;
    margin-bottom: 0.35rem;
}

.sa-vitals-ta-row,
.sa-vitals-field-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sa-vitals-input {
    width: 100%;
    min-width: 0;
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.42rem 0.55rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sa-vitals-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.sa-vitals-ta-row .sa-vitals-input {
    max-width: 4.5rem;
    text-align: center;
}

.sa-vitals-sep {
    color: #94a3b8;
    font-weight: 600;
}

.sa-vitals-unit {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

.sa-vitals-imc-display {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.sa-vitals-imc-display strong {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.sa-vitals-imc-category {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
}

.sa-vitals-imc-category.is-under { color: #0284c7; }
.sa-vitals-imc-category.is-normal { color: #059669; }
.sa-vitals-imc-category.is-over { color: #d97706; }
.sa-vitals-imc-category.is-high { color: #dc2626; }

.sa-vitals-notes {
    margin-top: 0.85rem;
}

.sa-vitals-notes label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.sa-vitals-notes .form-control {
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 4.5rem;
}

.sa-vitals-footer {
    padding: 0.85rem 1.25rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

/* —— Salle d'attente : Biométrie & croissance (Pédiatrie) —— */
.modal-content.sa-bio-modal {
    width: min(1480px, 98vw);
    max-width: min(1480px, 98vw);
    min-height: min(720px, 92vh);
    max-height: min(96vh, 980px);
    height: auto;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(14, 116, 144, 0.14);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
        radial-gradient(100% 70% at 100% 0%, rgba(16, 185, 129, 0.10), transparent 50%),
        #f8fafc;
}

.sa-bio-modal > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.sa-bio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.15rem;
    border-bottom: 1px solid rgba(14, 116, 144, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.75));
    flex-shrink: 0;
}

.sa-bio-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sa-bio-badge {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #0891b2, #0d9488);
    color: #ecfeff;
    box-shadow: 0 8px 18px rgba(8, 145, 178, 0.25);
    flex-shrink: 0;
}

.sa-bio-badge svg {
    width: 1.15rem;
    height: 1.15rem;
}

.sa-bio-head-text {
    min-width: 0;
}

.sa-bio-eyebrow {
    margin: 0;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0e7490;
}

.sa-bio-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.sa-bio-sub {
    margin: 0.1rem 0 0;
    font-size: 0.8rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-bio-updated {
    margin: 0.1rem 0 0;
    font-size: 0.7rem;
    color: #64748b;
}

.sa-bio-close {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.14);
    color: #475569;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.sa-bio-header-aside {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.sa-bio-age {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.75rem 0.45rem 0.5rem;
    border-radius: 14px;
    border: 1px solid rgba(8, 145, 178, 0.22);
    background: linear-gradient(145deg, rgba(236, 254, 255, 0.95), rgba(255, 255, 255, 0.92));
    box-shadow: 0 6px 16px rgba(8, 145, 178, 0.08);
    min-width: 11.5rem;
    max-width: 16rem;
}

.sa-bio-age-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #0891b2, #0d9488);
    color: #ecfeff;
    flex-shrink: 0;
}

.sa-bio-age-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.sa-bio-age-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.sa-bio-age-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0e7490;
}

.sa-bio-age-value {
    font-size: 0.86rem;
    font-weight: 750;
    color: #0f172a;
    white-space: normal;
    line-height: 1.2;
}

.sa-bio-close:hover {
    background: rgba(14, 116, 144, 0.16);
    color: #0e7490;
}

.sa-bio-body {
    padding: 0.9rem 1.35rem 0.5rem;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
}

.sa-bio-general-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    gap: 1rem;
    align-items: stretch;
    min-height: 420px;
}

.sa-bio-measures {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    align-content: start;
}

.sa-bio-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.sa-bio-card {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
    min-height: 4.6rem;
    overflow: hidden;
    position: relative;
    z-index: 0;
}

.sa-bio-card:focus-within {
    border-color: rgba(8, 145, 178, 0.45);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
    z-index: 1;
}

.sa-bio-card-wide {
    grid-column: 1 / -1;
}

.sa-bio-card-notes {
    grid-column: span 2;
    min-height: 4.6rem;
}

.sa-bio-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sa-bio-card-icon svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-bio-card-poids .sa-bio-card-icon { background: #ecfdf5; color: #059669; }
.sa-bio-card-taille .sa-bio-card-icon { background: #ecfeff; color: #0891b2; }
.sa-bio-card-pc .sa-bio-card-icon { background: #f0fdf4; color: #16a34a; }
.sa-bio-card-imc .sa-bio-card-icon { background: #f1f5f9; color: #475569; }
.sa-bio-card-temp .sa-bio-card-icon { background: #fff7ed; color: #ea580c; }
.sa-bio-card-ta .sa-bio-card-icon { background: #fef2f2; color: #dc2626; }
.sa-bio-card-bu .sa-bio-card-icon { background: #eff6ff; color: #2563eb; }
.sa-bio-card-dextro .sa-bio-card-icon { background: #fefce8; color: #ca8a04; }
.sa-bio-card-notes .sa-bio-card-icon { background: #f8fafc; color: #64748b; }

.sa-bio-card-content {
    flex: 1;
    min-width: 0;
}

.sa-bio-card-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 650;
    color: #64748b;
    margin-bottom: 0.3rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-bio-field-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}

.sa-bio-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    background: #fff;
    line-height: 1.25;
}

.sa-bio-input:focus {
    outline: none;
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.sa-bio-input-wide {
    font-weight: 500;
}

.sa-bio-unit {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.sa-bio-imc-display {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    min-height: 2.2rem;
}

.sa-bio-imc-display strong {
    font-size: 1.3rem;
    color: #0f172a;
}

.sa-bio-imc-hint {
    font-size: 0.72rem;
    color: #94a3b8;
}

.sa-bio-footer {
    padding: 0.85rem 1.35rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(14, 116, 144, 0.12);
    flex-shrink: 0;
}

@media (max-width: 1280px) {
    .modal-content.sa-bio-modal {
        width: min(1280px, 98vw);
        max-width: min(1280px, 98vw);
        min-height: min(680px, 90vh);
    }
    .sa-bio-general-layout {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
    }
    .sa-bio-measures {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .sa-bio-card-notes {
        grid-column: span 3;
    }
}

@media (max-width: 920px) {
    .modal-content.sa-bio-modal {
        width: min(96vw, 920px);
        max-width: 96vw;
        min-height: 0;
        max-height: 94vh;
    }
    .sa-bio-general-layout {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .sa-bio-measures {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .sa-bio-card-notes {
        grid-column: 1 / -1;
    }
    .sa-bio-body {
        overflow: auto;
    }
    .sa-bio-calc-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }
    .sa-bio-calc-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        border-top: none;
        padding: 0.45rem 0.55rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.75);
        border: 1px solid rgba(148, 163, 184, 0.18);
    }
    .sa-bio-calc-cols { display: none; }
    .sa-bio-calc-row span:not(:first-child) { text-align: left; }
}

@media (max-width: 640px) {
    .sa-bio-measures {
        grid-template-columns: 1fr;
    }
    .sa-bio-calc-grid {
        grid-template-columns: 1fr;
    }
}

.sa-vitals-card.is-abnormal {
    border-color: #fca5a5;
    background: linear-gradient(165deg, #fff5f5 0%, #ffffff 55%, #fef2f2 100%);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.sa-vitals-card.is-abnormal .sa-vitals-input {
    border-color: #f87171;
    background: #fff;
    color: #991b1b;
}

.sa-vitals-alerts-bar {
    margin-top: 0.85rem;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    background: linear-gradient(165deg, #fff5f5 0%, #ffffff 45%, #fef2f2 100%);
    overflow: hidden;
    animation: saVitalsAlertsBarIn 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes saVitalsAlertsBarIn {
    from { opacity: 0; transform: translateY(0.35rem); }
    to { opacity: 1; transform: translateY(0); }
}

.sa-vitals-alerts-bar-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
}

.sa-vitals-alerts-bar-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    background: #fee2e2;
    color: #dc2626;
}

.sa-vitals-alerts-bar-icon svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-vitals-alerts-bar-title {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b91c1c;
    margin-bottom: 0.35rem;
}

.sa-vitals-alerts-bar-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sa-vitals-alerts-bar-list li {
    font-size: 0.78rem;
    font-weight: 600;
    color: #991b1b;
    line-height: 1.35;
}

.sa-vitals-alerts-bar-list li span {
    font-weight: 700;
}

.sa-vitals-alerts-host {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 9999;
    width: min(28rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}

.sa-vitals-alerts-host.is-open {
    pointer-events: auto;
}

.sa-vitals-alerts-host:not(.is-open) {
    display: none;
}

.sa-vitals-alerts-card {
    box-sizing: border-box;
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: linear-gradient(165deg, #fff5f5 0%, #ffffff 45%, #fef2f2 100%);
    box-shadow:
        0 12px 32px rgba(185, 28, 28, 0.16),
        0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    animation: saVitalsGlobalAlertIn 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes saVitalsGlobalAlertIn {
    from { transform: translateY(1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.sa-vitals-alerts-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.65rem 0.5rem 0.75rem;
    border-bottom: 1px solid #fecaca;
    background: linear-gradient(180deg, rgba(254, 226, 226, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
}

.sa-vitals-alerts-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b91c1c;
    line-height: 1.25;
}

.sa-vitals-alerts-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff;
    color: #991b1b;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sa-vitals-alerts-close:hover {
    background: #fef2f2;
    border-color: #f87171;
    color: #7f1d1d;
}

.sa-vitals-alerts-body {
    padding: 0.65rem 0.75rem 0.75rem;
}

.sa-vitals-alerts-patient {
    margin: 0 0 0.25rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

.sa-vitals-alerts-main {
    margin: 0 0 0.15rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: #991b1b;
    line-height: 1.35;
}

.sa-vitals-alerts-detail {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #7f1d1d;
    line-height: 1.35;
}

@media (max-width: 640px) {
    .sa-vitals-grid {
        grid-template-columns: 1fr;
    }
}

/* Validation paiement — salle d'attente (Patients vus) */
.modal-content.sa-reglement-modal {
    max-width: 560px;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.modal-content.sa-reglement-modal #sa-reglement-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.sa-reglement-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.7rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 45%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    flex-shrink: 0;
}

.sa-reglement-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-reglement-badge {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-reglement-head-text {
    min-width: 0;
}

.sa-reglement-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.sa-reglement-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-reglement-status {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #059669;
}

.sa-reglement-status.is-pending {
    color: #d97706;
}

.sa-reglement-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    font-size: 1.35rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.sa-reglement-close:hover {
    background: #fff;
    color: var(--text);
}

.sa-reglement-body {
    padding: 0.45rem 1rem 0.4rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-content.sa-reglement-modal .modal-body.sa-reglement-body {
    padding: 0.45rem 1rem 0.4rem;
}

.sa-reglement-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
}

.sa-reglement-field-wide {
    grid-column: 1 / -1;
}

.sa-reglement-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-reglement-montant-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 10.5rem;
}

.sa-reglement-montant-row .sa-reglement-input {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.sa-reglement-currency {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sa-reglement-input {
    width: 100%;
}

.modal-content.sa-reglement-modal .sa-reglement-input.form-control {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    min-height: 1.75rem;
    border-width: 1px;
    border-radius: 4px;
}

.modal-content.sa-reglement-modal .sa-reglement-input.form-control:focus {
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.modal-content.sa-reglement-modal .sa-reglement-field:not(.sa-reglement-field-wide) .ref-combo,
.modal-content.sa-reglement-modal .sa-reglement-field:not(.sa-reglement-field-wide) select.sa-reglement-input {
    max-width: 100%;
}

.sa-reglement-check-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    padding: 0.4rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius);
    background: #f8fafc;
    max-width: 16rem;
}

.sa-reglement-check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sa-reglement-check-ui {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(148, 163, 184, 0.55);
    border-radius: 0.2rem;
    background: #fff;
    position: relative;
}

.sa-reglement-check:checked + .sa-reglement-check-ui {
    background: #059669;
    border-color: #059669;
}

.sa-reglement-check:checked + .sa-reglement-check-ui::after {
    content: '';
    position: absolute;
    left: 0.22rem;
    top: 0.02rem;
    width: 0.35rem;
    height: 0.65rem;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.sa-reglement-check-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.sa-reglement-footer {
    padding: 0.6rem 1rem 0.75rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    flex-shrink: 0;
}

.sa-reglement-modal.is-reglement-locked .sa-reglement-body {
    opacity: 0.92;
}

.sa-reglement-modal.is-reglement-locked #sa-reglement-etat-mutuelle {
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
}

.sa-reglement-modal.is-reglement-locked .sa-reglement-check-ui {
    opacity: 0.75;
}

.sa-reglement-credit-panel {
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.sa-reglement-credit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.sa-reglement-credit-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.sa-reglement-credit-badge.is-credit {
    color: #047857;
    background: #ecfdf5;
    border-color: rgba(16, 185, 129, 0.28);
}

.sa-reglement-credit-badge.is-dette {
    color: #b45309;
    background: #fffbeb;
    border-color: rgba(245, 158, 11, 0.28);
}

.sa-reglement-credit-check.is-disabled {
    opacity: 0.55;
}

.sa-reglement-credit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    max-width: 22rem;
}

.sa-reglement-credit-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.3rem 0.45rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.sa-reglement-credit-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}

.sa-reglement-credit-value {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.sa-reglement-credit-value.has-reste,
.sa-reglement-credit-reste.has-reste {
    color: #b45309;
}

.sa-reglement-credit-value.has-credit,
.sa-reglement-credit-genere.has-credit {
    color: #047857;
}

.sa-reglement-input.is-readonly,
.sa-reglement-input:read-only {
    background: #f8fafc;
    color: #334155;
    cursor: default;
}

.sa-reglement-print-panel {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: linear-gradient(180deg, #f8faff 0%, #fff 100%);
}

.sa-reglement-print-head {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    margin-bottom: 0.6rem;
}

.sa-reglement-print-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4338ca;
}

.sa-reglement-print-hint {
    font-size: 0.72rem;
    color: #64748b;
}

.sa-reglement-print-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.sa-reglement-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.62rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sa-reglement-print-btn:hover {
    border-color: rgba(79, 70, 229, 0.35);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.sa-reglement-print-icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #4338ca;
    background: #eef2ff;
}

.sa-reglement-print-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    min-width: 0;
}

.sa-reglement-print-label {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.1;
}

.sa-reglement-print-sub {
    font-size: 0.66rem;
    color: #64748b;
    line-height: 1.15;
    max-width: 12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-reglement-modal.is-reglement-admin-validated .sa-reglement-body {
    opacity: 0.98;
}

@media (max-width: 540px) {
    .sa-reglement-grid {
        grid-template-columns: 1fr;
    }

    .sa-reglement-credit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Documents patient — modal moderne */
.modal-content.sa-docs-modal {
    max-width: 680px;
    width: calc(100% - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.sa-docs-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 1rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 55%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-docs-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-docs-badge {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.28);
}

.sa-docs-head-text { min-width: 0; }

.sa-docs-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.sa-docs-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-docs-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.sa-docs-close:hover {
    background: #fff;
    color: #0f172a;
}

.sa-docs-body {
    padding: 1rem 1.25rem;
    background: #f8fafc;
}

.sa-docs-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.sa-docs-category-btn {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 0.38rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sa-docs-category-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.sa-docs-category-btn.is-active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.28);
}

.sa-docs-dropzone {
    border: 2px dashed rgba(148, 163, 184, 0.45);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
    margin-bottom: 1rem;
}

.sa-docs-dropzone.is-dragover {
    border-color: var(--primary);
    background: #f0f9ff;
}

.sa-docs-dropzone.is-uploading {
    opacity: 0.65;
    pointer-events: none;
}

.sa-docs-dropzone-icon svg {
    width: 2rem;
    height: 2rem;
    fill: none;
    stroke: #0284c7;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-docs-dropzone-title {
    margin: 0.55rem 0 0.2rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.sa-docs-dropzone-hint {
    margin: 0 0 0.75rem;
    font-size: 0.74rem;
    color: #64748b;
}

.sa-docs-upload-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    max-width: 520px;
    margin: 0 auto;
}

.sa-docs-method-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sa-docs-method-btn:hover {
    border-color: #0284c7;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12);
    transform: translateY(-1px);
}

.sa-docs-method-scan {
    border-color: rgba(5, 150, 105, 0.35);
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
}

.sa-docs-method-scan:hover {
    border-color: #059669;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.14);
}

.sa-docs-method-icon {
    flex-shrink: 0;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: #0284c7;
}

.sa-docs-method-scan .sa-docs-method-icon {
    background: #d1fae5;
    color: #059669;
}

.sa-docs-method-photo {
    display: none;
    border-color: rgba(2, 132, 199, 0.35);
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    cursor: pointer;
    box-sizing: border-box;
}

.sa-docs-camera-file-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sa-docs-method-photo:hover {
    border-color: #0284c7;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.14);
}

.sa-docs-method-photo .sa-docs-method-icon {
    background: #dbeafe;
    color: #0369a1;
}

.sa-docs-camera-modal .sa-docs-camera-dialog {
    width: min(100vw - 1rem, 28rem);
    max-height: min(96vh, 40rem);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.sa-docs-camera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.sa-docs-camera-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.sa-docs-camera-body {
    padding: 0.75rem 1rem 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    flex: 1;
}

.sa-docs-camera-status {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.sa-docs-camera-stage {
    position: relative;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    max-height: 58vh;
}

.sa-docs-camera-video,
.sa-docs-camera-preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #0f172a;
}

.sa-docs-camera-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

@media (max-width: 768px) {
    .sa-docs-camera-modal.active {
        align-items: stretch;
        padding: 0;
    }

    .sa-docs-camera-modal .sa-docs-camera-dialog {
        width: 100%;
        max-width: none;
        max-height: none;
        height: 100%;
        min-height: 100dvh;
        border-radius: 0;
    }

    .sa-docs-camera-stage {
        flex: 1;
        max-height: none;
        aspect-ratio: auto;
        min-height: 55dvh;
        border-radius: 0;
    }

    .sa-docs-camera-footer {
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .sa-docs-camera-footer .btn {
        flex: 1 1 auto;
        min-height: 2.75rem;
    }
}

.sa-docs-method-btn:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
    pointer-events: none;
}

.sa-docs-method-icon svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-docs-method-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.sa-docs-method-text strong {
    font-size: 0.84rem;
    color: #0f172a;
}

.sa-docs-method-text small {
    font-size: 0.72rem;
    color: #64748b;
}

@media (max-width: 768px) {
    .sa-docs-method-scan {
        display: none !important;
    }

    .sa-docs-method-photo {
        display: flex;
    }

    .sa-docs-upload-methods {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .sa-docs-dropzone-title,
    .sa-docs-dropzone-hint {
        display: none;
    }

    .sa-docs-dropzone-icon {
        display: none;
    }
}

@media (max-width: 560px) {
    .sa-docs-upload-methods {
        grid-template-columns: 1fr;
    }
}

.sa-docs-list-wrap {
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sa-docs-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: #f1f5f9;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

#sa-existing-patient-modal .dm-interro-label-text,
#sa-edit-motif-modal .dm-interro-label-text {
    text-transform: none;
}

.sa-docs-list-head h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    text-transform: none;
    letter-spacing: 0.01em;
}

.sa-docs-list-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    background: #e2e8f0;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    min-width: 1.35rem;
    text-align: center;
}

.sa-docs-list-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.sa-docs-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(37, 99, 235, 0.22);
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
    color: #1d4ed8;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.sa-docs-refresh-btn svg {
    width: 0.85rem;
    height: 0.85rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-docs-refresh-btn:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.sa-docs-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem;
    max-height: 220px;
    overflow-y: auto;
}

.sa-docs-list li + li {
    margin-top: 0.35rem;
}

.sa-docs-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.82rem;
    color: #94a3b8;
}

.sa-docs-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.sa-docs-item-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.sa-docs-item-icon.kind-pdf { background: #fef2f2; color: #dc2626; }
.sa-docs-item-icon.kind-word { background: #eff6ff; color: #2563eb; }
.sa-docs-item-icon.kind-image { background: #fdf4ff; color: #a21caf; }
.sa-docs-item-icon.kind-file { background: #f1f5f9; color: #64748b; }

.sa-docs-thumb-btn {
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.6rem;
    background: #fff;
    overflow: hidden;
    cursor: zoom-in;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sa-docs-thumb-btn:hover {
    transform: scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.18);
}

.sa-docs-item-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f1f5f9;
}

.sa-docs-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
}

.sa-docs-preview-overlay[hidden] {
    display: none !important;
}

body.sa-docs-preview-open {
    overflow: hidden;
}

.sa-docs-preview-box {
    position: relative;
    max-width: min(92vw, 920px);
    max-height: 88vh;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}

.sa-docs-preview-close {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.sa-docs-preview-close:hover {
    background: rgba(15, 23, 42, 0.75);
}

.sa-docs-preview-img {
    display: block;
    max-width: min(88vw, 880px);
    max-height: calc(88vh - 3rem);
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: #f8fafc;
}

.sa-docs-preview-caption {
    margin: 0.65rem 0 0.15rem;
    padding: 0 0.35rem;
    font-size: 0.82rem;
    color: #475569;
    text-align: center;
    word-break: break-word;
}

.sa-docs-item-main {
    flex: 1;
    min-width: 0;
}

.sa-docs-item-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-docs-item-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.7rem;
    color: #94a3b8;
}

.sa-docs-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.sa-docs-item-btn {
    border: none;
    background: #fff;
    color: #64748b;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.sa-docs-item-btn:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
    background: #f0f9ff;
}

.sa-docs-item-btn.is-danger:hover {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.sa-docs-item-btn svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-docs-footer {
    padding: 0.85rem 1.25rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

/* Grille résultats analyses */
.modal-content.sa-analyses-modal {
    display: flex;
    flex-direction: column;
    max-width: min(98vw, 1280px);
    width: calc(100% - 1.5rem);
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
}

.modal-content.sa-analyses-modal .sa-analyses-header {
    flex-shrink: 0;
}

.modal-content.sa-analyses-modal form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0;
}

.modal-content.sa-analyses-modal .sa-analyses-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.modal-content.sa-analyses-modal .sa-analyses-footer {
    flex-shrink: 0;
    margin-top: 0;
}

.sa-analyses-bottom-alert {
    flex-shrink: 0;
    border-top: 1px solid #fecaca;
    background: linear-gradient(135deg, #fff7ed 0%, #fef2f2 100%);
    box-shadow: 0 -8px 24px rgba(185, 28, 28, 0.08);
    animation: saAnalysesBottomAlertIn 0.22s ease;
}

@keyframes saAnalysesBottomAlertIn {
    from {
        opacity: 0;
        transform: translateY(0.65rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sa-analyses-bottom-alert-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
}

.sa-analyses-bottom-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.sa-analyses-bottom-alert-content {
    flex: 1;
    min-width: 0;
}

.sa-analyses-bottom-alert-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    color: #b91c1c;
    font-size: 0.84rem;
}

.sa-analyses-bottom-alert-count {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: #991b1b;
}

.sa-analyses-bottom-alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 5.5rem;
    overflow: auto;
}

.sa-analyses-bottom-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.78);
    font-size: 0.78rem;
    line-height: 1.35;
    color: #7f1d1d;
}

.sa-analyses-bottom-alert-item.is-low {
    color: #1d4ed8;
    background: rgba(239, 246, 255, 0.92);
}

.sa-analyses-bottom-alert-item.is-high {
    color: #991b1b;
}

.sa-analyses-bottom-alert-tag {
    flex-shrink: 0;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
}

.sa-analyses-bottom-alert-item.is-low .sa-analyses-bottom-alert-tag {
    background: #dbeafe;
    color: #1d4ed8;
}

.sa-analyses-bottom-alert-close {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: #64748b;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.sa-analyses-bottom-alert-close:hover {
    background: #fff;
    color: #0f172a;
}

.sa-analyses-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 1rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 55%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-analyses-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-analyses-badge {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.28);
}

.sa-analyses-head-text { min-width: 0; }

.sa-analyses-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.sa-analyses-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-analyses-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.sa-analyses-close:hover {
    background: #fff;
    color: #0f172a;
}

.sa-analyses-body {
    padding: 1rem 1.25rem;
    background: #f8fafc;
}

.sa-analyses-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.sa-analyses-result-input.sa-analyses-result-abnormal {
    font-weight: 700;
}

.sa-analyses-result-input.sa-analyses-result-high {
    border-color: #f87171 !important;
    background: #fef2f2 !important;
    color: #991b1b;
}

.sa-analyses-result-input.sa-analyses-result-low {
    border-color: #60a5fa !important;
    background: #eff6ff !important;
    color: #1d4ed8;
}

.sa-analyses-add-date-btn {
    font-weight: 600;
}

.sa-analyses-add-date-col {
    min-width: 5.5rem;
    text-align: center;
    background: #f8fafc !important;
    vertical-align: middle;
}

.sa-analyses-add-date-col-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.75rem;
    padding: 0.35rem 0.55rem;
    border: 1.5px dashed rgba(14, 165, 233, 0.45);
    border-radius: var(--radius-sm);
    background: #f0f9ff;
    color: var(--primary-dark);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.sa-analyses-add-date-col-btn:hover {
    background: #e0f2fe;
    border-color: var(--primary);
}

.sa-analyses-add-date-spacer {
    background: #fafafa !important;
    min-width: 5.5rem;
}

.sa-analyses-table-wrap {
    overflow: auto;
    max-height: min(38vh, 360px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-md);
    background: #fff;
}

.sa-analyses-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.sa-analyses-table th,
.sa-analyses-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    padding: 0.18rem 0.28rem;
    vertical-align: middle;
    background: #fff;
}

.sa-analyses-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f5f9;
}

.sa-analyses-corner {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 8rem;
    width: 8rem;
    max-width: 8rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e2e8f0 !important;
}

.sa-analyses-corner-head {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.sa-analyses-corner-label {
    font-size: 0.68rem;
    line-height: 1.2;
}

.sa-analyses-type-filter {
    width: 100%;
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    padding: 0.16rem 0.3rem;
    min-height: 1.55rem;
    color: #334155;
    background: #fff;
}

.sa-analyses-type-filter::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.sa-analyses-type-col {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 8rem;
    width: 8rem;
    max-width: 8rem;
    background: #f8fafc !important;
}

.sa-analyses-table tbody tr.sa-analyses-data-row.sa-analyses-row-filtered,
.sa-analyses-table .sa-analyses-col-filtered {
    display: none;
}

.sa-analyses-date-col {
    min-width: 7rem;
    width: 7rem;
    max-width: 7rem;
}

.sa-analyses-table td:has(.sa-analyses-result-input) {
    width: 7rem;
    max-width: 7rem;
}

.sa-analyses-chart-pick {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-sm);
    background: #fff;
    color: #64748b;
    cursor: pointer;
}

.sa-analyses-chart-pick svg {
    width: 0.85rem;
    height: 0.85rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sa-analyses-chart-pick:hover,
.sa-analyses-chart-pick.is-active {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.sa-analyses-date-head,
.sa-analyses-type-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sa-analyses-date-text {
    display: none;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
}

.sa-analyses-mobile-list {
    display: none;
}

.sa-analyses-mobile-list:not([hidden]) {
    display: flex;
}

.sa-analyses-date-input {
    min-width: 0;
    width: 100%;
    flex: 1;
    font-size: 0.72rem;
    padding: 0.16rem 0.28rem;
    min-height: 1.6rem;
}

.sa-analyses-date-alt {
    min-width: 0;
    width: 100%;
    flex: 1;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.35rem;
    min-height: 1.7rem;
    color: #0f172a;
}

.sa-analyses-type-input {
    flex: 1;
    min-width: 0;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.16rem 0.32rem;
    min-height: 1.55rem;
}

.sa-analyses-result-input {
    width: 100%;
    min-width: 4rem;
    max-width: 7rem;
    font-size: 0.76rem;
    font-weight: 600;
    text-align: center;
    padding: 0.15rem 0.32rem;
    min-height: 1.55rem;
    line-height: 1.2;
}

.sa-analyses-col-remove,
.sa-analyses-row-remove {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.sa-analyses-col-remove:hover,
.sa-analyses-row-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

.sa-analyses-table tbody tr.sa-analyses-data-row {
    cursor: pointer;
}

.sa-analyses-table tbody tr.sa-analyses-data-row:hover {
    background: rgba(5, 150, 105, 0.04);
}

.sa-analyses-table tbody tr.sa-analyses-row-selected {
    background: color-mix(in srgb, var(--sa-chart-color, #059669) 10%, transparent);
}

.sa-analyses-table tbody tr.sa-analyses-row-selected:hover {
    background: color-mix(in srgb, var(--sa-chart-color, #059669) 14%, transparent);
}

.sa-analyses-table tbody tr.sa-analyses-row-selected .sa-analyses-type-col {
    box-shadow: inset 3px 0 0 var(--sa-chart-color, #059669);
}

.sa-analyses-chart-title span {
    color: var(--sa-chart-color, #059669);
    font-weight: 700;
}

.sa-analyses-loading {
    padding: 1.5rem;
    text-align: center;
    color: #94a3b8;
}

.sa-analyses-chart-section {
    margin-top: 1rem;
    padding: 0.85rem 1rem 1rem;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-md);
}

.sa-analyses-chart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    margin-bottom: 0.75rem;
}

.sa-analyses-chart-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
}

.sa-analyses-chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
}

.sa-analyses-chart-style-group {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}

.sa-analyses-chart-style-btn {
    border: none;
    border-right: 1px solid rgba(148, 163, 184, 0.25);
    background: #fff;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.38rem 0.65rem;
    cursor: pointer;
    white-space: nowrap;
}

.sa-analyses-chart-style-btn:last-child {
    border-right: none;
}

.sa-analyses-chart-style-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

.sa-analyses-chart-style-btn.is-active {
    background: var(--sa-chart-color, #059669);
    color: #fff;
}

.sa-analyses-chart-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #64748b;
}

.sa-analyses-chart-select-wrap .form-control {
    min-width: 10rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
}

.sa-analyses-chart-wrap {
    position: relative;
    height: 220px;
}

.sa-analyses-chart-empty {
    margin: 0;
    padding: 1.25rem 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
}

.sa-analyses-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.sa-analyses-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.types-analyses-help {
    margin: 0 0 1rem;
    font-size: 0.84rem;
    color: #64748b;
}

/* Gestion des analyses — page moderne */
.ta-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ta-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ta-toolbar-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.ta-toolbar-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
    box-shadow: 0 8px 18px rgba(2, 132, 199, 0.24);
}

.ta-toolbar-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.ta-title {
    margin: 0;
}

.ta-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.ta-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.ta-add-btn,
.ta-load-defaults-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.ta-add-btn svg,
.ta-load-defaults-btn svg {
    width: 1rem;
    height: 1rem;
}

.ta-load-defaults-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.ta-help-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(14, 165, 233, 0.22);
    border-radius: 14px;
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
}

.ta-help-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    background: rgba(255, 255, 255, 0.85);
}

.ta-help-icon svg {
    width: 1rem;
    height: 1rem;
}

.ta-help-text {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #334155;
}

.ta-card {
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.ta-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.ta-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 8rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.95);
}

.ta-kpi-active {
    border-color: rgba(16, 185, 129, 0.25);
    background: linear-gradient(135deg, #fff 0%, #ecfdf5 100%);
}

.ta-kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ta-kpi-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.ta-kpi-active .ta-kpi-value {
    color: #059669;
}

.ta-table-wrap {
    padding: 0.85rem 1rem 1rem;
}

.ta-table tbody td {
    vertical-align: middle;
}

.ta-libelle-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.ta-libelle-icon {
    flex-shrink: 0;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    background: #eff6ff;
}

.ta-libelle-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ta-libelle-text {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

.ta-alias-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.ta-alias-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.ta-alias-empty,
.ta-norme-empty {
    color: var(--text-muted);
}

.ta-norme-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    border: 1px solid rgba(14, 165, 233, 0.25);
}

.ta-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.ta-status svg {
    width: 0.85rem;
    height: 0.85rem;
}

.ta-status.is-active {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.ta-status.is-inactive {
    color: #64748b;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.ta-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ta-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.ta-action-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ta-action-btn.is-edit:hover {
    color: #0284c7;
    border-color: #bae6fd;
    background: #eff6ff;
    transform: translateY(-1px);
}

.ta-action-btn.is-delete:hover {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
    transform: translateY(-1px);
}

.ta-empty {
    padding: 2rem 1rem !important;
}

.modal-content.ta-modal {
    max-width: min(96vw, 560px);
    width: calc(100% - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.modal-content.ta-modal form {
    display: flex;
    flex-direction: column;
}

.ta-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.1rem 0.95rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 55%, #fff 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.ta-modal-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.ta-modal-badge {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.22);
}

.ta-modal-badge svg {
    width: 1.15rem;
    height: 1.15rem;
}

.ta-modal-kicker {
    margin: 0 0 0.1rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0284c7;
}

.ta-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.ta-modal-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ta-modal-close svg {
    width: 1rem;
    height: 1rem;
}

.ta-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.ta-modal-body {
    padding: 1rem 1.1rem;
    background: #f8fafc;
}

.ta-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.ta-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ta-submit-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ta-field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ta-field-label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 8px;
    color: #0284c7;
    background: #eff6ff;
}

.ta-field-label-icon svg {
    width: 0.8rem;
    height: 0.8rem;
}

.ta-control {
    border-radius: 10px;
}

.ta-norme-section {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.85rem;
    border: 1px solid rgba(14, 165, 233, 0.18);
    border-radius: 12px;
    background: #fff;
}

.ta-norme-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0369a1;
}

.analyse-type-combo {
    position: relative;
}

.analyse-type-combo-hint {
    margin: 0.35rem 0 0;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.35;
}

.analyse-type-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1200;
    margin: 0;
    padding: 0.25rem;
    list-style: none;
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.analyse-type-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    cursor: pointer;
}

.analyse-type-suggestion-icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    background: #eff6ff;
}

.analyse-type-suggestion-icon svg {
    width: 0.9rem;
    height: 0.9rem;
}

.analyse-type-suggestion-body {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 0.15rem 0.65rem;
    flex: 1;
}

.analyse-type-suggestion-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
}

.analyse-type-suggestion-meta {
    font-size: 0.74rem;
    font-weight: 600;
    color: #0369a1;
    text-align: right;
}

.analyse-type-suggestion-source {
    grid-column: 1 / -1;
    font-size: 0.68rem;
    color: #94a3b8;
}

.analyse-type-suggestion:hover,
.analyse-type-suggestion.is-active {
    background: rgba(14, 165, 233, 0.1);
}

.analyse-type-suggestion:hover .analyse-type-suggestion-icon,
.analyse-type-suggestion.is-active .analyse-type-suggestion-icon {
    background: #dbeafe;
    color: #0369a1;
}

.analyse-type-order-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.analyse-type-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: #fff;
    color: #64748b;
    cursor: grab;
    touch-action: none;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.analyse-type-drag-handle svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: currentColor;
}

.analyse-type-drag-handle:hover {
    border-color: rgba(14, 165, 233, 0.45);
    background: rgba(14, 165, 233, 0.08);
    color: #0284c7;
}

.analyse-type-drag-handle:active {
    cursor: grabbing;
}

.analyse-type-row.is-dragging {
    opacity: 0.45;
}

.analyse-type-row.is-drag-over {
    background: rgba(14, 165, 233, 0.08);
    box-shadow: inset 0 2px 0 #0ea5e9;
}

.analyse-type-order-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    font-size: 0.74rem;
    font-weight: 800;
    color: #0369a1;
    background: #e0f2fe;
    border-radius: 999px;
}

.sa-edit-motif-text {
    min-height: 9rem;
    resize: vertical;
}

/* Motif et type de visite — modal moderne */
.modal-content.sa-motif-modal {
    max-width: min(96vw, 528px);
    width: calc(100% - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.modal-content.sa-motif-modal form {
    padding: 0;
}

.sa-motif-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem 1rem;
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 55%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sa-motif-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.sa-motif-badge {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #0284c7 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
}

.sa-motif-head-text {
    min-width: 0;
}

.sa-motif-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.sa-motif-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
    word-break: break-word;
}

.sa-motif-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sa-motif-close:hover {
    background: #fff;
    color: #0f172a;
}

.sa-motif-body {
    padding: 1.15rem 1.25rem 1.25rem;
    background: #f8fafc;
}

.sa-motif-field + .sa-motif-field {
    margin-top: 1rem;
}

.sa-motif-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #64748b;
}

.sa-motif-control {
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sa-motif-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.sa-motif-hint {
    margin: 0.45rem 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

.sa-motif-footer {
    padding: 0.85rem 1.25rem 1rem;
    background: #fff;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    margin-top: 0;
}

.sa-config-intro { font-size: 0.85rem; margin-bottom: 0.65rem; }

.sa-config-poste-info {
    font-size: 0.85rem;
    margin: 0 0 0.65rem;
    padding: 0.45rem 0.65rem;
    background: #fef3c7;
    border-radius: var(--radius-sm);
    color: #92400e;
}

.sa-config-role-block {
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.65rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.sa-config-role-block h4 {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    color: var(--primary);
}

.sa-config-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
}

.sa-config-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}

.sa-config-colors h3 {
    font-size: 0.9rem;
    margin: 0.75rem 0 0.5rem;
}

/*
 * Configuration SA : header + footer fixes, corps scrollable seul
 * (évite double barre / contenu coupé / « pas de scrolling »).
 */
#sa-config-modal .sa-config-modal.modal-content,
.modal-content.sa-config-modal {
    display: flex;
    flex-direction: column;
    width: min(96vw, 1100px);
    max-width: min(96vw, 1100px);
    max-height: min(92vh, 900px);
    overflow: hidden;
}

#sa-config-modal .sa-config-modal > .modal-header,
#sa-config-modal .sa-config-modal > .modal-footer,
.modal-content.sa-config-modal > .modal-header,
.modal-content.sa-config-modal > .modal-footer {
    flex: 0 0 auto;
}

.sa-config-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 0.5rem;
}

.sa-config-modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sa-config-modal-footer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.sa-config-default-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.sa-config-default-btn svg {
    flex-shrink: 0;
}

.sa-config-columns-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sa-config-style-section + .sa-config-style-section {
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border, #e2e8f0);
}

.sa-config-section-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--primary, #2563eb);
}

.sa-config-colors-hint {
    margin: -0.35rem 0 0.65rem;
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.sa-config-colors-group + .sa-config-colors-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.sa-config-colors-subtitle {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sa-config-columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.5rem;
}

.sa-config-color-row {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
}

.sa-config-col-label,
.sa-config-color-row strong { min-width: 0; }

.sa-config-style-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
}

.sa-config-style-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
    cursor: pointer;
}

.sa-config-font-size {
    width: 4rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
}

.sa-config-color-row label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
    margin-right: 0.35rem;
}

.sa-config-color-row input[type=color] {
    width: 28px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.sa-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.sa-detail-grid label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.sa-detail-grid p { margin: 0; font-size: 0.9rem; font-weight: 600; }

/* Popup petite */
.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

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

.popup-sm {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
    padding: 1.25rem 1.5rem;
    max-width: 320px;
    width: 100%;
    text-align: center;
    animation: popupIn 0.2s ease;
}

@keyframes popupIn {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-sm-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
}

.popup-sm-icon-danger { background: #fee2e2; color: #dc2626; }
.popup-sm-icon-success { background: #dcfce7; color: #16a34a; }
.popup-sm-icon-warn { background: #fef3c7; color: #d97706; }
.popup-sm-icon-info { background: #e0f2fe; color: #0284c7; }

.popup-sm-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.popup-sm-text {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.patient-dup-popup-box {
    max-width: 400px;
    text-align: left;
}

.patient-dup-popup-box .popup-sm-icon,
.patient-dup-popup-box > .popup-sm-title,
.patient-dup-popup-box > .popup-sm-text {
    text-align: center;
}

.patient-dup-details {
    margin: 0.75rem 0 1rem;
    padding: 0.65rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
}

.patient-dup-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.35rem 0.5rem;
    padding: 0.22rem 0;
    font-size: 0.82rem;
}

.patient-dup-row dt {
    color: #64748b;
    font-weight: 600;
}

.patient-dup-row dd {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
    word-break: break-word;
}

.patient-dup-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.popup-sm-detail {
    margin: 0 0 1rem;
    font-size: 0.78rem;
    color: var(--text);
    padding: 0.5rem 0.65rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.popup-sm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Popup confirmation — toujours au-dessus de la patience (app-busy ~12500) */
.confirm-popup-overlay {
    z-index: 13000;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.confirm-popup-dialog {
    position: relative;
    width: 100%;
    max-width: 430px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 16px;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 8px 16px rgba(15, 23, 42, 0.08);
    animation: confirmPopupIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.confirm-popup-accent {
    height: 4px;
    background: linear-gradient(90deg, #f87171 0%, #ef4444 55%, #dc2626 100%);
}

.confirm-popup-dialog-warn .confirm-popup-accent {
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
}

.confirm-popup-dialog-success .confirm-popup-accent {
    background: linear-gradient(90deg, #4ade80 0%, #22c55e 55%, #16a34a 100%);
}

.confirm-popup-dialog-info .confirm-popup-accent {
    background: linear-gradient(90deg, #38bdf8 0%, #0ea5e9 55%, #0284c7 100%);
}

.confirm-popup-dialog-leave .confirm-popup-accent {
    background: linear-gradient(90deg, #38bdf8 0%, #0ea5e9 45%, #6366f1 100%);
}

.confirm-popup-dialog-leave .confirm-popup-detail {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
    color: #334155;
}

.confirm-popup-dialog-leave .confirm-popup-icon {
    background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0284c7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.confirm-popup-btn-stay {
    border: none;
    background: linear-gradient(145deg, #38bdf8 0%, #0ea5e9 100%);
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.28);
    color: #fff;
}

.confirm-popup-btn-stay:hover {
    background: linear-gradient(145deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}

.confirm-popup-btn-leave {
    border: 1px solid #fca5a5;
    background: #fff;
    color: #b91c1c;
    box-shadow: none;
}

.confirm-popup-btn-leave:hover {
    background: #fef2f2;
    border-color: #f87171;
    color: #991b1b;
}

.confirm-popup-close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.92);
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.confirm-popup-close svg {
    width: 0.95rem;
    height: 0.95rem;
}

.confirm-popup-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.confirm-popup-body {
    padding: 1.15rem 1.25rem 1.1rem;
}

.confirm-popup-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.65rem;
    padding-right: 1.75rem;
}

.confirm-popup-icon {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    border-radius: 12px;
    font-size: 0;
}

.confirm-popup-icon svg {
    width: 1.35rem;
    height: 1.35rem;
}

.confirm-popup-icon.popup-sm-icon-danger {
    background: linear-gradient(145deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.confirm-popup-icon.popup-sm-icon-warn {
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.confirm-popup-icon.popup-sm-icon-success {
    background: linear-gradient(145deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.confirm-popup-icon.popup-sm-icon-info {
    background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0284c7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.confirm-popup-head-text {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}

.confirm-popup-title {
    margin: 0 0 0.35rem;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0f172a;
    line-height: 1.25;
}

.confirm-popup-message {
    margin: 0;
    font-size: 0.86rem;
    color: #64748b;
    line-height: 1.5;
}

.confirm-popup-detail {
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    color: #334155;
    line-height: 1.45;
    text-align: left;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.confirm-popup-prompt-wrap {
    margin: 0 0 0.85rem;
}

.confirm-popup-prompt-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
    color: #0f172a;
    background: #fff;
    outline: none;
}

.confirm-popup-prompt-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.confirm-popup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-top: 0.15rem;
}

.confirm-popup-actions .btn {
    min-height: 2.25rem;
    font-weight: 600;
    border-radius: 10px;
}

.confirm-popup-actions .btn-outline {
    background: #fff;
    border-color: #cbd5e1;
    color: #475569;
}

.confirm-popup-actions .btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.confirm-popup-actions .btn-danger,
.confirm-popup-actions .btn-warn,
.confirm-popup-actions .btn-success,
.confirm-popup-actions .btn-primary {
    border: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.confirm-popup-actions .btn-danger {
    background: linear-gradient(145deg, #f87171 0%, #ef4444 100%);
}

.confirm-popup-actions .btn-danger:hover {
    background: linear-gradient(145deg, #ef4444 0%, #dc2626 100%);
}

.confirm-popup-actions .btn-warn {
    background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 100%);
}

.confirm-popup-actions .btn-warn:hover {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
}

.confirm-popup-actions .btn-success {
    background: linear-gradient(145deg, #4ade80 0%, #22c55e 100%);
}

.confirm-popup-actions .btn-success:hover {
    background: linear-gradient(145deg, #22c55e 0%, #16a34a 100%);
}

.confirm-popup-actions .btn-primary {
    background: linear-gradient(145deg, #38bdf8 0%, #0ea5e9 100%);
    color: #fff;
}

.confirm-popup-actions .btn-primary:hover {
    background: linear-gradient(145deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
}

.btn-danger:hover { background: #dc2626; }

.btn-success {
    background: #22c55e;
    color: #fff;
    border: none;
}

.btn-success:hover { background: #16a34a; }

.btn-warn {
    background: #f59e0b;
    color: #fff;
    border: none;
}

.btn-warn:hover { background: #d97706; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        position: relative;
        overflow: visible;
        transition: none;
        transform: none;
        visibility: visible;
        pointer-events: auto;
    }

    html.sidebar-collapsed .sidebar {
        display: none;
    }
    .sidebar-nav {
        max-height: 50vh;
    }
    .main-content { margin-left: 0; padding: 0 1.25rem 1.25rem; }
    .page-header {
        margin: 0 -1.25rem 1rem;
        padding: 0.75rem 1.25rem;
    }
    .app-layout { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-charts-grid { grid-template-columns: 1fr; }
    .chart-card-wide { grid-column: auto; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .chat-card { height: calc(100vh - 140px); min-height: 360px; }
    .chat-layout { grid-template-columns: 1fr; grid-template-rows: 220px 1fr; }
    .chat-contacts { border-right: none; border-bottom: 1px solid var(--border); }
    .sa-th-actions, .sa-td-actions { position: static; box-shadow: none; }
    .pf-textarea-grid { grid-template-columns: 1fr; }
    .sa-patient-modal.pf-compact .form-row {
        grid-template-columns: 1fr 1fr;
    }
    .pf-coord-address-layout {
        grid-template-columns: 1fr;
    }
}

/* Calendrier français (Flatpickr) */
.flatpickr-calendar {
    font-family: inherit;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays,
.flatpickr-day {
    font-size: 0.85rem;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--primary);
    border-color: var(--primary);
}

.flatpickr-day.today {
    border-color: var(--primary);
}

.flatpickr-time input {
    font-size: 0.9rem;
}

input.flatpickr-input.form-control,
input[type="date"].form-control + input.form-control,
input[type="datetime-local"].form-control + input.form-control {
    cursor: pointer;
}

/* Agenda médical (FullCalendar) */
.main-content:has(.agenda-page) {
    padding: 0 1.5rem 1.25rem;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.main-content:has(.agenda-page) .page-header {
    margin: 0 -1.5rem 0.75rem;
    padding: 0.75rem 1.5rem;
    flex-shrink: 0;
}

.main-content:has(.agenda-page) .page-header h1 {
    font-size: 1rem;
}

.main-content:has(.agenda-page) .page-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.agenda-page {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
    min-height: 0;
}

.agenda-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    flex-shrink: 0;
}

.agenda-toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.agenda-filter-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 180px;
}

.agenda-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

#agenda-btn-config {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

#agenda-btn-config svg {
    width: 1rem;
    height: 1rem;
}

.agenda-config-modal.modal-content {
    width: min(1512px, 90vw); /* +40 % vs 1080px — toutes les cartes visibles */
    max-width: 90vw;
    max-height: none;
    height: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

#agenda-config-modal.modal.active {
    align-items: flex-start;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.agenda-config-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 55%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    flex-shrink: 0;
}

.agenda-config-header-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.agenda-config-badge {
    flex-shrink: 0;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #0c4a8a 0%, #0284c7 100%);
    box-shadow: 0 4px 12px rgba(12, 74, 138, 0.24);
}

.agenda-config-badge svg {
    width: 1.05rem;
    height: 1.05rem;
}

.agenda-config-kicker {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0c4a8a;
    margin-bottom: 0.05rem;
}

.agenda-config-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
}

.agenda-config-sub {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: #64748b;
}

.agenda-config-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.agenda-config-close:hover {
    background: #fff;
    color: #0f172a;
}

.agenda-config-body {
    padding: 0.5rem 0.75rem;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    align-content: start;
}

.agenda-config-span-2 {
    grid-column: 1 / -1;
}

.agenda-config-inline-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
}

.agenda-config-inline-block {
    min-width: 0;
}

.agenda-config-section {
    padding: 0.4rem 0.55rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    min-width: 0;
}

.agenda-config-section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin-bottom: 0.3rem;
}

.agenda-config-section-head.is-compact {
    margin-bottom: 0.25rem;
}

.agenda-config-section-head.is-compact h3 {
    font-size: 0.82rem;
}

.agenda-config-section-head.is-compact p {
    font-size: 0.66rem;
    margin-top: 0;
    line-height: 1.25;
}

.agenda-config-section-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0369a1;
}

.agenda-config-section-icon.is-warn {
    background: #ffedd5;
    color: #c2410c;
}

.agenda-config-section-icon.is-block {
    background: #fee2e2;
    color: #b91c1c;
}

.agenda-config-section-icon.is-ferie {
    background: #ffedd5;
    color: #c2410c;
}

.agenda-config-section-icon.is-wa {
    background: #dcfce7;
    color: #15803d;
}

.agenda-config-section-icon.is-popup {
    background: #e0e7ff;
    color: #4338ca;
}

.agenda-config-row-compact {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.agenda-config-color-field {
    margin-top: 0;
}

.agenda-config-color-field.is-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.agenda-config-color-field.is-inline > span {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
}

.agenda-config-color {
    width: 2.4rem;
    height: 1.85rem;
    padding: 0.1rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    cursor: pointer;
}

.agenda-config-feries-add {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0;
    flex: 1;
    min-width: 0;
}

.agenda-config-feries-add .form-control {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}

.agenda-config-feries-list {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-height: none;
    overflow: visible;
}

.agenda-config-feries-empty {
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 0.2rem 0;
}

.agenda-config-plages-head {
    justify-content: space-between;
    align-items: center;
}

.agenda-config-plages-head .agenda-config-section-head-main {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}

.agenda-config-plages {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: none;
    overflow: visible;
}

@media (max-width: 820px) {
    .agenda-config-body {
        grid-template-columns: 1fr;
    }

    .agenda-config-inline-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.agenda-config-ferie-item {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.25rem 0.4rem 0.25rem 0.5rem;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9a3412;
}

.agenda-config-ferie-remove {
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #c2410c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.agenda-config-ferie-remove svg {
    width: 0.95rem;
    height: 0.95rem;
}

#agenda-calendar {
    --agenda-sunday-bg: #e0f2fe;
    --agenda-sunday-text: #0c4a8a;
    --agenda-holiday-bg: #ffedd5;
}

#agenda-calendar .fc-day-sun,
#agenda-calendar .agenda-day-sunday {
    background-color: var(--agenda-sunday-bg) !important;
}

#agenda-calendar .fc-col-header-cell.fc-day-sun .fc-col-header-cell-cushion,
#agenda-calendar .fc-col-header-cell.agenda-day-sunday .fc-col-header-cell-cushion,
#agenda-calendar .fc-daygrid-day.fc-day-sun .fc-daygrid-day-number,
#agenda-calendar .fc-daygrid-day.agenda-day-sunday .fc-daygrid-day-number,
#agenda-calendar .fc-timegrid-col.fc-day-sun .fc-timegrid-col-frame,
#agenda-calendar .agenda-day-sunday .fc-col-header-cell-cushion,
#agenda-calendar .agenda-day-sunday a {
    color: var(--agenda-sunday-text) !important;
}

#agenda-calendar .agenda-day-holiday {
    background-color: var(--agenda-holiday-bg) !important;
}

#agenda-calendar .agenda-day-holiday.agenda-day-sunday {
    background-image: linear-gradient(135deg, var(--agenda-holiday-bg), var(--agenda-sunday-bg)) !important;
}

.agenda-config-section-icon svg {
    width: 0.9rem;
    height: 0.9rem;
}

.agenda-config-section-head h3 {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
}

.agenda-config-section-head p {
    margin: 0.08rem 0 0;
    font-size: 0.7rem;
    line-height: 1.25;
    color: #64748b;
}

.agenda-config-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: #475569;
}

.agenda-config-modal .form-control,
.agenda-config-modal select.form-control,
.agenda-config-modal input.form-control {
    min-height: 1.85rem;
    padding: 0.28rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.25;
}

.agenda-config-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
}

.agenda-config-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.agenda-config-switch-ui {
    width: 2.5rem;
    height: 1.4rem;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background 0.2s ease;
}

.agenda-config-switch-ui::after {
    content: '';
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    transition: transform 0.2s ease;
}

.agenda-config-switch input:checked + .agenda-config-switch-ui {
    background: #0c4a8a;
}

.agenda-config-switch input:checked + .agenda-config-switch-ui::after {
    transform: translateX(1.1rem);
}

.agenda-config-switch-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
}

.agenda-config-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.agenda-config-demi-grid {
    display: grid;
    gap: 0.2rem;
}

.agenda-config-demi-head,
.agenda-config-demi-row {
    display: grid;
    grid-template-columns: 1fr 4.5rem 4.5rem;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
}

.agenda-config-demi-head {
    color: #64748b;
    font-weight: 650;
    padding: 0 0.15rem 0.25rem;
}

.agenda-config-demi-row {
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin: 0;
    cursor: default;
}

.agenda-config-demi-row span:first-child {
    font-weight: 600;
    color: #334155;
}

.agenda-config-demi-row input[type="checkbox"] {
    justify-self: center;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #0284c7;
}


.agenda-config-day {
    cursor: pointer;
}

.agenda-config-day input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.agenda-config-day span {
    display: inline-flex;
    min-width: 2.2rem;
    justify-content: center;
    padding: 0.28rem 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    transition: all 0.15s ease;
}

.agenda-config-day input:checked + span {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.agenda-config-plages {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0;
    max-height: none;
    overflow: visible;
}

.agenda-config-plage-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
    gap: 0.3rem;
    align-items: center;
}

.agenda-config-plage-row .form-control {
    min-width: 0;
}

.agenda-config-plage-remove {
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    border-radius: 10px;
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.agenda-config-plage-remove svg {
    width: 1rem;
    height: 1rem;
}

.agenda-config-add-plage {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.agenda-config-add-plage svg {
    width: 0.95rem;
    height: 0.95rem;
}

.agenda-config-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: #f8fafc;
    flex-shrink: 0;
}

.agenda-config-footer .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.agenda-config-footer .btn-primary svg {
    width: 1rem;
    height: 1rem;
}

#agenda-calendar .fc-bg-event.agenda-blocked-range {
    background: repeating-linear-gradient(
        -45deg,
        rgba(239, 68, 68, 0.14),
        rgba(239, 68, 68, 0.14) 6px,
        rgba(239, 68, 68, 0.05) 6px,
        rgba(239, 68, 68, 0.05) 12px
    ) !important;
    border: none !important;
    opacity: 1 !important;
}

@media (max-width: 640px) {
    .agenda-config-plage-row {
        grid-template-columns: 1fr 1fr auto;
    }
    .agenda-config-plage-row select {
        grid-column: 1 / -2;
    }
}

/* Emplacement date mobile (vide sur desktop) */
.agenda-toolbar-date-slot {
    display: none;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    min-width: 0;
}

.agenda-toolbar-date-icon {
    display: none;
    width: 1.05rem;
    height: 1.05rem;
    color: #64748b;
    flex-shrink: 0;
}

.agenda-toolbar-date-icon svg {
    width: 100%;
    height: 100%;
}

.agenda-btn-transfer-jour svg {
    width: 0.95rem;
    height: 0.95rem;
    margin-right: 0.35rem;
    vertical-align: -0.12rem;
}

#agenda-btn-rtp-jour svg {
    width: 0.95rem;
    height: 0.95rem;
    margin-right: 0.35rem;
    vertical-align: -0.12rem;
}

#agenda-btn-rtp-jour.is-rtp-running {
    opacity: 0.85;
    box-shadow: inset 0 0 0 1px rgba(2, 132, 199, 0.35);
}

.agenda-rtp-date-modal {
    width: min(420px, 96vw);
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.16);
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
}

.agenda-rtp-date-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.15rem 0.85rem;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(2, 132, 199, 0.04));
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.agenda-rtp-date-header-main {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.agenda-rtp-date-badge {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #38bdf8, #0284c7);
    color: #fff;
    flex-shrink: 0;
}

.agenda-rtp-date-badge svg {
    width: 1.25rem;
    height: 1.25rem;
}

.agenda-rtp-date-kicker {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0284c7;
    margin-bottom: 0.15rem;
}

.agenda-rtp-date-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.agenda-rtp-date-sub {
    margin: 0.2rem 0 0;
    font-size: 0.84rem;
    color: #64748b;
    line-height: 1.35;
}

.agenda-rtp-date-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.agenda-rtp-date-close:hover {
    background: rgba(148, 163, 184, 0.18);
    color: #0f172a;
}

.agenda-rtp-date-body {
    padding: 1.1rem 1.15rem;
}

.agenda-rtp-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.agenda-rtp-date-field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: #334155;
}

.agenda-rtp-date-field-label svg {
    width: 1rem;
    height: 1rem;
    color: #0284c7;
}

#agenda-rtp-date-input {
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
}

#agenda-rtp-date-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
    outline: none;
}

.agenda-rtp-date-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    padding: 0.85rem 1.15rem 1.1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(248, 250, 252, 0.8);
}

.agenda-rtp-date-footer .btn-primary svg {
    width: 0.95rem;
    height: 0.95rem;
    margin-right: 0.35rem;
    vertical-align: -0.12rem;
}

.agenda-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0.65rem;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.agenda-sidebar {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
    overflow-y: auto;
}

.agenda-sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.agenda-sidebar-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.agenda-day-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.agenda-stat {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.5rem;
    text-align: center;
}

.agenda-stat strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.2;
    color: var(--primary-dark);
}

.agenda-stat span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.agenda-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 140px;
    overflow-y: auto;
}

.agenda-day-empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.agenda-day-item {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.45rem;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.agenda-day-item .agenda-rdv-statut-dot.is-sidebar {
    grid-row: 1 / span 2;
    align-self: center;
}

.agenda-day-item:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.agenda-day-item-time {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--primary-dark);
    grid-column: 2;
    grid-row: 1;
}

.agenda-day-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    grid-column: 3;
    grid-row: 1;
}

.agenda-day-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    grid-column: 3;
    grid-row: 2;
}

.agenda-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.82rem;
}

.agenda-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agenda-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.agenda-statut-planifie { background: #0ea5e9; }
.agenda-statut-confirme { background: #10b981; }
.agenda-statut-en_cours { background: #f59e0b; }
.agenda-statut-termine { background: #64748b; }
.agenda-statut-valider { background: #6366f1; }
.agenda-statut-annule { background: #ef4444; }
.agenda-statut-absent { background: #a855f7; }

.agenda-main {
    padding: 0.5rem;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#agenda-calendar {
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* FullCalendar — thème cabinet */
.agenda-main .fc {
    --fc-border-color: var(--border);
    --fc-button-bg-color: #fff;
    --fc-button-border-color: var(--border);
    --fc-button-text-color: var(--text);
    --fc-button-hover-bg-color: var(--primary-light);
    --fc-button-hover-border-color: var(--primary);
    --fc-button-active-bg-color: var(--primary);
    --fc-button-active-border-color: var(--primary-dark);
    --fc-today-bg-color: rgba(14, 165, 233, 0.08);
    --fc-now-indicator-color: #ef4444;
    --fc-event-border-color: transparent;
    font-family: inherit;
    font-size: 0.8rem;
    height: 100%;
}

.agenda-main .fc .fc-toolbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.agenda-main .fc .fc-toolbar {
    margin-bottom: 0.45rem !important;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.agenda-main .fc .fc-button {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    box-shadow: none;
    text-transform: capitalize;
}

.agenda-main .fc .fc-button-primary:not(:disabled).fc-button-active,
.agenda-main .fc .fc-button-primary:not(:disabled):active {
    color: #fff;
}

.agenda-main .fc .fc-col-header-cell-cushion,
.agenda-main .fc .fc-daygrid-day-number,
.agenda-main .fc .fc-timegrid-slot-label-cushion {
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
}

.agenda-main .fc .fc-timegrid-slot {
    height: 1.65rem;
}

.agenda-main .fc .fc-col-header-cell-cushion {
    padding: 0.35rem 0;
    font-size: 0.75rem;
}

.agenda-main .fc .fc-timegrid-slot-label-cushion {
    font-size: 0.72rem;
}

.agenda-main .fc .fc-timegrid-now-indicator-line {
    border-width: 2px;
}

.agenda-main .fc .fc-event {
    border-radius: 5px;
    padding: 1px 3px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    border-width: 1px;
    border-style: solid;
}

.agenda-main .fc .agenda-rdv-event-main {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
    width: 100%;
}

.agenda-main .fc .agenda-rdv-statut-dot {
    flex-shrink: 0;
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.15rem;
    border-radius: 999px;
    border: 1.5px solid rgba(15, 23, 42, 0.15);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.agenda-main .fc .agenda-rdv-event-main .fc-event-title-container {
    min-width: 0;
    flex: 1;
}

.agenda-main .fc .fc-event-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-rdv-statut-dot.is-sidebar {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    border: 1.5px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.agenda-main .fc .fc-daygrid-event {
    margin: 1px 2px;
}

.agenda-main .fc .fc-highlight {
    background: rgba(14, 165, 233, 0.15);
}

.agenda-main .fc .fc-non-business {
    background: rgba(148, 163, 184, 0.06);
}

.agenda-detail-popover {
    position: fixed;
    z-index: 2500;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.85rem 1rem;
    max-width: 280px;
    font-size: 0.85rem;
}

.agenda-rdv-context-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2590;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.agenda-rdv-context-backdrop.is-visible {
    opacity: 1;
}

.agenda-rdv-context-menu {
    position: fixed;
    z-index: 2600;
    width: min(92vw, 320px);
    overflow: hidden;
    padding: 0;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 8px 16px rgba(15, 23, 42, 0.08);
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transform-origin: top left;
    transition:
        opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.agenda-rdv-context-menu.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.agenda-rdv-context-accent {
    height: 4px;
    background: linear-gradient(90deg, #38bdf8 0%, #0ea5e9 45%, #6366f1 100%);
}

.agenda-rdv-context-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(135deg, rgba(240, 249, 255, 0.9) 0%, rgba(248, 250, 252, 0.4) 100%);
}

.agenda-rdv-context-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 12px;
    background: linear-gradient(145deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0284c7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.agenda-rdv-context-avatar svg {
    width: 1.15rem;
    height: 1.15rem;
}

.agenda-rdv-context-head-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.agenda-rdv-context-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.agenda-rdv-context-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-rdv-context-meta {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-rdv-context-badge {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: #e2e8f0;
    color: #475569;
}

.agenda-rdv-context-badge.is-planifie { background: #e0f2fe; color: #0369a1; }
.agenda-rdv-context-badge.is-confirme { background: #dcfce7; color: #15803d; }
.agenda-rdv-context-badge.is-en_cours { background: #fef3c7; color: #b45309; }
.agenda-rdv-context-badge.is-termine { background: #f1f5f9; color: #475569; }
.agenda-rdv-context-badge.is-valider { background: #e0e7ff; color: #4338ca; }
.agenda-rdv-context-badge.is-annule { background: #fee2e2; color: #b91c1c; }
.agenda-rdv-context-badge.is-absent { background: #f3e8ff; color: #7e22ce; }

.agenda-rdv-context-actions {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.45rem;
}

.agenda-rdv-context-divider {
    height: 1px;
    margin: 0.15rem 0.35rem;
    background: rgba(148, 163, 184, 0.22);
}

.agenda-rdv-context-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    font: inherit;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.agenda-rdv-context-item:hover:not(:disabled),
.agenda-rdv-context-item:focus-visible:not(:disabled) {
    background: rgba(14, 165, 233, 0.08);
    outline: none;
}

.agenda-rdv-context-item:active:not(:disabled) {
    transform: scale(0.985);
}

.agenda-rdv-context-item-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
}

.agenda-rdv-context-item-icon svg {
    width: 1rem;
    height: 1rem;
}

.agenda-rdv-context-item-icon.is-edit {
    background: #eff6ff;
    color: #2563eb;
}

.agenda-rdv-context-item-icon.is-transfer {
    background: #ecfdf5;
    color: #059669;
}

.agenda-rdv-context-item-icon.is-wa {
    background: #ecfdf5;
    color: #00a884;
}

.agenda-rdv-context-item-icon.is-delete {
    background: #fef2f2;
    color: #dc2626;
}

.agenda-rdv-context-item-text {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    min-width: 0;
}

.agenda-rdv-context-item-text strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

.agenda-rdv-context-item-text small {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.3;
}

.agenda-rdv-context-item.is-danger:hover:not(:disabled),
.agenda-rdv-context-item.is-danger:focus-visible:not(:disabled) {
    background: rgba(239, 68, 68, 0.07);
}

.agenda-rdv-context-item.is-danger .agenda-rdv-context-item-text strong {
    color: #b91c1c;
}

.agenda-rdv-context-item:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.agenda-rdv-hover-popup {
    position: fixed;
    z-index: 10050;
    width: min(16.5rem, calc(100vw - 2rem));
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 52%, #ffffff 100%);
    box-shadow:
        0 14px 32px rgba(15, 23, 42, 0.12),
        0 3px 10px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.agenda-rdv-hover-popup[hidden] {
    display: none !important;
}

.agenda-rdv-hover-popup.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.agenda-rdv-hover-accent {
    height: 3px;
    background: var(--primary, #0ea5e9);
}

.agenda-rdv-hover-body {
    padding: 0.55rem 0.65rem 0.65rem;
}

.agenda-rdv-hover-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.15rem;
}

.agenda-rdv-hover-kicker {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.agenda-rdv-hover-kicker-icon {
    display: inline-flex;
    width: 0.75rem;
    height: 0.75rem;
    color: #0ea5e9;
}

.agenda-rdv-hover-kicker-icon svg {
    width: 100%;
    height: 100%;
}

.agenda-rdv-hover-statut {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.38rem;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1.2;
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
}

.agenda-rdv-hover-statut.is-planifie { background: #e0f2fe; color: #0369a1; }
.agenda-rdv-hover-statut.is-confirme { background: #dcfce7; color: #15803d; }
.agenda-rdv-hover-statut.is-en_cours { background: #fef3c7; color: #b45309; }
.agenda-rdv-hover-statut.is-termine { background: #f1f5f9; color: #475569; }
.agenda-rdv-hover-statut.is-valider { background: #e0e7ff; color: #4338ca; }
.agenda-rdv-hover-statut.is-annule { background: #fee2e2; color: #b91c1c; }
.agenda-rdv-hover-statut.is-absent { background: #f3e8ff; color: #7e22ce; }

.agenda-rdv-hover-name {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.agenda-rdv-hover-details {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.agenda-rdv-hover-row {
    display: grid;
    grid-template-columns: 5.8rem 1fr;
    gap: 0.3rem;
    align-items: start;
}

.agenda-rdv-hover-row dt {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    font-size: 0.62rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1.3;
}

.agenda-rdv-hover-row-icon {
    display: inline-flex;
    width: 0.7rem;
    height: 0.7rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.agenda-rdv-hover-row-icon svg {
    width: 100%;
    height: 100%;
}

.agenda-rdv-hover-row dd {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
}

@media (max-width: 1100px) {
    .agenda-layout {
        grid-template-columns: 1fr;
    }
    .agenda-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    /* Remplir tout l’espace vertical disponible */
    .main-content:has(.agenda-page) {
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        padding-bottom: 0.5rem;
    }
    .main-content:has(.agenda-page) .page-body {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    .agenda-page {
        flex: 1;
        min-height: 0;
        gap: 0.45rem;
        overflow: hidden;
    }
    .agenda-toolbar {
        flex-direction: column;
        align-items: stretch;
        flex-shrink: 0;
        padding: 0.5rem 0.65rem;
    }
    .agenda-toolbar-left,
    .agenda-toolbar-right {
        width: 100%;
    }
    .agenda-filter-label {
        min-width: 0;
        flex: 1;
    }
    /* Date dans la toolbar ; sidebar (Résumé / Légende) masquée */
    .agenda-sidebar-date-section,
    .agenda-sidebar-resume-section,
    .agenda-sidebar {
        display: none !important;
    }
    .agenda-toolbar-date-slot {
        display: inline-flex;
        flex: 1 1 8.5rem;
        order: 10;
        padding: 0.2rem 0.45rem 0.2rem 0.55rem;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        background: #fff;
        min-height: 2.4rem;
    }
    .agenda-toolbar-date-icon {
        display: inline-flex;
    }
    .agenda-toolbar-date-slot #agenda-mini-date,
    .agenda-toolbar-date-slot .form-control {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
        min-height: 2rem;
        height: 2rem;
        padding: 0.15rem 0.25rem;
        border: none;
        background: transparent;
        font-size: 16px;
        box-shadow: none;
    }
    #agenda-btn-new-rdv {
        order: 11;
        flex: 1 1 10rem;
        justify-content: center;
        min-height: 2.4rem;
    }
    .agenda-layout {
        flex: 1;
        min-height: 0;
        grid-template-columns: 1fr;
        gap: 0;
        overflow: hidden;
    }
    .agenda-main {
        min-height: 0;
        height: 100%;
        padding: 0.35rem;
        overflow: hidden;
    }
    #agenda-calendar,
    .agenda-main .fc {
        height: 100% !important;
        min-height: 0;
    }
    .agenda-main .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.card-header-sub {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.card-body {
    padding: 1rem 1.25rem 1.25rem;
}

.menu-config-table th,
.menu-config-table td {
    vertical-align: middle;
}

.menu-config-role-col {
    width: 130px;
    text-align: center;
}

.menu-config-group-row td {
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

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

.menu-config-check {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.medicament-reference-sites-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #fff;
}

.medicament-reference-sites-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.medicament-reference-sites-table th,
.medicament-reference-sites-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
}

.medicament-reference-sites-table th {
    background: #f8fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.medicament-reference-sites-table tr:last-child td {
    border-bottom: none;
}

.medicament-reference-sites-table tr.is-active-source td {
    background: #eff6ff;
}

.medicament-reference-sites-site a {
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.medicament-reference-sites-site a:hover {
    text-decoration: underline;
}

.medicament-reference-sites-desc {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

.medicament-reference-sites-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.medicament-reference-sites-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
}

.medicament-reference-sites-contexts {
    margin: 0;
    padding-left: 1.1rem;
    color: #334155;
    font-size: 0.82rem;
    line-height: 1.45;
}

.medicament-reference-sites-tag.is-custom {
    background: #fef3c7;
    color: #92400e;
}

.medicament-custom-reference-sites-group {
    margin-top: 0.25rem;
}

.medicament-custom-reference-sites-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.medicament-custom-sites-empty {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
}

.medicament-custom-site-card {
    border: 1px solid #dbeafe;
    border-radius: 0.65rem;
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    padding: 0.85rem 0.95rem;
}

.medicament-custom-site-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.medicament-custom-site-card-head strong {
    font-size: 0.88rem;
    color: #0f172a;
}

.medicament-custom-site-remove {
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid #fecaca;
    border-radius: 0.4rem;
    background: #fff;
    color: #b91c1c;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.medicament-custom-site-remove:hover {
    background: #fef2f2;
}

.medicament-custom-site-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.medicament-custom-site-card .form-group {
    margin-bottom: 0.65rem;
}

.medicament-custom-site-card .form-group:last-child {
    margin-bottom: 0;
}

.medicament-custom-site-card label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
}

.medicament-custom-site-checks {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.medicament-custom-site-check {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #334155;
    cursor: pointer;
}

.medicament-custom-site-check input {
    margin-top: 0.15rem;
}

.medicament-custom-reference-site-add-btn {
    margin-top: 0.15rem;
}

@media (max-width: 768px) {
    .medicament-custom-site-grid {
        grid-template-columns: 1fr;
    }
}

.medicament-info-fields-options {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.medicament-info-field-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: #f8fafc;
    cursor: pointer;
}

.medicament-info-field-option input {
    margin-right: 0.35rem;
}

.options-hint {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
}

.sauvegarde-client-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.db-admin-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.db-admin-status-item {
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.db-admin-status-item strong {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.db-admin-status-item span {
    font-size: 0.92rem;
    color: #0f172a;
    word-break: break-word;
}

.db-admin-status-item.is-ok span {
    color: #166534;
}

.db-admin-status-item.is-warn span {
    color: #b45309;
}

.db-admin-status-item.is-error span {
    color: #b91c1c;
}

.db-admin-panels {
    display: grid;
    gap: 1.25rem;
}

.db-admin-panel {
    padding: 1rem 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.db-admin-panel-title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.db-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.db-admin-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
    font-size: 0.9rem;
}

.db-admin-footnote {
    margin-top: 1rem;
    margin-bottom: 0;
}

.db-admin-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.db-admin-user-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
}

.db-admin-user-badge.is-current {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.sauvegarde-path-row {
    display: flex;
    gap: 0.65rem;
    align-items: stretch;
}

.sauvegarde-path-row .form-control {
    flex: 1;
    min-width: 0;
}

.sauvegarde-client-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.sauvegarde-client-status {
    margin: 0.75rem 0 0;
    font-size: 0.88rem;
}

.sauvegarde-client-status.is-ok {
    color: #047857;
}

.sauvegarde-client-status.is-warn {
    color: #b45309;
}

.sauvegarde-client-status.is-muted {
    color: #64748b;
}

.sauvegarde-client-path-info {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.sauvegarde-docs-panel {
    margin: 1rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.sauvegarde-docs-title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}

.sauvegarde-docs-check-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0.75rem 0;
    font-size: 0.92rem;
    cursor: pointer;
}

.sauvegarde-docs-check {
    margin-top: 0.15rem;
}

.sauvegarde-docs-fields {
    margin-top: 0.75rem;
}

.sauvegarde-encrypt-section {
    margin: 1rem 0 0.5rem;
    padding: 1rem 1.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.sauvegarde-encrypt-fields {
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .sauvegarde-client-grid {
        grid-template-columns: 1fr;
    }

    .sauvegarde-path-row {
        flex-direction: column;
    }
}

.migration-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 720px;
}

.migration-hero-title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.migration-hero-desc {
    margin: 0 0 1.25rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.migration-result-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.migration-log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.migration-log-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.92rem;
    line-height: 1.45;
}

.migration-log-item.is-ok .migration-log-icon {
    color: #16a34a;
}

.migration-log-item.is-error .migration-log-icon {
    color: #dc2626;
}

.migration-log-icon {
    flex-shrink: 0;
    font-weight: 700;
    width: 1rem;
    text-align: center;
}

/* Configuration dictaphone (Outils) */
.dictaphone-config-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1100px;
}

.dictaphone-config-card .card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.dictaphone-config-commands-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dictaphone-config-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dictaphone-config-head-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dictaphone-config-general {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.25rem;
    align-items: start;
}

.dictaphone-config-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    cursor: pointer;
    user-select: none;
}

.dictaphone-config-check input {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.dictaphone-medical-toggle {
    margin-bottom: 1rem;
}

#dictaphone-targets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.65rem 1.25rem;
}

.dictaphone-config-table-wrap {
    overflow-x: auto;
}

.dictaphone-config-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dictaphone-config-table th,
.dictaphone-config-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.dictaphone-config-table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

.dictaphone-config-col-check {
    width: 3rem;
    text-align: center;
}

.dictaphone-config-col-actions {
    width: 2.5rem;
    text-align: center;
}

.dictaphone-config-table .form-control {
    width: 100%;
    min-width: 120px;
}

.dictaphone-config-table .dictaphone-command-insert {
    margin-top: 0.45rem;
}

.dictaphone-config-col-action {
    min-width: 220px;
}

.dictaphone-command-action-extra {
    margin-top: 0.45rem;
}

.dictaphone-command-hint {
    margin: 0.45rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.dictaphone-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

.dictaphone-char-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.dictaphone-char-preset {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.dictaphone-char-preset:hover {
    border-color: #0284c7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
    transform: translateY(-1px);
}

.dictaphone-char-preset-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.2rem;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    font-weight: 700;
}

.dictaphone-char-input {
    width: 4.5rem;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 700;
}

.dictaphone-config-card .card-header .btn svg {
    vertical-align: -2px;
}

.dictaphone-test-shell {
    position: relative;
}

.dictaphone-test-shell .dm-rich-editor,
.dictaphone-test-shell .dm-champ-modele {
    margin: 0;
}

/* Écrase .dm-champ-modele .dm-rich-editor-body-shell (height: 3.25rem + overflow hidden)
   chargé via dossier-medical.css — sinon la zone de test est inutilisable. */
.dictaphone-test-shell .dm-champ-modele .dm-rich-editor-body-shell,
.dictaphone-test-shell .dm-rich-editor-body-shell {
    position: relative;
    flex: 0 0 auto;
    height: auto !important;
    min-height: 9.5rem !important;
    max-height: none !important;
    overflow: visible !important;
}

.dictaphone-test-shell .dm-champ-modele .dm-rich-editor-body-shell .dm-rich-editor-body,
.dictaphone-test-shell .dm-rich-editor-body,
.dictaphone-test-shell #dictaphone-test-field {
    flex: 1 1 auto;
    min-height: 8.5rem !important;
    height: auto !important;
    max-height: none !important;
    padding-right: 2.35rem;
}

.dictaphone-test-shell .dm-dictaphone-btn {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #475569;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.dictaphone-test-shell .dm-dictaphone-btn:hover:not(:disabled) {
    background: #f0f9ff;
    border-color: #7dd3fc;
    color: #0284c7;
}

.dictaphone-test-shell .dm-dictaphone-btn.is-recording {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.dictaphone-test-shell .dm-dictaphone-icon {
    width: 0.95rem;
    height: 0.95rem;
}

/* Modal rendez-vous — agenda */
.modal-content.rdv-modal {
    max-width: min(96vw, 640px);
    width: calc(100% - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 24px 48px rgba(15, 23, 42, 0.16);
}

.modal-content.rdv-modal form {
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}

.rdv-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem 1rem;
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 55%, #f8fafc 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    flex-shrink: 0;
}

.rdv-modal-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.rdv-modal-badge {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #0284c7 100%);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
}

.rdv-modal-badge svg {
    width: 1.25rem;
    height: 1.25rem;
}

.rdv-modal-head-text {
    min-width: 0;
}

.rdv-modal-kicker {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6366f1;
    margin-bottom: 0.15rem;
}

.rdv-modal-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.rdv-modal-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: #64748b;
}

.rdv-modal-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.rdv-modal-close:hover {
    background: #fff;
    color: #0f172a;
}

.rdv-modal-body {
    padding: 0.75rem 1.15rem 0.35rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.rdv-modal-section + .rdv-modal-section {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.rdv-modal-section-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: -0.01em;
}

.rdv-modal-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 8px;
    flex-shrink: 0;
}

.rdv-modal-section-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.rdv-modal-section-icon.is-patient {
    background: #ede9fe;
    color: #7c3aed;
}

.rdv-modal-section-icon.is-schedule {
    background: #dbeafe;
    color: #2563eb;
}

.rdv-modal-section-icon.is-details {
    background: #dcfce7;
    color: #16a34a;
}

#rdv-medecin-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.rdv-medecin-label-icon {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    color: #0d9488;
}

.rdv-medecin-label-icon svg {
    width: 100%;
    height: 100%;
}

#rdv-medecin-group.is-solo-medecin,
#rdv-medecin-group[hidden] {
    display: none !important;
}

.rdv-modal-body .form-row {
    gap: 0.55rem 0.75rem;
}

.rdv-modal-body .form-group {
    margin-bottom: 0.5rem;
}

.rdv-modal-body .form-group:last-child {
    margin-bottom: 0.25rem;
}

.rdv-modal-body .form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.rdv-modal-body .form-control {
    border-radius: 10px;
    border-color: rgba(148, 163, 184, 0.45);
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rdv-modal-body .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Popup Nouveau rendez-vous (Agenda) — Notes compact pour garder Enregistrer visible */
.rdv-modal-body #rdv-notes {
    min-height: 4.5rem;
    max-height: 7rem;
    line-height: 1.45;
    resize: vertical;
}

.rdv-modal-footer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.25rem 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: #f8fafc;
    flex-shrink: 0;
}

.rdv-modal-footer-spacer {
    flex: 1;
}

.rdv-modal-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.rdv-modal-submit svg {
    width: 1rem;
    height: 1rem;
}

/* Combo patient — modal RDV */
.rdv-patient-group {
    position: relative;
    z-index: 2;
}

.rdv-patient-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.2rem;
}

.rdv-patient-label-row > label[for="rdv-patient-search"] {
    margin-bottom: 0;
}

.rdv-patient-contains-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.rdv-patient-contains-check input {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: #2563eb;
    cursor: pointer;
}

.rdv-patient-combo {
    position: relative;
}

.rdv-patient-combo-bar {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    position: relative;
}

.rdv-patient-combo-icon {
    position: absolute;
    left: 0.72rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
    display: inline-flex;
}

.rdv-patient-combo-icon svg {
    width: 1rem;
    height: 1rem;
}

.rdv-patient-combo-input {
    flex: 1;
    min-width: 0;
    padding-left: 2.25rem !important;
    padding-right: 2rem !important;
}

.rdv-patient-combo-input.has-value {
    font-weight: 600;
    color: #0f172a;
}

.rdv-patient-combo-clear {
    position: absolute;
    right: 2.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 999px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.rdv-patient-combo-clear:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.rdv-patient-combo-add {
    flex-shrink: 0;
    width: 2.5rem;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff, #f0f9ff);
    color: #4f46e5;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.rdv-patient-combo-add svg {
    width: 1.1rem;
    height: 1.1rem;
}

.rdv-patient-combo-add:hover:not(:disabled) {
    background: #e0e7ff;
    border-color: #6366f1;
}

.rdv-patient-combo-add:active:not(:disabled) {
    transform: scale(0.96);
}

.rdv-patient-combo-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.rdv-patient-combo.is-open .rdv-patient-combo-input {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.rdv-patient-combo-suggestions {
    position: absolute;
    left: 0;
    right: 2.85rem;
    top: calc(100% + 4px);
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
}

.rdv-patient-combo-option {
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.rdv-patient-combo-option:hover,
.rdv-patient-combo-option.is-active {
    background: rgba(99, 102, 241, 0.08);
}

.rdv-patient-combo-option-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
}

.rdv-patient-combo-option-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: #64748b;
}

.rdv-patient-combo-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    color: #94a3b8;
    text-align: center;
}

.session-idle-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.session-idle-overlay.is-visible {
    display: flex;
}

.session-idle-dialog {
    width: min(420px, 100%);
    padding: 1.6rem 1.5rem 1.35rem;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.session-idle-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.9rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #eff6ff, #dbeafe);
    color: #2563eb;
}

.session-idle-icon svg {
    width: 28px;
    height: 28px;
}

.session-idle-dialog h2 {
    margin: 0 0 0.45rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.session-idle-dialog p {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.45;
}

.session-idle-countdown {
    margin-top: 0.75rem !important;
    font-weight: 600;
    color: #334155 !important;
}

.session-idle-countdown strong {
    color: #dc2626;
    font-variant-numeric: tabular-nums;
}

.session-idle-continue {
    margin-top: 1.15rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.session-idle-continue svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 640px) {
    .rdv-modal-body .form-row {
        flex-direction: column;
    }

    .rdv-patient-combo-suggestions {
        right: 0;
    }
}

.options-hint.is-ok {
    color: #15803d;
}

.options-hint.is-warning {
    color: #b45309;
}

.pii-enc-card .pii-enc-header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.pii-enc-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    flex-shrink: 0;
}

.pii-enc-header-icon svg {
    width: 22px;
    height: 22px;
}

.pii-enc-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.pii-enc-status-item {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.pii-enc-status-item strong {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.pii-enc-switch {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 14px;
    cursor: pointer;
    margin-bottom: 1.15rem;
}

.pii-enc-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pii-enc-switch-ui {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    flex-shrink: 0;
    margin-top: 0.15rem;
    transition: background 0.2s ease;
}

.pii-enc-switch-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.pii-enc-switch input:checked + .pii-enc-switch-ui {
    background: #2563eb;
}

.pii-enc-switch input:checked + .pii-enc-switch-ui::after {
    transform: translateX(20px);
}

.pii-enc-switch-text strong {
    display: block;
    color: #0f172a;
}

.pii-enc-section {
    margin-bottom: 1.15rem;
}

.pii-enc-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.95rem;
    margin: 0 0 0.65rem;
    color: #0f172a;
}

.pii-enc-section-title svg {
    width: 18px;
    height: 18px;
    color: #2563eb;
}

.pii-enc-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.55rem;
}

.pii-enc-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

.pii-enc-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #2563eb;
}

.pii-enc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.pii-enc-pass-wrap {
    position: relative;
}

.pii-enc-pass-wrap .form-control {
    padding-right: 2.6rem;
}

.pii-enc-eye {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #64748b;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pii-enc-eye svg {
    width: 18px;
    height: 18px;
}

.pii-enc-eye:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.pii-enc-strength {
    margin-top: 0.45rem;
}

.pii-enc-strength-bar {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.pii-enc-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: #ef4444;
    transition: width 0.2s ease, background 0.2s ease;
}

.pii-enc-strength-bar span.is-weak { width: 25%; background: #ef4444; }
.pii-enc-strength-bar span.is-fair { width: 50%; background: #f59e0b; }
.pii-enc-strength-bar span.is-good { width: 75%; background: #3b82f6; }
.pii-enc-strength-bar span.is-strong { width: 100%; background: #16a34a; }

.pii-enc-progress {
    margin: 0.75rem 0 1rem;
}

.pii-enc-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.pii-enc-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    transition: width 0.25s ease;
}

.pii-enc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.pii-enc-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pii-enc-actions .btn svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 720px) {
    .pii-enc-grid {
        grid-template-columns: 1fr;
    }
}


/* SA Biometrie onglets / courbes / calculs */
.sa-bio-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.25rem;
    border-radius: 12px;
    background: rgba(14, 116, 144, 0.08);
    flex-shrink: 0;
}
.sa-bio-tab {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #475569;
    background: transparent;
    cursor: pointer;
}
.sa-bio-tab.is-active {
    background: #fff;
    color: #0e7490;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.sa-bio-pane[hidden] { display: none !important; }
.sa-bio-pane.is-active {
    display: block;
}
.sa-bio-card-pb .sa-bio-card-icon { background: #fdf4ff; color: #a21caf; }
.sa-bio-calc-panel {
    margin-top: 0;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(8, 145, 178, 0.18);
    background: linear-gradient(165deg, rgba(236, 254, 255, 0.95), #fff);
    align-self: stretch;
    min-width: 0;
}
.sa-bio-calc-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.sa-bio-calc-head strong { font-size: 0.88rem; color: #0f172a; }
.sa-bio-calc-head span { font-size: 0.7rem; color: #64748b; }
.sa-bio-calc-cols,
.sa-bio-calc-row {
    display: grid;
    grid-template-columns: 1.5fr 0.7fr 0.7fr;
    gap: 0.35rem;
    align-items: center;
}
.sa-bio-calc-cols {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}
.sa-bio-calc-row {
    font-size: 0.84rem;
    padding: 0.4rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}
.sa-bio-calc-row span:first-child { font-weight: 600; color: #334155; }
.sa-bio-calc-row span:not(:first-child) {
    text-align: right;
    font-weight: 700;
    color: #0e7490;
    font-variant-numeric: tabular-nums;
}
.sa-bio-courbe-toolbar { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.55rem; }
.sa-bio-sex-switch,
.sa-bio-courbe-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sa-bio-sex-btn,
.sa-bio-courbe-tab {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 650;
    cursor: pointer;
}
.sa-bio-sex-btn.is-active,
.sa-bio-courbe-tab.is-active {
    border-color: transparent;
    background: linear-gradient(145deg, #0891b2, #0d9488);
    color: #ecfeff;
}
.sa-bio-courbe-meta {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    color: #64748b;
}
.sa-bio-courbe-canvas-wrap {
    height: min(56vh, 520px);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #fff;
    padding: 0.55rem;
}
.modal-content.sa-bio-modal {
    width: min(1480px, 98vw);
    max-width: min(1480px, 98vw);
}
