:root {
    /* Light theme (default) — palette Linear/Vercel : neutres doux + accent bleu ciel */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --primary-ring: rgba(14, 165, 233, 0.12);
    --success: #10b981;
    --success-light: #d1fae5;
    --warn: #f59e0b;
    --warn-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    --bg: #fafafa;
    --surface: #ffffff;
    --surface-2: #f4f4f5;
    --surface-3: #e4e4e7;
    --border: #e4e4e7;
    --border-strong: #d4d4d8;
    --text: #18181b;
    --text-muted: #71717a;
    --text-subtle: #a1a1aa;

    --sidebar-bg: #09090b;
    --sidebar-surface: #18181b;
    --sidebar-text: #a1a1aa;
    --sidebar-text-strong: #fafafa;
    --sidebar-active: #27272a;
    --sidebar-hover: #27272a;
    --sidebar-border: #27272a;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.08), 0 4px 8px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -8px rgba(0, 0, 0, 0.12);

    --radius-sm: 0.375rem; /* 6px */
    --radius: 0.5rem;      /* 8px */
    --radius-lg: 0.75rem;  /* 12px */
    --radius-xl: 1rem;     /* 16px */

    /* Easing Linear-like : naturelle, rapide mais pas brusque */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: 180ms var(--ease);
    --transition-fast: 120ms var(--ease);
    --transition-slow: 280ms var(--ease);
}

:root[data-theme="dark"] {
    --primary: #38bdf8;
    --primary-dark: #0ea5e9;
    --primary-light: #082f49;
    --primary-ring: rgba(56, 189, 248, 0.18);
    --success: #34d399;
    --success-light: #064e3b;
    --warn: #fbbf24;
    --warn-light: #78350f;
    --danger: #f87171;
    --danger-light: #7f1d1d;
    --info: #22d3ee;
    --info-light: #155e75;

    --bg: #09090b;
    --surface: #18181b;
    --surface-2: #27272a;
    --surface-3: #3f3f46;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;

    --sidebar-bg: #000000;
    --sidebar-surface: #09090b;
    --sidebar-text: #a1a1aa;
    --sidebar-text-strong: #fafafa;
    --sidebar-active: #27272a;
    --sidebar-hover: #18181b;
    --sidebar-border: #18181b;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 40px -8px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    transition: background var(--transition), color var(--transition);
}

/* Focus visible accessible : outline animé qui grossit, respecte le clavier */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
    transition: outline-offset var(--transition-fast);
}

/* Skip-link : invisible hors focus, permet aux utilisateurs clavier/screen-reader
   de sauter la sidebar et aller directement au contenu principal (WCAG 2.1 Bypass Blocks). */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 1000;
    padding: 0.625rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: top var(--transition-fast);
}
.skip-link:focus-visible { top: 1rem; outline-offset: 4px; }

/* Préférence accessibilité : désactiver animations et transitions si l'utilisateur
   a configuré son OS pour réduire le mouvement (vestibulaire, épilepsie, etc.). */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 0;
    transition: width var(--transition-slow), background var(--transition);
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
/* Sidebar réduite (collapse) : ne montre que les icônes */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .profile-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .lang-switcher,
.sidebar.collapsed .profile-chevron { display: none; }
.sidebar.collapsed .nav a { justify-content: center; padding: 0.625rem 0; }
.sidebar.collapsed .nav-section .nav-section-items a { justify-content: center; }
.sidebar.collapsed .profile-menu-btn { justify-content: center; padding: 0.5rem; }
.sidebar.collapsed .profile-menu-btn .icon { margin-right: 0; }
.sidebar.collapsed .dropdown-menu { left: calc(100% + 0.5rem); right: auto; top: 0; }
@media (max-width: 1024px) {
    /* Tablette : sidebar légèrement réduite, contenu plus dense */
    .sidebar { width: 200px; }
    .content { padding: 1.5rem 1.75rem; }
}
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .profile-info,
    .sidebar .nav-label,
    .sidebar .nav-section-title,
    .sidebar .lang-switcher,
    .sidebar .profile-chevron { display: none; }
    .sidebar .nav a { justify-content: center; padding: 0.625rem 0; }
    .sidebar .nav-section .nav-section-items a { justify-content: center; }
    .sidebar .profile-menu-btn { justify-content: center; padding: 0.5rem; }
    .sidebar .profile-menu-btn .icon { margin-right: 0; }
    .sidebar .dropdown-menu { left: calc(100% + 0.5rem); right: auto; top: 0; }
    .content { padding: 1.25rem; }
}

