/* ============================================
   FUSION GROUPE - Application de gestion BTP
   ============================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --purple: #8b5cf6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo i { color: var(--warning); font-size: 1.5rem; }

.sidebar-toggle {
    background: none; border: none; color: white;
    font-size: 1.25rem; cursor: pointer;
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--gray-300);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
    position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(26,86,219,0.3); color: white; border-right: 3px solid var(--primary); }
.nav-item i { width: 20px; text-align: center; }

.nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 0.5rem 1.25rem; }

.badge {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    margin-left: auto;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: var(--gray-400);
    margin-bottom: 0.5rem;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

.topbar-mobile {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    box-shadow: var(--shadow);
    margin: -2rem -2rem 1.5rem -2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-weight: 700; color: var(--primary); }

.btn-icon {
    background: none; border: none; font-size: 1.25rem;
    color: var(--gray-600); cursor: pointer; position: relative;
}

.badge-small {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: white;
    border-radius: 50%; width: 16px; height: 16px;
    font-size: 0.6rem; display: flex;
    align-items: center; justify-content: center;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h1 i { color: var(--primary); }
.welcome { color: var(--gray-500); font-size: 0.9rem; margin-top: 0.25rem; }

/* ---- STATS GRID ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border-left: 4px solid;
}

.stat-blue { border-color: var(--primary); }
.stat-yellow { border-color: var(--warning); }
.stat-orange { border-color: #f97316; }
.stat-red { border-color: var(--danger); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
}

.stat-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-yellow .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-orange .stat-icon { background: #fff7ed; color: #f97316; }
.stat-red .stat-icon { background: var(--danger-light); color: var(--danger); }

.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); display: block; }
.stat-label { font-size: 0.85rem; color: var(--gray-500); }

/* ---- CARDS ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-outline { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- FORMS ---- */
.form-grid { max-width: 900px; }

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.35rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: white;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group-inline {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.form-inline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.form-inline-grid input, .form-inline-grid select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table thead th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr.row-warning { background: #fffbeb; }

/* ---- STATUS BADGES ---- */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-en_preparation, .status-brouillon, .status-identifie, .status-planifiee { background: var(--gray-100); color: var(--gray-600); }
.status-en_cours { background: #dbeafe; color: #1d4ed8; }
.status-en_pause { background: var(--warning-light); color: #b45309; }
.status-termine, .status-terminee, .status-validee, .status-confirmee, .status-gagne, .status-livree { background: var(--success-light); color: #047857; }
.status-signee, .status-soumise, .status-soumis { background: #ede9fe; color: #6d28d9; }
.status-facturee, .status-commandee, .status-envoyee { background: #dbeafe; color: #1d4ed8; }
.status-annule, .status-annulee, .status-perdu { background: var(--danger-light); color: #dc2626; }

/* ---- PRIORITY ---- */
.priority-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.priority-basse { background: var(--gray-100); color: var(--gray-500); }
.priority-normale { background: #dbeafe; color: #1d4ed8; }
.priority-haute { background: var(--warning-light); color: #b45309; }
.priority-urgente { background: var(--danger-light); color: #dc2626; }

/* ---- ROLE ---- */
.role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.role-gerant { background: #fef3c7; color: #b45309; }
.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-ouvrier { background: var(--gray-100); color: var(--gray-600); }

/* ---- DETAIL GRID ---- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.25rem;
}

.detail-item span { font-size: 0.95rem; color: var(--gray-800); }

/* ---- TASKS ---- */
.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: white;
    border-left: 3px solid var(--gray-300);
}

.task-item.task-haute { border-left-color: var(--warning); }
.task-item.task-urgente { border-left-color: var(--danger); }
.task-item.task-normale { border-left-color: var(--primary); }

.task-info { flex: 1; min-width: 0; }
.task-info strong { display: block; font-size: 0.9rem; }
.task-info small { color: var(--gray-500); font-size: 0.8rem; }

.btn-check {
    background: none; border: 2px solid var(--gray-300);
    width: 28px; height: 28px; border-radius: 50%;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    color: var(--gray-400); font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-check:hover { border-color: var(--primary); color: var(--primary); }
.btn-check.checked { border-color: var(--warning); color: var(--warning); }
.btn-check.done { border-color: var(--success); color: var(--success); border: none; font-size: 1.2rem; }

/* ---- LIST ITEMS ---- */
.list-items { display: flex; flex-direction: column; gap: 0.5rem; }

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    border: 1px solid var(--gray-100);
}

.list-item:hover { background: var(--gray-50); }
.list-item-main { min-width: 0; }
.list-item-main strong { display: block; font-size: 0.9rem; }
.list-item-main small { color: var(--gray-500); font-size: 0.8rem; }

/* ---- PHOTO GRID ---- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.photo-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: white;
}

.photo-card img { width: 100%; height: 140px; object-fit: cover; }
.photo-info { padding: 0.5rem; }
.photo-info small { display: block; color: var(--gray-500); font-size: 0.75rem; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--gray-200); }

.tab {
    padding: 0.75rem 1.25rem;
    background: none; border: none;
    font-size: 0.9rem; font-weight: 500;
    color: var(--gray-500); cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex; align-items: center; gap: 0.5rem;
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { padding: 1.5rem 0; }

/* ---- FILTERS ---- */
.filters-bar {
    margin-bottom: 1.5rem;
}

.filters-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.filters-form select, .filters-form input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-group { display: flex; gap: 0.25rem; }

/* ---- FLASH MESSAGES ---- */
.flash-container { margin-bottom: 1.5rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.flash-success { background: var(--success-light); color: #047857; }
.flash-error { background: var(--danger-light); color: #dc2626; }
.flash-info { background: var(--primary-light); color: var(--primary); }
.flash-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; margin-left: auto; opacity: 0.6; }

/* ---- ALERTS ---- */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.alert-warning { background: var(--warning-light); color: #92400e; }
.alert a { color: inherit; font-weight: 600; }

/* ---- NOTIFICATIONS ---- */
.notifications-list { display: flex; flex-direction: column; gap: 0.5rem; }

.notification-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: #eff6ff; border-left: 3px solid var(--primary); }

.notif-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.notif-content { flex: 1; min-width: 0; }
.notif-content p { color: var(--gray-600); font-size: 0.85rem; margin-top: 0.25rem; }
.notif-content small { color: var(--gray-400); }

.notif-dot {
    width: 10px; height: 10px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- SIGNATURE ---- */
.signature-container {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    touch-action: none;
}

.signature-container canvas { display: block; width: 100%; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; color: var(--gray-400); padding: 2rem; font-size: 0.9rem; }

/* ---- LIGNE MATERIEL ---- */
.ligne-materiel { margin-bottom: 0.5rem; }

/* ---- TEXT UTILS ---- */
.text-danger { color: var(--danger) !important; font-weight: 700; }

/* ---- LEGEND ---- */
.legend { font-size: 0.85rem; color: var(--gray-500); }
.legend span { display: flex; align-items: center; gap: 0.3rem; }

/* ---- LOGIN ---- */
.login-body {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container { width: 100%; max-width: 420px; padding: 1rem; }

.login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon { font-size: 3rem; color: var(--warning); margin-bottom: 0.5rem; display: block; }
.login-header h1 { font-size: 1.75rem; color: var(--gray-900); }
.login-header p { color: var(--gray-500); font-size: 0.9rem; }

.login-form .form-group { margin-bottom: 1.25rem; }
.login-form label { display: flex; align-items: center; gap: 0.4rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; padding: 0 1rem 2rem; }
    .topbar-mobile { display: flex; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .table { font-size: 0.8rem; }
    .table thead th, .table tbody td { padding: 0.5rem; }
    .btn-group { flex-direction: column; }
    .form-inline-grid { grid-template-columns: 1fr; }
}

/* ---- FULLCALENDAR OVERRIDES ---- */
.fc { font-family: inherit; }
.fc .fc-button-primary { background: var(--primary); border-color: var(--primary); }
.fc .fc-button-primary:hover { background: var(--primary-dark); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--primary-dark); }
.fc .fc-today-button { text-transform: capitalize; }
.fc-event { border-radius: 4px; font-size: 0.8rem; }
/* ============================================
   FUSION GROUPE — DESIGN SYSTEM VIOLET v2.0
   Harmonisation avec vitrine fusion-smartconnect.net
   Déployé le 2026-04-21 (Phase 2C)
   ============================================ */

:root {
    /* Brand — violet Fusion SmartConnect */
    --primary: #7C3AED;
    --primary-dark: #5B21B6;
    --primary-light: #EDE9FE;
    --primary-soft: #F5F3FF;

    /* Accent gold */
    --accent: #F59E0B;
    --accent-dark: #D97706;
    --accent-light: #FEF3C7;

    /* Semantic */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #0EA5E9;
    --info-light: #E0F2FE;

    /* Neutrals — slate */
    --purple: #8B5CF6;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px rgba(15, 23, 42, 0.08), 0 4px 6px rgba(15, 23, 42, 0.05);
    --shadow-violet: 0 4px 14px rgba(124, 58, 237, 0.25);
}

/* ============================================
   SIDEBAR — violet hover/active
   ============================================ */
.sidebar {
    background: linear-gradient(180deg, #0F172A 0%, #1E1B4B 100%);
}

.logo {
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-violet);
    letter-spacing: -0.02em;
}

.logo-mark-sm {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
    border-radius: 6px;
    margin-right: 0.5rem;
}

.logo-text {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.nav-section {
    padding: 0.9rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
}

.nav-item {
    border-left: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.nav-item:hover {
    background: rgba(124, 58, 237, 0.12);
    color: white;
}

.nav-item.active {
    background: rgba(124, 58, 237, 0.22);
    color: white;
    border-left-color: var(--primary);
    border-right: none;
    font-weight: 600;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-meta { min-width: 0; flex: 1; }
.user-name {
    font-size: 0.85rem;
    color: white;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logout-link {
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.7) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.85rem !important;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5 !important;
}

/* ============================================
   BUTTONS — accent violet
   ============================================ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-violet);
}

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

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

.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* Topbar mobile */
.topbar-mobile {
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.topbar-title {
    font-weight: 700;
    color: var(--gray-900);
    display: inline-flex;
    align-items: center;
}

/* Flash messages — unified style */
.flash-container {
    padding: 1rem 1.25rem 0;
}

.flash {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid transparent;
}

.flash-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.flash-error, .flash-danger { background: var(--danger-light); color: #991B1B; border-color: #FECACA; }
.flash-warning { background: var(--warning-light); color: #92400E; border-color: #FDE68A; }
.flash-info { background: var(--info-light); color: #075985; border-color: #BAE6FD; }

.flash i { font-size: 1.15rem; flex-shrink: 0; }
.flash span { flex: 1; }

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0 0.25rem;
}

.flash-close:hover { opacity: 1; }

/* ============================================
   CARDS — consistent shadow + radius
   ============================================ */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

.card-header.bg-primary {
    background: var(--primary) !important;
    color: white;
    border-bottom-color: var(--primary-dark);
}

/* Tables — subtle violet header */
.table > thead {
    background: var(--primary-soft);
}

.table > thead > tr > th {
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom-color: var(--primary-light);
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Respecte reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
