:root {
    --blue: #2563eb;
    --violet: #7c3aed;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --surface: rgba(255, 255, 255, .86);
    --bg: #f5f7fb;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at top left, rgba(37,99,235,.12), transparent 28rem), linear-gradient(135deg, #f8fafc, #eef2ff 52%, #fdfdfd); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: sticky; top: 0; width: 280px; height: 100vh; padding: 1.25rem; background: rgba(15, 23, 42, .94); color: white; backdrop-filter: blur(16px); transition: transform .25s ease; z-index: 20; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 800; letter-spacing: 0; }
.sidebar-brand { justify-content: flex-start; }
.sidebar-close { display: none; width: 44px; height: 44px; margin-left: auto; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; color: white; background: rgba(255,255,255,.1); }
.sidebar-backdrop { display: none; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--violet)); color: white; }
.sidebar .nav { margin-top: 2rem; }
.sidebar .nav-link { color: rgba(255,255,255,.76); border-radius: 8px; padding: .85rem .95rem; display: flex; align-items: center; gap: .75rem; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: white; background: rgba(255,255,255,.12); }
.main { flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 76px; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem; background: rgba(255,255,255,.82); border-bottom: 1px solid rgba(226,232,240,.8); backdrop-filter: blur(18px); }
.content { padding: 1.5rem; max-width: 1500px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.55rem, 3vw, 2.3rem); margin: 0; font-weight: 800; letter-spacing: 0; }
.page-head p { color: var(--muted); margin: .2rem 0 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat-card, .panel { background: var(--surface); border: 1px solid rgba(226,232,240,.9); border-radius: 8px; box-shadow: 0 18px 45px rgba(15, 23, 42, .07); }
.stat-card { padding: 1.15rem; display: grid; gap: .45rem; }
.stat-card span { color: var(--muted); font-size: .92rem; }
.stat-card strong { font-size: 1.35rem; line-height: 1.15; }
.stat-icon { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--blue), var(--violet)); }
.panel { padding: 1.15rem; }
.panel-title { font-weight: 800; margin-bottom: .9rem; }
.user-form { display: grid; gap: 1rem; }
.user-form-panel { padding: 1.35rem; }
.user-form-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.user-form-heading h2 { margin: .15rem 0 0; font-size: 1.12rem; font-weight: 800; letter-spacing: 0; }
.section-kicker { color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.section-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; color: var(--blue); background: rgba(37,99,235,.1); border: 1px solid rgba(37,99,235,.18); font-size: 1.1rem; }
.user-form-actions { display: flex; justify-content: flex-end; }
.pagination-shell { display: flex; justify-content: flex-end; margin-top: 1rem; overflow-x: auto; }
.pagination-shell nav { max-width: 100%; }
.pagination { flex-wrap: wrap; gap: .25rem; margin: 0; }
.page-link { border-radius: 8px; min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.page-item.active .page-link { background: var(--blue); border-color: var(--blue); }
.pagination svg { width: 18px; height: 18px; }
.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; margin-bottom: 1rem; }
.report-filter { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }
.report-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.report-tabs a, .report-tabs button { color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: .62rem .85rem; background: rgba(255,255,255,.72); font-weight: 700; }
.report-tabs a.active, .report-tabs a:hover, .report-tabs button.active, .report-tabs button:hover { color: white; background: var(--ink); border-color: var(--ink); }
.role-badge { background: rgba(37,99,235,.12); color: var(--blue); border: 1px solid rgba(37,99,235,.2); }
.status { display: inline-flex; align-items: center; padding: .32rem .58rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #eef2ff; color: #3730a3; }
.status.valide, .status.actif { background: #dcfce7; color: #166534; }
.status.refuse, .status.bloque { background: #fee2e2; color: #991b1b; }
.status.en_attente { background: #fef3c7; color: #92400e; }
.status.suppression_en_attente { background: #ffedd5; color: #9a3412; }
.status.approuvee { background: #dcfce7; color: #166534; }
.status.refusee { background: #fee2e2; color: #991b1b; }
.icon-btn { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.toastish { position: fixed; right: 1rem; top: 5rem; z-index: 30; padding: .85rem 1rem; border-radius: 8px; background: #ecfdf5; color: #166534; border: 1px solid #bbf7d0; box-shadow: 0 12px 35px rgba(15,23,42,.12); }
.balance { font-size: 1.4rem; color: var(--blue); }
.notification-row { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.notification-row:last-child { border-bottom: 0; }
.notification-row p { margin: .2rem 0; color: var(--muted); }
.notification-row.unread { background: rgba(37,99,235,.06); margin-inline: -.75rem; padding-inline: .75rem; border-radius: 8px; }
.dashboard-notification-alert { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; padding: .9rem 1rem; border: 1px solid #fbbf24; border-radius: 10px; background: #fffbeb; color: #92400e; text-decoration: none; box-shadow: 0 4px 14px rgba(146,64,14,.12); animation: notification-attention 1.8s ease-in-out infinite; }
.dashboard-notification-alert:hover { color: #78350f; }
.dashboard-notification-alert small { display: block; color: #a16207; }
.dashboard-notification-bell { font-size: 1.3rem; transform-origin: top center; animation: notification-ring 1.8s ease-in-out infinite; }
.panel-title { display: flex; align-items: center; gap: .5rem; }
.table-toggle { margin-left: auto; white-space: nowrap; }
@keyframes notification-attention { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); box-shadow: 0 8px 20px rgba(245,158,11,.28); } }
@keyframes notification-ring { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } 50% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .dashboard-notification-alert, .dashboard-notification-bell { animation: none; } }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at top left, #dbeafe, transparent 38%), #f8fafc; }
.auth-card { width: min(100%, 480px); padding: 2rem; border-radius: 18px; background: rgba(255,255,255,.96); border: 1px solid rgba(226,232,240,.9); box-shadow: 0 24px 70px rgba(15,23,42,.12); }
.auth-card-modern { padding: 2.5rem; }
.auth-brand { display: flex; justify-content: center; align-items: center; gap: .65rem; color: #0f172a; font-weight: 800; letter-spacing: .04em; font-size: .9rem; }
.auth-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 1.7rem auto 1rem; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #2563eb, #1d4ed8); font-size: 1.35rem; box-shadow: 0 10px 24px rgba(37,99,235,.25); }
.auth-card h1 { margin-bottom: .35rem; text-align: center; font-size: 1.75rem; font-weight: 800; letter-spacing: 0; }
.auth-subtitle { margin-bottom: 1.8rem; text-align: center; color: var(--muted); }
.auth-input { border: 1px solid #dbe3ef; border-radius: 10px; overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.auth-input:focus-within { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.auth-input .input-group-text, .auth-input .form-control, .password-toggle { border: 0; background: #fff; }
.auth-input .input-group-text { color: #64748b; padding-left: 1rem; }
.auth-input .form-control:focus { box-shadow: none; }
.password-toggle { color: #64748b; padding: 0 1rem; }
.auth-remember { color: #64748b; font-size: .92rem; }
.auth-submit { display: flex; justify-content: center; align-items: center; gap: .6rem; padding: .85rem; border-radius: 10px; font-weight: 700; transition: transform .2s, box-shadow .2s; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(37,99,235,.22); }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.error-box { width: min(100%, 520px); }
.error-panel { padding: 2rem; }
.error-code { color: var(--blue); font-size: 4rem; font-weight: 800; line-height: 1; }
.error-panel h1 { margin: 1rem 0 .5rem; font-size: 1.7rem; font-weight: 800; }
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 991px) {
    body { background: #f6f8fc; }
    .app-shell { display: block; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); height: 100vh; height: 100dvh; max-height: 100dvh; padding-top: max(1.25rem, env(safe-area-inset-top)); padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translateX(-100%); box-shadow: 18px 0 45px rgba(15,23,42,.22); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-brand { position: sticky; top: 0; z-index: 2; padding-bottom: .85rem; background: rgba(15, 23, 42, .98); }
    .sidebar-close { display: grid; place-items: center; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(15,23,42,.42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
    html.sidebar-is-open { overflow: hidden; }
    body.sidebar-is-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
    .sidebar-is-open .sidebar { touch-action: auto; }
    .sidebar-is-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .sidebar .nav { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
    .sidebar .nav-link { min-height: 46px; font-size: .95rem; }
    .main { min-height: 100vh; }
    .topbar { min-height: 62px; padding: .65rem .85rem; gap: .65rem; }
    .topbar .text-muted.small { display: none; }
    .topbar strong { display: block; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
    .topbar .ms-auto { gap: .45rem !important; }
    .topbar [data-live-sync] { display: none; }
    .role-badge { max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
    .content { padding: .85rem; padding-bottom: 1.25rem; }
    .page-head { margin-bottom: .85rem; }
    .page-head h1 { font-size: 1.35rem; }
    .page-head p { font-size: .9rem; }
    .panel, .stat-card { box-shadow: 0 8px 24px rgba(15,23,42,.06); }
    .panel { padding: .95rem; }
    .row.g-4 { --bs-gutter-y: .85rem; --bs-gutter-x: .85rem; }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; gap: .75rem; }
    .stat-card { grid-template-columns: 42px minmax(0, 1fr); align-items: center; padding: .9rem; }
    .stat-card span, .stat-card strong { grid-column: 2; }
    .stat-card .stat-icon { grid-row: 1 / span 2; }
    .stat-card strong { font-size: 1.12rem; overflow-wrap: anywhere; }
    .page-head { align-items: stretch; flex-direction: column; }
    .filter-bar, .report-filter { grid-template-columns: 1fr; }
    .user-form-heading, .user-form-actions { align-items: stretch; flex-direction: column; }
    .pagination-shell { justify-content: flex-start; }
    .btn, .form-control, .form-select { min-height: 44px; }
    .icon-btn { width: 44px; height: 44px; }
    .table-responsive { margin-inline: -.45rem; padding-inline: .45rem; }
    .table { min-width: 560px; font-size: .88rem; }
    .table th, .table td { white-space: nowrap; }
    .panel-title { font-size: .98rem; flex-wrap: wrap; }
    .table-toggle { margin-left: 0; }
    .dashboard-notification-alert { align-items: flex-start; padding: .8rem; margin-bottom: .85rem; }
    .dashboard-notification-alert .bi-arrow-right { display: none; }
    .toastish { left: .75rem; right: .75rem; top: 4.5rem; }
    .auth-page, .error-page { align-items: start; padding-top: 2rem; }
    .auth-card, .auth-card-modern, .error-panel { padding: 1.25rem; border-radius: 12px; }
}
