/* Design « Admin Red » (DESIGN.md) : jetons, composants et mise en page du back-office.
   Toutes les couleurs passent par les variables de :root ; le thème sombre (classe .dark sur <html>,
   posée par assets/theme.js) ne redéfinit que ces variables. Les palettes Tailwind employées dans les
   vues (slate, green, red, amber, blue, violet) sont branchées sur ces mêmes variables dans vues/tete.php. */

/* ---------- 1. Jetons ---------- */
:root {
    color-scheme: light;
    --primary: #FF0000;
    --primary-dark: #CC0000;
    --primary-darker: #990000;
    --primary-light: #FFECEC;
    --primary-rgb: 255, 0, 0;

    --background: #F9F9F9;
    --surface: #FFFFFF;
    --subtle-bg: #F2F2F2;
    --border: #E5E5E5;
    --text: #0F0F0F;
    --heading-color: #0F0F0F;
    --body-text: #272727;
    --text-secondary: #525252;
    --muted: #606060;

    --success: #16A34A; --success-bg: #DCFCE7; --success-text: #15803D; --success-border: #BBF7D0;
    --warning: #F59E0B; --warning-bg: #FEF3C7; --warning-text: #B45309; --warning-border: #FDE68A;
    --danger:  #B91C1C; --danger-bg:  #FEE2E2; --danger-text:  #991B1B; --danger-border:  #FECACA;
    --info:    #3B82F6; --info-bg:    #DBEAFE; --info-text:    #1D4ED8; --info-border:    #BFDBFE;
    --purple:  #9333EA; --purple-bg:  #F3E8FF; --purple-text:  #7E22CE;
    --gray:    #6B7280; --gray-bg:    #F3F4F6; --gray-text:    #374151;

    /* Neutres en canaux RVB pour les classes Tailwind slate-* (avec opacité possible) */
    --n-50: 249 249 249;  --n-100: 242 242 242; --n-200: 229 229 229; --n-300: 212 212 212;
    --n-400: 144 144 144; --n-500: 96 96 96;    --n-600: 82 82 82;    --n-700: 39 39 39;
    --n-800: 15 15 15;    --n-900: 15 15 15;

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;

    --radius-sm: 8px; --radius: 10px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px;

    --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.10);
    --shadow-modal: 0 24px 64px rgba(0,0,0,.15);
    --shadow-brand: 0 8px 32px rgba(var(--primary-rgb), .25);
    --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), .12);

    --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem;
    --text-lg: 1.125rem; --text-xl: 1.25rem; --text-2xl: 1.5rem; --text-3xl: 1.875rem;

    --chart-grid: rgba(229,229,229,.8);
    --chart-tick: #606060;
    --chart-tooltip: rgba(15,15,15,.95);
}

html.dark {
    color-scheme: dark;
    --primary-dark: #FF3B3B;
    --primary-darker: #FF6B6B;
    --primary-light: #3A0B0B;

    --background: #0F0F0F;
    --surface: #1A1A1A;
    --subtle-bg: #212121;
    --border: #303030;
    --text: #F1F1F1;
    --heading-color: #FFFFFF;
    --body-text: #D9D9D9;
    --text-secondary: #AAAAAA;
    --muted: #AAAAAA;

    --success-bg: rgba(22,163,74,.15);  --success-text: #4ADE80; --success-border: rgba(22,163,74,.35);
    --warning-bg: rgba(245,158,11,.15); --warning-text: #FBBF24; --warning-border: rgba(245,158,11,.35);
    --danger: #F87171;
    --danger-bg:  rgba(248,113,113,.15); --danger-text: #FCA5A5; --danger-border: rgba(248,113,113,.35);
    --info-bg:    rgba(59,130,246,.15);  --info-text:   #93C5FD; --info-border:   rgba(59,130,246,.35);
    --purple-bg:  rgba(147,51,234,.18);  --purple-text: #D8B4FE;
    --gray-bg:    rgba(107,114,128,.2);  --gray-text:   #D1D5DB;

    --n-50: 33 33 33;    --n-100: 38 38 38;   --n-200: 48 48 48;   --n-300: 63 63 63;
    --n-400: 113 113 113; --n-500: 170 170 170; --n-600: 189 189 189; --n-700: 217 217 217;
    --n-800: 241 241 241; --n-900: 255 255 255;

    --shadow-sm: 0 1px 4px rgba(0,0,0,.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,.45);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.5);

    --chart-grid: rgba(48,48,48,.8);
    --chart-tick: #AAAAAA;
    --chart-tooltip: rgba(33,33,33,.97);
}

