/* ==================================================================
   TrouvTout â back-office
   Feuille de style autonome : aucun CDN, aucune Ã©tape de build.

   Deux teintes, et rien d'autre : un corail qui porte toute l'action,
   une encre chaude qui porte tout le reste. Les Ã©tats â succÃ¨s, alerte,
   erreur â se distinguent par leur icÃ´ne et leur libellÃ©, jamais par une
   couleur supplÃ©mentaire (Â§10.2). La mÃªme rÃ¨gle gouverne l'application
   mobile : les deux surfaces se reconnaissent du premier coup d'Åil.

   ThÃ¨me clair/sombre automatique, surchargeable par data-theme.
   ================================================================== */

:root {
    /* --- Accent : corail */
    --accent-700: #A8330F;
    --accent-600: #C03C1D;
    --accent-500: #EA5230;
    --accent-400: #FF6B45;
    --accent-100: #FFEBE4;

    /* --- Encre : neutre chaud.
       Un gris strictement neutre jurerait avec le corail : toute la gamme
       garde une pointe de rouge, ce qui soude les deux teintes. */
    --ink-900: #150C0A;
    --ink-800: #241714;
    --ink-700: #3A241D;
    --ink-100: #F1E9E5;

    /* --- SÃ©mantique : les deux mÃªmes teintes, redistribuÃ©es.
       L'encre pour ce qui est acquis, le corail pour ce qui rÃ©clame une
       action. Â« En attente Â» et Â« Erreur Â» partagent le corail : l'un se
       pose sur un fond neutre, l'autre sur un fond teintÃ©. */
    --success: var(--ink-800);
    --success-bg: var(--ink-100);
    --warning: var(--accent-500);
    --warning-bg: var(--ink-100);
    --danger: var(--accent-600);
    --danger-bg: var(--accent-100);
    --info: var(--ink-800);
    --info-bg: var(--ink-100);

    /* --- Surfaces */
    --bg: #F7F3F1;
    --surface: #FFFFFF;
    --surface-2: #F2EBE7;
    --surface-3: #EAE0DA;
    --border: #E8DED8;
    --border-soft: #F1E9E4;

    --text: #241714;
    --text-muted: #7D6A62;
    --text-soft: #A89992;

    --sidebar-bg: #FFFFFF;
    --sidebar-active: var(--ink-800);

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 7px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(36, 23, 20, .05);
    --shadow: 0 1px 3px rgba(36, 23, 20, .06), 0 10px 28px -14px rgba(36, 23, 20, .18);
    --shadow-lg: 0 2px 6px rgba(36, 23, 20, .07), 0 24px 48px -20px rgba(36, 23, 20, .28);

    --sidebar-w: 236px;
    --navbar-h: 56px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

    --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17100E;
        --surface: #211815;
        --surface-2: #2B201B;
        --surface-3: #342821;
        --border: #3C2D27;
        --border-soft: #2E221D;

        --text: #F6EEEA;
        --text-muted: #BBA8A0;
        --text-soft: #8D7B74;

        --sidebar-bg: #1C1411;
        --sidebar-active: var(--accent-500);

        --accent-100: #3A211A;
        --ink-100: #2B201B;
        --success: #E6D8D2;
        --success-bg: #2B201B;
        --warning: #FF6B45;
        --warning-bg: #2B201B;
        --danger: #FF8360;
        --danger-bg: #3A211A;
        --info: #E6D8D2;
        --info-bg: #2B201B;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 12px 30px -16px rgba(0, 0, 0, .8);
        --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 28px 56px -24px rgba(0, 0, 0, .9);
    }
}

:root[data-theme="dark"] {
    --bg: #17100E;
    --surface: #211815;
    --surface-2: #2B201B;
    --surface-3: #342821;
    --border: #3C2D27;
    --border-soft: #2E221D;
    --text: #F6EEEA;
    --text-muted: #BBA8A0;
    --text-soft: #8D7B74;
    --sidebar-bg: #1C1411;
    --sidebar-active: var(--accent-500);
    --accent-100: #3A211A;
    --ink-100: #2B201B;
    --success: #E6D8D2;
    --success-bg: #2B201B;
    --warning: #FF6B45;
    --warning-bg: #2B201B;
    --danger: #FF8360;
    --danger-bg: #3A211A;
    --info: #E6D8D2;
    --info-bg: #2B201B;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 12px 30px -16px rgba(0, 0, 0, .8);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 28px 56px -24px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-500); text-decoration: none; transition: color .15s; }
a:hover { color: var(--ink-800); }

:root[data-theme="dark"] a:hover,
:root:not([data-theme="light"]) a:hover { color: var(--accent-400); }

::selection { background: var(--accent-100); color: var(--ink-800); }

/* ------------------------------------------------------ Animations */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: none; }
}

