:root {
    --sidebar-w: 260px;
    --neutral-ink: #2c2722;
    --neutral-ink-rgb: 69,64,60;
    --neutral-cream: #f7f2ea;
    --neutral-cream-strong: #efe5d6;
    --neutral-line: rgba(var(--neutral-ink-rgb), .12);
    --role-praticien: #ff3366;
    --role-praticien-rgb: 255,51,102;
    --role-correspondant: #3399cc;
    --role-correspondant-rgb: 51,153,204;
    --role-admin: #33cc66;
    --role-admin-rgb: 51,204,102;
    --sidebar-bg: color-mix(in srgb, var(--neutral-ink) 92%, black 8%);
    --sidebar-border: rgba(255,255,255,.06);
    --sidebar-muted: rgba(255,255,255,.62);
    --topbar-h: 58px;
    --body-bg: var(--neutral-cream);
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);

    /* Accent par défaut (pages non authentifiées) */
    --accent: var(--neutral-ink);
    --accent-rgb: var(--neutral-ink-rgb);
    --accent-dark: #000;
    --accent-soft: rgba(var(--accent-rgb), .1);
    --accent-softer: rgba(var(--accent-rgb), .06);
}

/* ── Déclinaison de couleur par profil connecté : couleur identifiée + alpha + noir/blanc ── */
body.theme-admin {
    --accent: var(--role-admin);
    --accent-rgb: var(--role-admin-rgb);
    --accent-dark: color-mix(in srgb, var(--role-admin) 72%, black 28%);
    --accent-soft: rgba(var(--role-admin-rgb), .12);
    --accent-softer: rgba(var(--role-admin-rgb), .07);
    --sidebar-bg: color-mix(in srgb, var(--role-admin) 22%, var(--neutral-ink) 78%);
}

body.theme-correspondant {
    --accent: var(--role-correspondant);
    --accent-rgb: var(--role-correspondant-rgb);
    --accent-dark: color-mix(in srgb, var(--role-correspondant) 72%, black 28%);
    --accent-soft: rgba(var(--role-correspondant-rgb), .12);
    --accent-softer: rgba(var(--role-correspondant-rgb), .07);
    --sidebar-bg: color-mix(in srgb, var(--role-correspondant) 22%, var(--neutral-ink) 78%);
}

body.theme-praticien {
    --accent: var(--role-praticien);
    --accent-rgb: var(--role-praticien-rgb);
    --accent-dark: color-mix(in srgb, var(--role-praticien) 72%, black 28%);
    --accent-soft: rgba(var(--role-praticien-rgb), .12);
    --accent-softer: rgba(var(--role-praticien-rgb), .07);
    --sidebar-bg: color-mix(in srgb, var(--role-praticien) 22%, var(--neutral-ink) 78%);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: #1e293b;
    min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform .25s ease, width .25s ease;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 1.125rem 1.25rem;
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.01em;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon img {
    display: block;
    width: 27px;
    height: 27px;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    padding: .75rem 0;
    flex: 1;
}

.nav-section-label {
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sidebar-muted);
    padding: .75rem 1.25rem .25rem;
}

.sidebar-nav .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .625rem;
    margin: .125rem .75rem;
    padding: .55rem .75rem;
    color: var(--sidebar-muted);
    border-radius: .5rem;
    font-size: .825rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.nav-attention-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    margin-left: auto;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
}

.sidebar-nav .nav-link .material-icons-round {
    font-size: 1.1rem;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #e2e8f0;
}

.sidebar-nav .nav-link.active {
    background: rgba(var(--accent-rgb),.35);
    color: #fff;
}

.sidebar-nav .nav-link.active .material-icons-round {
    color: #fff;
}

.sidebar-footer {
    padding: .875rem 1rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
    border-radius: .5rem;
    color: #e2e8f0;
    text-decoration: none;
    margin-bottom: .375rem;
}

.sidebar-user:hover {
    background: transparent;
}

.sidebar-user.active {
    background: rgba(255, 255, 255, .08);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-name {
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.2;
}

.user-role {
    font-size: .7rem;
    color: var(--sidebar-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .45rem .75rem;
    background: none;
    border: none;
    color: var(--sidebar-muted);
    border-radius: .5rem;
    font-size: .8rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.btn-logout:hover {
    background: rgba(239,68,68,.15);
    color: #f87171;
}

.btn-logout .material-icons-round {
    font-size: 1rem;
}

/* Backdrop mobile */
#sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
}

/* ── Main wrapper ── */
#main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

#topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: #64748b;
    transition: background .15s, color .15s;
}

.topbar-sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--accent-dark);
}

.topbar-sidebar-toggle .material-icons-round {
    font-size: 1.25rem;
}

.version-trigger {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 32px;
    padding: .35rem .55rem;
    border: 0;
    border-radius: .5rem;
    background: #f8fafc;
    color: #64748b;
    font-size: .75rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.version-trigger:hover {
    background: #f1f5f9;
    color: #334155;
}

.version-trigger > .material-icons-round {
    font-size: 1rem;
}

.version-trigger strong {
    color: #334155;
    font-weight: 700;
}

.version-new-indicator {
    padding: .15rem .38rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.version-modal-content {
    overflow: hidden;
}

.version-modal-content > .modal-header,
.version-modal-content > .modal-footer {
    border-color: #e2e8f0;
}

.version-modal-eyebrow {
    margin-bottom: .18rem;
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.version-modal-footnote {
    color: #94a3b8;
    font-size: .7rem;
}

.version-current-release {
    padding: .25rem;
}

.version-number {
    padding: .28rem .55rem;
    border-radius: 999px;
    background: #334155;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}

.version-release-date {
    color: #64748b;
    font-size: .74rem;
}

.version-current-release h3 {
    margin: 0 0 .45rem;
    color: #1e293b;
    font-size: 1.22rem;
    font-weight: 700;
}

.version-release-summary {
    max-width: 650px;
    margin: 0 0 1.2rem;
    color: #64748b;
    font-size: .84rem;
    line-height: 1.6;
}

.version-change-list {
    display: grid;
    gap: .65rem;
}

.version-change-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: .7rem;
    align-items: start;
    padding: .75rem;
    border-radius: .65rem;
    background: #f8fafc;
}

.version-change-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
}

.version-change-icon .material-icons-round {
    font-size: 1rem;
}

.version-change-icon.type-new {
    background: #e0f2fe;
    color: #0369a1;
}

.version-change-icon.type-improved {
    background: #ede9fe;
    color: #6d28d9;
}

.version-change-icon.type-security {
    background: #dcfce7;
    color: #15803d;
}

.version-change-icon.type-fixed {
    background: #ffedd5;
    color: #c2410c;
}

.version-change-type {
    margin-bottom: .12rem;
    color: #94a3b8;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.version-change-item strong {
    display: block;
    color: #334155;
    font-size: .82rem;
}

.version-change-item p {
    margin: .18rem 0 0;
    color: #64748b;
    font-size: .75rem;
    line-height: 1.5;
}

.version-history-heading {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 1.5rem 0 .65rem;
    color: #475569;
    font-size: .78rem;
    font-weight: 700;
}

.version-history-heading .material-icons-round {
    font-size: 1rem;
}

.version-history-list {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: .7rem;
}

.version-history-item + .version-history-item {
    border-top: 1px solid #e2e8f0;
}

.version-history-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1rem;
    background: #fff;
    cursor: pointer;
    list-style: none;
}

.version-history-item summary::-webkit-details-marker {
    display: none;
}

.version-history-item summary strong,
.version-history-item summary small {
    display: block;
}

.version-history-item summary strong {
    color: #334155;
    font-size: .8rem;
}

.version-history-item summary small {
    margin-top: .16rem;
    color: #64748b;
    font-size: .7rem;
}

.version-history-chevron {
    color: #94a3b8;
    font-size: 1.1rem;
    transition: transform .15s ease;
}

.version-history-item[open] .version-history-chevron {
    transform: rotate(180deg);
}

.version-history-body {
    padding: .85rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.version-history-summary {
    margin: 0 0 .75rem;
    color: #64748b;
    font-size: .75rem;
    line-height: 1.5;
}

.version-history-body .version-change-item {
    background: #fff;
}

@media (max-width: 575.98px) {
    #topbar {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .version-trigger {
        font-size: .7rem;
    }

    .version-new-indicator {
        width: 8px;
        min-width: 8px;
        height: 8px;
        padding: 0;
        font-size: 0;
    }

    .version-modal-footnote {
        display: none;
    }
}

#page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ── Cards ── */
.card {
    border: none;
    border-radius: .75rem;
    box-shadow: none;
}

.card > .card-body.p-0 {
    border-radius: inherit;
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-header .material-icons-outlined {
    font-size: 1.25rem;
    color: #64748b;
}

.card-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #64748b;
}

.card-header-icon .material-icons-round {
    font-size: 1.1rem;
    color: #64748b !important;
}

/* ── Stat cards ── */
.stat-card {
    background: #fff;
    border: none;
    border-radius: .75rem;
    padding: 1.25rem;
    box-shadow: none;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: .625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: #1e293b;
}

.stat-label {
    font-size: .8rem;
    color: #64748b;
    margin-top: .25rem;
}

/* ── Status badges ── */
.badge {
    font-weight: 500;
    font-size: .72rem;
    border-radius: .375rem;
    min-height: 22px;
    padding: 1px .65em 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}

.status-envoye  { background: rgba(var(--role-correspondant-rgb), .14); color: color-mix(in srgb, var(--role-correspondant) 62%, black 38%); }
.status-recu    { background: #cffafe; color: #0e7490; }
.status-rdv     { background: #fef3c7; color: #b45309; }
.status-en_cours{ background: #d1fae5; color: #065f46; }
.status-traite  { background: #f1f5f9; color: #475569; }

.referral-detail-header {
    min-height: 32px;
}

.referral-detail-crumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-height: 32px;
    line-height: 1;
}

.referral-detail-crumb > span,
.referral-detail-crumb > strong {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    line-height: 1;
}

.referral-detail-header .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 1px .65em 0;
    line-height: 1;
}

/* ── Referral detail: patient assignment tabs ── */
#changePatientModeTabs .nav-link {
    background: transparent;
    color: #6c757d;
}

#changePatientModeTabs .nav-link:hover:not(.active) {
    color: #212529;
}

#changePatientModeTabs .nav-link.active {
    background: #edf0f4;
    color: #212529;
    font-weight: 500;
}