/* ---------- 2. Base ---------- */
/* Remise à zéro (équivalent du preflight Tailwind, désactivé dans vues/tete.php : injecté après cette
   feuille, il écraserait le fond des boutons type="button"). */
*, ::before, ::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: var(--border); }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; tab-size: 4; -webkit-font-smoothing: antialiased; }
body { margin: 0; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }
p, blockquote, dl, dd, figure, pre, hr { margin: 0; }
ol, ul, menu { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: 600; }
img, svg, video, canvas, iframe { display: block; vertical-align: middle; }
img, video { max-width: 100%; height: auto; }
button, input, optgroup, select, textarea {
    margin: 0; padding: 0; font: inherit; font-feature-settings: inherit; letter-spacing: inherit; color: inherit;
}
button, select { text-transform: none; }
button, [type='button'], [type='reset'], [type='submit'] { -webkit-appearance: button; background: none; cursor: pointer; }
button:disabled { cursor: default; }
textarea { resize: vertical; }
table { border-collapse: collapse; text-indent: 0; border-color: inherit; }
summary { display: list-item; cursor: pointer; }
[hidden] { display: none; }
dialog { padding: 0; color: inherit; }

body {
    background: var(--background);
    color: var(--body-text);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    font-size: var(--text-sm);
    line-height: 1.5;
}
h1, h2, h3, h4 { color: var(--heading-color); line-height: 1.25; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }
::placeholder { color: var(--muted); opacity: .8; }
code { font-size: .85em; padding: 1px 5px; border-radius: 6px; background: var(--subtle-bg); color: var(--text); }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* Utilitaires de couleur (DESIGN §10). Sélecteur renforcé : Tailwind CDN injecte ses règles après cette feuille. */
html .text-primary, html .hover\:text-primary:hover { color: var(--primary-dark); }
html .text-muted { color: var(--muted); }
html .text-heading { color: var(--heading-color); }
html .bg-primary-light { background: var(--primary-light); }
html .bg-surface { background: var(--surface); }
html .border-token { border-color: var(--border); }

/* ---------- 3. Mise en page ---------- */
.app-shell { min-height: 100vh; transition: padding-left .3s cubic-bezier(.4,0,.2,1); }
@media (min-width: 1024px) {
    .app-shell { padding-left: var(--sidebar-width); }
    .sidebar-collapsed .app-shell { padding-left: var(--sidebar-collapsed-width); }
}

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: var(--sidebar-width);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
}
.sidebar::after { /* liseré dégradé (DESIGN §6.8) */
    content: ''; position: absolute; top: 0; right: -1px; width: 1px; height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, transparent 100%); opacity: .3; pointer-events: none;
}
.sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) {
    .sidebar { transform: none; }
    .sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
}
.sidebar-overlay { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); }

.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    height: var(--header-height); padding: 0 18px; flex-shrink: 0;
    font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--heading-color);
    border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden;
}
.sidebar-logo-icon {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--primary); color: #fff; font-size: 20px; box-shadow: var(--shadow-brand);
}
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px 16px; }
.sidebar-section-label {
    padding: 18px 14px 8px; font-size: 11px; font-weight: 600; letter-spacing: .6px;
    text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 11px 14px; margin-bottom: 2px; border-radius: var(--radius);
    font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); text-align: left;
    white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.nav-item i { font-size: 19px; line-height: 1; flex-shrink: 0; }
