@import url("https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css");

/* ============================================================
   GESTION BY BELENTIA — Design system « Canopée »
   Typo : Sora (display) + Figtree (corps)
   Sidebar vert forêt, surfaces papier, accents émeraude
   ============================================================ */

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

:root {
    /* Marque */
    --primary: #059669;
    --primary-hover: #047857;
    --primary-50: #E3F4EC;
    --primary-100: #C7EADA;
    --primary-25: #F1F9F5;
    --accent: #0D9488;
    --accent-hover: #0B7A70;
    --accent-50: rgba(13,148,136,0.12);

    /* Surfaces */
    --white: #FFFFFF;
    --bg: #F2F5F3;
    --text: #14201B;
    --text-muted: #5E7268;
    --border: #D5E0DA;
    --border-light: #E4ECE7;

    /* Gris teintés vert */
    --gray-50: #F2F5F3;
    --gray-100: #E8EFEA;
    --gray-200: #D5E0DA;
    --gray-300: #B9C9C0;
    --gray-400: #8AA094;
    --gray-500: #5E7268;
    --gray-600: #47594F;
    --gray-700: #33423A;
    --gray-800: #22302A;
    --gray-900: #14201B;

    /* Sémantique */
    --green-500: #10B981;
    --green-50: rgba(16,185,129,0.12);
    --orange-500: #E58F0C;
    --orange-50: rgba(229,143,12,0.13);
    --purple-500: #8B5CF6;
    --purple-50: rgba(139,92,246,0.12);
    --red-500: #DC2626;
    --red-50: rgba(220,38,38,0.1);
    --red-100: #FDF1F1;
    --blue-500: #3B82F6;
    --blue-50: rgba(59,130,246,0.12);
    --indigo-500: #6366F1;
    --indigo-50: rgba(99,102,241,0.12);
    --pink-500: #EC4899;
    --pink-50: rgba(236,72,153,0.12);
    --teal-500: #14B8A6;
    --teal-50: rgba(20,184,166,0.12);

    /* Sidebar claire et nette */
    --sidebar-bg: #FBFDFC;
    --sidebar-hover: #EEF4F0;
    --sidebar-active: #E3F4EC;
    --sidebar-text: #47594F;
    --sidebar-text-strong: #14201B;
    --sidebar-border: #E4ECE7;

    /* Formes & ombres */
    --r: 12px;
    --r-sm: 8px;
    --r-lg: 18px;
    --r-xl: 26px;
    --r-pill: 9999px;
    --shadow-sm: 0 1px 2px rgba(20,32,27,0.05);
    --shadow-md: 0 8px 20px rgba(20,32,27,0.08);
    --shadow-lg: 0 20px 48px rgba(20,32,27,0.14);

    --font-display: 'Sora', -apple-system, sans-serif;
    --font-body: 'Figtree', -apple-system, system-ui, sans-serif;
}

[data-theme="dark"] {
    --primary: #34D399;
    --primary-hover: #10B981;
    --primary-50: rgba(52,211,153,0.13);
    --primary-100: rgba(52,211,153,0.2);
    --primary-25: rgba(52,211,153,0.06);
    --accent: #2DD4BF;
    --accent-hover: #14B8A6;
    --accent-50: rgba(45,212,191,0.13);

    --white: #121D17;
    --bg: #0A120E;
    --text: #E7EFEA;
    --text-muted: #92A89B;
    --border: #28392F;
    --border-light: rgba(40,57,47,0.75);

    --gray-50: #16221B;
    --gray-100: #1C2A22;
    --gray-200: #28392F;
    --gray-300: #35493D;
    --gray-400: #6E8478;
    --gray-500: #92A89B;
    --gray-600: #A9BCB0;
    --gray-700: #C4D2C9;
    --gray-800: #DAE5DE;
    --gray-900: #E7EFEA;

    --green-500: #34D399;
    --green-50: rgba(52,211,153,0.13);
    --orange-500: #FBBF24;
    --orange-50: rgba(251,191,36,0.13);
    --purple-500: #A78BFA;
    --purple-50: rgba(167,139,250,0.13);
    --red-500: #F87171;
    --red-50: rgba(248,113,113,0.13);
    --red-100: rgba(248,113,113,0.08);
    --blue-500: #60A5FA;
    --blue-50: rgba(96,165,250,0.13);
    --indigo-500: #818CF8;
    --indigo-50: rgba(129,140,248,0.13);
    --pink-500: #F472B6;
    --pink-50: rgba(244,114,182,0.13);
    --teal-500: #2DD4BF;
    --teal-50: rgba(45,212,191,0.13);

    --sidebar-bg: #101A14;
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-active: rgba(52,211,153,0.13);
    --sidebar-text: #92A89B;
    --sidebar-text-strong: #E7EFEA;
    --sidebar-border: rgba(40,57,47,0.75);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.35);
    --shadow-lg: 0 20px 48px rgba(0,0,0,0.45);
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
    overflow-x: hidden;
}

