/* ═══════════════════════════════════════════════════════════════
   91STUDIO — CRITICAL CSS v1.0.0
   Variables, composants de base, reset, loading, login, layout
   Extrait de styles.css pour optimisation FCP (render-blocking)
   ═══════════════════════════════════════════════════════════════ */

/* ═══ SKELETON SCREEN — Shimmer pendant le chargement ═══ */
.skeleton-container {
    position: fixed;
    inset: 0;
    display: flex;
    z-index: 9998;
    background: var(--bg-primary, #ffffff);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.skeleton-container.visible {
    opacity: 1;
    pointer-events: auto;
}
.skeleton-container.hidden {
    display: none;
}
[data-theme="dark"] .skeleton-container {
    background: #18181A;
}
.skeleton-sidebar {
    width: 220px;
    padding: 24px 16px;
    background: var(--bg-secondary, #F5F5F7);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
[data-theme="dark"] .skeleton-sidebar {
    background: #0C0C0C;
}
.skeleton-logo {
    width: 100px;
    height: 24px;
    border-radius: 4px;
    margin-bottom: 24px;
}
.skeleton-nav-item {
    width: 90%;
    height: 36px;
    border-radius: 6px;
}
.skeleton-section-gap {
    height: 16px;
}
.skeleton-main {
    flex: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.skeleton-header {
    width: 200px;
    height: 32px;
    border-radius: 6px;
}
.skeleton-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.skeleton-card {
    height: 120px;
    border-radius: 12px;
}
.skeleton-table {
    height: 300px;
    border-radius: 12px;
}
.shimmer {
    background: linear-gradient(90deg,
        var(--bg-secondary, #f0f0f0) 25%,
        var(--bg-tertiary, #e8e8e8) 50%,
        var(--bg-secondary, #f0f0f0) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite ease-in-out;
}
[data-theme="dark"] .shimmer {
    background: linear-gradient(90deg,
        #1E1E20 25%,
        #262628 50%,
        #1E1E20 75%
    );
    background-size: 200% 100%;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (max-width: 1024px) {
    .skeleton-sidebar { display: none; }
    .skeleton-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .skeleton-cards { grid-template-columns: 1fr; }
    .skeleton-main { padding: 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   91STUDIO APP — STYLES v4.0.0
   Design System Apple HIG — SF Pro, mixed-case, 0.5px borders, pills
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM - VARIABLES GLOBALES (Light Mode par defaut)
   ═══════════════════════════════════════════════════════════════ */
:root {
    /* === COULEURS SEMANTIQUES === */
    --bg-primary: #ffffff;
    --bg-secondary: #F5F5F7;
    --bg-tertiary: #FAFAFA;
    --bg-elevated: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --bg-active: rgba(0, 0, 0, 0.08);
    --bg-input: #ffffff;

    /* Couleurs sombres statiques (pour login, etc.) */
    --bg-dark: #000000;
    --bg-dark-secondary: #0a0a0a;
    --bg-dark-tertiary: #1d1d1f;

    /* Texte */
    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-tertiary: #86868b;
    --text-muted: #aeaeb2;
    --text-disabled: #d2d2d7;
    --text-light: #ffffff;
    --text-inverse: #ffffff;

    /* Bordures */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);
    --border-light: rgba(0, 0, 0, 0.04);
    --divider-color: rgba(0, 0, 0, 0.06);

    /* Surfaces (cards, modals, etc.) */
    --surface-card: #ffffff;
    --surface-modal: #ffffff;
    --surface-sidebar: #F5F5F7;
    --surface-header: rgba(255, 255, 255, 0.8);

    /* === ACCENTS (identiques light/dark) === */
    --accent-blue: #007AFF;
    --accent-green: #34C759;
    --accent-orange: #FF9500;
    --accent-red: #FF3B30;
    --accent-purple: #AF52DE;
    --accent-gold: #c9a961;
    --accent-cyan: #32ADE6;
    --accent-pink: #FF2D55;

    /* Status colors */
    --color-success: #34C759;
    --color-success-bg: rgba(52, 199, 89, 0.12);
    --color-warning: #FF9500;
    --color-warning-bg: rgba(255, 149, 0, 0.12);
    --color-danger: #FF3B30;
    --color-danger-bg: rgba(255, 59, 48, 0.12);
    --bg-danger-light: #FEF2F2;
    --accent-red-dark: #991B1B;
    --color-info: #007AFF;
    --color-info-bg: rgba(0, 122, 255, 0.12);

    /* Chat IA */
    --chat-user-bg: #1a1a1a;
    --chat-user-text: #ffffff;
    --chat-accent: #3b82f6;
    --chat-assistant-bg: var(--bg-tertiary);
    --chat-tool-bg: rgba(59, 130, 246, 0.08);
    --chat-tool-border: rgba(59, 130, 246, 0.15);
    --chat-tool-color: #3b82f6;

    /* === TYPOGRAPHIE APPLE HIG === */
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Inter', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'Roboto Mono', 'Menlo', monospace;

    /* Tailles de base */
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 20px;
    --font-size-2xl: 28px;
    --font-size-3xl: 36px;
    --font-size-4xl: 48px;

    /* Headers specifiques (AUGMENTES) */
    --font-size-page-title: 17px; /* HIG Headline — toujours 17px */
    --font-size-section-title: clamp(17px, 1.5vw + 12px, 24px);
    --font-size-card-title: clamp(14px, 1vw + 11px, 18px);
    --font-size-table-header: 12px;
    --font-size-label: 12px;
    --font-size-caption: 11px;

    /* Line heights */
    --line-height-tight: 1.2;
    --line-height-base: 1.5;
    --line-height-relaxed: 1.75;

    /* === ESPACEMENTS === */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;

    /* === LAYOUT === */
    --sidebar-width: 220px;
    --header-height: 64px;
    --content-max-width: 1600px;
    --card-border-radius: 12px;
    --input-border-radius: 8px;
    --button-border-radius: 8px;

    /* === RAYONS APPLE HIG === */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 980px;

    /* === STATUS PILLS === */
    --status-new-bg: rgba(0, 122, 255, 0.12);
    --status-new-text: #007AFF;
    --status-valid-bg: rgba(52, 199, 89, 0.12);
    --status-valid-text: #34C759;
    --status-wait-bg: rgba(255, 149, 0, 0.12);
    --status-wait-text: #FF9500;
    --status-reject-bg: rgba(255, 59, 48, 0.12);
    --status-reject-text: #FF3B30;
    --status-paid-bg: rgba(175, 82, 222, 0.12);
    --status-paid-text: #AF52DE;
    --status-muted-bg: rgba(142, 142, 147, 0.12);
    --status-muted-text: #8E8E93;

    /* === OMBRES APPLE HIG === */
    --shadow-xs: 0 1px 2px rgba(17, 17, 17, 0.04);
    --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.08);
    --shadow-md: 0 1px 3px rgba(17, 17, 17, 0.10);
    --shadow-lg: 0 4px 12px rgba(17, 17, 17, 0.10);
    --shadow-xl: 0 8px 24px rgba(17, 17, 17, 0.12);

    /* === TRANSITIONS === */
    --transition-fast: 120ms ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
    --transition-theme: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — PALETTE APPLE HIG v3.0.0
   Surfaces superposées, bordures fines, accents Apple
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    /* Backgrounds — Palette neutre (gris pur, sans teinte bleue) */
    --bg-primary: #18181A;          /* Fond principal (gris charbon) */
    --bg-secondary: #1E1E20;        /* Cards et surfaces */
    --bg-tertiary: #262628;         /* Surfaces élevées */
    --bg-elevated: #2E2E30;         /* Hover states et surfaces hautes */
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-active: rgba(255, 255, 255, 0.08);
    --bg-input: #1C1C1E;

    /* Texte — Contraste amélioré */
    --text-primary: #FAFAFA;        /* Blanc cassé lumineux */
    --text-secondary: #A0A0A6;      /* Gris moyen */
    --text-tertiary: #7C7C82;       /* Gris clair */
    --text-muted: #5C5C62;          /* Gris très clair */
    --text-disabled: #3C3C42;       /* Gris disabled */
    --text-inverse: #0C0C0C;        /* Inverse (fond sombre) */

    /* Bordures — Fines et subtiles */
    --border-color: rgba(255, 255, 255, 0.12);     /* Bordure principale (1px) */
    --border-strong: rgba(255, 255, 255, 0.18);    /* Bordures accentuées */
    --border-light: rgba(255, 255, 255, 0.06);     /* Bordures très subtiles */
    --divider-color: rgba(255, 255, 255, 0.08);    /* Séparateurs */
    --border-linear: #2C2C2C;                       /* Bordure solide neutre */

    /* Surfaces — Superposition de couches */
    --surface-card: #161616;         /* Cards (niveau 1) */
    --surface-modal: #202020;        /* Modals (niveau 2) */
    --surface-sidebar: #0C0C0C;      /* Sidebar (fond principal) */
    --surface-header: rgba(12, 12, 12, 0.90);  /* Header glassmorphism */

    /* Status colors (plus lumineux pour dark mode) */
    --color-success: #30D158;
    --color-success-bg: rgba(48, 209, 88, 0.15);
    --color-warning: #FFD60A;
    --color-warning-bg: rgba(255, 214, 10, 0.15);
    --color-danger: #FF453A;
    --color-danger-bg: rgba(255, 69, 58, 0.15);
    --color-info: #86868b;
    --color-info-bg: rgba(255, 255, 255, 0.06);

    /* Ombres — Réduites (on privilégie les bordures) */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.4);

    /* Danger light / accent red dark — dark mode */
    --bg-danger-light: rgba(239, 68, 68, 0.12);
    --accent-red-dark: #FCA5A5;

    /* Chat IA dark */
    --chat-user-bg: #3b82f6;
    --chat-accent: #3b82f6;
    --chat-tool-bg: rgba(124, 58, 237, 0.08);
    --chat-tool-border: rgba(124, 58, 237, 0.15);
    --chat-tool-color: #7C3AED;

    /* Accents Apple dark mode — couleurs vives (pas neutres) */
    --accent-blue: #0A84FF;
    --accent-green: #30D158;
    --accent-orange: #FF9F0A;
    --accent-red: #FF453A;
    --accent-purple: #BF5AF2;
    --accent-cyan: #64D2FF;
    --accent-pink: #FF375F;

    /* === ACCENT PRINCIPAL — Dark Mode (bleu Apple) === */
    --accent: #0A84FF;
    --accent-subtle: rgba(10, 132, 255, 0.10);
    --accent-border: rgba(10, 132, 255, 0.25);
    --accent-glow: rgba(10, 132, 255, 0.15);

    /* Status pills dark mode */
    --status-new-bg: rgba(10, 132, 255, 0.15);
    --status-new-text: #0A84FF;
    --status-valid-bg: rgba(48, 209, 88, 0.15);
    --status-valid-text: #30D158;
    --status-wait-bg: rgba(255, 159, 10, 0.15);
    --status-wait-text: #FF9F0A;
    --status-reject-bg: rgba(255, 69, 58, 0.15);
    --status-reject-text: #FF453A;
    --status-paid-bg: rgba(191, 90, 242, 0.15);
    --status-paid-text: #BF5AF2;
    --status-muted-bg: rgba(142, 142, 147, 0.15);
    --status-muted-text: #98989D;

    /* Card hover state */
    --bg-card-hover: #1C1C1C;
    --border-hover: #2A2A2E;
}

/* ═══════════════════════════════════════════════════════════════
   COMPOSANTS APPLE HIG — Classes réutilisables
   Pills, boutons, tables, inputs, modals
   ═══════════════════════════════════════════════════════════════ */

/* --- Boutons Apple HIG --- */
.btn-apple-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 20px; height: 44px; min-height: 44px;
    background: var(--accent-blue, #007AFF); color: #fff;
    border: none; border-radius: var(--radius-md, 8px);
    font-size: 15px; font-weight: 600; font-family: var(--font-family);
    cursor: pointer; transition: all var(--transition-fast);
}
.btn-apple-primary:hover { filter: brightness(1.1); }
.btn-apple-primary:active { transform: scale(0.98); }

.btn-apple-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 20px; height: 44px; min-height: 44px;
    background: var(--bg-secondary); color: var(--text-primary);
    border: 0.5px solid var(--border-color); border-radius: var(--radius-md, 8px);
    font-size: 15px; font-weight: 500; font-family: var(--font-family);
    cursor: pointer; transition: all var(--transition-fast);
}
.btn-apple-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

/* --- Pills / Badges Apple HIG --- */
.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: var(--radius-full, 980px);
    font-size: 12px; font-weight: 500; line-height: 16px;
    white-space: nowrap;
}
.pill-nouveau, .pill-info { background: var(--status-new-bg); color: var(--status-new-text); }
.pill-valide, .pill-success { background: var(--status-valid-bg); color: var(--status-valid-text); }
.pill-attente, .pill-warning { background: var(--status-wait-bg); color: var(--status-wait-text); }
.pill-rejete, .pill-danger { background: var(--status-reject-bg); color: var(--status-reject-text); }
.pill-paiement, .pill-purple { background: var(--status-paid-bg); color: var(--status-paid-text); }
.pill-muted { background: var(--status-muted-bg); color: var(--status-muted-text); }

/* --- Table Apple HIG --- */
.table-apple { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-apple thead th {
    background: #f5f5f7; color: #86868b;
    font-size: 11px; font-weight: 600; text-align: left;
    padding: 8px 12px; border-bottom: 0.5px solid var(--border-color);
}
.table-apple tbody td {
    padding: 10px 12px; border-bottom: 0.5px solid var(--border-light);
    color: var(--text-primary);
}
.table-apple tbody tr:hover { background: var(--bg-hover); }
[data-theme="dark"] .table-apple thead th {
    background: var(--bg-tertiary); color: var(--text-tertiary);
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .table-apple tbody td { border-bottom-color: var(--border-light); }

/* --- Input Apple HIG --- */
.input-apple {
    width: 100%; height: 44px; min-height: 44px;
    padding: 0 12px; border: 0.5px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    font-size: 15px; font-family: var(--font-family);
    background: var(--bg-input, #fff); color: var(--text-primary);
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}
.input-apple:focus { outline: none; border-color: var(--accent-blue, #007AFF); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12); }
[data-theme="dark"] .input-apple { background: var(--bg-input); border-color: var(--border-color); }
[data-theme="dark"] .input-apple:focus { border-color: #0A84FF; box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15); }

/* --- Modal Apple HIG --- */
.modal-apple-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.modal-apple-content {
    background: var(--surface-modal, #fff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl);
    max-width: 540px; width: 90%; max-height: 85vh; overflow-y: auto;
}
[data-theme="dark"] .modal-apple-content {
    background: var(--surface-modal); border: 1px solid var(--border-color);
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   GRAIN TEXTURE — Landing Page DNA (dark mode uniquement)
   SVG feTurbulence fractalNoise, opacité subtile
   ═══════════════════════════════════════════════════════════════ */
/* GRAIN TEXTURE — Désactivé temporairement pour debug bleu
[data-theme="dark"] .main-content::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}
*/

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Card Depth & Hover
   Note: Chaque module gère ses propres bordures dark mode.
   Plus de wildcard [class*="-card"] qui causait des effets de bord.
   ═══════════════════════════════════════════════════════════════ */

/* Accent neutre sur éléments interactifs */
[data-theme="dark"] a:not([class]):hover,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] button[class*="primary"]:hover {
    color: var(--accent, #FAFAFA);
}

/* Active states avec accent neutre */
[data-theme="dark"] .nav-link.active,
[data-theme="dark"] .sidebar-link.active,
[data-theme="dark"] [class*="tab"].active,
[data-theme="dark"] [class*="tab-btn"].active {
    color: var(--accent, #FAFAFA);
    border-color: var(--accent, #FAFAFA);
}

/* Transition fluide entre themes — color-scheme: light forcé pour empêcher
   le navigateur de peindre un canvas bleu-gris derrière nos backgrounds */
html, [data-theme="dark"] {
    color-scheme: light !important;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — FOND GLOBAL FORCÉ (couleurs directes, pas de variables)
   Garantit un fond neutre même si les variables CSS ne se résolvent pas.
   ═══════════════════════════════════════════════════════════════ */
html[data-theme="dark"],
[data-theme="dark"] body,
[data-theme="dark"] .layout-team,
[data-theme="dark"] #app,
[data-theme="dark"] .main-content,
[data-theme="dark"] .page-content,
[data-theme="dark"] #page-content {
    background: #0C0C0C !important;
    background-color: #0C0C0C !important;
    background-image: none !important;
    color: #FAFAFA !important;
}

body,
.sidebar,
.header,
.card,
.modal,
.dropdown,
.tooltip,
input,
select,
textarea,
button {
    transition: var(--transition-theme);
}

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE — SIDEBAR (Linear Style)
   Toggle discret en haut de la sidebar, style minimaliste
   ═══════════════════════════════════════════════════════════════ */
.sidebar-theme-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    padding: 12px 16px 8px 16px;
    border-bottom: 1px solid var(--border-light);
}

.theme-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;          /* Border radius Linear (6px) */
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin: 0;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* Sidebar collapsed : theme toggle + color compact et centré */
.sidebar.collapsed .sidebar-theme-container {
    justify-content: center;
    padding: 8px 0 4px;
    border-bottom: none;
    gap: 2px;
}
.sidebar.collapsed .sidebar-color-btn {
    width: 24px;
    height: 24px;
}
.sidebar.collapsed .color-dot {
    width: 10px;
    height: 10px;
}



/* ═══════════════════════════════════════════════════════════════
   CRITICAL PART 2 — Global dark mode overrides + reset + layout
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   DARK MODE - OVERRIDES GLOBAUX POUR HOVER ET TEXTE
   ═══════════════════════════════════════════════════════════════ */

/* Force les hover states clairs à être sombres */
[data-theme="dark"] tr:hover,
[data-theme="dark"] [class*="-row"]:hover,
[data-theme="dark"] [class*="-item"]:hover,
[data-theme="dark"] [class*="-card"]:hover {
    background: var(--bg-hover) !important;
}

/* Override styles inline hover clairs */
[data-theme="dark"] [style*="background:#f5f5f5"],
[data-theme="dark"] [style*="background: #f5f5f5"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background:#fafafa"],
[data-theme="dark"] [style*="background: #fafafa"],
[data-theme="dark"] [style*="background:#f9fafb"],
[data-theme="dark"] [style*="background: #f9fafb"] {
    background: var(--bg-tertiary) !important;
}

/* Override couleurs de texte grises */
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color: #333"],
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color: #666"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"],
[data-theme="dark"] [style*="color:#6B7280"],
[data-theme="dark"] [style*="color: #6B7280"],
[data-theme="dark"] [style*="color:#94a3b8"],
[data-theme="dark"] [style*="color: #94a3b8"] {
    color: var(--text-secondary) !important;
}

/* Override couleurs de texte très sombres */
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #334155"] {
    color: var(--text-primary) !important;
}

/* Tables génériques - header et body */
[data-theme="dark"] table th {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] table td {
    color: var(--text-primary) !important;
}

[data-theme="dark"] table tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* Labels et petits textes */
[data-theme="dark"] label {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] small,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .text-gray {
    color: var(--text-tertiary) !important;
}

/* Headers */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-primary) !important;
}

/* Inputs et selects génériques */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Boutons génériques avec fond clair */
[data-theme="dark"] button:not(.btn-primary):not([class*="primary"]) {
    background: var(--surface-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Count badges */
[data-theme="dark"] .count,
[data-theme="dark"] [class*="-count"],
[data-theme="dark"] .badge-count {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 768px) {
    [data-theme="dark"] .sidebar {
        background: var(--bg-primary) !important;
    }
}

/* === RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* === APP CONTAINER === */
#app {
    min-height: 100vh;
}

/* === LOADING SCREEN — AUGUSTE SPLASH (première visite uniquement) === */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0C0C0C;
    z-index: 9999;
    overflow: hidden;
}

.loading-screen.hidden {
    display: none;
}

/* Container central pour logo + texte */
.intro-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* Logo AUGUSTE — layers icon */
.intro-logo {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(12px);
    animation: introLogoFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.intro-logo svg {
    width: 36px;
    height: 36px;
}

@keyframes introLogoFade {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Masque d'écrêtage pour texte AUGUSTE */
.intro-text-mask {
    position: relative;
    overflow: hidden;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Texte AUGUSTE — typographie sobre */
.intro-text {
    display: flex;
    align-items: baseline;
    transform: translateY(110%);
    animation: introTextReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.intro-auguste {
    font-family: Inter, system-ui, Helvetica, Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #FAFAFA;
    letter-spacing: 0.08em;
    line-height: 1;
}

@keyframes introTextReveal {
    0% { transform: translateY(110%); }
    100% { transform: translateY(0); }
}

/* Loader bar violet subtil */
.intro-loader {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 1px;
    background: rgba(124, 58, 237, 0.15);
    overflow: hidden;
    opacity: 0;
    animation: introLoaderFade 0.3s ease 0.4s forwards;
}

.intro-loader-bar {
    width: 30%;
    height: 100%;
    background: rgba(167, 139, 250, 0.6);
    animation: introLoaderSlide 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes introLoaderFade {
    to { opacity: 1; }
}

@keyframes introLoaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(450%); }
}

/* Status text */
.intro-status {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: Inter, system-ui, Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: rgba(250, 250, 250, 0.25);
}

/* === SORTIE — Simple fade out (Linear-like) === */
.loading-screen.exit {
    animation: splashFadeOut 0.4s ease forwards;
}

@keyframes splashFadeOut {
    to { opacity: 0; }
}

/* === LOGIN PAGE === */
.page {
    min-height: 100vh;
}

#page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: var(--spacing-lg);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.login-logo .logo-91 {
    font-size: 36px;
}

.login-logo .logo-studio {
    font-size: 36px;
}

.login-subtitle {
    margin-top: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

.login-form {
    background: var(--bg-dark-secondary);
    padding: var(--spacing-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.login-form label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--spacing-sm);
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    font-size: var(--font-size-base);
    color: var(--text-light);
    background: var(--bg-dark-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    transition: border-color var(--transition-fast);
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-form input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

.form-error {
    font-size: var(--font-size-sm);
    color: var(--accent-red);
    margin-bottom: var(--spacing-md);
    min-height: 20px;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: var(--spacing-lg) 0;
    color: rgba(255, 255, 255, 0.3);
    font-size: var(--font-size-sm);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.login-divider span {
    padding: 0 var(--spacing-md);
}

.login-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.login-footer a {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.5);
    transition: color var(--transition-fast);
}

.login-footer a:hover {
    color: var(--text-light);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 14px 24px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 1px;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--text-light);
    color: var(--bg-dark);
    border-color: var(--text-light);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.9);
}

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-full {
    width: 100%;
}

.btn-google {
    position: relative;
}

.btn-google svg {
    position: absolute;
    left: 16px;
}

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--bg-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.loading .btn-loader {
    display: block;
}

.btn.loading span {
    visibility: hidden;
}

/* === TEAM LAYOUT === */
.layout-team {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
/* === SIDEBAR - Personnalisable avec variables --sb-* === */
.sidebar {
    /* Variables de personnalisation sidebar (surchargeables par JS) */
    --sb-bg: #E0E0E5;
    --sb-text: rgba(0, 0, 0, 0.55);
    --sb-text-hover: rgba(0, 0, 0, 0.9);
    --sb-text-active: #1E40AF;
    --sb-accent: #3B82F6;
    --sb-accent-bg: rgba(59, 130, 246, 0.08);
    --sb-hover-bg: rgba(0, 0, 0, 0.05);
    --sb-border: rgba(0, 0, 0, 0.10);
    --sb-avatar-bg: rgba(0, 0, 0, 0.08);
    --sb-avatar-text: rgba(0, 0, 0, 0.7);
    --sb-section-title: rgba(0, 0, 0, 0.35);
    --sb-logo-color: var(--text-primary);
    --sb-muted: rgba(0, 0, 0, 0.35);

    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sb-bg);
    color: var(--sb-text);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base), background var(--transition-base), color var(--transition-base);
    border-right: 1px solid var(--sb-border);
}

/* Dark mode sidebar — plus sombre que le main content pour contraste */
[data-theme="dark"] .sidebar {
    --sb-bg: #060608;
    --sb-text: rgba(255, 255, 255, 0.45);
    --sb-text-hover: rgba(255, 255, 255, 0.90);
    --sb-text-active: #FAFAFA;
    --sb-accent: #FAFAFA;
    --sb-accent-bg: rgba(255, 255, 255, 0.08);
    --sb-hover-bg: rgba(255, 255, 255, 0.05);
    --sb-border: rgba(255, 255, 255, 0.06);
    --sb-avatar-bg: rgba(255, 255, 255, 0.10);
    --sb-avatar-text: #FAFAFA;
    --sb-section-title: rgba(255, 255, 255, 0.28);
    --sb-logo-color: #FAFAFA;
    --sb-muted: rgba(255, 255, 255, 0.30);
}

/* Sidebar fond sombre personnalisé (textMode light) */
.sidebar[data-sb-text-mode="light"] {
    --sb-text: rgba(255, 255, 255, 0.55);
    --sb-text-hover: rgba(255, 255, 255, 0.9);
    --sb-hover-bg: rgba(255, 255, 255, 0.06);
    --sb-border: rgba(255, 255, 255, 0.08);
    --sb-avatar-bg: rgba(255, 255, 255, 0.1);
    --sb-avatar-text: rgba(255, 255, 255, 0.8);
    --sb-section-title: rgba(255, 255, 255, 0.30);
    --sb-logo-color: rgba(255, 255, 255, 0.9);
    --sb-muted: rgba(255, 255, 255, 0.35);
}

.sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--sb-border);
}

.sidebar-logo {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.sidebar-logo .logo-91 {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: -0.5px;
    color: var(--sb-logo-color);
}

.sidebar-logo .logo-studio {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 3px;
    color: var(--sb-logo-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

/* Scrollbar élégante */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sb-muted);
    border-radius: 2px;
    opacity: 0.3;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    opacity: 0.5;
}

.nav-section {
    margin-bottom: 4px;
    background: var(--sb-bg);
}

.nav-section-title {
    padding: 16px 16px 4px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sb-section-title, #86868b);
    background: var(--sb-bg);
}


.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--sb-text);
    transition: all 120ms ease;
    border-radius: 6px;
    margin: 1px 8px;
    border-left: none;
    min-height: 28px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--sb-hover-bg);
    color: var(--sb-text-hover);
}

.nav-item.active {
    background: var(--sb-accent-bg);
    color: var(--sb-accent);
    font-weight: 500;
}

.nav-item svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
    opacity: 0.4;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.nav-item:hover svg {
    opacity: 1;
    color: var(--sb-text-hover);
}

.nav-item.active svg {
    opacity: 1;
    color: var(--sb-accent);
}

/* === SIDEBAR FOOTER — Compact layout === */
/* Structure: [chat] [notif] [avatar] [nom] [settings] [logout] */
.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--sb-border);
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Icônes injectées (chat-ia-btn, notif-bell) : compacter */
.user-info .cia-header-btn,
.user-info .notif-bell {
    padding: 4px !important;
    margin-right: 0 !important;
    flex-shrink: 0;
}
.user-info .cia-header-btn svg,
.user-info .notif-bell svg {
    width: 16px !important;
    height: 16px !important;
}

.user-avatar {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sb-avatar-bg);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 50%;
    color: var(--sb-avatar-text);
    flex-shrink: 0;
}

.user-details {
    min-width: 0;
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--sb-text-hover);
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--sb-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton color picker dans header */
.sidebar-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--sb-border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.sidebar-color-btn:hover {
    border-color: var(--sb-accent);
    transform: scale(1.1);
}
.color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sb-accent);
}

.btn-logout {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--sb-muted);
    transition: all 0.15s ease;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: var(--sb-text-hover);
    background: var(--sb-hover-bg);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

/* === Bouton Réglages (sidebar footer) === */
.btn-settings {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--sb-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    text-decoration: none;
}
.btn-settings:hover {
    color: var(--sb-text-hover);
    background: var(--sb-hover-bg);
}
.btn-settings.active {
    color: var(--sb-accent);
    background: var(--sb-accent-bg);
}
.btn-settings svg {
    width: 16px;
    height: 16px;
}

/* === COLOR PICKER PANEL === */
.sidebar-color-panel {
    position: fixed;
    top: 50px;
    left: 12px;
    width: calc(var(--sidebar-width) - 24px);
    max-width: calc(var(--sidebar-width) - 24px);
    box-sizing: border-box;
    overflow: hidden;
    background: var(--surface-modal, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.sidebar-color-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
/* Position quand sidebar collapsed */
.sidebar-color-panel.collapsed-position {
    left: 78px;
    top: 8px;
    width: 240px;
}
[data-theme="dark"] .sidebar-color-panel {
    background: var(--bg-secondary, #161616);
    border-color: var(--border-linear, #2C2C2C);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
/* Onglets ACCENT / FOND */
.cp-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.cp-tab {
    flex: 1;
    padding: 6px 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.15s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.cp-tab:hover {
    color: var(--text-primary);
}
.cp-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}
/* Section picker */
.cp-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.color-panel-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-tertiary);
    margin: 0;
    display: block;
}
/* Presets rapides */
.cp-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cp-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    outline: none;
}
.cp-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.cp-swatch.active {
    border-color: var(--text-primary, #1d1d1f);
    box-shadow: 0 0 0 2px var(--bg-primary, #ffffff), 0 0 0 3px var(--text-tertiary);
}
/* Canvas gradient saturation/luminosité */
.cp-sl-wrap {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    cursor: crosshair;
}
.cp-sl-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 6px;
}
.cp-sl-cursor {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform: translate(-7px, -7px);
    z-index: 2;
}
/* Barre de teinte */
.cp-hue-wrap {
    position: relative;
    width: 100%;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    cursor: pointer;
}
.cp-hue-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 7px;
}
.cp-hue-cursor {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 18px;
    border-radius: 3px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform: translate(-3px, -50%);
    z-index: 2;
}
/* Ligne hex + aperçu */
.cp-hex-row {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
}
.cp-preview {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.cp-hex-input {
    flex: 1;
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
}
.cp-hex-input:focus {
    border-color: var(--text-tertiary);
}
[data-theme="dark"] .cp-hex-input {
    background: var(--bg-tertiary, #202020);
    border-color: var(--border-linear, #2C2C2C);
    color: var(--text-primary, #FAFAFA);
}
[data-theme="dark"] .cp-preview {
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .cp-tab {
    color: var(--text-tertiary, #8B8B8E);
}
[data-theme="dark"] .cp-tab.active {
    color: var(--text-primary, #FAFAFA);
    border-bottom-color: var(--text-primary, #FAFAFA);
}

/* === MAIN CONTENT - Apple Canvas === */
.main-content {
    flex: 1;
    min-width: 0; /* permet au flex item de shrink sous le min-content — corrige overflow horizontal */
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: #FFFFFF;
    overflow-x: clip;  /* clip au lieu de hidden — ne crée pas de scroll container, préserve position:sticky */
}
[data-theme="dark"] .main-content {
    background: #18181A;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEAMLESS HEADER - Apple Native App Style
   Le header fixe est CACHE par defaut, apparait en glassmorphism au scroll
   ═══════════════════════════════════════════════════════════════════════════ */

.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0 32px;
    background: transparent;
    border-bottom: 1px solid transparent;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    /* Pas de transform — le header reste en position, seule l'opacité change (iOS-style) */
    transition: opacity 0.15s ease, background 0.15s ease, backdrop-filter 0.15s ease, -webkit-backdrop-filter 0.15s ease, border-bottom-color 0.15s ease, box-shadow 0.15s ease;
}

/* ═══ LIQUID GLASS — Apple WWDC 2025 ═══
   Le header et la toolbar fusionnent visuellement en une surface glass continue.
   3 couches : highlight spéculaire (bord haut), fond translucide saturé, ombre de profondeur.
   Le contenu scrolle SOUS le glass — les couleurs se mélangent via backdrop-filter. */

.main-header.scrolled {
    opacity: 1;
    background: rgba(245, 245, 247, 0.55);
    backdrop-filter: blur(40px) saturate(200%) brightness(1.05);
    -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.05);
    border-bottom: none;  /* Pas de bordure — fusion avec toolbar */
    border-top: 0.5px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),     /* Highlight spéculaire fort */
        inset 0 -0.5px 0 rgba(0, 0, 0, 0.03);       /* Micro-ombre interne */
    pointer-events: auto;
}

/* Dark — Liquid Glass inversé */
[data-theme="dark"] .main-header.scrolled {
    background: rgba(28, 28, 30, 0.65);
    backdrop-filter: blur(40px) saturate(200%) brightness(0.85);
    -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(0.85);
    border-bottom: none;
    border-top: 0.5px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -0.5px 0 rgba(0, 0, 0, 0.30);
}

/* Sidebar collapsed */
.sidebar.collapsed ~ .main-content .main-header {
    left: 60px;
}

.btn-menu {
    display: none;
    padding: 10px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-menu:hover {
    background: rgba(0, 0, 0, 0.08);
}

.page-title {
    font-size: 20px;       /* Practical UI H4 — identique à .prj-title-text */
    font-weight: 600;
    letter-spacing: -1px;  /* Practical UI heading */
    line-height: 1.4em;    /* 28px */
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Projets : le module a son propre Large Title sticky,
   le main-header shell est redondant (doublon "Projets").
   On garde le bloc comme couche Liquid Glass (bloque le scroll avec effet givré)
   mais on cache son contenu (texte, boutons). */
.main-header[data-module="projets"],
.main-header[data-module="consultations"] {
    background: rgba(245, 245, 247, 0.85) !important;
    backdrop-filter: blur(40px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
}
.main-header[data-module="projets"] > *,
.main-header[data-module="consultations"] > * {
    opacity: 0 !important;
    pointer-events: none !important;
}
[data-theme="dark"] .main-header[data-module="projets"],
[data-theme="dark"] .main-header[data-module="consultations"] {
    background: rgba(11, 12, 14, 0.85) !important;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Page content - Plus de padding top, fond Apple */
.page-content {
    padding: 0;
    min-height: calc(100vh - 0px);
    background: var(--bg-secondary);
}

/* === CLIENT LAYOUT === */
.layout-client {
    min-height: 100vh;
    background: var(--bg-secondary);
}

.client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--bg-dark);
    color: var(--text-light);
}

.client-logo .logo-91 {
    font-size: 20px;
}

.client-logo .logo-studio {
    font-size: 20px;
    letter-spacing: 2px;
}

.client-nav {
    display: flex;
    gap: 24px;
}

.client-nav-item {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.55);
    padding: 8px 0;
    border-bottom: 1px solid transparent;
    transition: all 0.15s ease;
}

.client-nav-item:hover {
    color: rgba(255, 255, 255, 0.9);
}

.client-nav-item.active {
    color: #fff;
    border-bottom-color: #fff;
    font-weight: 500;
}

.btn-logout-client {
    padding: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
}

.btn-logout-client:hover {
    color: var(--text-light);
}

.client-content {
    padding: var(--spacing-xl);
    max-width: 1200px;
    margin: 0 auto;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    padding: 14px 20px;
    background: var(--bg-dark);
    color: var(--text-light);
    font-size: var(--font-size-sm);
    border-left: 3px solid var(--text-light);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }
.toast.warning { border-left-color: var(--accent-orange); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === FORMS === */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--text-primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* === CARDS === */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: var(--spacing-lg);
}

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

.card-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-tertiary);
}

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border-color);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-primary);
    padding: var(--spacing-lg);
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* === TABLES === */
.table-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--bg-secondary);
}

/* === STATUS BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-blue { background: rgba(0, 102, 204, 0.1); color: var(--accent-blue); }
.badge-green { background: rgba(0, 200, 83, 0.1); color: var(--accent-green); }
.badge-orange { background: rgba(255, 149, 0, 0.1); color: var(--accent-orange); }
.badge-red { background: rgba(255, 59, 48, 0.1); color: var(--accent-red); }
.badge-gold { background: rgba(201, 169, 97, 0.1); color: var(--accent-gold); }
.badge-gray { background: rgba(0, 0, 0, 0.05); color: var(--text-muted); }

/* Dark mode badges */
[data-theme="dark"] .badge-blue { background: rgba(10, 132, 255, 0.2); }
[data-theme="dark"] .badge-green { background: rgba(48, 209, 88, 0.2); }
[data-theme="dark"] .badge-orange { background: rgba(255, 159, 10, 0.2); }
[data-theme="dark"] .badge-red { background: rgba(255, 69, 58, 0.2); }
[data-theme="dark"] .badge-gold { background: rgba(201, 169, 97, 0.2); }
[data-theme="dark"] .badge-gray { background: rgba(255, 255, 255, 0.1); }

/* === EMPTY STATE === */
.empty-state {
    padding: var(--spacing-2xl);
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.empty-state p {
    font-size: var(--font-size-base);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .btn-menu {
        display: block;
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-base);
    }
    
    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: var(--spacing-md);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .client-nav {
        gap: var(--spacing-md);
    }
    
    .client-nav-item {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 0;
    }

    .login-form {
        padding: var(--spacing-lg);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE TYPOGRAPHY - Adaptation par taille d'ecran
   ═══════════════════════════════════════════════════════════════ */

/* Extra Large Screens (28"+) */
@media (min-width: 1920px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 26px;
        --font-size-card-title: 20px;
        --font-size-base: 16px;
        --font-size-sm: 14px;
        --font-size-xs: 12px;
    }
}

/* Large Screens (24"+) */
@media (min-width: 1440px) and (max-width: 1919px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 22px;
        --font-size-card-title: 18px;
    }
}

/* Medium Screens (15-23") - Default */
@media (min-width: 1024px) and (max-width: 1439px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 20px;
        --font-size-card-title: 16px;
    }
}

/* Small Screens (13-14") */
@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 18px;
        --font-size-card-title: 15px;
        --font-size-base: 14px;
    }
}

/* Tablets */
@media (min-width: 576px) and (max-width: 767px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 17px;
        --font-size-card-title: 14px;
        --font-size-base: 14px;
        --font-size-sm: 12px;
    }
}

/* Mobile */
@media (max-width: 575px) {
    :root {
        --font-size-page-title: 17px;
        --font-size-section-title: 16px;
        --font-size-card-title: 14px;
        --font-size-base: 14px;
        --font-size-sm: 12px;
        --font-size-xs: 11px;
    }

    /* Reduce spacing on mobile */
    :root {
        --spacing-lg: 20px;
        --spacing-xl: 24px;
        --spacing-2xl: 32px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR — BADGE "NEW" (bleu)
   ═══════════════════════════════════════════════════════════════════ */

.nav-item .nav-new-badge {
    font-size: 9px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1.2;
}

/* Masquer le badge quand sidebar collapsed */
.sidebar.collapsed .nav-new-badge {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE WHAT'S NEW — Styles
   ═══════════════════════════════════════════════════════════════════ */

.wnp-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* ── Hero ────────────────────────────────────────────────────────── */

.wnp-hero {
    text-align: center;
    padding: 48px 24px 40px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--border-color, #E5E5E5);
}

.wnp-hero-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 16px;
}

.wnp-hero-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary, #1A1A1A);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.wnp-hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary, #6B7280);
    margin: 0 0 32px;
}

.wnp-hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.wnp-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.wnp-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1A1A1A);
    font-feature-settings: 'tnum';
}

.wnp-stat-label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-tertiary, #9CA3AF);
}

/* ── Section ─────────────────────────────────────────────────────── */

.wnp-section {
    margin-bottom: 48px;
}

.wnp-section-header {
    margin-bottom: 24px;
}

.wnp-section-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.wnp-section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #1A1A1A);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.wnp-section-subtitle {
    font-size: 14px;
    color: var(--text-secondary, #6B7280);
    margin: 0;
}

/* ── Auguste Grid ────────────────────────────────────────────────── */

.wnp-aug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.wnp-aug-card {
    background: var(--surface-card, #fff);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.2s;
}

.wnp-aug-card:hover {
    border-color: #3b82f6;
}

.wnp-aug-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #3b82f6;
}

.wnp-aug-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1A1A1A);
    margin: 0 0 6px;
}

.wnp-aug-desc {
    font-size: 13px;
    color: var(--text-secondary, #6B7280);
    margin: 0;
    line-height: 1.5;
}

/* ── Timeline ────────────────────────────────────────────────────── */

.wnp-timeline {
    position: relative;
    padding-left: 24px;
}

.wnp-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border-color, #E5E5E5);
}

.wnp-tl-item {
    position: relative;
    margin-bottom: 32px;
}

.wnp-tl-item:last-child {
    margin-bottom: 0;
}

.wnp-tl-dot {
    position: absolute;
    left: -21px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #fff);
    box-shadow: 0 0 0 1px var(--border-color, #E5E5E5);
}

.wnp-tl-content {
    background: var(--surface-card, #fff);
    border: 1px solid var(--border-color, #E5E5E5);
    border-radius: 8px;
    padding: 16px 20px;
    transition: border-color 0.2s;
}

.wnp-tl-content:hover {
    border-color: var(--text-tertiary, #9CA3AF);
}

.wnp-tl-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.wnp-tl-icon {
    flex-shrink: 0;
}

.wnp-tl-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1A1A1A);
    margin: 0;
}

.wnp-tl-version {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-secondary, #F5F5F7);
    color: var(--text-secondary, #6B7280);
    padding: 2px 8px;
    border-radius: 4px;
}

.wnp-tl-date {
    font-size: 12px;
    color: var(--text-tertiary, #9CA3AF);
    margin-left: auto;
}

.wnp-tl-list {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
}

.wnp-tl-list li {
    font-size: 13px;
    color: var(--text-secondary, #6B7280);
    line-height: 1.6;
    margin-bottom: 4px;
}

.wnp-tl-list li:last-child {
    margin-bottom: 0;
}

/* ── Upcoming ────────────────────────────────────────────────────── */

.wnp-upcoming-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 12px;
}

.wnp-upcoming-card {
    background: var(--surface-card, #fff);
    border: 1px dashed var(--border-color, #E5E5E5);
    border-radius: 8px;
    padding: 24px;
    transition: border-color 0.2s;
}

.wnp-upcoming-card:hover {
    border-color: #f97316;
}

.wnp-upcoming-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(249, 115, 22, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #f97316;
}

.wnp-upcoming-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1A1A1A);
    margin: 0 0 8px;
}

.wnp-upcoming-desc {
    font-size: 13px;
    color: var(--text-secondary, #6B7280);
    margin: 0;
    line-height: 1.6;
}

/* ── Footer ──────────────────────────────────────────────────────── */

.wnp-footer {
    text-align: center;
    padding: 32px 0;
    border-top: 1px solid var(--border-color, #E5E5E5);
    margin-top: 48px;
}

.wnp-footer p {
    font-size: 13px;
    color: var(--text-tertiary, #9CA3AF);
    margin: 0 0 4px;
}

.wnp-footer p:last-child {
    margin-bottom: 0;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .wnp-page {
        padding: 16px 16px 48px;
    }

    .wnp-hero {
        padding: 32px 16px;
    }

    .wnp-hero-title {
        font-size: 28px;
    }

    .wnp-hero-stats {
        gap: 20px;
    }

    .wnp-stat-value {
        font-size: 22px;
    }

    .wnp-aug-grid {
        grid-template-columns: 1fr;
    }

    .wnp-upcoming-grid {
        grid-template-columns: 1fr;
    }

    .wnp-tl-date {
        margin-left: 0;
        width: 100%;
        order: 10;
    }
}