/* ── Referral detail: appointment tabs ── */
.appointment-date-tabs {
    display: flex;
    gap: .35rem;
    padding: .75rem 1rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(0,0,0,.08);
    border: 0;
    scrollbar-width: none;
}

#appointmentsList {
    border-radius: 0 !important;
}

.appointment-date-tabs::-webkit-scrollbar {
    display: none;
}

.appointment-date-tab-item {
    position: relative;
    flex: 0 0 auto;
    margin-bottom: -1px;
}

.appointment-date-tab-item.active {
    z-index: 1;
}

.appointment-date-tab {
    height: 100%;
    padding: .55rem .85rem;
    border: 0;
    border-radius: 0;
    background: rgba(0,0,0,.06);
    color: #64748b;
    font-size: .76rem;
    line-height: 1.3;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease;
}

.appointment-date-tab-item.has-edit .appointment-date-tab {
    padding-right: 2.2rem;
}

.appointment-date-tab:hover {
    background: #e9ecef;
    color: var(--neutral-ink);
}

.appointment-date-tab.active {
    border-bottom: 0;
    background: #fff;
    color: var(--neutral-ink);
    font-weight: 650;
}

.appointment-date-tab.legacy.active {
    background: #fffbeb;
}

.appointment-date-tab .appointment-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: .35rem;
    padding: 0 .3rem;
    border-radius: 1rem;
    background: #eef2f6;
    color: #64748b;
    font-size: .62rem;
    font-weight: 650;
}

.appointment-date-tab.active .appointment-tab-count {
    background: #e2e8f0;
    color: var(--neutral-ink);
}

.appointment-tab-edit {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: .45rem;
    display: grid;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    transform: translateY(-50%);
    place-items: center;
}

.appointment-tab-edit:hover {
    background: #eef2f6;
    color: var(--neutral-ink);
}

.appointment-tab-edit .material-icons-round {
    font-size: .82rem;
}

/* ── Referral detail: appointment files ── */
.appointment-polaroid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 1rem;
    padding: 1.15rem;
    background: rgba(0,0,0,.02);
}

.file-polaroid {
    position: relative;
    min-width: 0;
    padding: .5rem .5rem .7rem;
    overflow: hidden;
    border: 0;
    border-radius: .45rem;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .1);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}

.file-polaroid:hover {
    z-index: 1;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .14);
    transform: translateY(-2px);
}

.file-polaroid-preview {
    display: grid;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: .25rem;
    background: #eef2f6;
    color: #64748b;
    place-items: center;
}

.file-polaroid-preview .material-icons-round {
    font-size: 2.4rem;
}

.file-polaroid-preview.has-thumbnail {
    background: #e2e8f0;
}

.file-polaroid-preview.has-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-polaroid-preview.has-thumbnail .material-icons-round {
    display: none;
}

.file-polaroid-photo .file-polaroid-preview {
    background: #eef6f2;
    color: #4f7c68;
}

.file-polaroid-radio .file-polaroid-preview {
    background: #eef3f8;
    color: #536f89;
}

.file-polaroid-pdf .file-polaroid-preview {
    background: #fff1f2;
    color: #be5864;
}

.file-polaroid-note .file-polaroid-preview {
    background: #fff8e7;
    color: #a87828;
}

.file-polaroid-caption {
    padding: .6rem .15rem 0;
}

.file-polaroid-name {
    overflow: hidden;
    color: var(--neutral-ink);
    font-size: .76rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-polaroid-meta {
    margin-top: .15rem;
    color: #94a3b8;
    font-size: .66rem;
}

.file-polaroid-actions {
    position: absolute;
    top: .72rem;
    right: .72rem;
    display: flex;
    gap: .25rem;
    opacity: 0;
    transition: opacity .15s ease;
}

.file-polaroid:hover .file-polaroid-actions,
.file-polaroid:focus-within .file-polaroid-actions {
    opacity: 1;
}

.file-polaroid-actions .icon-btn,
.file-polaroid-actions .file-notify-btn {
    width: 1.65rem;
    height: 1.65rem;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 5px rgba(15, 23, 42, .15);
}

.file-polaroid-add {
    display: grid;
    min-height: 155px;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: .45rem;
    background: rgba(255, 255, 255, .55);
    color: #94a3b8;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
    place-items: center;
}

.file-polaroid-add:hover {
    border-color: #64748b;
    background: #fff;
    color: var(--neutral-ink);
}

.file-polaroid-add .material-icons-round {
    font-size: 2rem;
}

.appointment-legacy {
    background: #fffbeb;
}

.appointment-legacy-title {
    padding: .75rem 1rem .35rem;
    color: #92400e;
    font-size: .75rem;
    font-weight: 650;
}

.appointment-legacy-note {
    padding: 0 1rem .7rem;
    color: #a16207;
    font-size: .68rem;
    line-height: 1.45;
}

.role-admin {
    background: rgba(var(--role-admin-rgb), .14);
    color: color-mix(in srgb, var(--role-admin) 62%, black 38%);
}
.role-praticien {
    background: rgba(var(--role-praticien-rgb), .14);
    color: color-mix(in srgb, var(--role-praticien) 62%, black 38%);
}
.role-correspondant {
    background: rgba(var(--role-correspondant-rgb), .14);
    color: color-mix(in srgb, var(--role-correspondant) 62%, black 38%);
}

/* ── Unified team directory ── */
.team-directory-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.app-page-header {
    align-items: flex-start;
}

.team-directory-header h1 {
    margin: .1rem 0 .25rem;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -.035em;
}

.team-directory-header p {
    margin: 0;
    color: #64748b;
    font-size: .88rem;
}

.team-directory-header .btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
}

