:root {
    --sidebar-w: 250px;
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #0f172a;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.15rem 1.25rem;
    font-weight: 700; font-size: 1.05rem; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: #818cf8; font-size: 1.4rem; }

.sidebar .nav { padding: .75rem .5rem; gap: .15rem; flex: 1; }
.sidebar .nav-link {
    color: #cbd5e1; border-radius: .5rem;
    padding: .6rem .85rem; display: flex; align-items: center; gap: .75rem;
    font-size: .93rem;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; }

.sidebar-footer { padding: .75rem 0 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.role-badge { background: #6366f1; }

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

.topbar {
    background: var(--card);
    border-bottom: 1px solid #e5e7eb;
    padding: .75rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
    position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; }

.content { padding: 1.5rem; flex: 1; }
.app-footer {
    padding: 1rem 1.5rem; display: flex; justify-content: space-between;
    color: var(--muted); font-size: .85rem; border-top: 1px solid #e5e7eb;
}

/* ---------- Cards / stats ---------- */
.card { border: none; border-radius: .8rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.stat-icon {
    width: 52px; height: 52px; border-radius: .7rem; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.bg-indigo { background: var(--brand); }
.bg-emerald { background: #10b981; }
.bg-amber { background: #f59e0b; }
.bg-sky { background: #0ea5e9; }
.bg-rose { background: #f43f5e; }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #0ea5e9); padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 410px; }

/* ---------- Utilities ---------- */
.table-responsive { border-radius: .6rem; }
.avatar-initials {
    width: 36px; height: 36px; border-radius: 50%; background: var(--brand);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600;
}
.file-chip i { font-size: 1.15rem; margin-right: .35rem; color: var(--brand); }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}
