:root {
    --primary:     #4f46e5;
    --primary-dark:#4338ca;
    --bg:          #f1f5f9;
    --card-bg:     #ffffff;
    --text-muted:  #64748b;
}

body {
    background-color: var(--bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ── Auth pages ── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 2.5rem;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #fff;
    font-size: 1.5rem;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .25rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 2rem;
}

.form-label {
    font-weight: 500;
    font-size: .875rem;
}

.form-control {
    border-radius: .5rem;
    padding: .6rem .85rem;
    border-color: #e2e8f0;
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: .5rem;
    font-weight: 600;
    padding: .65rem;
    transition: background-color .2s, border-color .2s;
}

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

.btn-primary:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.divider {
    text-align: center;
    color: var(--text-muted);
    font-size: .82rem;
    margin: 1.25rem 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e2e8f0;
}

.divider::before { left: 0; }
.divider::after  { right: 0; }

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .875rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

/* ── Alert ── */
.alert-custom {
    border-radius: .5rem;
    font-size: .875rem;
    padding: .75rem 1rem;
    display: none;
}

/* ── Password strength ── */
.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin-top: .35rem;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .3s, background .3s;
    width: 0;
}

/* ── Dashboard ── */
.navbar-brand { font-weight: 700; font-size: 1.2rem; }
.navbar-brand span { color: var(--primary); }

.sidebar {
    background: var(--card-bg);
    border-right: 1px solid #e2e8f0;
    min-height: calc(100vh - 56px);
    padding: 1.5rem 1rem;
}

.sidebar .nav-link {
    color: #374151;
    border-radius: .5rem;
    padding: .6rem .9rem;
    font-weight: 500;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    transition: background .15s, color .15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(79,70,229,.08);
    color: var(--primary);
}

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

.content-area {
    padding: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: .75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.stat-card h6 { font-size: .78rem; color: var(--text-muted); margin: 0 0 .2rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-card p  { font-size: 1.5rem; font-weight: 700; margin: 0; }

.welcome-banner {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    border-radius: .75rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.welcome-banner h2 { font-weight: 700; margin-bottom: .25rem; }
.welcome-banner p  { opacity: .85; margin: 0; }

/* ── Spinner ── */
.spinner-border-sm { width: 1rem; height: 1rem; }

/* ── Avatar circle ── */
.avatar-circle {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Logout button in banner ── */
.btn-logout-banner {
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.5);
    color: #fff;
    font-weight: 600;
    border-radius: .5rem;
    transition: background .2s;
}
.btn-logout-banner:hover {
    background: rgba(255,255,255,.28);
    color: #fff;
}

/* ── Welcome banner (override for flex) ── */
.welcome-banner { align-items: center !important; }

/* ── Stat cards (column mode for small tiles) ── */
.stat-card.flex-column {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 1rem;
}
.stat-card.flex-column p { font-size: 1.3rem; }

/* ── Chart cards ── */
.chart-card {
    background: var(--card-bg);
    border-radius: .75rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    overflow: hidden;
}
.chart-card-header {
    padding: .9rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}
.chart-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.text-purple { color: #7c3aed !important; }

/* ── Donut wrapper ── */
.donut-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto .75rem;
}
.donut-wrapper canvas { display: block; }
.donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    pointer-events: none;
}

/* ── Chart legend ── */
.chart-legend { width: 100%; }
.legend-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    padding: .25rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.legend-row:last-child { border-bottom: none; }
.legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.legend-label { color: var(--text-muted); flex: 1; }

/* ── Avatar small variant ── */
.avatar-sm {
    width: 28px !important;
    height: 28px !important;
    font-size: .75rem !important;
}

/* ── Role badges ── */
.badge-role {
    display: inline-flex;
    align-items: center;
    padding: .3rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
}
.badge-admin  { background: rgba(79,70,229,.12); color: #4f46e5; }
.badge-membre { background: rgba(100,116,139,.1); color: #475569; }

/* ── Status dot ── */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: .35rem;
}
.status-dot.active { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }

/* ── Table ── */
.table > :not(caption) > * > * { padding-top: .85rem; padding-bottom: .85rem; }
.table-hover tbody tr:hover { background-color: rgba(79,70,229,.03); }

/* ── Modal icons ── */
.modal-icon-danger,
.modal-icon-primary {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 1rem auto .5rem;
}
.modal-icon-danger  { background: rgba(239,68,68,.12);  color: #ef4444; }
.modal-icon-primary { background: rgba(79,70,229,.12);  color: #4f46e5; }

/* ── Live badge pulse ── */
@keyframes pulse-badge {
    0%   { opacity: 1; }
    50%  { opacity: .4; }
    100% { opacity: 1; }
}
#refreshBadge.pulse { animation: pulse-badge .8s ease; }