.team-directory-header .btn .material-icons-round { font-size: 1.1rem; }

.team-directory-eyebrow {
    color: var(--accent);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.team-stat-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    border: 0;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    text-align: left;
    box-shadow: none;
    transition: background .15s;
}

.team-stat-card:hover,
.team-stat-card.active {
    box-shadow: none;
}

.team-stat-card.active {
    background: rgba(var(--accent-rgb), .06);
    box-shadow: none;
}

.team-stat-card[data-role="admin"].active { background: rgba(var(--role-admin-rgb), .14); }
.team-stat-card[data-role="praticien"].active { background: rgba(var(--role-praticien-rgb), .14); }
.team-stat-card[data-role="correspondant"].active { background: rgba(var(--role-correspondant-rgb), .14); }
.team-stat-card[data-role="admin"].active .team-stat-label,
.team-stat-card[data-role="admin"].active .team-stat-count { color: color-mix(in srgb, var(--role-admin) 62%, black 38%); }
.team-stat-card[data-role="praticien"].active .team-stat-label,
.team-stat-card[data-role="praticien"].active .team-stat-count { color: color-mix(in srgb, var(--role-praticien) 62%, black 38%); }
.team-stat-card[data-role="correspondant"].active .team-stat-label,
.team-stat-card[data-role="correspondant"].active .team-stat-count { color: color-mix(in srgb, var(--role-correspondant) 62%, black 38%); }
.team-stat-card.active .team-stat-icon { background: rgba(255, 255, 255, .5); }

.team-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.team-stat-icon .material-icons-round { font-size: 1.25rem; }
.team-stat-all { background: rgba(var(--accent-rgb), .1); color: var(--accent); }
.team-stat-label {
    flex: 1;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
}

.team-stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(100, 116, 139, .18);
}

.team-stat-count {
    min-width: 28px;
    color: #334155;
    font-size: 1.55rem;
    font-weight: 400;
    line-height: 1;
    text-align: center;
}

.team-directory-card { overflow: hidden; }

.team-directory-toolbar {
    min-height: 76px;
    padding: .9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #eef2f6;
}