@keyframes popIn {
    0%   { opacity: 0; transform: scale(.94); }
    60%  { transform: scale(1.015); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes growUp {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@keyframes drawRing {
    from { stroke-dashoffset: var(--dash-total); }
}

@keyframes shimmer {
    0%   { background-position: -460px 0; }
    100% { background-position: 460px 0; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* Les animations d'entrÃ©e sont dÃ©sactivÃ©es pour qui demande
   explicitement moins de mouvement (accessibilitÃ©, Â§10.2). */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

.anim-up { animation: fadeUp .5s var(--ease) both; }
.anim-in { animation: fadeIn .45s var(--ease) both; }
.anim-pop { animation: popIn .42s var(--ease) both; }

/* EntrÃ©e dÃ©calÃ©e : les Ã©lÃ©ments d'une grille arrivent en cascade. */
.stagger > * { animation: fadeUp .5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }
.stagger > *:nth-child(7) { animation-delay: .32s; }
.stagger > *:nth-child(8) { animation-delay: .37s; }
.stagger > *:nth-child(9) { animation-delay: .42s; }
.stagger > *:nth-child(10) { animation-delay: .47s; }

/* ---------------------------------------------------------- Layout */

/* Barre globale, au-dessus de la barre latérale comme du contenu.
   Elle porte ce qui ne dépend d'aucune page : la marque, la recherche,
   les alertes en attente et le compte connecté. L'en-tête de page, lui,
   reste sous elle et change à chaque écran. */
.navbar {
    height: var(--navbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}

.navbar-brand {
    display: flex; align-items: center; gap: 10px;
    width: calc(var(--sidebar-w) - 54px);
    min-width: 0; flex: none;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-brand .brand-name { color: var(--text); font-size: 14.5px; }
.navbar-brand .brand-sub { color: var(--text-soft); }

.navbar-search { flex: 1; display: flex; justify-content: center; }
.navbar-search .search-box { max-width: 520px; width: 100%; }

.navbar-end { display: flex; align-items: center; gap: 10px; flex: none; }

/* Cloche : le compte des dossiers en attente se lit sans ouvrir de menu. */
.bell {
    position: relative;
    width: 38px; height: 38px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    display: grid; place-items: center;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
}
.bell:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.bell svg { width: 17px; height: 17px; }

.bell-count {
    position: absolute; top: -3px; right: -3px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--accent-500);
    border: 2px solid var(--surface);
    color: #fff;
    font-size: 10px; font-weight: 800; line-height: 14px;
    text-align: center;
}

/* Compte connecté : initiales, nom, rôle — même grammaire que la
   pastille de la barre latérale, dont elle prend la place. */
.navbar-user {
    display: flex; align-items: center; gap: 9px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    min-width: 0;
}
.navbar-user:hover { text-decoration: none; background: var(--surface-3); }
.navbar-user .navbar-user-name { font-size: 13px; font-weight: 650; color: var(--text); line-height: 1.2; }
.navbar-user .navbar-user-role { font-size: 11px; color: var(--text-muted); line-height: 1.2; }

/* Bouton d'ouverture de la barre latérale, utile sous 1100 px. */
.nav-toggle {
    display: none;
    width: 38px; height: 38px; flex: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    place-items: center;
    cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-3); color: var(--text); }
.nav-toggle svg { width: 18px; height: 18px; }

/* Carte de rappel en pied de barre latérale : l'équipe y retrouve la
   file qui l'attend, sans parcourir le menu. */
.side-promo {
    margin-top: 14px;
    border-radius: var(--radius);
    padding: 14px;
    background: linear-gradient(135deg, var(--ink-700), var(--ink-900));
    position: relative; overflow: hidden;
}
.side-promo::after {
    content: "";
    position: absolute; right: -30px; bottom: -40px;
    width: 110px; height: 110px; border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}
.side-promo-title { position: relative; z-index: 1; color: #fff; font-weight: 700; font-size: 13.5px; }
.side-promo-text { position: relative; z-index: 1; color: rgba(255,255,255,.68); font-size: 11.5px; margin-top: 3px; line-height: 1.45; }
.side-promo .btn { position: relative; z-index: 1; margin-top: 11px; width: 100%; }

.layout { display: flex; min-height: calc(100vh - var(--navbar-h)); }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Les éléments de la colonne ne se compriment jamais : sans cela, dès
   que le menu dépasse la hauteur de l'écran, flexbox écrase la carte de
   marque et le pied de colonne au lieu de les faire défiler. */
.sidebar > * { flex: 0 0 auto; }

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Carte de marque en tÃªte de la barre latÃ©rale. */
.brand-card {
    background: linear-gradient(135deg, var(--ink-700), var(--ink-900));
    border-radius: var(--radius-sm);
    padding: 12px 12px 11px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
    animation: popIn .5s var(--ease) both;
}

.brand-card::after {
    content: "";
    position: absolute;
    right: -32px; top: -42px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
}

.brand-card .row { position: relative; z-index: 1; }

.brand-mark {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent-400), var(--accent-500));
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 15px;
    letter-spacing: -.4px;
    box-shadow: 0 4px 12px -4px rgba(234, 82, 48, .55);
    flex: none;
}

.brand-name { font-weight: 700; font-size: 15.5px; color: #fff; letter-spacing: -.2px; }
.brand-sub { font-size: 10.5px; color: rgba(255,255,255,.62); letter-spacing: .5px; text-transform: uppercase; font-weight: 600; }

.brand-meta {
    position: relative; z-index: 1;
    margin-top: 12px; padding-top: 11px;
    border-top: 1px solid rgba(255,255,255,.12);
    display: flex; align-items: center; gap: 8px;
    font-size: 11.5px; color: rgba(255,255,255,.7);
}

.brand-pill {
    background: rgba(255, 255, 255, .18);
    color: #FFD9CE;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    font-size: 10.5px; font-weight: 700;
}

.nav-label {
    font-size: 10px; font-weight: 700; letter-spacing: .7px;
    text-transform: uppercase; color: var(--text-soft);
    padding: 12px 10px 5px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 550;
    font-size: 13.5px;
    transition: background .18s var(--ease), color .18s, transform .18s var(--ease);
    position: relative;
    animation: slideIn .35s var(--ease) both;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; transform: translateX(2px); }
.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 6px 16px -8px var(--sidebar-active);
}
.nav-item.active .nav-ico { color: #fff; opacity: 1; }
.nav-item.active .nav-count { background: rgba(255,255,255,.25); color: #fff; }

.nav-ico { width: 18px; height: 18px; flex: none; opacity: .85; }

.nav-count {
    margin-left: auto;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    padding: 1px 8px;
    font-size: 11.5px;
    font-weight: 700;
    min-width: 22px; text-align: center;
}
.nav-count.alert { background: var(--danger); color: #fff; }
.nav-count.warn  { background: var(--warning); color: #fff; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-soft); }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    background: var(--surface-2);
    margin-bottom: 8px;
}

.avatar {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    background: linear-gradient(135deg, var(--accent-400), var(--ink-800));
    color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: 12.5px;
}

.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 18px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    min-height: 58px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 10px 20px;
    position: sticky; top: var(--navbar-h); z-index: 30;
}

.page-title { font-size: 19px; font-weight: 700; letter-spacing: -.3px; margin: 0; }
.page-sub { font-size: 12.5px; color: var(--text-muted); margin: 1px 0 0; }

/* Pleine largeur : le back-office affiche des tableaux, pas de la
   prose. Une mesure plafonnee aide la lecture d'un texte suivi ; sur
   une grille de douze colonnes, elle ne fait que laisser une bande
   morte a droite et serrer les colonnes utiles. */
.content { padding: 18px 22px 40px; width: 100%; }

/* --------------------------------------------------------- Recherche */

.search-box {
    position: relative; flex: 1; max-width: 420px;
}
.search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13.5px; font-family: inherit;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.search-box input:focus {
    outline: none; background: var(--surface);
    border-color: var(--accent-400);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-500) 20%, transparent);
}
.search-box svg {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; color: var(--text-soft);
}

/* ----------------------------------------------------------- Cartes */

/* `min-width: 0` empêche une carte d'être élargie par son contenu : sans
   lui, un tableau ou un graphique trop large repousse la page entière. */
.card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
}

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

.card-head {
    padding: 13px 15px;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 14.5px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.card-sub { font-size: 12px; color: var(--text-muted); margin: 1px 0 0; }
.card-body { padding: 15px; min-width: 0; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--border-soft); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 14px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-sidebar-left { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

@media (max-width: 1320px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-sidebar, .grid-sidebar-left { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
    /* Sous cette largeur la barre latérale se replie derrière le bouton
       de la navbar : le contenu garde sa place entière. */
    .sidebar { display: none; }
    .sidebar.open {
        display: flex;
        position: fixed; top: var(--navbar-h); left: 0; z-index: 45;
        box-shadow: var(--shadow-lg);
    }
    .nav-toggle { display: grid; }
    .navbar-brand { width: auto; }
    .navbar-search { justify-content: flex-start; }
}

@media (max-width: 900px) {
    .grid-5, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .navbar { padding: 0 14px; gap: 10px; }
    .navbar-user .navbar-user-text { display: none; }
    .navbar-user { padding: 4px; }
}

@media (max-width: 760px) {
    .navbar-search { display: none; }
    .navbar-cta-label { display: none; }
}
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------ Indicateurs */

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 15px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .25s var(--ease), transform .25s var(--ease);
    display: block;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-3px); text-decoration: none; }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 550; }
.stat-value {
    font-size: 25px; font-weight: 800; letter-spacing: -.8px;
    margin: 5px 0 2px; font-variant-numeric: tabular-nums; color: var(--text);
    animation: countUp .55s var(--ease) both; animation-delay: .12s;
}
.stat-hint { font-size: 11.5px; color: var(--text-soft); }

.ico-badge {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    display: grid; place-items: center;
}
.ico-badge svg { width: 17px; height: 17px; }
.ico-badge.lg { width: 48px; height: 48px; border-radius: 14px; }
.ico-badge.lg svg { width: 23px; height: 23px; }
.ico-badge.sm { width: 30px; height: 30px; border-radius: 9px; }
.ico-badge.sm svg { width: 15px; height: 15px; }

.ico-accent  { background: var(--accent-100); color: var(--accent-600); }
.ico-ink     { background: var(--ink-100);    color: var(--ink-800); }
.ico-ok      { background: var(--success-bg); color: var(--success); }
.ico-wait    { background: var(--warning-bg); color: var(--warning); }
.ico-alert   { background: var(--danger-bg);  color: var(--danger); }
.ico-neutral { background: var(--surface-2);  color: var(--text-muted); }

.delta {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 700;
}
.delta svg { width: 11px; height: 11px; }
.delta-up   { background: var(--success-bg); color: var(--success); }
.delta-down { background: var(--danger-bg);  color: var(--danger); }
.delta-flat { background: var(--surface-2);  color: var(--text-muted); }

/* --------------------------------------------------------- Graphiques */

.chart-bars {
    display: flex; align-items: flex-end; gap: 7px;
    height: 170px; padding-top: 22px;
    /* Au-delà d'une quinzaine de points, les étiquettes de date ne tiennent
       plus côte à côte. Le graphique défile alors dans sa propre carte :
       sans cela, c'est la page entière qui s'élargit. */
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.chart-bars::-webkit-scrollbar { height: 5px; }
.chart-bars::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* `min-width: 0` est indispensable : un élément flex refuse par défaut de
   descendre sous la largeur de son contenu, et l'étiquette de date l'en
   empêcherait. La base de 22 px garde les barres lisibles. */
.chart-col {
    flex: 1 0 22px; min-width: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
    align-items: center; height: 100%; gap: 6px;
}

.chart-val {
    font-size: 10.5px; font-weight: 700; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    animation: fadeIn .5s var(--ease) both; animation-delay: .4s;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--accent-400), var(--accent-500));
    border-radius: 6px 6px 3px 3px;
    min-height: 4px;
    transform-origin: bottom;
    animation: growUp .65s var(--ease) both;
    transition: filter .2s, transform .2s var(--ease);
    position: relative;
}
.chart-col:hover .chart-bar { filter: brightness(1.12); transform: scaleX(1.06); }

.chart-bar.accent { background: linear-gradient(180deg, var(--accent-400), var(--accent-600)); }
.chart-bar.muted  { background: linear-gradient(180deg, var(--surface-3), var(--border)); }

.chart-x { font-size: 10px; color: var(--text-soft); white-space: nowrap; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* Camembert / anneau : tracÃ© SVG animÃ©. */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { position: relative; flex: none; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut circle { fill: none; stroke-linecap: butt; transition: stroke-width .2s; }
.donut .seg { animation: drawRing 1.05s var(--ease) both; }
.donut .seg:hover { stroke-width: 26 !important; }

.donut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; pointer-events: none;
}
.donut-total { font-size: 25px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; animation: countUp .6s var(--ease) both .3s; }
.donut-label { font-size: 10.5px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 9px; }
.donut-legend .row-between { font-size: 13px; }
.donut-legend .lg-name { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.donut-legend .lg-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Barre de progression horizontale. */
.meter { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.meter > span {
    display: block; height: 100%; border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent-400), var(--accent-500));
    transform-origin: left;
    animation: growUp .7s var(--ease) both;
    animation-name: meterGrow;
}
@keyframes meterGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.meter.accent > span  { background: linear-gradient(90deg, var(--accent-400), var(--accent-600)); }
.meter.success > span { background: linear-gradient(90deg, var(--ink-700), var(--ink-900)); }
.meter.danger > span  { background: linear-gradient(90deg, var(--accent-500), var(--accent-700)); }

/* Courbe (sparkline / aire). */
.spark { width: 100%; height: 60px; display: block; overflow: visible; }
.spark path.line { fill: none; stroke: var(--accent-500); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: sparkDraw 1.2s var(--ease) forwards; }
.spark path.area { fill: url(#sparkGrad); opacity: 0; animation: fadeIn .7s var(--ease) .5s forwards; }
@keyframes sparkDraw { to { stroke-dashoffset: 0; } }

/* Liste classÃ©e (top catÃ©gories, top partenaires). */
.rank-list { display: flex; flex-direction: column; gap: 2px; }
.rank-row {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    transition: background .18s;
}
.rank-row:hover { background: var(--surface-2); }
.rank-num {
    width: 22px; height: 22px; border-radius: 7px; flex: none;
    background: var(--surface-2); color: var(--text-muted);
    display: grid; place-items: center; font-size: 11px; font-weight: 800;
}
.rank-row:nth-child(1) .rank-num { background: var(--ink-800); color: #fff; }
.rank-row:nth-child(2) .rank-num { background: var(--accent-500); color: #fff; }
.rank-row:nth-child(3) .rank-num { background: var(--accent-500); color: #fff; }
.rank-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { font-size: 11.5px; color: var(--text-soft); }
.rank-val { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Tables */

.table-wrap { overflow-x: auto; scrollbar-width: thin; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left; font-size: 11px; font-weight: 700;
    letter-spacing: .6px; text-transform: uppercase; color: var(--text-soft);
    padding: 11px 15px; border-bottom: 1px solid var(--border);
    white-space: nowrap; background: var(--surface-2);
    position: sticky; top: 0; z-index: 1;
}
table.data th:first-child { border-radius: var(--radius) 0 0 0; }
table.data th:last-child { border-radius: 0 var(--radius) 0 0; }
table.data td { padding: 12px 15px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data tbody tr { transition: background .15s; animation: fadeIn .4s var(--ease) both; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr:last-child td { border-bottom: 0; }

.cell-strong { font-weight: 650; }
.cell-muted { color: var(--text-muted); font-size: 13px; }
.cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.cell-num { font-variant-numeric: tabular-nums; font-weight: 600; }

.cell-media { display: flex; align-items: center; gap: 11px; }

/* ------------------------------------------------------------ Badges */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    border: 1px solid transparent;
}
/* Un statut n'est jamais signalÃ© par la seule couleur : un point
   et un libellÃ© explicite l'accompagnent toujours (Â§10.2). */
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: none; }
.badge.no-dot::before { display: none; }

.badge-ok      { background: var(--success-bg); color: var(--success); }
.badge-wait    { background: var(--warning-bg); color: var(--warning); }
.badge-alert   { background: var(--danger-bg);  color: var(--danger); }
.badge-ink     { background: var(--info-bg);    color: var(--info); }
.badge-accent  { background: var(--accent-100); color: var(--accent-600); }
.badge-neutral { background: var(--surface-2);  color: var(--text-muted); border-color: var(--border); }

/* ----------------------------------------------------------- Boutons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px; font-weight: 600; font-family: inherit;
    cursor: pointer; white-space: nowrap;
    transition: background .18s, border-color .18s, transform .12s var(--ease), box-shadow .18s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }
.btn-primary:hover { background: var(--ink-700); border-color: var(--ink-700); box-shadow: 0 8px 18px -8px var(--ink-800); }

.btn-accent { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-accent:hover { background: var(--accent-500); border-color: var(--accent-500); box-shadow: 0 8px 18px -8px var(--accent-600); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); box-shadow: 0 8px 18px -8px var(--success); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); box-shadow: 0 8px 18px -8px var(--danger); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-icon svg { width: 17px; height: 17px; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Grille d'actions rapides, colorÃ©e. */
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.quick-btn {
    display: flex; align-items: center; gap: 11px;
    padding: 14px 15px; border-radius: var(--radius-sm);
    color: #fff; font-weight: 650; font-size: 13.5px;
    transition: transform .22s var(--ease), box-shadow .22s var(--ease), filter .2s;
    position: relative; overflow: hidden;
}
.quick-btn::after {
    content: ""; position: absolute; right: -18px; top: -26px;
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.quick-btn:hover { transform: translateY(-3px); text-decoration: none; filter: brightness(1.06); }
.quick-btn svg { width: 19px; height: 19px; position: relative; z-index: 1; }
.quick-btn span { position: relative; z-index: 1; }

.qb-ink    { background: linear-gradient(135deg, var(--ink-700), var(--ink-900)); box-shadow: 0 8px 20px -10px var(--ink-800); }
.qb-accent { background: linear-gradient(135deg, var(--accent-400), var(--accent-600)); box-shadow: 0 8px 20px -10px var(--accent-500); }
.qb-alert  { background: linear-gradient(135deg, var(--accent-500), var(--accent-700)); box-shadow: 0 8px 20px -10px var(--accent-600); }

/* ------------------------------------------------------- Formulaires */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.label { font-size: 12.5px; font-weight: 650; color: var(--text-muted); }
.label .req { color: var(--danger); }
.help { font-size: 11.5px; color: var(--text-soft); }

.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px; font-family: inherit;
    transition: border-color .18s, box-shadow .18s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent-400);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-500) 20%, transparent);
}
.input.error, .select.error, .textarea.error { border-color: var(--danger); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238D99AE' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
    padding-right: 34px;
}

.field-error { font-size: 12px; color: var(--danger); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { min-width: 160px; flex: 0 1 auto; margin-bottom: 0; }

.form-section {
    border-top: 1px solid var(--border-soft);
    padding-top: 20px; margin-top: 20px;
}
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section-title { font-size: 14px; font-weight: 700; margin: 0 0 3px; }
.form-section-sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 15px; }

.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 0; border-bottom: 1px solid var(--border-soft);
}
.switch-row:last-child { border-bottom: 0; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--surface-3); border-radius: 99px;
    transition: background .22s var(--ease);
}
.switch .slider::before {
    content: ""; position: absolute;
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: transform .22s var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--accent-500); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Choix sous forme de cartes radio. */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.choice {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 13px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s var(--ease);
}
.choice:hover { border-color: var(--accent-400); transform: translateY(-2px); }
.choice input { margin-top: 2px; accent-color: var(--accent-500); }
.choice input:checked ~ .choice-body .choice-title { color: var(--accent-500); }
.choice:has(input:checked) { border-color: var(--accent-500); background: var(--accent-100); }
.choice-title { font-size: 13.5px; font-weight: 650; }
.choice-desc { font-size: 11.5px; color: var(--text-muted); }

/* ----------------------------------------------------------- Alertes */

.alert {
    padding: 12px 15px; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 18px;
    border: 1px solid transparent;
    display: flex; align-items: flex-start; gap: 10px;
    animation: fadeUp .45s var(--ease) both;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 35%, transparent); }

/* EncadrÃ© d'information confidentielle. */
.private-box {
    background: var(--warning-bg);
    border: 1px dashed var(--warning);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    font-size: 13.5px;
}
.private-box strong { display: block; margin-bottom: 4px; color: var(--warning); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

/* --------------------------------------------------------- Pagination */

.pagination { display: flex; gap: 5px; flex-wrap: wrap; padding: 14px 18px; align-items: center; }
.pagination a, .pagination span {
    padding: 6px 11px; border-radius: var(--radius-xs); font-size: 13px;
    border: 1px solid var(--border); color: var(--text-muted);
    transition: background .15s, border-color .15s;
}
.pagination a:hover { background: var(--surface-2); border-color: var(--text-soft); text-decoration: none; }
.pagination .active span { background: var(--ink-800); border-color: var(--ink-800); color: #fff; }
.pagination .disabled span { opacity: .45; }

/* ------------------------------------------------------------ Divers */

.empty { padding: 48px 20px; text-align: center; color: var(--text-soft); animation: fadeUp .5s var(--ease) both; }
.empty-ico {
    width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px;
    background: var(--surface-2); display: grid; place-items: center;
}
.empty-ico svg { width: 28px; height: 28px; color: var(--text-soft); }
.empty-title { font-weight: 700; color: var(--text-muted); margin-bottom: 4px; font-size: 15px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 9px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.thumb {
    width: 44px; height: 44px; border-radius: 11px; object-fit: cover; flex: none;
    border: 1px solid var(--border); background: var(--surface-2);
    display: grid; place-items: center; color: var(--text-soft); font-size: 11px;
}
.thumb.lg { width: 92px; height: 92px; border-radius: 14px; }

.detail-list { display: grid; grid-template-columns: 175px 1fr; gap: 11px 16px; font-size: 14px; }
.detail-list dt { color: var(--text-muted); font-size: 13px; }
.detail-list dd { margin: 0; }
@media (max-width: 560px) { .detail-list { grid-template-columns: 1fr; gap: 3px 0; } .detail-list dd { margin-bottom: 9px; } }

/* Frise verticale (historique, journal). */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
    content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border);
}
.tl-item { position: relative; padding-bottom: 18px; animation: fadeUp .45s var(--ease) both; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
    position: absolute; left: -22px; top: 3px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--border);
}
.tl-dot.success { border-color: var(--success); background: var(--success); }
.tl-dot.danger  { border-color: var(--danger);  background: var(--danger); }
.tl-dot.warning { border-color: var(--warning); background: var(--warning); }
.tl-dot.info    { border-color: var(--info);    background: var(--info); }
.tl-time { font-size: 11.5px; color: var(--text-soft); font-family: var(--mono); }
.tl-title { font-size: 13.5px; font-weight: 650; margin: 1px 0 2px; }
.tl-body { font-size: 12.5px; color: var(--text-muted); }

/* Onglets. */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
    padding: 10px 15px; font-size: 13.5px; font-weight: 600;
    color: var(--text-muted); border-bottom: 2px solid transparent;
    white-space: nowrap; transition: color .18s, border-color .18s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-500); border-bottom-color: var(--accent-500); }

/* Squelette de chargement. */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 920px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-xs);
}

