:root {
    --navy: #1e293b;
    --navy-light: #334155;
    --navy-dark: #0f172a;
    --gold: #d4a537;
    --gold-light: #e4b850;
    --cream: #faf7f0;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--cream);
    color: var(--text);
    margin: 0;
}

.anonymous {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
}

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

.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: #cbd5e1;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar .brand i { font-size: 1.5rem; }

.sidebar .nav {
    padding: 12px 0;
}

.sidebar .nav-section {
    padding: 14px 20px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    font-weight: 600;
}

.sidebar .nav-link {
    color: #cbd5e1;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    font-size: 0.93rem;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--gold);
    border-left-color: var(--gold);
}

.sidebar .nav-link i { width: 18px; text-align: center; }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    background: var(--navy);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-chip {
    background: rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
}

.footer {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

/* ============ CARDS / WIDGETS ============ */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-radius: 8px;
}

.card-header {
    background: #fff;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    padding: 14px 18px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 4px solid var(--gold);
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
    margin-top: 4px;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--cream);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* ============ BUTTONS ============ */
.btn-primary {
    background: var(--navy);
    border-color: var(--navy);
}
.btn-primary:hover {
    background: var(--navy-light);
    border-color: var(--navy-light);
}

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}
.btn-gold:hover {
    background: var(--gold-light);
    color: #fff;
}

/* ============ TABLES ============ */
.table {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background: var(--navy);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover { background: var(--cream); }

/* ============ LOGIN ============ */
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-card h1 {
    color: var(--navy);
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.login-card .brand-icon {
    width: 64px;
    height: 64px;
    background: var(--navy);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 20px;
}

/* ============ BULLETIN / RECU PRINT ============ */
.bulletin-header, .recu-header {
    text-align: center;
    border-bottom: 3px double var(--navy);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.bulletin-header h2 { color: var(--navy); margin: 0; }

@@media print {
    .sidebar, .topbar, .footer, .no-print { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff; }
}

/* ============ SIDEBAR — GROUPES COLLAPSIBLES ============ */
.nav-group-toggle {
    width: 100%;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: #94a3b8;
    padding: 9px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-top: 4px;
}
.nav-group-toggle:hover {
    color: var(--gold-light);
    background: rgba(255,255,255,0.05);
    border-left-color: rgba(212,165,55,0.4);
}
.nav-group-toggle .arrow {
    margin-left: auto;
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.nav-group-toggle.collapsed .arrow { transform: rotate(-90deg); }
.nav-group .nav-link { padding-left: 38px; font-size: 0.88rem; }
.nav-sub-label {
    padding: 7px 20px 2px 38px;
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(148,163,184,0.55);
    font-weight: 600;
}
.nav-group-sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 3px 20px 3px 38px;
}

/* ============ RESPONSIVE ============ */
@@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}