/* ===== A11Y ===== */
.skip-to-content {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
}

.skip-to-content:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    width: auto;
    height: auto;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--r);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-md);
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.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;
}

/* ============================================================
   BOUTONS — rectangulaires arrondis, plus de pill noir
   ============================================================ */
.btn-primary,
.btn-accent,
.btn-outline,
.btn-white,
.btn-danger,
.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--font-body);
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(5,150,105,0.28);
}

[data-theme="dark"] .btn-primary { color: #07110D; }

.btn-accent {
    background: var(--gray-900);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--gray-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-25);
}

.btn-white {
    background: var(--white);
    color: var(--gray-800);
}

.btn-white:hover { background: var(--gray-100); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    font-family: var(--font-body);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ghost:hover { color: var(--gray-900); background: var(--gray-100); }

.btn-danger {
    background: var(--red-500);
    color: #fff;
}

.btn-danger:hover { filter: brightness(0.92); transform: translateY(-1px); }

.btn-cancel {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-cancel:hover { background: var(--gray-100); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-full { width: 100%; text-align: center; }

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading .btn-text { visibility: hidden; }

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   LAYOUT APPLICATION
   ============================================================ */
.app-body {
    overflow-x: hidden;
    background: var(--bg);
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR — vert forêt, sombre dans les deux modes ===== */
.sidebar {
    width: 264px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--sidebar-text-strong);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.sidebar-logo svg, .sidebar-logo img { flex-shrink: 0; }

.sidebar-logo small { color: var(--sidebar-text) !important; }

.sidebar-nav {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
}

.sidebar-nav-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-text);
    opacity: 0.75;
    padding: 0 12px;
    margin: 26px 0 10px;
    display: block;
}

.sidebar-nav-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-strong);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    flex-shrink: 0;
    font-size: 19px;
    width: 20px;
    text-align: center;
}

.nav-item.active i { color: var(--primary); }

.dark-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dark-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-strong);
}

.dark-toggle i { font-size: 19px; width: 20px; text-align: center; }

.sidebar-signout {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--sidebar-text);
    transition: color 0.15s;
    font-size: 17px;
}

.sidebar-signout:hover { color: var(--sidebar-text-strong); }

.sidebar-user {
    padding: 16px 18px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #059669;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sidebar-text-strong);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== MAIN ===== */
.main {
    flex: 1;
    margin-left: 264px;
    min-height: 100vh;
    min-width: 0;
}

/* ===== HEADER DE PAGE — transparent, intégré ===== */
.topbar {
    padding: 30px 36px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: transparent;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-greeting {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.topbar-breadcrumb::before {
    content: '·';
    margin-right: 10px;
    opacity: 0.5;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-bell {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    color: var(--text-muted);
    text-decoration: none;
}

.topbar-bell i { font-size: 18px; }
.topbar-right .btn-primary i,
.topbar-right .btn-accent i { font-size: 14px; }

.topbar-bell:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-25);
}

.bell-dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--orange-500);
    border: 1.5px solid var(--white);
}

.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--white);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gray-600);
    flex-shrink: 0;
}

.content {
    padding: 24px 36px 56px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7,17,9,0.55);
    z-index: 45;
}

.sidebar-overlay.active { display: block; }

/* ============================================================
   CARTES KPI — icône à gauche du label, chiffres Sora
   ============================================================ */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 26px;
}