/* Fil d'ariane. */
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); margin-bottom: 3px; }
.crumbs a { color: var(--text-muted); }
.crumbs svg { width: 13px; height: 13px; }

/* ------------------------------------------------------- Connexion */

/* Deux volets : l'identite a gauche, le formulaire a droite. Sous 900px
   le volet d'identite disparait et le formulaire redevient une carte
   centree : sur un telephone, seul le formulaire compte. */

.auth-body { min-height: 100vh; }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }

.auth-aside {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 44px 48px;
    background: linear-gradient(155deg, var(--ink-800), var(--ink-900) 62%);
    color: #fff;
}
.auth-aside::before,
.auth-aside::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-aside::before {
    width: 540px; height: 540px; top: -210px; right: -175px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-500) 52%, transparent), transparent 68%);
}
.auth-aside::after {
    width: 430px; height: 430px; bottom: -185px; left: -145px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-400) 26%, transparent), transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-aside-top { display: flex; align-items: center; gap: 12px; }
.auth-aside-body { max-width: 430px; }

.auth-claim {
    font-size: clamp(25px, 2.6vw, 34px); line-height: 1.2;
    letter-spacing: -1px; font-weight: 800; margin: 0 0 26px;
}
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.auth-point { display: flex; align-items: center; gap: 11px; font-size: 14px; color: rgba(255, 255, 255, .78); }
.auth-point svg { flex: none; color: var(--accent-400); }
.auth-aside-foot { margin: 0; font-size: 12px; color: rgba(255, 255, 255, .45); }