.nav-item:hover { background: var(--background); color: var(--text); }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item.active::before, .nav-item[aria-current="page"]::before {
    content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
    min-width: 20px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
    text-align: center; background: var(--subtle-bg); color: var(--text-secondary);
}
.nav-badge-hot { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-card { padding: 12px 14px; border-radius: var(--radius-md); background: var(--background); }
.header-icon-btn.sidebar-collapse-btn { display: none; }
@media (min-width: 1024px) {
    .header-icon-btn.sidebar-collapse-btn { display: inline-grid; }
    .sidebar-collapsed .sidebar-section-label,
    .sidebar-collapsed .nav-label,
    .sidebar-collapsed .nav-badge,
    .sidebar-collapsed .sidebar-logo-text,
    .sidebar-collapsed .sidebar-footer { display: none; }
    .sidebar-collapsed .sidebar-nav { padding-top: 16px; }
    .sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; }
    .sidebar-collapsed .sidebar-logo { justify-content: center; padding: 0; }
}

.app-header {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 12px;
    height: var(--header-height); padding: 0 24px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header-icon-btn {
    position: relative; display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: var(--radius);
    color: var(--text-secondary); font-size: 20px; transition: background .15s ease, color .15s ease;
}
.header-icon-btn:hover { background: var(--background); color: var(--text); }
.header-dot {
    position: absolute; top: 6px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px; border: 2px solid var(--surface);
    background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
}

.search-box { position: relative; width: 100%; max-width: 420px; }
.search-box .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 17px; pointer-events: none;
}
.search-box .form-input { padding-left: 38px; background: var(--background); }
.search-box .form-input:focus { background: var(--surface); }

.app-content { padding: 24px; }
@media (max-width: 767px) { .app-content { padding: 16px; } .app-header { padding: 0 16px; } }

.app-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
    padding: 18px 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
}

/* En-tête de page */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-dark); }
.breadcrumb .sep { opacity: .6; }
.breadcrumb .current { color: var(--text); font-weight: 500; }
.page-title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; color: var(--heading-color); }
.page-subtitle { margin-top: 4px; font-size: var(--text-sm); color: var(--muted); }
.page-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 767px) {
    .page-header { align-items: stretch; flex-direction: column; }
    .page-header-actions > .btn { flex: 1; }
}