.dash-kpi {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dash-kpi-header {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.dash-kpi-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dash-kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.dash-kpi-icon.primary { background: var(--primary-50); color: var(--primary); }
.dash-kpi-icon.coral { background: var(--primary-50); color: var(--primary); }
.dash-kpi-icon.orange { background: var(--orange-50); color: var(--orange-500); }
.dash-kpi-icon.green { background: var(--green-50); color: var(--green-500); }
.dash-kpi-icon.purple { background: var(--purple-50); color: var(--purple-500); }
.dash-kpi-icon.accent { background: var(--accent-50); color: var(--accent); }
.dash-kpi-icon.warning { background: var(--orange-50); color: var(--orange-500); }
.dash-kpi-icon.indigo { background: var(--indigo-50); color: var(--indigo-500); }
.dash-kpi-icon.pink { background: var(--pink-50); color: var(--pink-500); }
.dash-kpi-icon.teal { background: var(--teal-50); color: var(--teal-500); }

.dash-kpi-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
    line-height: 1.15;
    margin-bottom: 4px;
    letter-spacing: -0.03em;
}

.dash-kpi-value .total { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.dash-kpi-value.warning { color: var(--orange-500); }
.dash-kpi-value.success { color: var(--green-500); }

.dash-kpi-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dash-kpi-sub .trend { color: var(--green-500); font-weight: 700; }
.dash-kpi-sub .trend.down { color: var(--red-500); }

.dash-kpi-bar {
    height: 7px;
    background: var(--gray-100);
    border-radius: var(--r-pill);
    margin-top: 12px;
    overflow: hidden;
}

.dash-kpi-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--r-pill);
    transition: width 1s ease;
}

/* ============================================================
   PANNEAUX, CARTES & TABLEAUX
   ============================================================ */
.hero-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.hero-card h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--gray-900);
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.03em;
}

.hero-card p {
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 0.92rem;
    margin: 0;
    max-width: 720px;
}

.panel-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 24px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--gray-900);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.dash-panel,
.dash-table-wrap {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.dash-table-wrap { margin-bottom: 26px; }

.dash-panel-head,
.dash-table-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
}

.dash-panel-title,
.dash-table-title {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.015em;
}

.dash-panel-link {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}

.dash-panel-link:hover { color: var(--primary-hover); }

.dash-table-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--gray-100);
    padding: 4px 12px;
    border-radius: var(--r-pill);
}

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

.dash-table thead th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--gray-400);
    padding: 12px 22px;
    background: transparent;
    border-bottom: 2px solid var(--gray-100);
}

.dash-table tbody td {
    padding: 14px 22px;
    font-size: 0.875rem;
    color: var(--gray-600);
    border-bottom: 1px solid var(--border-light);
    font-weight: 500;
}

.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover { background: var(--primary-25); }

.dash-table thead th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
.dash-table thead th.sortable:hover { color: var(--gray-900); }
.dash-table thead th.sortable .sort-icon { display: inline-flex; margin-left: 4px; font-size: 12px; opacity: 0.3; vertical-align: middle; }
.dash-table thead th.sortable.asc .sort-icon,
.dash-table thead th.sortable.desc .sort-icon { opacity: 1; color: var(--primary); }

.dash-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.dash-three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
    margin-top: 26px;
}

/* ===== BADGES — pastilles cerclées ===== */
.status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
}

.status-badge.green { color: var(--green-500); background: var(--green-50); border-color: rgba(16,185,129,0.25); }
.status-badge.orange { color: var(--orange-500); background: var(--orange-50); border-color: rgba(229,143,12,0.28); }
.status-badge.red { color: var(--red-500); background: var(--red-50); border-color: rgba(220,38,38,0.25); }
.status-badge.gray { color: var(--text-muted); background: var(--gray-100); border-color: var(--gray-200); }
.status-badge.blue { color: var(--blue-500); background: var(--blue-50); border-color: rgba(59,130,246,0.25); }
.status-badge.primary { color: var(--primary); background: var(--primary-50); border-color: rgba(5,150,105,0.25); }
.status-badge.purple { color: var(--purple-500); background: var(--purple-50); border-color: rgba(139,92,246,0.25); }

/* ===== PROGRESSION ===== */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.progress-track {
    flex: 1;
    height: 7px;
    background: var(--gray-100);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--primary);
    transition: width 0.8s ease;
}

.progress-bar.accent { background: var(--accent); }

.progress-text {
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--gray-700);
    min-width: 36px;
    text-align: right;
}

/* ===== FORMULAIRES ===== */
.app-form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 16px;
}

.app-form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700);
}