.content {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-x: hidden;
    max-width: 100%;
    min-width: 0;
}

/* Sidebar : header (profil en haut) */
.sidebar-header {
    position: relative;
    padding: 0.625rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.logo {
    width: 1.875rem;
    height: 1.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: transform var(--transition), box-shadow var(--transition);
}
.logo svg { width: 1.125rem; height: 1.125rem; }
.logo.big { width: 3.5rem; height: 3.5rem; font-size: 2rem; margin: 0 auto 1rem; }

/* Bouton collapse (toggle sidebar) — utilisé dans .sidebar-footer */
.sidebar-collapse-btn {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    width: 1.875rem;
    height: 1.875rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
}
.sidebar-collapse-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.sidebar-collapse-btn .icon { width: 0.9375rem; height: 0.9375rem; transition: transform var(--transition); }
.sidebar.collapsed .sidebar-collapse-btn .icon { transform: rotate(180deg); }
@media (max-width: 768px) { .sidebar-collapse-btn { display: none; } }

/* Nav : sectionnée */
.nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    min-height: 0;
}
.nav-section { display: flex; flex-direction: column; gap: 0.125rem; }
.nav-section-title {
    color: var(--text-subtle);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.75rem 0.375rem;
    display: block;
}
.nav a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    position: relative;
}
.nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.nav a:active { transform: scale(0.98); }
.nav a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-strong);
}
.nav a.active::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}
/* SVG icons : taille intrinsèque 1em pour qu'ils s'adaptent au contexte
   sans déborder (display:inline-block pour ne pas s'étirer en flex parent). */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: -0.125em;
    color: currentColor;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    /* En cas d'oubli de viewBox, ne pas laisser le SVG exploser */
    max-width: 100%;
    max-height: 100%;
}
.nav .icon, .nav a .icon {
    width: 1.125rem;
    height: 1.125rem;
}
.nav a:hover .icon, .nav a.active .icon { opacity: 1; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Profil en haut de sidebar (dropdown menu) */
.profile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    font-family: inherit;
    font-size: 0.875rem;
    min-width: 0;
}
.profile-menu-btn:hover { background: var(--sidebar-hover); border-color: var(--sidebar-border); color: var(--sidebar-text-strong); }
.profile-avatar {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #38bdf8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    flex-shrink: 0;
}
.profile-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.profile-name { color: var(--sidebar-text-strong); font-weight: 600; font-size: 0.8125rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { color: var(--text-subtle); font-size: 0.6875rem; margin-top: 0.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-chevron { color: var(--text-subtle); flex-shrink: 0; transition: transform var(--transition); width: 1rem; height: 1rem; }
.profile-menu-btn[aria-expanded="true"] .profile-chevron { transform: rotate(180deg); }

/* Dropdown menu (s'ouvre vers le BAS depuis le profil) */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0.5rem;
    right: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    padding: 0.375rem;
    z-index: 200;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    color: var(--text);
}
.dropdown-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
}
.dropdown-header .profile-name { color: var(--text); font-size: 0.875rem; }
.dropdown-header .profile-role { color: var(--text-muted); }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }
.dropdown-label { color: var(--text-muted); font-size: 0.6875rem; text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; padding: 0.375rem 0.625rem 0.125rem; }

/* Sidebar footer (sticky bottom) : langue + theme + collapse */
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.lang-switcher { display: flex; gap: 0.25rem; }
.lang-btn {
    background: transparent; border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm); padding: 0.25rem 0.5rem; cursor: pointer;
    font-size: 0.875rem; transition: all var(--transition-fast); line-height: 1;
    color: var(--sidebar-text);
}
.lang-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.lang-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Theme toggle (animé) — utilisé dans le footer */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    width: 1.875rem;
    height: 1.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
    font-size: 0.9375rem;
}
.theme-toggle:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.theme-toggle .icon { width: 0.9375rem; height: 0.9375rem; transition: transform var(--transition); }
.theme-toggle:hover .icon { transform: rotate(15deg) scale(1.1); }