.team-directory-title { font-size: .92rem; font-weight: 700; }
.team-directory-result { color: #94a3b8; font-size: .72rem; margin-top: .08rem; }

.team-directory-filters {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.team-directory-filters .form-select { width: 170px; font-size: .8rem; }

.team-search { position: relative; width: min(310px, 32vw); }
.team-search .material-icons-round {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
}
.team-search .form-control { padding-left: 2rem; font-size: .8rem; }

.team-directory-table th {
    padding-top: .7rem;
    padding-bottom: .7rem;
    color: #94a3b8;
    font-size: .65rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.team-directory-table td { padding-top: .75rem; padding-bottom: .75rem; }
.team-user-name { font-size: .86rem; font-weight: 650; color: #1e293b; }
.team-user-email, .team-contact-secondary { color: #94a3b8; font-size: .7rem; }
.team-contact { color: #475569; font-size: .78rem; }
.team-date { color: #64748b; font-size: .76rem; }

.team-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #64748b;
    font-size: .72rem;
    font-weight: 500;
    border-radius: .375rem;
    min-height: 22px;
    padding: 1px .65em 0;
    line-height: 1;
    vertical-align: middle;
}
.team-status i { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.team-status.active { background: rgba(var(--role-admin-rgb), .14); color: color-mix(in srgb, var(--role-admin) 62%, black 38%); }
.team-status.active i { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.team-status.creation,
.team-status.pending { background: rgba(245, 158, 11, .16); color: #a16207; }
.team-status.creation i,
.team-status.pending i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.team-status.inactive { background: #fee2e2; color: #b91c1c; }
.team-status.inactive i { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }

.user-detail-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.user-detail-action {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .32rem .7rem .32rem .35rem;
    border: 0;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: .74rem;
    font-weight: 600;
    line-height: 1;
    transition: background .15s, color .15s;
}

.user-detail-action > span:last-child {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transform: translateY(1px);
}

.user-detail-action-icon {
    width: 27px;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .72);
}

.user-detail-action-icon .material-icons-round { display: block; font-size: .95rem; line-height: 1; }
.user-detail-action.action-email { background: rgba(var(--role-correspondant-rgb), .16); color: color-mix(in srgb, var(--role-correspondant) 62%, black 38%); }
.user-detail-action.action-impersonate { background: #e0f2fe; color: #0369a1; }
.user-detail-action.action-disable { background: #fef3c7; color: #a16207; }
.user-detail-action.action-delete { background: #fee2e2; color: #b91c1c; }
.user-detail-action:hover:not(:disabled) { filter: saturate(1.15) brightness(.98); }
.user-detail-action:disabled { opacity: .4; cursor: not-allowed; }

.user-static-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 1px .65em 0;
    border-radius: .375rem;
    background: #f1f5f9;
    color: #475569;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}
.user-static-pill.is-active { background: rgba(var(--role-admin-rgb), .14); color: color-mix(in srgb, var(--role-admin) 62%, black 38%); }
.user-static-pill.is-pending { background: rgba(245, 158, 11, .16); color: #a16207; }
.user-static-pill.is-inactive { background: #fee2e2; color: #b91c1c; }

.assignment-frozen {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .375rem .75rem;
    border-radius: .5rem;
    background: #f1f5f9;
    color: #475569;
    font-size: .875rem;
    font-weight: 500;
}

.assignment-frozen .material-icons-round {
    color: #94a3b8;
    font-size: 1rem;
}

#userReferralsCard > .card-body.p-0 {
    border-radius: 0;
}

#userReferralsCard .table tbody tr:last-child td {
    border-bottom: 0;
}

.activity-feed-item {
    padding: .55rem .6rem;
    border-radius: 0;
}

#userActivity,
#activityLog {
    border-radius: 0 !important;
}

.activity-feed-item:nth-child(even) {
    background: #f8fafc;
}

[data-email-id] {
    cursor: pointer;
}

[data-email-id]:focus-visible {
    outline: 2px solid rgba(51, 153, 204, .45);
    outline-offset: -2px;
}

.email-preview-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.25rem;
    margin-bottom: .65rem;
    padding: .25rem 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.email-preview-detail-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: .55rem;
    align-items: center;
    min-height: 28px;
    padding: .2rem 0;
}

.email-preview-detail-row > span {
    color: #64748b;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.email-preview-detail-row > strong {
    color: #15120f;
    font-size: .76rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.email-preview-error {
    margin: 0 0 1rem;
    border-radius: .5rem;
    background: #fee2e2;
    color: #991b1b;
    padding: .65rem .75rem;
    font-size: .82rem;
}

.email-preview-section-title {
    margin: .7rem 0 .45rem;
    color: #334155;
    font-size: .78rem;
    font-weight: 750;
    text-transform: uppercase;
}

.email-preview-technical {
    margin: .35rem 0 .6rem;
}

.email-preview-technical summary {
    width: fit-content;
    color: #64748b;
    cursor: pointer;
    font-size: .7rem;
    font-weight: 700;
}

.email-preview-params {
    margin: .45rem 0 0;
}

.email-preview-body {
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #e2e8f0;
    border-radius: .65rem;
    background: #fffdf8;
    color: #15120f;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .78rem;
    line-height: 1.6;
    padding: 1rem;
    max-height: 45vh;
    overflow: auto;
}

.email-preview-frame {
    display: block;
    width: 100%;
    height: min(680px, 65vh);
    border: 1px solid #e2e8f0;
    border-radius: .65rem;
    background: #f7f2ea;
}

@media (max-width: 640px) {
    .email-preview-details {
        grid-template-columns: 1fr;
    }
}

.activity-pagination-footer {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: .7rem;
}

.activity-pagination {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.activity-page-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
}

.activity-page-btn .material-icons-round { font-size: 1rem; }
.activity-page-btn:hover:not(:disabled) { background: rgba(var(--accent-rgb), .1); color: var(--accent); }
.activity-page-btn:disabled { opacity: .35; }

.user-confirm-icon {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.user-confirm-icon.impersonate {
    background: #e0f2fe;
    color: #0369a1;
}

.user-confirm-icon.disable {
    background: #fef3c7;
    color: #a16207;
}

.user-confirm-icon.delete {
    background: #fee2e2;
    color: #b91c1c;
}

.user-confirm-icon.email {
    background: rgba(var(--role-correspondant-rgb), .16);
    color: color-mix(in srgb, var(--role-correspondant) 62%, black 38%);
}

.delete-reassignment {
    padding: .75rem;
    border-radius: 10px;
    background: #fff7ed;
}

.delete-reassignment-note {
    color: #9a3412;
    font-size: .7rem;
    line-height: 1.45;
}

.user-confirm-icon .material-icons-round { font-size: 1.45rem; }

@media (max-width: 767.98px) {
    .team-directory-header { align-items: flex-start; }
    .team-directory-header p { max-width: 290px; }
    .team-directory-header .btn { padding: .55rem .7rem; font-size: 0; }
    .team-directory-header .btn .material-icons-round { font-size: 1.25rem; }
    .team-directory-toolbar { align-items: flex-start; flex-direction: column; }
    .team-directory-filters, .team-search { width: 100%; }
    .team-directory-filters .form-select { width: 45%; }
}

/* ── Pastel circular icon badges — used wherever an icon needs a soft background, never a border ── */
.avatar-circle, .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    flex-shrink: 0;
    text-decoration: none;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    font-size: .75rem;
    font-weight: 600;
}

.avatar-circle.patient-avatar {
    background: #ccfbf1;
    color: #0f766e;
}

.icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    line-height: 1;
    position: relative;
    background: #e2e8f0;
    color: #64748b;
    transition: filter .15s ease;
}

.icon-btn .material-icons-round {
    font-size: 1.05rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.icon-btn:hover {
    filter: brightness(.94);
    color: inherit;
}

.icon-btn-primary { background: rgba(var(--accent-rgb),.12); color: var(--accent-dark); }
.icon-btn-success { background: rgba(var(--role-admin-rgb), .12); color: color-mix(in srgb, var(--role-admin) 68%, black 32%); }
.icon-btn-danger  { background: rgba(var(--role-praticien-rgb), .12); color: color-mix(in srgb, var(--role-praticien) 68%, black 32%); }

/* ── Tables ── */
.table {
    font-size: .875rem;
}

.table thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: .75rem 1rem;
}

.table thead th.sortable {
    padding: 0;
}

.table thead th.sortable button {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    width: 100%;
    min-height: 42px;
    padding: .75rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-align: left;
    text-transform: inherit;
    white-space: nowrap;
}

.table thead th.sortable button:hover,
.table thead th.sortable button:focus-visible,
.table thead th.sort-active button {
    color: var(--accent-dark);
}

.table thead th.sortable button:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), .35);
    outline-offset: -2px;
}

.sort-indicator::before {
    content: 'unfold_more';
    display: block;
    font-family: 'Material Icons Round';
    font-size: .9rem;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
    opacity: .45;
}

.sort-asc .sort-indicator::before {
    content: 'arrow_upward';
    opacity: 1;
}

.sort-desc .sort-indicator::before {
    content: 'arrow_downward';
    opacity: 1;
}

.table tbody td {
    padding: .85rem 1rem;
    border-color: #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table-link {
    cursor: pointer;
}

.table-link:hover td {
    background: rgba(var(--accent-rgb),.08) !important;
}

/* ── Status stepper ── */
.status-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 32px;
    left: calc(50% + 32px);
    right: calc(-50% + 32px);
    height: 1px;
    background: rgba(0,0,0,.2);
    z-index: 0;
}

.step-item.done:not(:last-child)::after {
    background: rgba(var(--accent-rgb),.5);
}

.step-icon-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0,0,0,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background .2s;
}

.step-icon {
    font-size: 2rem;
    color: #fff;
    transition: color .2s;
}

.step-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background:
        linear-gradient(rgba(0,0,0,.2), rgba(0,0,0,.2)),
        #fff;
    color: #fff;
    font-size: .65rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    transition: background .2s;
}

.step-item.done .step-icon-wrap { background: rgba(var(--accent-rgb),.5); }
.step-item.done .step-icon      { color: #fff; }
.step-item.done .step-badge     {
    background:
        linear-gradient(rgba(var(--accent-rgb),.5), rgba(var(--accent-rgb),.5)),
        #fff;
}

.step-item.current .step-icon-wrap { background: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.25); }
.step-item.current .step-icon      { color: #fff; }
.step-item.current .step-badge     { background: var(--accent); }

.step-label {
    font-size: 1rem;
    color: rgba(0,0,0,.2);
    margin-top: .5rem;
    text-align: center;
    font-weight: 500;
}

.step-item.done .step-label    { color: rgba(var(--accent-rgb),.5); }
.step-item.current .step-label { color: var(--accent); }

.step-hint {
    font-size: .62rem;
    color: rgba(0,0,0,.2);
    text-align: center;
    margin-top: .15rem;
    line-height: 1.3;
}

.step-item.done .step-hint    { color: rgba(var(--accent-rgb),.5); }
.step-item.current .step-hint { color: var(--accent); }

.step-item.future-action {
    cursor: pointer;
}

.step-item.future-action:hover .step-icon-wrap {
    background: rgba(var(--accent-rgb), .12);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .12);
}

.step-item.future-action:hover .step-icon,
.step-item.future-action:hover .step-label,
.step-item.future-action:hover .step-hint {
    color: var(--accent);
}

.step-item.future-action:hover .step-badge {
    background: var(--accent);
}

/* ── Patient info card ── */
.patient-info {
    font-size: .875rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .45rem 0;
}

.info-row + .info-row {
    border-top: 1px solid #f8fafc;
}

.info-label {
    width: 110px;
    flex-shrink: 0;
    font-size: .72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.info-reason {
    line-height: 1.55;
    color: #1e293b;
}

.info-footer {
    font-size: .72rem;
    color: #cbd5e1;
    padding-top: .6rem;
    margin-top: .25rem;
    border-top: 1px solid #f8fafc;
    text-align: right;
}

.locked-pill {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    gap: .3rem;
    background: #fefce8;
    border-radius: .375rem;
    min-height: 22px;
    padding: 1px .65em 0;
    font-size: .72rem;
    font-weight: 500;
    color: #854d0e;
    vertical-align: middle;
}

.locked-pill .material-icons-round {
    font-size: .75rem;
    color: #ca8a04;
}

.assignment-pill {
    background: #e0e7ff;
    color: #3730a3;
    transition: background .15s ease;
}

.assignment-pill:hover {
    background: #c7d2fe;
}

.age-pill {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    margin-left: .5rem;
    min-height: 22px;
    padding: 1px .65em 0;
    background: #f1f5f9;
    color: #475569;
    border-radius: .375rem;
    font-size: .72rem;
    font-weight: 500;
    vertical-align: middle;
}

.bip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fef3c7;
    color: #a16207;
    cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.bip-btn:hover {
    background: #fde68a;
    color: #78350f;
}

.bip-btn .material-icons-round {
    font-size: 1rem;
}

.file-auto-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    margin: 0;
    color: rgba(var(--neutral-ink-rgb), .62);
    cursor: pointer;
    font-size: .67rem;
    font-weight: 650;
    line-height: 1.15;
    text-align: right;
}

.file-auto-toggle .ios-toggle {
    width: 36px;
    height: 22px;
}

.file-auto-toggle .ios-toggle .track {
    border-radius: 11px;
}

.file-auto-toggle .ios-toggle .track::after {
    width: 16px;
    height: 16px;
}

.file-auto-toggle .ios-toggle input:checked + .track {
    background: var(--accent);
}

.file-auto-toggle .ios-toggle input:checked + .track::after {
    transform: translateX(14px);
}

.file-notify-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fef3c7;
    color: #a16207;
    flex-shrink: 0;
}

.file-notify-btn:hover {
    background: #fde68a;
    color: #78350f;
}

.file-notify-btn:disabled {
    background: rgba(var(--neutral-ink-rgb), .07);
    color: rgba(var(--neutral-ink-rgb), .38);
    cursor: default;
}

.file-notify-btn .material-icons-round {
    font-size: 1rem;
}

.user-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(var(--accent-rgb),.1);
    color: var(--accent-dark);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.user-view-btn:hover {
    background: rgba(var(--accent-rgb),.2);
    color: var(--accent-dark);
}

.user-view-btn .material-icons-round {
    font-size: 1rem;
}

.bip-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.bip-history-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .4rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .78rem;
    color: #475569;
}

.bip-history-item:last-child {
    border-bottom: none;
}

/* ── Messages thread ── */
.msg-row {
    display: flex;
}

.msg-row-mine {
    justify-content: flex-end;
}

.msg-row-mine .msg-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.msg-row-mine .msg-author {
    width: 100%;
}

.msg-author {
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
}

.msg-author .badge {
    min-height: 20px;
}

.msg-row-other {
    justify-content: flex-start;
}

.msg-wrap {
    max-width: 75%;
}

.msg-bubble {
    padding: .75rem 1rem;
    border-radius: .75rem;
    font-size: .875rem;
    line-height: 1.5;
    word-break: break-word;
}

.msg-bubble.mine {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: .25rem;
}

.msg-bubble.other {
    background: rgba(var(--neutral-ink-rgb), .08);
    color: rgba(var(--neutral-ink-rgb), .88);
    border-bottom-left-radius: .25rem;
}

.msg-meta {
    font-size: .7rem;
    color: #94a3b8;
    margin-top: .2rem;
}

/* ── Événements fichiers dans le fil de discussion (partage / suppression) ── */
.msg-file-event {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.msg-file-thumb {
    display: inline-block;
}

.msg-file-thumb img {
    max-width: 180px;
    max-height: 180px;
    border-radius: .5rem;
    display: block;
}

.msg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .65rem;
    border-radius: .5rem;
    text-decoration: none;
    font-size: .8rem;
    font-weight: 500;
    max-width: 100%;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.msg-file-chip span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-bubble.mine .msg-file-chip {
    background: rgba(255,255,255,.2);
    color: #fff;
}

.msg-bubble.other .msg-file-chip {
    background: rgba(var(--neutral-ink-rgb), .08);
    color: var(--neutral-ink);
}

.msg-file-chip-gone {
    cursor: default;
    opacity: .65;
}

.msg-file-event-delete {
    font-style: italic;
    opacity: .9;
}

/* Secure file viewer */
.file-viewer-modal {
    min-height: min(780px, 92vh);
}

.file-viewer-access {
    display: flex;
    align-items: center;
    gap: .2rem;
    margin-top: .15rem;
    color: #15803d;
    font-size: .68rem;
    font-weight: 600;
}

.file-viewer-access .material-icons-round {
    font-size: .85rem;
}

.file-viewer-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 65vh;
    padding: 1rem;
    overflow: auto;
    background: #eef2f6;
}

.file-viewer-loading,
.file-viewer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    color: #64748b;
    text-align: center;
}

.file-viewer-error .material-icons-round {
    color: #dc2626;
    font-size: 2.5rem;
}

.file-viewer-image {
    display: block;
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: .375rem;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .12);
}