/* Le logo sert sur les deux volets : il herite de la couleur du texte
   environnant plutot que d'en imposer une. */
.auth-logo {
    width: 42px; height: 42px; border-radius: 13px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
    color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.5px;
    box-shadow: 0 8px 18px -8px var(--accent-600);
}
.auth-logo-name { font-weight: 700; font-size: 16px; letter-spacing: -.3px; }
.auth-logo-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; opacity: .62; }

.auth-main {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 24px;
    background: var(--surface);
}
.auth-form-wrap { width: 100%; max-width: 384px; animation: fadeUp .5s var(--ease) both; }
.auth-mini-brand { display: none; align-items: center; gap: 12px; margin-bottom: 26px; }

.auth-theme {
    position: absolute; top: 20px; right: 20px;
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); cursor: pointer;
    transition: color .18s, border-color .18s, transform .25s var(--ease);
}
.auth-theme:hover { color: var(--accent-500); border-color: var(--accent-400); transform: rotate(-25deg); }

.auth-title { font-size: 26px; font-weight: 800; letter-spacing: -.8px; margin: 0 0 6px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 26px; line-height: 1.55; }

.auth-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }

/* Champ a icone : l'icone se teinte d'accent quand le champ a le focus,
   ce qui signale la ligne active sans ajouter de couleur supplementaire. */
