*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --purple: #7F77DD;
    --purple-light: #EEEDFE;
    --purple-dark: #3C3489;
    --teal: #1D9E75;
    --teal-light: #E1F5EE;
    --teal-dark: #085041;
    --amber: #BA7517;
    --amber-light: #FAEEDA;
    --coral: #D85A30;
    --coral-light: #FAECE7;
    --red: #E24B4A;
    --red-light: #FCEBEB;
    --bg: #ffffff;
    --bg2: #f5f5f3;
    --bg3: #efeeec;
    --text: #1a1a18;
    --muted: #6b6b67;
    --border: rgba(0, 0, 0, 0.10);
    --radius: 10px;
    --radius-lg: 16px;
}

html,
body {
    min-height: 100%;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background: var(--bg2);
}

/* ── LAYOUT GÉNÉRAL ── */
.page-dashboard {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    background: var(--bg);
    border-right: 0.5px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 22px 24px 20px;
    border-bottom: 0.5px solid var(--border);
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    text-decoration: none;
    color: var(--text);
}

.logo-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--purple);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--bg2);
    color: var(--text);
}

.nav-item.active {
    background: var(--purple-light);
    color: var(--purple-dark);
    font-weight: 500;
}

.nav-item i {
    font-size: 18px;
}

.nav-badge {
    margin-left: auto;
    background: var(--purple);
    color: white;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 40px;
    font-weight: 600;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    padding: 12px 14px 6px;
    opacity: 0.6;
}

.sidebar-footer {
    padding: 12px;
    border-top: 0.5px solid var(--border);
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--text);
}

.user-item:hover {
    background: var(--bg2);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--purple-light);
    color: var(--purple-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    color: var(--muted);
}

/* ── MAIN ── */
.main {
    flex: 1;
    min-width: 0;
    padding: 40px 44px 60px;
    overflow-y: auto;
}

/* ── DASHBOARD CONTAINER ── */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 960px;
}

/* ── DASHBOARD HEADER ── */
.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard-header h1 {
    font-family: 'Syne', sans-serif;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 40px;
    background: var(--purple-light);
    color: var(--purple-dark);
    width: fit-content;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ── BOUTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 40px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--purple);
    color: white;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
}

.btn-primary:hover {
    opacity: 0.88;
}

.btn-outline {
    background: var(--bg);
    border: 0.5px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg2);
}

/* ── STATS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.stat-card {
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--purple);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    background: var(--bg2);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--purple);
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
}

/* ── QUICK ACTIONS ── */
.quick-actions {
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.quick-actions h2 {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── RECENT ACTIVITY ── */
.recent-activity {
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.recent-activity h2 {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 20px 24px 16px;
    border-bottom: 0.5px solid var(--border);
}

.collaborations-list {
    display: flex;
    flex-direction: column;
}

.collaboration-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 0.5px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.collaboration-item:last-child {
    border-bottom: none;
}

.collaboration-item:hover {
    background: var(--bg2);
}

.collaboration-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg2);
}

.collaboration-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collaboration-info {
    flex: 1;
    min-width: 0;
}

.collaboration-info h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.username {
    font-size: 12px;
    color: var(--muted);
    margin-left: 6px;
    font-weight: 400;
}

.collaboration-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
}

/* ── STATUS BADGES ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 40px;
    font-size: 11px;
    font-weight: 500;
}

.status-pending {
    background: var(--amber-light);
    color: #633806;
}

.status-brief_sent {
    background: var(--purple-light);
    color: var(--purple-dark);
}

.status-approved {
    background: var(--teal-light);
    color: var(--teal-dark);
}

.status-in_progress {
    background: #E6F1FB;
    color: #0C447C;
}

.status-delivered {
    background: var(--teal-light);
    color: var(--teal-dark);
}

.status-validated {
    background: var(--teal-light);
    color: var(--teal-dark);
}

.status-dispute {
    background: var(--red-light);
    color: #791F1F;
}

.collab-arrow {
    color: var(--muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* ── EMPTY STATE ── */
.empty-state {
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 56px 32px;
    color: var(--muted);
}

.empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: 'Syne', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 280px;
    line-height: 1.6;
}

.date {
    font-size: 12px;
    color: var(--muted);
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
   Everything below adapts the layout above for
   tablet and phone widths. Nothing above this line
   was changed.
   ══════════════════════════════════════════════════ */

/* ── Tablet (≤968px): the 240px fixed sidebar
      becomes a horizontal top bar instead of a tall
      rail — no JS needed, everything stays reachable,
      just laid out differently ──────────────────────── */
@media (max-width: 968px) {
    .page-dashboard {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 0.5px solid var(--border);
        overflow: visible;
        z-index: 50;
    }

    .sidebar-logo {
        border-bottom: none;
        border-right: 0.5px solid var(--border);
        padding: 14px 18px;
        flex-shrink: 0;
    }

    .sidebar-nav {
        flex: 1;
        flex-direction: row;
        align-items: center;
        padding: 8px 10px;
        gap: 4px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .nav-item {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Section headers ("Compte", "Outils"...) don't read
       well inline in a horizontal strip, so they're
       dropped here — the items themselves stay. */
    .nav-section-label {
        display: none;
    }

    .sidebar-footer {
        border-top: none;
        border-left: 0.5px solid var(--border);
        padding: 8px 10px;
        flex-shrink: 0;
    }

    .user-item {
        padding: 8px;
    }

    /* Keep just the avatar on the top bar to save space;
       name/role still show once this becomes a real
       dropdown menu later. */
    .user-name,
    .user-role {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Tablet / large phone (≤768px) ───────────────── */
@media (max-width: 768px) {
    .main {
        padding: 24px 20px 44px;
    }

    .dashboard-container {
        gap: 20px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .quick-actions {
        padding: 18px;
    }

    .recent-activity h2 {
        padding-left: 18px;
        padding-right: 18px;
    }

    .collaboration-item {
        padding: 12px 18px;
    }
}

/* ── Small phones (≤480px) ───────────────────────── */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 18px 20px;
    }

    .dashboard-header h1 {
        font-size: 22px;
    }

    .collaboration-meta {
        flex-wrap: wrap;
        row-gap: 4px;
    }

    .empty-state {
        padding: 40px 20px;
    }
}