.file-viewer-pdf {
    width: 100%;
    height: 68vh;
    border: 0;
    border-radius: .375rem;
    background: #fff;
}

#fileViewerMeta {
    font-size: .75rem;
}

/* ── Auth layout ── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(var(--neutral-ink-rgb), .08), transparent 30%),
        radial-gradient(circle at bottom right, rgba(var(--neutral-ink-rgb), .06), transparent 32%),
        var(--neutral-cream);
    padding: 1.5rem;
}

.auth-panel {
    width: min(960px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
    overflow: hidden;
    border-radius: .75rem;
    background: #fffaf2;
    box-shadow: 0 24px 70px rgba(15,23,42,.14);
}

.auth-panel-register {
    width: min(960px, 100%);
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
}

.auth-panel-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.25rem;
    background: var(--neutral-ink);
    color: #fff;
}

.auth-panel-with-photo .auth-panel-brand {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.auth-panel-with-photo .auth-panel-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: url('/assets/b35e7e89-54ec-4f0b-a822-e4d252d2aeec.png') center / cover no-repeat;
    filter: grayscale(1) contrast(.9);
    opacity: .09;
    pointer-events: none;
}

.auth-panel-with-photo .auth-panel-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand-mark {
    width: 140px;
    height: 158px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    background: transparent;
}

.auth-brand-mark img {
    width: 140px;
    height: 158px;
    display: block;
}

.auth-panel-with-photo .auth-brand-mark {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--neutral-ink) 82%, black 18%);
}

.auth-panel-with-photo .auth-brand-mark img {
    width: 112px;
    height: 128px;
}

.auth-brand-domain {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.auth-brand-tld {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border-radius: 50%;
    background: #fff;
    color: var(--neutral-ink);
    font-size: .68em;
    font-weight: 750;
    letter-spacing: -.03em;
}

.auth-kicker {
    margin: 0 0 .75rem;
    color: color-mix(in srgb, var(--neutral-cream) 72%, white 28%);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    opacity: .5;
}

.auth-panel-brand h1 {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 0;
}

.auth-brand-copy {
    max-width: 370px;
    margin: 1rem 0 0;
    color: color-mix(in srgb, var(--neutral-cream) 78%, white 22%);
    font-size: .95rem;
    line-height: 1.65;
}

.auth-trust-list {
    display: grid;
    gap: .75rem;
}

.auth-trust-list span {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: color-mix(in srgb, var(--neutral-cream) 82%, white 18%);
    font-size: .86rem;
}

.auth-trust-list i {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: 1rem;
}

.auth-card {
    background: #fffaf2;
    border-radius: 0;
    padding: 2.25rem;
    width: 100%;
    max-width: none;
    align-self: center;
    box-shadow: none;
}

.auth-card.auth-card-segmented {
    padding: 0;
    overflow: hidden;
}

.auth-panel-with-photo > .auth-card.auth-card-segmented {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.auth-panel-with-photo > .auth-card.auth-card-segmented > form,
.auth-panel-with-photo > .auth-card.auth-card-segmented > #setupSection,
.auth-panel-with-photo > .auth-card.auth-card-segmented > #backupSection,
.auth-panel-with-photo > .auth-card.auth-card-segmented > #setPasswordSuccess {
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.auth-panel-with-photo > .auth-card.auth-card-segmented > form,
.auth-panel-with-photo > .auth-card.auth-card-segmented > #setupSection {
    display: flex;
}

.auth-panel-with-photo .auth-card-segmented .auth-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-panel-with-photo .auth-card-segmented .auth-card-body.auth-success {
    align-items: center;
}

.auth-card-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(var(--neutral-ink-rgb), .09);
    background: rgba(255, 255, 255, .22);
}

.auth-card-header .auth-card-head {
    margin-bottom: 0;
}

.auth-card-body {
    padding: 1.5rem 1.75rem;
}

.auth-card-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.75rem 1.15rem;
    border-top: 1px solid rgba(var(--neutral-ink-rgb), .09);
    background: rgba(var(--neutral-ink-rgb), .025);
}

.auth-card-footer .auth-footer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 220px;
    max-width: 100%;
}

.auth-card-footer .auth-links {
    margin-top: .8rem;
}

.auth-card-segmented .tfa-backup-panel {
    margin-top: 0;
}

.auth-card-head {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.75rem;
}

.auth-card-head h2 {
    margin: 0;
    color: var(--neutral-ink);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0;
}

.auth-card-head p {
    margin: .15rem 0 0;
    color: rgba(var(--neutral-ink-rgb), .58);
    font-size: .85rem;
}

.auth-lock-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(var(--neutral-ink-rgb), .07);
    color: var(--neutral-ink);
}

.auth-lock-icon .material-icons-round {
    font-size: 2rem;
}

.auth-card .form-control {
    border: none;
    background: rgba(var(--neutral-ink-rgb), .045);
    border-radius: .5rem;
    color: var(--neutral-ink);
}

.auth-card .form-control:focus {
    background: rgba(var(--neutral-ink-rgb), .07);
    border-color: transparent;
    box-shadow: none;
}

.auth-card .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.auth-card .input-group .btn {
    border: none;
    background: rgba(var(--neutral-ink-rgb), .045);
    color: rgba(var(--neutral-ink-rgb), .72);
    border-top-right-radius: .5rem;
    border-bottom-right-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card .input-group .btn:hover,
.auth-card .input-group .btn:focus {
    background: rgba(var(--neutral-ink-rgb), .07);
    color: var(--neutral-ink);
}

.auth-card .input-group .btn .material-icons-round {
    display: block;
    font-size: 1.1rem;
}

.auth-logo {
    width: 46px;
    height: 46px;
    background: var(--accent);
    border-radius: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    flex-shrink: 0;
}

.auth-logo .material-icons-round {
    color: #fff;
    font-size: 1.5rem;
}

.auth-logo img {
    display: block;
    width: 30px;
    height: 30px;
    filter: brightness(0) invert(1);
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
}

.auth-links a {
    color: rgba(var(--neutral-ink-rgb), .62);
    font-size: .8rem;
    text-decoration: none;
}

.auth-links a:hover {
    color: var(--neutral-ink);
}

.auth-links a:focus {
    color: var(--neutral-ink);
    outline: none;
}

.auth-links a.is-disabled {
    color: rgba(var(--neutral-ink-rgb), .42);
    cursor: default;
    pointer-events: auto;
    text-decoration: none;
}

.auth-links span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(var(--neutral-ink-rgb), .24);
}

.auth-forgot {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(var(--neutral-ink-rgb), .1);
}

.auth-forgot p {
    margin: 0 0 .75rem;
    color: rgba(var(--neutral-ink-rgb), .62);
    font-size: .8rem;
}

.auth-footnote {
    margin: .85rem 0 0;
    color: rgba(var(--neutral-ink-rgb), .5);
    font-size: .88rem;
    line-height: 1.45;
    text-align: center;
}

.auth-label-hint {
    color: rgba(var(--neutral-ink-rgb), .45);
    font-weight: 500;
}

.auth-success {
    display: grid;
    justify-items: center;
    gap: .75rem;
    padding: 1.25rem .5rem;
    text-align: center;
}

.auth-success > .material-icons-round {
    width: 66px;
    height: 66px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--role-admin-rgb), .14);
    color: color-mix(in srgb, var(--role-admin) 62%, black 38%);
    font-size: 2rem;
}

.auth-success h2 {
    margin: 0;
    color: var(--neutral-ink);
    font-size: 1.15rem;
    font-weight: 700;
}

.auth-success p {
    max-width: 340px;
    margin: 0;
    color: rgba(var(--neutral-ink-rgb), .62);
    font-size: .86rem;
    line-height: 1.55;
}

.auth-password-toggle {
    width: 44px;
}

@media (max-width: 860px) {
    .auth-wrapper {
        align-items: flex-start;
        padding: 1rem;
    }

    .auth-panel {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .auth-panel-register {
        width: min(960px, 100%);
        grid-template-columns: 1fr;
    }

    .auth-panel-brand {
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .auth-panel-brand h1 {
        font-size: 1.75rem;
    }

    .auth-brand-copy {
        margin-top: .65rem;
        font-size: .88rem;
    }

    .auth-trust-list {
        grid-template-columns: 1fr;
        gap: .5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

@media (max-width: 520px) {
    .auth-wrapper {
        padding: 0;
        background: #fff;
    }

    .auth-panel {
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-panel-brand {
        padding: 1.25rem;
    }

    .auth-brand-mark {
        width: 104px;
        height: 118px;
    }

    .auth-brand-mark img {
        width: 104px;
        height: 118px;
    }

    .auth-panel-with-photo .auth-brand-mark {
        width: 124px;
        height: 124px;
    }

    .auth-panel-with-photo .auth-brand-mark img {
        width: 82px;
        height: 94px;
    }

    .auth-panel-brand h1 {
        font-size: 1.45rem;
    }

    .auth-trust-list {
        display: none;
    }

    .auth-card {
        align-self: start;
        padding: 1.25rem;
    }

    .auth-card-head {
        margin-bottom: 1.35rem;
    }

    .auth-card-header,
    .auth-card-body {
        padding: 1.25rem;
    }

    .auth-card-footer {
        padding: 1rem 1.25rem;
    }

    .auth-links {
        flex-wrap: wrap;
    }
}

/* ── Spinner overlay ── */
.loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    border-radius: inherit;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.bg-cream { background: #fafafa; }

.message-composer {
    padding: .65rem;
    border-top: 1px solid #dbe3ec;
    background: #f8fafc;
}

.message-composer .input-group {
    overflow: hidden;
    border: 1px solid #dbe3ec;
    border-radius: .5rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.message-composer .form-control {
    background: #fff;
}

/* ── File tabs ── */
.files-tabs {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fafafa;
}

.file-row {
    padding-right: .75rem !important;
}

.file-row:last-child {
    border-bottom: 0 !important;
}

.files-tab {
    display: inline-flex;
    align-items: center;
    border: none;
    background: none;
    padding: .3rem;
    font-size: .75rem;
    font-weight: 500;
    color: #64748b;
    border-radius: 2rem;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.files-tab > strong {
    padding: 0 .35rem;
}

.files-tab:hover {
    background: #e2e8f0;
    color: #334155;
}

.files-tab.active {
    background: var(--accent);
    color: #fff;
}

.files-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    min-height: 22px;
    padding: 1px .65em 0;
    font-size: .72rem;
    font-weight: 500;
    border-radius: .375rem;
    background: #e2e8f0;
    color: #64748b;
    line-height: 1;
    vertical-align: middle;
}

.files-tab.active .files-tab-badge {
    background: rgba(255,255,255,.25);
    color: #fff;
}

.files-tab .files-tab-badge {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border-radius: 50%;
    font-size: .65rem;
    line-height: 18px;
}

/* ── Upload zone ── */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: .625rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb),.08);
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state .material-icons-round {
    font-size: 3rem;
    opacity: .4;
    display: block;
    margin-bottom: .75rem;
}