.auth-control { position: relative; display: flex; align-items: center; }
.auth-control-ico {
    position: absolute; left: 12px; display: grid; place-items: center;
    color: var(--text-soft); pointer-events: none; transition: color .18s;
}
.auth-control:focus-within .auth-control-ico { color: var(--accent-500); }

.auth-input { padding: 11px 13px 11px 39px; background: var(--surface-2); }
.auth-input:focus { background: var(--surface); }
.auth-input-pwd { padding-right: 44px; }

.auth-reveal {
    position: absolute; right: 6px;
    width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center;
    border: 0; background: transparent; color: var(--text-soft);
    cursor: pointer; transition: color .18s, background .18s;
}
.auth-reveal:hover { color: var(--text); background: var(--surface-2); }
.auth-reveal.is-on { color: var(--accent-500); }

.auth-check {
    display: flex; align-items: center; gap: 9px;
    margin: 2px 0 22px;
    font-size: 13.5px; color: var(--text-muted);
    cursor: pointer; user-select: none;
}
.auth-check input { width: 16px; height: 16px; flex: none; accent-color: var(--accent-500); cursor: pointer; }

.auth-submit {
    width: 100%; padding: 12px 16px; font-size: 14.5px;
    background: var(--accent-500); border-color: var(--accent-500); color: #fff;
}
.auth-submit:hover {
    background: var(--accent-400); border-color: var(--accent-400);
    box-shadow: 0 10px 22px -10px var(--accent-500);
}
.auth-submit svg { order: 2; transition: transform .18s var(--ease); }
.auth-submit:hover svg { transform: translateX(3px); }