/* Typography */
h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.1rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.warn { color: var(--warn); }
code {
    background: var(--surface-2);
    padding: 0.1em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.9em;
    font-family: "SF Mono", Monaco, monospace;
    color: var(--text);
}

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, var(--primary-ring) 100%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--border-strong);
}
.card:hover::before { opacity: 1; }
.card-label { color: var(--text-muted); font-size: 0.8125rem; margin-bottom: 0.5rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.025em; display: flex; align-items: center; gap: 0.375rem; }
.card-label .icon { width: 0.875rem; height: 0.875rem; }
.card-value { font-size: 1.875rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.025em; font-feature-settings: "tnum"; }
.card-sub { color: var(--text-muted); font-size: 0.8125rem; }
.card-link { color: var(--primary); text-decoration: none; font-size: 0.875rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.25rem; transition: gap var(--transition-fast); }
.card-link:hover { text-decoration: none; gap: 0.5rem; }

/* Panel */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: background var(--transition), border-color var(--transition);
}
.panel h2 { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-2-1 { display: grid; grid-template-columns: 1fr 2fr; gap: 1.25rem; }
@media (max-width: 900px) { .grid-2, .grid-2-1 { grid-template-columns: 1fr; } }

/* Forms */
label {
    display: block;
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 500;
}
label small { display: block; font-weight: normal; margin-top: 0.25rem; color: var(--text-muted); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], textarea, input[type=file], select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.375rem;
    font-size: 0.95rem;
    margin-top: 0.375rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; min-height: 100px; }
input[type=checkbox] { width: auto; margin: 0; }
input[type=file] { padding: 0.375rem; }

/* Password input wrapper (eye toggle) */
.password-input {
    position: relative;
    display: flex;
    align-items: center;
}
.password-input input { padding-right: 2.5rem; }
.password-input button.pw-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1.125rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
}
.password-input button.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-input button.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Par défaut : on montre l'icône "œil ouvert" (le user n'a PAS encore cliqué). */
.pw-toggle .pw-toggle-hide { display: none; }
.pw-toggle.is-visible .pw-toggle-show { display: none; }
.pw-toggle.is-visible .pw-toggle-hide { display: inline-block; }

/* Password strength meter */
.password-strength {
    height: 4px;
    background: var(--surface-2);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}
.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s, background 0.3s;
}
.password-strength-bar.weak { width: 33%; background: var(--danger); }
.password-strength-bar.medium { width: 66%; background: var(--warn); }
.password-strength-bar.strong { width: 100%; background: var(--success); }
.password-strength-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.25;
    position: relative;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 0.9375rem; height: 0.9375rem; }
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 1px 2px var(--primary-ring);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 12px var(--primary-ring); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 2px var(--primary-ring); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; border-color: #dc2626; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; gap: 0.3rem; }
.btn-sm .icon { width: 0.8125rem; height: 0.8125rem; }
.btn-lg { padding: 0.625rem 1.125rem; font-size: 0.9375rem; }
.btn-block { width: 100%; }