/* ── Responsive ── */
@media (min-width: 768px) {
    .sidebar-collapsed {
        --sidebar-w: 76px;
    }

    .sidebar-collapsed .sidebar-brand {
        justify-content: center;
        gap: 0;
        padding-right: .75rem;
        padding-left: .75rem;
        overflow: hidden;
        font-size: 0;
    }

    .sidebar-collapsed .sidebar-nav .nav-section-label {
        display: none;
    }

    .sidebar-collapsed .sidebar-nav {
        padding-top: .75rem;
    }

    .sidebar-collapsed .sidebar-nav .nav-link {
        justify-content: center;
        gap: 0;
        margin-right: .65rem;
        margin-left: .65rem;
        padding-right: .5rem;
        padding-left: .5rem;
        overflow: hidden;
        font-size: 0;
    }

    .sidebar-collapsed .sidebar-nav .nav-link .material-icons-round {
        font-size: 1.25rem;
    }

    .sidebar-collapsed .nav-attention-badge {
        position: absolute;
        top: 2px;
        right: 2px;
        min-width: 9px;
        width: 9px;
        height: 9px;
        padding: 0;
        font-size: 0;
    }

    .sidebar-collapsed .sidebar-footer {
        padding-right: .65rem;
        padding-left: .65rem;
    }

    .sidebar-collapsed .sidebar-user {
        justify-content: center;
        padding-right: 0;
        padding-left: 0;
    }

    .sidebar-collapsed .sidebar-user > div:last-child {
        display: none;
    }

    .sidebar-collapsed .btn-logout {
        justify-content: center;
        gap: 0;
        padding-right: .5rem;
        padding-left: .5rem;
        overflow: hidden;
        font-size: 0;
    }

    .sidebar-collapsed .btn-logout .material-icons-round {
        font-size: 1.1rem;
    }
}