.auth-note {
    display: flex; align-items: flex-start; gap: 9px;
    margin: 26px 0 0; padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px; color: var(--text-soft); line-height: 1.55;
}
.auth-note svg { flex: none; margin-top: 2px; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { background: var(--bg); }
    .auth-mini-brand { display: flex; }
    .auth-form-wrap {
        max-width: 420px;
        padding: 30px 26px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 22px;
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 420px) {
    .auth-main { padding: 22px 14px; }
    .auth-form-wrap { padding: 26px 20px; border-radius: 18px; }
    .auth-title { font-size: 23px; }
}

/* ------------------------------------- Carte isolee (page de scan QR) */

.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: var(--bg);
    position: relative; overflow: hidden;
}
.auth-wrap::before,
.auth-wrap::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.auth-wrap::before {
    width: 620px; height: 620px; top: -220px; right: -180px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-500) 16%, transparent), transparent 68%);
}
.auth-wrap::after {
    width: 520px; height: 520px; bottom: -200px; left: -160px;
    background: radial-gradient(circle, color-mix(in srgb, var(--ink-800) 12%, transparent), transparent 68%);
}

.auth-card {
    width: 100%; max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 34px 32px;
    box-shadow: var(--shadow-lg);
    position: relative; z-index: 1;
    animation: popIn .5s var(--ease) both;
}