/* Theme toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid var(--success); }
:root[data-theme="dark"] .alert-success { color: var(--success); }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid var(--danger); }
:root[data-theme="dark"] .alert-error { color: var(--danger); }
.alert-warn { background: var(--warn-light); color: #92400e; border: 1px solid var(--warn); }
:root[data-theme="dark"] .alert-warn { color: var(--warn); }
.alert-info { background: var(--info-light); color: #155e75; border: 1px solid var(--info); }
:root[data-theme="dark"] .alert-info { color: var(--info); }

/* Banner persistant (must_change_password) */
.banner {
    background: var(--warn-light);
    color: #92400e;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--warn);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
:root[data-theme="dark"] .banner { color: var(--warn); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;       /* permet le scroll horizontal sur mobile sans casser la mise en page */
    -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; min-width: 600px; }  /* évite que les colonnes s'écrasent */
.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th { background: var(--surface-2); font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .trunc { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.table-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-style: italic; }

/* Search bar */
.search-bar {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.search-bar input { margin: 0; }
.search-bar .search-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.pagination .page-info,
.pagination .pagination-info { color: var(--text-muted); font-size: 0.85rem; padding: 0 0.75rem; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-ok { background: var(--success-light); color: #065f46; }
:root[data-theme="dark"] .badge-ok { color: var(--success); }
.badge-warn { background: var(--warn-light); color: #92400e; }
:root[data-theme="dark"] .badge-warn { color: var(--warn); }

/* Status pill */
.status { display: inline-block; padding: 0.2em 0.65em; border-radius: 999px; font-size: 0.85rem; font-weight: 500; }
.status-open { background: var(--success-light); color: #065f46; }
:root[data-theme="dark"] .status-open { color: var(--success); }
.status-connecting { background: var(--warn-light); color: #92400e; }
:root[data-theme="dark"] .status-connecting { color: var(--warn); }
.status-close, .status-closed { background: var(--danger-light); color: #991b1b; }
:root[data-theme="dark"] .status-close, :root[data-theme="dark"] .status-closed { color: var(--danger); }
.status-disconnected, .status-unknown { background: var(--surface-2); color: var(--text-muted); }
.status-resolved { background: var(--info-light); color: #155e75; }
:root[data-theme="dark"] .status-resolved { color: var(--info); }

/* WhatsApp page */
.status-line { margin-bottom: 0.75rem; }
.status-line span:first-child { color: var(--text-muted); margin-right: 0.5rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.qr-panel { text-align: center; }
.qr-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}
.qr-container img { max-width: 280px; height: auto; }
.qr-placeholder { color: var(--text-muted); }
.qr-placeholder-icon { font-size: 3rem; margin-bottom: 0.5rem; opacity: 0.5; }

.steps { padding-left: 1.5rem; line-height: 2; color: var(--text-muted); }
.steps li { margin-bottom: 0.25rem; }
.steps strong { color: var(--text); }

/* Settings */
.inline-form { display: flex; gap: 0.5rem; margin-top: 1rem; }
.inline-form input { margin: 0; }

/* Formulaires inline (bouton submit dans la même ligne qu'un item de tableau) */
form.inline { display: inline; }

/* Helpers texte */
.text-success { color: var(--success); }

/* Upload */
.upload-form { display: flex; gap: 0.75rem; align-items: center; }
.upload-form input[type=file] { flex: 1; margin: 0; }

/* Conversations */
.conv-list { max-height: 600px; overflow-y: auto; }
.conv-item {
    display: block;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition);
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); padding-left: calc(0.75rem - 3px); }
:root[data-theme="dark"] .conv-item.active { color: var(--text); }
.conv-phone { font-weight: 500; }
.conv-last { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0; }
.conv-time { color: var(--text-muted); }
.conv-resolved { opacity: 0.6; }
.messages { max-height: 600px; overflow-y: auto; padding: 0.5rem; }
.message {
    margin-bottom: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    max-width: 80%;
}
.message-user { background: var(--primary-light); margin-left: auto; }
.message-assistant { background: var(--surface-2); }
/* V2 Inbox : distinguer visuellement les messages humains (admin) du bot.
   Border-left orange + fond crème pour être lisible sans surcharger. */
.message-admin { background: #fff7ed; border-left: 3px solid #ea580c; }
:root[data-theme="dark"] .message-admin { background: #7c2d12; border-left-color: #fb923c; }
.message-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.message-meta-admin { color: #ea580c; font-weight: 600; }
:root[data-theme="dark"] .message-meta-admin { color: #fb923c; }
.message-content { white-space: pre-wrap; word-break: break-word; }

/* Login */
.login-page {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { margin-bottom: 0.25rem; }
.hint { color: var(--text-muted); font-size: 0.85rem; text-align: center; margin-top: 1rem; }

/* Wrapper password avec bouton œil (toggle show/hide).
   Le <button> est positionné absolument à l'intérieur du wrapper,
   superposé à l'input sans interrompre son utilisation (pointer-events:auto
   uniquement sur le bouton, l'input prend le reste). */
.password-reveal {
    position: relative;
    display: block;
}
.password-reveal input[name="password"] {
    padding-right: 2.75rem; /* laisse la place au bouton œil */
}
.password-reveal-toggle {
    position: absolute;
    top: 50%;
    right: 0.25rem;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 0.375rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s, color 0.15s;
}
.password-reveal-toggle:hover {
    background: var(--surface-2);
    color: var(--text);
}
.password-reveal-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.password-reveal-toggle .icon { width: 1.1rem; height: 1.1rem; display: block; }

/* Ligne "se souvenir de moi" — checkbox aligné avec le label.
   Classe volontairement minimale : on hérite des styles de <label> et <input>. */
.remember-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}
.remember-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}
.remember-row:hover { color: var(--text); }

/* Analytics — bar charts */
.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 50px;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}
.bar-row .bar-label { color: var(--text-muted); text-align: right; }
.bar-row .bar-track { background: var(--surface-2); border-radius: 4px; height: 22px; overflow: hidden; }
.bar-row .bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
    min-width: 2px;
}
.bar-row.bar-success .bar-fill { background: var(--success); }
.bar-row.bar-warn .bar-fill { background: var(--warn); }
.bar-row.bar-accent .bar-fill { background: #38bdf8; }
.bar-row .bar-value { font-weight: 600; text-align: left; }
.bar-row.bar-empty .bar-track { background: var(--surface-2); }

.hbar-list { display: flex; flex-direction: column; gap: 0.75rem; }
.hbar-item {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}
.hbar-item .hbar-label { font-weight: 500; }
.hbar-item .hbar-track { background: var(--surface-2); border-radius: 6px; height: 26px; overflow: hidden; }
.hbar-item .hbar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width 0.3s; }
.hbar-item.hbar-text .hbar-fill { background: var(--primary); }
.hbar-item.hbar-voice .hbar-fill { background: var(--warn); }
.hbar-item.hbar-image .hbar-fill { background: #38bdf8; }
.hbar-item .hbar-value { font-weight: 600; text-align: right; font-size: 0.85rem; }

/* Analytics — SVG charts */
.chart-svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    font-family: inherit;
}
.chart-svg rect { transition: opacity 0.15s; }
.chart-svg rect:hover { opacity: 1 !important; }
.chart-svg-hbar { max-height: 140px; }
.chart-svg-pie { max-width: 200px; margin: 0 auto; }

.chart-empty { color: var(--text-muted); padding: 2rem; text-align: center; font-style: italic; }
.chart-legend { display: flex; gap: 1rem; margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); flex-wrap: wrap; }
.chart-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.375rem;
    vertical-align: middle;
}

/* ----- Toast notifications ----- */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 380px;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-left: 4px solid var(--primary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toast-in 0.25s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warn { border-left-color: var(--warn); }
.toast.toast-info { border-left-color: var(--info); }
.toast.removing { opacity: 0; transform: translateX(20px); }
.toast-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.toast-message { flex: 1; font-size: 0.9rem; color: var(--text); word-break: break-word; }
.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}
.toast-close:hover { color: var(--text); }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ----- Spinner ----- */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -0.15em;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spinner { border-color: rgba(255, 255, 255, 0.4); border-right-color: white; }

/* ----- Modal confirmation ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fade-in 0.15s ease-out;
    padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.2s ease-out;
}
.modal h3 { margin-bottom: 0.5rem; }
.modal p { color: var(--text-muted); margin-bottom: 1rem; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ----- Header bar ----- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 { margin-bottom: 0; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Tenant filter pill */
.tenant-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}
.tenant-filter select {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 0.25rem;
    margin: 0;
    font-size: 0.85rem;
}

/* ===========================================================
   ANIMATIONS & UTILITAIRES
   Style Linear/Vercel : fluide, sobre, professionnel.
   Respecte prefers-reduced-motion.
   =========================================================== */

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Stagger fade-in : appliqué sur les enfants directs, 40ms entre chaque */
.stagger > * {
    animation: fade-in-up 320ms var(--ease-out) backwards;
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }
.stagger > *:nth-child(9) { animation-delay: 320ms; }
.stagger > *:nth-child(10) { animation-delay: 360ms; }
.stagger > *:nth-child(n+11) { animation-delay: 400ms; }

/* Page enter : le <main> entier fade-in */
main.content > * {
    animation: fade-in-up 360ms var(--ease-out) backwards;
}
main.content > *:nth-child(1) { animation-delay: 0ms; }
main.content > *:nth-child(2) { animation-delay: 60ms; }
main.content > *:nth-child(3) { animation-delay: 120ms; }
main.content > *:nth-child(4) { animation-delay: 180ms; }
main.content > *:nth-child(n+5) { animation-delay: 240ms; }

/* Skeleton loader (shimmer) */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
    color: transparent;
    user-select: none;
    pointer-events: none;
}
.skeleton-line { height: 0.875rem; margin-bottom: 0.5rem; }
.skeleton-line:last-child { width: 70%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 100px; }

/* Badge animé (pour notifications, compteurs) */
.badge-pulse {
    position: relative;
}
.badge-pulse::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: currentColor;
    opacity: 0.4;
    animation: pulse-soft 1.8s infinite ease-in-out;
    z-index: -1;
}

/* Toasts : slide-in moderne (côté CSS, complément de app.js) */
.toast {
    animation: slide-in-right 240ms var(--ease-out);
}
.toast.removing {
    animation: fade-in 200ms var(--ease) reverse forwards;
}

/* Modale : scale-in */
.modal-overlay:not([hidden]) {
    animation: fade-in 160ms var(--ease);
}
.modal-overlay:not([hidden]) .modal {
    animation: scale-in 200ms var(--ease-out);
}

/* Page header moderne (titre + actions alignés) */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin: 0;
}
.page-header p { margin: 0.25rem 0 0; }
.page-header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* Toolbar (filtres + recherche au-dessus des tables) */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.toolbar .search-bar { margin: 0; flex: 1; min-width: 200px; max-width: 400px; }

/* Empty state (avec icône) */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state .icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    color: var(--text-subtle);
    opacity: 0.5;
}
.empty-state h3 {
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}
.empty-state p { font-size: 0.875rem; margin-bottom: 1rem; }

/* Amélioration tables : hover subtil + transition */
.table tbody tr {
    transition: background var(--transition-fast);
}
.table tbody tr:hover {
    background: var(--surface-2);
}

/* Form labels : plus modernes */
label {
    display: block;
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.875rem;
}
label small { display: block; font-weight: normal; margin-top: 0.25rem; color: var(--text-muted); font-size: 0.8125rem; }

/* Inputs : focus ring plus subtil */
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], textarea, input[type=file], select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 0.375rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Alerts : animation d'entrée */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border: 1px solid;
    font-size: 0.875rem;
    animation: fade-in-up 280ms var(--ease-out) backwards;
}
.alert .icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.alert-success { background: var(--success-light); color: #065f46; border-color: var(--success); }
:root[data-theme="dark"] .alert-success { color: var(--success); }
.alert-error { background: var(--danger-light); color: #991b1b; border-color: var(--danger); }
:root[data-theme="dark"] .alert-error { color: var(--danger); }
.alert-warn { background: var(--warn-light); color: #92400e; border-color: var(--warn); }
:root[data-theme="dark"] .alert-warn { color: var(--warn); }
.alert-info { background: var(--info-light); color: #155e75; border-color: var(--info); }
:root[data-theme="dark"] .alert-info { color: var(--info); }

/* Banner persistant (must_change_password) : moins agressif */
.banner {
    background: var(--warn-light);
    color: #92400e;
    padding: 0.625rem 1.25rem;
    border-bottom: 1px solid var(--warn);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    animation: fade-in 240ms var(--ease);
}
:root[data-theme="dark"] .banner { color: var(--warn); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }
.banner .icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.banner > span { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }

/* Badges : plus subtils */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid transparent;
    transition: background var(--transition-fast);
}
.badge.badge-ok { background: var(--success-light); color: #065f46; border-color: var(--success); }
:root[data-theme="dark"] .badge.badge-ok { color: var(--success); }
.badge.badge-warn { background: var(--warn-light); color: #92400e; border-color: var(--warn); }
:root[data-theme="dark"] .badge.badge-warn { color: var(--warn); }
.badge.badge-err { background: var(--danger-light); color: #991b1b; border-color: var(--danger); }
:root[data-theme="dark"] .badge.badge-err { color: var(--danger); }
.badge.badge-info { background: var(--info-light); color: #155e75; border-color: var(--info); }
:root[data-theme="dark"] .badge.badge-info { color: var(--info); }
.badge .icon { width: 0.75rem; height: 0.75rem; }

/* H1, H2, H3 plus modernes */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 1.5rem; color: var(--text); }
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.011em; margin-bottom: 1rem; color: var(--text); }
h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--text); }
.muted { color: var(--text-muted); }
.small { font-size: 0.8125rem; }
.text-mono { font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace; font-size: 0.875em; }

/* Respecte les préférences accessibilité (vitales) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* View Transitions API : morphing doux entre pages (Chrome/Edge/Safari récents) */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 240ms;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}