@media (max-width: 767.98px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #sidebar-backdrop.show { display: block; }
    #main-wrapper { margin-left: 0; }
    #topbar { padding: 0 1rem; }
    #page-content { padding: 1rem; }
}

/* ── Misc ── */
.btn {
    font-size: .875rem;
    font-weight: 500;
    border-radius: .5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.btn .material-icons-round {
    font-size: 1rem;
    line-height: 1;
    display: block;
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

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

.form-control, .form-select {
    border-color: #e2e8f0;
    border-radius: .5rem;
    font-size: .875rem;
    color: #1e293b;
}

.referral-reason-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .5rem;
}

.reason-suggestion-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), .11);
    color: var(--accent-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s, transform .15s;
}

.reason-suggestion-btn:hover {
    background: rgba(var(--accent-rgb), .2);
    color: var(--accent);
    transform: translateY(-1px);
}

.reason-suggestion-btn:disabled {
    cursor: wait;
    opacity: .55;
    transform: none;
}

.reason-suggestion-btn .material-icons-round {
    font-size: 1rem;
}

.form-control::placeholder {
    color: rgba(var(--neutral-ink-rgb), .28);
    font-weight: 400;
    font-size: .875rem;
}

.form-select.placeholder-shown,
.form-select option[value=""] {
    color: #64748b;
    font-weight: 500;
}

.form-select:has(option[value=""]:checked) {
    color: #64748b;
    font-weight: 500;
}

.form-select option:not([value=""]) {
    color: #1e293b;
    font-weight: 400;
}

input[type="date"].form-control {
    color: #cbd5e1;
}

input[type="date"].form-control:not(:placeholder-shown),
input[type="date"].form-control:valid {
    color: #1e293b;
}

/* ── Tom Select — alignement visuel avec .form-control ── */
.ts-wrapper.form-control {
    padding: 0;
}

.ts-wrapper .ts-control {
    border: 1px solid #e2e8f0;
    border-radius: .5rem !important;
    font-size: .875rem;
    padding: .375rem .75rem;
    box-shadow: none;
    min-height: unset;
}

.ts-wrapper.focus .ts-control,
.ts-wrapper .ts-control:focus-within {
    border-color: transparent;
    background: #f1f5f9;
    box-shadow: none;
}

.ts-wrapper .ts-control div.placeholder {
    font-size: .875rem;
    color: #cbd5e1;
    font-weight: 400;
}

.ts-dropdown {
    border-color: #e2e8f0;
    border-radius: .5rem;
    font-size: .875rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.ts-dropdown .option {
    padding: .4rem .75rem;
}

.ts-dropdown .option.active {
    background: rgba(var(--accent-rgb),.12);
    color: #1e293b;
}

.form-control:focus, .form-select:focus {
    border-color: transparent;
    background-color: #f1f5f9;
    box-shadow: none;
}

.form-label {
    font-size: .8rem;
    font-weight: 500;
    color: rgba(var(--neutral-ink-rgb), .88);
    margin-bottom: .35rem;
}

.modal-content {
    border: none;
    border-radius: .875rem;
    box-shadow: 0 25px 60px rgba(0,0,0,.2);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 0 !important;
    border-radius: 0 0 .875rem .875rem;
    padding: .5rem 1rem !important;
    background: #fafafa;
}

.card-footer {
    border-top: 0 !important;
}

.file-encryption-card {
    transition: background-color .2s ease, box-shadow .2s ease;
}

.file-encryption-card.is-decrypted {
    border: 0 !important;
    background: #fff5f5;
    box-shadow: none;
}

.file-encryption-card.is-decrypted > .card-header {
    background: #fee2e2;
    color: #991b1b;
    border-bottom-color: #fecaca;
}

.file-encryption-card.is-decrypted > .card-header .material-icons-outlined {
    color: #dc3545;
}

.file-encryption-card.is-decrypted > .card-body {
    background: #fff5f5;
}

.file-encryption-card.is-decrypted > .card-footer {
    background: #fee2e2 !important;
}

/* ── Mon compte ── */
.account-page {
    max-width: 1180px;
}

.account-card {
    overflow: hidden;
}

.account-card > .card-header {
    min-height: 72px;
}

.account-card > .card-header small {
    display: block;
    margin-top: .12rem;
    color: #64748b;
    font-size: .74rem;
    font-weight: 400;
}

.account-readonly-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 42px;
    padding: .45rem .55rem .45rem .75rem;
    border: 0;
    border-radius: .5rem;
    background: #f8fafc;
}

.account-page .form-control,
#modalEmailChange .form-control,
#modalPasswordChange .form-control,
#modalTwoFactorSetup .form-control,
#modalSecurityConfirm .form-control {
    border: 0;
    background: #f1f5f9;
}