/* La marque est dessinee pour la barre laterale sombre : sur une carte
   claire, son texte blanc disparaitrait. */
.auth-card .brand-name { color: var(--text); }
.auth-card .brand-sub { color: var(--text-soft); }


/* Impression : masquer la navigation. */
@media print {
    .sidebar, .topbar, .btn, .pagination { display: none !important; }
    .content { padding: 0; }
    .card { box-shadow: none; border-color: #ddd; }
}

/* ------------------------------------------------------- Apparence */

.section-head { margin: 0 0 11px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.section-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }

/* Pastille à deux teintes : le thème tient en deux disques, pas plus. */
.theme-chip { display: flex; flex: none; }
.theme-chip span { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); }
.theme-chip span + span { margin-left: -9px; }

/* Carte de thème : aperçu, nom, description, et la coche de l'actif. */
.theme-card {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    font: inherit; color: inherit;
    overflow: hidden;
    transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease);
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--text-soft); }
.theme-card.selected { border-color: var(--accent-500); box-shadow: 0 0 0 3px var(--accent-100); }

.theme-body { display: block; padding: 13px 15px 15px; }
.theme-name { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.theme-desc { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }

.theme-check {
    position: absolute; right: 13px; bottom: 14px;
    color: var(--border);
    display: grid; place-items: center;
    transition: color .2s;
}
.theme-card.selected .theme-check { color: var(--accent-500); }

/* Maquette d'écran miniature.
   Les deux teintes du thème arrivent par --p-accent et --p-ink : la
   maquette se peint donc toute seule, sans une règle par thème. */
.theme-preview {
    display: flex;
    gap: 9px;
    padding: 11px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-soft);
}