.app-form-group input,
.app-form-group select,
.app-form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--gray-200);
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.app-form-group input:focus,
.app-form-group select:focus,
.app-form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar .search-input {
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font: inherit;
    font-size: 0.86rem;
    color: var(--gray-700);
    background: var(--white);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-bar select:focus,
.filter-bar .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--gray-400);
}

.empty-state-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 26px;
    color: var(--gray-400);
}

.empty-state h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto;
}

.empty-state .btn-primary {
    margin-top: 16px;
    font-size: 0.82rem;
    padding: 9px 18px;
}

/* ===== PAGINATION ===== */
.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-links { display: flex; gap: 6px; }

.pagination-links a,
.pagination-links span {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    transition: all 0.15s;
}

.pagination-links a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-25);
}

.pagination-links .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--white);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    animation: toastIn 0.35s cubic-bezier(0.21,1.02,0.73,1) forwards;
    transition: all 0.3s ease;
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-top: 1px;
}

.toast.success .toast-icon { color: var(--green-500); }
.toast.error .toast-icon { color: var(--red-500); }
.toast.warning .toast-icon { color: var(--orange-500); }
.toast.info .toast-icon { color: var(--blue-500); }

.toast-body { flex: 1; min-width: 0; }

.toast-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.toast-close:hover { color: var(--gray-700); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
    animation: toastProgress linear forwards;
}

.toast.success .toast-progress { background: var(--green-500); }
.toast.error .toast-progress { background: var(--red-500); }
.toast.warning .toast-progress { background: var(--orange-500); }
.toast.info .toast-progress { background: var(--blue-500); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(100%) scale(0.95); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================================
   MODALE DE CONFIRMATION
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(7,17,9,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-dialog {
    background: var(--white);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 430px;
    margin: 24px;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.21,1.02,0.73,1);
}

.modal-overlay.active .modal-dialog { transform: scale(1) translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 24px 0;
}

.modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.modal-icon.warning { background: var(--orange-50); color: var(--orange-500); }
.modal-icon.danger { background: var(--red-50); color: var(--red-500); }
.modal-icon.info { background: var(--blue-50); color: var(--blue-500); }
.modal-icon.success { background: var(--green-50); color: var(--green-500); }
.modal-icon.primary { background: var(--primary-50); color: var(--primary); }

.modal-header-text h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.modal-header-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-body { padding: 20px 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px 24px;
}

/* ============================================================
   NOTIFICATIONS (page)
   ============================================================ */
.notif-list { overflow-y: auto; }

.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread {
    background: var(--primary-25);
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 7px;
}

.notif-dot.critical { background: var(--red-500); }
.notif-dot.warning { background: var(--orange-500); }
.notif-dot.info { background: var(--blue-500); }
.notif-dot.success { background: var(--green-500); }

.notif-content { flex: 1; min-width: 0; }

.notif-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.45;
    margin-bottom: 2px;
}

.notif-text strong { font-weight: 700; color: var(--gray-900); }

.notif-time {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-weight: 500;
}

/* ============================================================
   COMPOSANTS MÉTIER
   ============================================================ */

/* Cartes de groupe */
.group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1100px) { .group-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .group-grid { grid-template-columns: 1fr; } }

.group-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 22px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.2s;
}

.group-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    border-color: var(--gray-200);
}

.group-card-head { display: flex; align-items: center; gap: 12px; }

.group-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-50);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.group-card-head h3 {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.group-card-head small { font-size: 0.76rem; color: var(--text-muted); font-weight: 500; }

.group-card-stats { display: flex; gap: 20px; }
.group-card-stats div { display: flex; flex-direction: column; }
.group-card-stats strong {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}
.group-card-stats span { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* Avatars — carrés arrondis « stickers » */
.mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    font-family: var(--font-display);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14);
}

.mini-avatar.lg { width: 38px; height: 38px; font-size: 0.7rem; border-radius: 12px; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .mini-avatar { margin-left: -9px; border: 2px solid var(--white); }
.avatar-stack .mini-avatar:first-child { margin-left: 0; }
.avatar-stack .more { margin-left: 8px; font-size: 0.75rem; color: var(--text-muted); font-weight: 700; }

/* Cellule membre */
.member-cell { display: flex; align-items: center; gap: 10px; }
.member-cell .member-name { font-weight: 600; color: var(--gray-800); display: block; line-height: 1.3; }
.member-cell .member-sub { font-size: 0.74rem; color: var(--text-muted); display: block; }

/* Timeline */
.timeline { display: flex; flex-direction: column; }

.timeline-item {
    display: flex;
    gap: 14px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--border-light);
}

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