/* ---------- 4. Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius);
    font-size: var(--text-sm); font-weight: 500; line-height: 1.25; white-space: nowrap;
    cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn i { font-size: 16px; line-height: 1; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #CC0000; border-color: #CC0000; }
.btn-secondary { background: var(--background); border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary-dark); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--background); color: var(--text); }
.btn-danger { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991B1B; border-color: #991B1B; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-bg); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803D; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #D97706; }
.btn-sm { padding: 6px 12px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-sm i { font-size: 14px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius-md); }
.btn-icon { padding: 8px; }
.btn-icon-sm { padding: 6px; border-radius: var(--radius-sm); }
.btn-icon i, .btn-icon-sm i { font-size: 17px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin 1s linear infinite;
}

/* Contrôle segmenté (DESIGN C22) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--subtle-bg); }
.segmented button { padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"], .segmented button.active { background: var(--surface); color: var(--primary-dark); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ---------- 5. Cartes ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px 20px 14px; transition: box-shadow .15s ease;
}
.card-hover:hover { box-shadow: var(--shadow-md); }
.card.p-0 { padding: 0; }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--heading-color); }
.card-subtitle { margin-top: 2px; font-size: 13px; color: var(--muted); }

.stat-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 576px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-card { display: flex; align-items: center; gap: 16px; padding: 20px; }
.stat-card-icon {
    display: grid; place-items: center; flex-shrink: 0;
    width: 48px; height: 48px; border-radius: var(--radius-md); font-size: 22px;
}
.stat-card-body { min-width: 0; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.stat-value { margin-top: 2px; font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; color: var(--heading-color); font-variant-numeric: tabular-nums; }
.stat-sub-label { margin-top: 2px; font-size: 12px; color: var(--muted); }

.icon-bg-primary { background: var(--primary-light); color: var(--primary-dark); }
.icon-bg-success { background: var(--success-bg); color: var(--success-text); }
.icon-bg-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.icon-bg-warning { background: var(--warning-bg); color: var(--warning-text); }
.icon-bg-info    { background: var(--info-bg);    color: var(--info-text); }
.icon-bg-purple  { background: var(--purple-bg);  color: var(--purple-text); }

/* ---------- 6. Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .2px;
    line-height: 1.4; white-space: nowrap;
}
.badge i { font-size: 13px; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-info    { background: var(--info-bg);    color: var(--info-text); }
.badge-purple  { background: var(--purple-bg);  color: var(--purple-text); }
.badge-gray    { background: var(--gray-bg);    color: var(--gray-text); }
.badge-sm { padding: 1px 8px; font-size: 11px; }
button.badge { cursor: pointer; transition: filter .15s ease; }
button.badge:hover { filter: brightness(.95); }
html.dark button.badge:hover { filter: brightness(1.2); }
.badge-solid { background: var(--primary); color: #fff; }

/* ---------- 7. Tableaux ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table thead th {
    padding: 12px 16px; background: var(--subtle-bg); text-align: left; white-space: nowrap;
    font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--body-text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: rgba(var(--primary-rgb), .03); }
.data-table tbody tr.selected { background: rgba(var(--primary-rgb), .06); }
.data-table .col-check { width: 44px; padding-right: 0; }
.data-table.compact tbody td { padding: 10px 16px; }
.data-table .text-right { text-align: right; }
.data-table td.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.table-section-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }
.table-footer-info { font-size: 13px; color: var(--muted); }
.thumb { width: 112px; max-width: none; flex-shrink: 0; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); object-fit: cover; background: var(--subtle-bg); }
.thumb-sm { width: 96px; }

.pagination { display: flex; align-items: center; gap: 6px; }
.page-btn {
    display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--muted); }

/* ---------- 8. Formulaires ---------- */
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.form-label .required { color: var(--danger); }
.form-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); font-size: var(--text-sm); line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: 0; border-color: var(--primary); box-shadow: var(--focus-ring); }
.form-input:disabled, .form-select:disabled, .form-textarea:disabled { opacity: .6; }
.form-input.error, .form-textarea.error { border-color: var(--danger); }
.form-select {
    appearance: none; padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23909090' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-input-sm, .form-select-sm { padding: 6px 10px; font-size: 13px; border-radius: var(--radius-sm); }
.form-select-sm { padding-right: 30px; background-position: right 10px center; }
.form-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.check-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; user-select: none;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
    font-size: var(--text-sm);
}
.check-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: background .2s ease; }
.toggle-slider::before {
    content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Bandeaux d'alerte (C39) */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border: 1px solid; border-radius: var(--radius-md); font-size: var(--text-sm); }
.alert > i { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info-text); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger-text); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert code { background: rgba(0,0,0,.06); color: inherit; }

/* ---------- 9. Onglets ---------- */
.tab-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; }
.tab-btn {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; padding: 10px 16px;
    border-bottom: 2px solid transparent; font-size: var(--text-sm); font-weight: 500; color: var(--muted); white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active, .tab-btn[aria-selected="true"] { border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ---------- 10. Barres de progression, divers ---------- */
.progress-bar { height: 8px; border-radius: 999px; background: var(--subtle-bg); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s ease; }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }
.divider { height: 1px; background: var(--border); border: 0; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--subtle-bg) 25%, var(--border) 50%, var(--subtle-bg) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty-state i { display: block; margin-bottom: 8px; font-size: 32px; opacity: .6; }
.chart-container { position: relative; height: 260px; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background .15s ease; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(var(--primary-rgb), .03); }
.list-row.selected { background: rgba(var(--primary-rgb), .06); }
.star-btn { font-size: 18px; line-height: 1; color: rgb(var(--n-300)); transition: color .15s ease, transform .1s ease; }
.star-btn:hover { color: var(--warning); }
.star-btn.on { color: var(--warning); }
.star-btn:active { transform: scale(.9); }

/* Barre d'actions groupées (C16) */
.bulk-bar {
    position: sticky; top: calc(var(--header-height) + 8px); z-index: 20;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; margin-bottom: 16px;
    border: 1px solid var(--primary); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-md);
}