.tp-side {
    flex: none;
    width: 30px;
    border-radius: 8px;
    background: var(--p-ink, var(--ink-800));
    padding: 7px 0;
    display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.tp-dot { width: 13px; height: 9px; border-radius: 3px; background: rgba(255, 255, 255, .22); }
.tp-dot-on { background: var(--p-accent, var(--accent-500)); }

.tp-main {
    flex: 1; min-width: 0;
    background: var(--surface);
    border-radius: 8px;
    padding: 9px;
    display: flex; flex-direction: column; gap: 7px;
}

.tp-row { display: flex; align-items: center; gap: 6px; }

.tp-btn {
    font-size: 9.5px; font-weight: 700;
    padding: 3px 8px; border-radius: 5px;
    white-space: nowrap;
}
.tp-btn-ink { background: var(--p-ink, var(--ink-800)); color: #fff; }
.tp-btn-soft {
    background: color-mix(in srgb, var(--p-accent, var(--accent-500)) 16%, #fff);
    color: var(--p-ink, var(--ink-800));
}
.tp-pill { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); min-width: 14px; }

.tp-bar { height: 5px; border-radius: 99px; background: var(--p-accent, var(--accent-500)); }

.tp-swatches span { flex: 1; height: 8px; border-radius: 4px; }
.tp-s1 { background: color-mix(in srgb, var(--p-accent, var(--accent-500)) 22%, #fff); }
.tp-s2 { background: color-mix(in srgb, var(--p-accent, var(--accent-500)) 55%, #fff); }
.tp-s3 { background: var(--p-accent, var(--accent-500)); }
.tp-s4 { background: var(--p-ink, var(--ink-800)); }

/* Sélecteur de couleur natif, aligné sur les autres champs. */
.color-input {
    width: 44px; height: 40px; flex: none;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

/* --------------------------------------------- Rôles et permissions */

.perm-table tbody tr:hover { background: var(--surface-2); }

/* Intertitre de domaine : il sépare les familles sans ajouter un tableau
   par famille, ce qui casserait l'alignement des colonnes de rôles. */
.perm-group td {
    background: var(--surface-2);
    font-size: 11px; font-weight: 700;
    letter-spacing: .7px; text-transform: uppercase;
    color: var(--text-muted);
    padding: 7px 14px;
}

/* La case à cocher occupe toute la cellule : viser une case de 14 px
   dans une colonne de 150 px est inutilement pénible. */
.perm-cell {
    display: grid; place-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.perm-cell:hover { background: var(--accent-100); }
.perm-cell input { width: 17px; height: 17px; accent-color: var(--accent-500); cursor: pointer; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Explication sous un champ : elle dit à quoi sert le réglage, pas ce
   qu'il contient — l'étiquette s'en charge déjà. */
.hint { font-size: 11.5px; color: var(--text-soft); margin-top: 5px; line-height: 1.45; }

/* ------------------------------------------------- Écrans de présentation

   La maquette reprend la géométrie de l'écran mobile : un panneau coloré
   qui porte le dessin, puis un socle clair qui remonte en arc. Voir ici
   ce que verra le téléphone évite l'aller-retour « j'enregistre, je
   regarde, je recommence ».
*/

.slide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
}

.slide-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-off { opacity: .62; }

.slide-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 168px;
    padding: 22px 18px 30px;
}

.slide-stage-ink {
    background: linear-gradient(135deg, var(--ink-700), var(--ink-900));
}

.slide-stage-accent {
    background: linear-gradient(135deg, var(--accent-400), var(--accent-700));
}

.slide-rank {
    position: absolute;
    top: 14px;
    left: 16px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: rgba(255, 255, 255, .55);
}

.slide-arc {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    width: 100%;
    height: 22px;
}

.slide-arc path { fill: var(--surface); }

.slide-text { flex: 1; }

.slide-eyebrow {
    margin: 0 0 6px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--accent-500);
}

.slide-title {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.2;
    letter-spacing: -.5px;
    font-weight: 800;
    color: var(--text);
}

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

.slide-actions form { display: inline-flex; }

/* --- Bibliothèque de dessins */

.illus { display: block; }

.illus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.illus-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease, background .16s ease;
}

.illus-choice:hover { transform: translateY(-2px); }

.illus-choice.is-on {
    border-color: var(--accent-500);
    background: var(--accent-100);
}

/* Le bouton radio natif est masqué, mais reste focalisable au clavier :
   la bordure du cadre sert de repère de focus. */
.illus-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.illus-choice:focus-within { border-color: var(--accent-500); }

.illus-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
}

/* --- Aperçu en forme de téléphone */

.phone {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    border: 7px solid var(--ink-800);
    border-radius: 30px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .45);
}

.phone-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 26px 16px 30px;
}

.phone-stage-ink {
    background: linear-gradient(135deg, var(--ink-700), var(--ink-900));
}

.phone-stage-accent {
    background: linear-gradient(135deg, var(--accent-400), var(--accent-700));
}

.phone-sheet { padding: 4px 16px 16px; }

.phone-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
}

.phone-dots { display: inline-flex; gap: 4px; align-items: center; }

.phone-dots i {
    width: 8px;
    height: 3px;
    border-radius: 999px;
    background: var(--border);
}

.phone-dots i.is-on { width: 20px; background: var(--accent-500); }

.phone-next {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--ink-800);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
}

/* ------------------------------------------------------------- Photos

   Les vignettes d'une annonce et l'envoi depuis le poste du modérateur.
   Le crédit reste visible : une licence libre n'est pas une licence sans
   condition, et la condition la plus répandue est la citation.
*/

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.photo-tile {
    position: relative;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2);
}

.photo-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.photo-tile figcaption {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 9px 8px;
    font-size: 10.5px;
}

.photo-credit {
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.photo-remove {
    position: absolute;
    top: 7px;
    right: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease;
}

.photo-tile:hover .photo-remove,
.photo-remove:focus-visible { opacity: 1; }

.photo-remove:hover { background: var(--accent-600); }

.photo-upload { margin-top: 14px; }

.photo-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 22px 16px;
    border: 1.5px dashed var(--border);
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.photo-drop:hover {
    border-color: var(--accent-500);
    background: var(--accent-100);
}

.photo-drop-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
}

.photo-drop-sub { font-size: 11.5px; }