.account-page .form-control:focus,
#modalEmailChange .form-control:focus,
#modalPasswordChange .form-control:focus,
#modalTwoFactorSetup .form-control:focus,
#modalSecurityConfirm .form-control:focus {
    border: 0;
    background: #e2e8f0;
    box-shadow: none;
}

.account-readonly-row > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .55rem;
}

.account-readonly-row .material-icons-round {
    color: #94a3b8;
    font-size: 1.1rem;
}

.account-readonly-row strong {
    overflow: hidden;
    font-size: .86rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-security-row {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #edf1f5;
}

.account-security-row:last-child {
    border-bottom: 0;
}

.account-security-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .75rem;
}

.account-security-copy > .material-icons-round {
    color: #64748b;
    font-size: 1.25rem;
}

.account-security-copy strong,
.account-security-copy small {
    display: block;
}

.account-security-copy strong {
    color: #1e293b;
    font-size: .84rem;
}

.account-security-copy small {
    margin-top: .18rem;
    color: #64748b;
    font-size: .72rem;
    line-height: 1.35;
}

.account-device-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: .8rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #edf1f5;
}

.account-device-row:last-child {
    border-bottom: 0;
}

.account-device-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    color: #64748b;
}

.account-device-main {
    min-width: 0;
}

.account-device-main strong {
    color: #1e293b;
    font-size: .86rem;
}

.account-device-main small {
    display: block;
    margin-top: .24rem;
    color: #64748b;
    font-size: .72rem;
}

.account-qr {
    width: 200px;
    height: 200px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    background: #fff;
}

.account-secret {
    display: inline-block;
    margin-top: .35rem;
    padding: .4rem .6rem;
    border-radius: .35rem;
    color: #334155;
    background: #f1f5f9;
    font-size: .76rem;
    word-break: break-all;
}

.account-code-input {
    max-width: 180px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .35rem;
}

.account-backup-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    padding: 1rem;
    border-radius: .75rem;
    background: #f8fafc;
}

.account-backup-codes code {
    padding: .45rem;
    border: 1px solid #e2e8f0;
    border-radius: .4rem;
    color: #1e293b;
    background: #fff;
    text-align: center;
    font-size: .86rem;
    font-weight: 700;
    letter-spacing: .08em;
}

@media (max-width: 575.98px) {
    .account-security-row {
        align-items: flex-start;
    }

    .account-device-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        padding-inline: 1rem;
    }

    .account-device-main small {
        line-height: 1.5;
    }

    .account-backup-codes {
        grid-template-columns: 1fr;
    }
}

.alert {
    border-radius: .625rem;
    font-size: .875rem;
    border: none;
}

/* ── 2FA ── */
.tfa-label-hint {
    font-size: .75rem;
    color: rgba(var(--neutral-ink-rgb), .5);
    font-weight: 500;
}

.tfa-code-input {
    min-height: 58px;
    font-size: 1.9rem;
    letter-spacing: .45rem;
    font-weight: 700;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    padding: .65rem .75rem .65rem 1.2rem;
    line-height: 1;
}

.tfa-code-input::placeholder {
    font-size: 1.9rem;
    letter-spacing: .45rem;
    font-weight: 700;
    color: rgba(var(--neutral-ink-rgb), .24);
    line-height: 1;
}

.tfa-trusted {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.25rem;
    padding: .85rem;
    border-radius: .5rem;
    background: rgba(var(--neutral-ink-rgb), .045);
}

.tfa-trusted-label {
    font-size: .85rem;
    font-weight: 650;
    color: var(--neutral-ink);
    transition: color .2s;
}

.tfa-trusted-label.active { color: color-mix(in srgb, var(--role-admin) 68%, black 32%); }

.tfa-trusted-sub {
    font-size: .77rem;
    color: rgba(var(--neutral-ink-rgb), .55);
    transition: color .2s;
}

.tfa-trusted-sub.active { color: color-mix(in srgb, var(--role-admin) 68%, black 32%); }

.tfa-backup-toggle { font-size: .78rem; color: rgba(var(--neutral-ink-rgb), .55); }
.tfa-backup-code   { letter-spacing: .1rem; }
.tfa-back-link     { font-size: .78rem; color: rgba(var(--neutral-ink-rgb), .62); }
.tfa-setup-hint {
    margin-top: .75rem;
    font-size: .75rem;
    color: rgba(var(--neutral-ink-rgb), .6);
    line-height: 1.55;
}

.tfa-setup-hint code {
    font-size: .85rem;
    color: var(--neutral-ink);
}

.tfa-setup-qr {
    min-height: 238px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    text-align: center;
}

.tfa-setup-qr .spinner-border {
    color: var(--neutral-ink);
}

.tfa-setup-qr img {
    max-width: 190px;
    border-radius: .5rem;
    background: #fff;
    padding: .5rem;
}

.tfa-backup-codes {
    width: 100%;
    font-size: .85rem;
    line-height: 1.8;
    color: var(--neutral-ink);
    text-align: center;
}

.tfa-backup-codes div {
    padding: .2rem .5rem;
    border-radius: .35rem;
    background: rgba(var(--neutral-ink-rgb), .045);
}

.tfa-backup-panel {
    margin-top: 1rem;
}

/* iOS toggle */
.ios-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

.ios-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ios-toggle .track {
    position: absolute;
    inset: 0;
    background: rgba(var(--neutral-ink-rgb), .16);
    border-radius: 13px;
    transition: background .2s;
}

.ios-toggle input:checked + .track {
    background: var(--role-admin);
}

.ios-toggle .track::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fffaf2;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(var(--neutral-ink-rgb), .18);
}

.ios-toggle input:checked + .track::after {
    transform: translateX(18px);
}

/* ── Full-screen loader overlay ── */
#appLoader {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#appLoader.active {
    display: flex;
}

/* ── Bandeau impersonate ── */
#impersonateBanner {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    width: 100%;
    min-height: 64px;
    background: #dc3545;
    color: #fff;
    border-radius: 0;
    padding: .65rem 1.5rem;
    box-shadow: 0 -6px 24px rgba(15,23,42,.2);
    z-index: 1095;
    flex-shrink: 0;
    border: 0;
}

body.is-impersonating #sidebar {
    bottom: 64px;
}

.impersonate-footer-spacer {
    height: 64px;
    min-height: 64px;
    flex-shrink: 0;
}

#impersonateBanner > .material-icons-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
}

.impersonate-banner-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: .8rem;
}

.impersonate-banner-text strong {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
}

#impersonateBanner button {
    background: #fff;
    color: #dc3545;
    border: none;
    border-radius: .5rem;
    padding: .4rem .75rem;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

#impersonateBanner button:hover {
    background: #fff;
    color: #b02a37;
}

/* ── Flash toasts — single unified system, bottom-right ── */
#toastContainer {
    z-index: 1090;
}

#toastContainer .toast {
    min-width: 300px;
    max-width: 380px;
    border-radius: .625rem;
    border: none;
    box-shadow: 0 10px 30px rgba(15,23,42,.18);
    color: #fff;
    overflow: hidden;
}

#toastContainer .toast-body {
    font-size: .85rem;
    padding: .75rem 1rem;
}

#toastContainer .toast-icon {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#toastContainer .toast-icon .material-icons-outlined {
    font-size: 1.4rem;
}

#toastContainer .toast-text {
    line-height: 1.35;
}

#toastContainer .toast .btn-close {
    filter: brightness(0) invert(1);
    opacity: .7;
}

#toastContainer .toast .btn-close:hover {
    opacity: 1;
}

#toastContainer .toast-success { background: #15803d; }
#toastContainer .toast-danger  { background: #b4233f; }
#toastContainer .toast-warning { background: #b45309; }