/* Texte rendu (résumés, réponses) : variables du plugin typography */
.prose {
    --tw-prose-body: var(--body-text);
    --tw-prose-headings: var(--heading-color);
    --tw-prose-bold: var(--heading-color);
    --tw-prose-links: var(--primary-dark);
    --tw-prose-bullets: var(--muted);
    --tw-prose-counters: var(--muted);
    --tw-prose-hr: var(--border);
    --tw-prose-quotes: var(--text);
    --tw-prose-quote-borders: var(--primary);
    --tw-prose-code: var(--primary-dark);
    --tw-prose-th-borders: var(--border);
    --tw-prose-td-borders: var(--border);
}
.prose a.citation, a.citation { color: var(--primary-dark); font-weight: 700; font-size: .78em; vertical-align: super; margin-left: 1px; text-decoration: none; }
.prose a.citation:hover, a.citation:hover { text-decoration: underline; }
.horodatage {
    display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--primary-light);
    color: var(--primary-dark); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .92em;
}
.horodatage:hover { background: var(--primary); color: #fff; }

/* ---------- 11. Modales ---------- */
dialog.modal-box {
    width: min(520px, calc(100vw - 32px)); max-height: 90vh; padding: 0; margin: auto;
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    background: var(--surface); color: var(--body-text); box-shadow: var(--shadow-modal);
}
dialog.modal-box[open] { animation: slideUp .2s ease; }
dialog.modal-box::backdrop { background: rgba(0,0,0,.5); animation: fadeIn .15s ease; }
dialog.modal-sm { width: min(400px, calc(100vw - 32px)); }
dialog.modal-lg { width: min(720px, calc(100vw - 32px)); }
dialog.modal-xl { width: min(1024px, calc(100vw - 32px)); }
body:has(dialog[open]) { overflow: hidden; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: var(--text-lg); font-weight: 600; color: var(--heading-color); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); }
.modal-confirm-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 50%; font-size: 24px; }

/* ---------- 12. Toasts ---------- */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 40px); }
.toast {
    display: flex; align-items: flex-start; gap: 12px; min-width: 300px; max-width: 420px; padding: 14px 14px 14px 16px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text);
    box-shadow: 0 8px 30px rgba(0,0,0,.12); animation: slideInRight .25s ease;
}
.toast-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: var(--radius-sm); font-size: 18px; }
.toast-success .toast-icon { background: var(--success-bg); color: var(--success-text); }
.toast-error   .toast-icon { background: var(--danger-bg);  color: var(--danger-text); }
.toast-warning .toast-icon { background: var(--warning-bg); color: var(--warning-text); }
.toast-info    .toast-icon { background: var(--info-bg);    color: var(--info-text); }
.toast-title { font-weight: 600; color: var(--heading-color); }
.toast-message { font-size: 13px; color: var(--text-secondary); word-break: break-word; }
.toast-close { margin-left: auto; padding: 2px; border-radius: 6px; color: var(--muted); font-size: 18px; line-height: 1; }
.toast-close:hover { background: var(--background); color: var(--text); }
@media (max-width: 575px) { .toast { min-width: 0; } .toast-container { left: 16px; right: 16px; } }