.timeline-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--primary-50);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.timeline-body { flex: 1; min-width: 0; }
.timeline-text { font-size: 0.85rem; color: var(--gray-700); font-weight: 500; line-height: 1.45; }
.timeline-meta { font-size: 0.72rem; color: var(--gray-400); font-weight: 500; margin-top: 2px; }

/* Échéances */
.deadline-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    margin-bottom: 14px;
}

.deadline-card.overdue {
    border-color: rgba(220,38,38,0.35);
}

.deadline-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.deadline-head h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.02em; }
.deadline-head h3 a { color: inherit; text-decoration: none; }
.deadline-head h3 a:hover { color: var(--primary); }

.deadline-days { font-size: 0.8rem; font-weight: 700; }
.deadline-days.late { color: var(--red-500); }
.deadline-days.soon { color: var(--orange-500); }
.deadline-days.ok { color: var(--green-500); }

/* Champ copiable */
.copy-field { display: flex; gap: 8px; align-items: center; }

.copy-field input {
    flex: 1;
    padding: 9px 12px;
    font-size: 0.78rem;
    font-family: monospace;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--gray-50);
    color: var(--gray-700);
    outline: none;
}

/* Répartition personnalisée */
.split-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }

.split-row .split-input {
    width: 130px;
    padding: 8px 12px;
    text-align: right;
    border: 1.5px solid var(--gray-200);
    border-radius: 9px;
    font: inherit;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
    background: var(--white);
    outline: none;
}

.split-row .split-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }

.split-summary { font-size: 0.82rem; font-weight: 700; padding: 10px 0; }
.split-summary.ok { color: var(--green-500); }
.split-summary.ko { color: var(--red-500); }

/* Sélection de participants */
.participant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }

.participant-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid var(--gray-200);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--white);
}

.participant-pick:hover { border-color: var(--gray-300); }
.participant-pick.selected { border-color: var(--primary); background: var(--primary-25); box-shadow: 0 0 0 1px var(--primary); }
.participant-pick input { accent-color: var(--primary); }

/* Bandeaux d'alerte */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 0.88rem;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert-banner i { font-size: 19px; flex-shrink: 0; margin-top: 1px; }

.alert-banner.warning {
    background: var(--orange-50);
    color: var(--gray-800);
    border-color: rgba(229,143,12,0.3);
}
.alert-banner.warning i { color: var(--orange-500); }

.alert-banner.info {
    background: var(--primary-25);
    color: var(--gray-800);
    border-color: var(--primary-100);
}
.alert-banner.info i { color: var(--primary); }

/* Clé / valeur */
.kv-list { display: flex; flex-direction: column; gap: 10px; }
.kv-list .kv { display: flex; justify-content: space-between; font-size: 0.85rem; }
.kv-list .kv span { color: var(--text-muted); font-weight: 500; }
.kv-list .kv strong { color: var(--gray-900); font-weight: 700; }

/* Pastilles de couleur */
.color-swatches { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.color-swatches label {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 3px rgba(20,32,27,0.2);
    transition: transform 0.1s, box-shadow 0.1s;
    display: block;
}

.color-swatches label:hover { transform: scale(1.15); }
.color-swatches label:has(input:checked) { box-shadow: 0 0 0 2.5px var(--gray-900); transform: scale(1.1); }
.color-swatches input { position: absolute; opacity: 0; pointer-events: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-two-col { grid-template-columns: 1fr; }
    .dash-three-col { grid-template-columns: 1fr; }
    .topbar-breadcrumb { display: none; }
    .hero-card { display: grid; }
    .filter-bar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar { padding: 18px 16px 0; flex-wrap: wrap; }
    .topbar-greeting { font-size: 1.15rem; }
    .mobile-toggle { display: flex; }
    .content { padding: 18px 16px 40px; }
    .dash-kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .dash-kpi { padding: 16px; }
    .dash-kpi-value { font-size: 1.45rem; }
    .topbar-right .btn-primary { display: none; }
}

@media (max-width: 480px) {
    .dash-kpi-grid { grid-template-columns: 1fr; }
}