/* ---------- 13. Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.animate-fadeIn { animation: fadeIn .15s ease both; }
.animate-slideInUp { animation: slideInUp .3s ease both; }
.stagger-1 { animation-delay: 50ms; } .stagger-2 { animation-delay: 100ms; } .stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; } .stagger-5 { animation-delay: 250ms; }

/* ---------- 14. Accessibilité, tactile, impression ---------- */
@media (hover: none) and (pointer: coarse) {
    .btn, .page-btn, .nav-item, .header-icon-btn { min-height: 44px; }
    .btn-icon-sm { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
    .no-print, .sidebar, .app-header, .app-footer, .toast-container { display: none !important; }
    .app-shell { padding-left: 0 !important; }
    .card { box-shadow: none !important; border-color: #ddd; }
}

/* ---------- 15. Écran de compte (DESIGN.md §6.15) ---------- */
.auth-body { min-height: 100vh; background: linear-gradient(160deg, #FFF5F5 0%, var(--background) 60%); position: relative; overflow-x: hidden; }
html.dark .auth-body { background: linear-gradient(160deg, #1F0A0A 0%, var(--background) 60%); }
.auth-bg-shape { position: fixed; border-radius: 50%; filter: blur(60px); pointer-events: none; background: rgba(var(--primary-rgb), .10); }
.auth-bg-shape-1 { width: 420px; height: 420px; top: -120px; right: -100px; }
.auth-bg-shape-2 { width: 320px; height: 320px; bottom: -100px; left: -80px; background: rgba(var(--primary-rgb), .08); }
.auth-wrap { position: relative; z-index: 1; width: min(440px, calc(100vw - 32px)); margin: 0 auto; padding: 56px 0 40px; }
.auth-logo-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.auth-card { padding: 32px; border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
@media (max-width: 575px) { .auth-card { padding: 24px 20px; } }
.auth-title { font-size: var(--text-xl); font-weight: 700; color: var(--heading-color); }
.auth-subtitle { margin: 6px 0 20px; color: var(--muted); }
.auth-card form > * + * { margin-top: 16px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-links { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
.auth-links a { color: var(--primary-dark); font-weight: 500; }
.auth-links a:hover { text-decoration: underline; }

/* ---------- 16. Menu déroulant et avatar (DESIGN.md §6.13, §6.15) ---------- */
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--radius); }
.user-btn:hover { background: var(--background); }
.avatar-placeholder { display: inline-grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary-dark); font-weight: 700; font-size: 14px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); z-index: 50; min-width: 180px; padding: 6px 0;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-lg);
    animation: fadeInDown .15s ease; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; font-size: var(--text-sm);
    color: var(--text); text-align: left; }
.dropdown-item:hover:not(:disabled) { background: var(--background); }
.dropdown-item:disabled { cursor: default; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item i { font-size: 17px; }
.dropdown-divider { height: 1px; margin: 6px 0; background: var(--border); }
.auth-demo-box { margin-top: 20px; padding: 14px; border: 1px dashed var(--warning); border-radius: var(--radius-md); background: var(--warning-bg); color: var(--warning-text); }

/* Pages légales : information de l'éditeur encore à renseigner (Legal::html). */
mark.a-completer {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-radius: 4px;
    padding: 0 4px;
    font-weight: 600;
}

/* Lecteur du résumé (page vidéo) : barre compacte façon lecteur audio. */
.lecteur { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border: 1px solid var(--border);
    border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); }
.lecteur-play { display: inline-flex; flex: none; width: 36px; height: 36px; align-items: center; justify-content: center;
    border-radius: 999px; background: var(--primary); color: #fff; font-size: 20px; transition: background .15s, transform .1s; }
.lecteur-play:hover { background: var(--primary-dark); }
.lecteur-play:active { transform: scale(.94); }
.lecteur-btn { display: inline-flex; flex: none; width: 28px; height: 28px; align-items: center; justify-content: center;
    border-radius: 999px; color: var(--text-secondary); font-size: 18px; }
.lecteur-btn:hover:not(:disabled) { background: var(--subtle-bg); color: var(--text); }
.lecteur-btn:disabled { opacity: .35; cursor: default; }
.lecteur-temps { flex: none; min-width: 74px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); text-align: center; }
.lecteur-piste { position: relative; flex: 1; min-width: 60px; height: 6px; border-radius: 999px; background: var(--border); cursor: pointer; }
.lecteur-piste:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.lecteur-progression { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s ease; }
.lecteur-vitesse { flex: none; min-width: 40px; padding: 2px 8px; border-radius: 999px; background: var(--subtle-bg);
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.lecteur-vitesse:hover { background: var(--border); }
@media (max-width: 480px) { .lecteur-temps { display: none; } }
