:root {
    --sidebar-w: 250px;
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --topbar-h: 60px;
    --bg: #f4f5fb;
}

body { background: var(--bg); }

/* ===== App shell ===== */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-content { padding: 1.5rem; flex: 1; }

/* ===== Sidebar ===== */
.app-sidebar {
    width: var(--sidebar-w);
    background: #1e293b;
    color: #cbd5e1;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left .25s ease;
}
.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1.25rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,.15);
    letter-spacing: .04em;
}
.sidebar-brand i { color: var(--brand); }
.app-sidebar .nav-link {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    border-radius: 0;
    font-size: .93rem;
    transition: background .15s, color .15s;
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar .nav-link.active {
    background: var(--brand);
    color: #fff;
    font-weight: 500;
    box-shadow: inset 3px 0 0 #fff3;
}
.app-sidebar .nav-link i { width: 20px; text-align: center; font-size: 1.05rem; }
.nav-section {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .08em;
    color: #64748b;
    padding: 1rem 1.25rem .35rem;
    font-weight: 600;
}

/* ===== Topbar ===== */
.app-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.sidebar-toggle { font-size: 1.4rem; color: #334155; padding: 0; text-decoration: none; }
.role-badge { background: #eef2ff; color: var(--brand-dark); font-weight: 600; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: none; background: none; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}

/* ===== Cards / stat tiles ===== */
.stat-card {
    background: #fff; border-radius: .8rem; padding: 1.25rem;
    border: 1px solid #eceef4;
    display: flex; align-items: center; gap: 1rem;
    height: 100%;
}
.stat-card .stat-icon {
    width: 52px; height: 52px; border-radius: .7rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { color: #6b7280; font-size: .85rem; margin-top: .25rem; }
.bg-indigo { background: #6366f1; } .bg-teal { background: #14b8a6; }
.bg-amber { background: #f59e0b; } .bg-rose { background: #f43f5e; }
.bg-sky { background: #0ea5e9; } .bg-emerald { background: #10b981; }

.card { border: 1px solid #eceef4; border-radius: .8rem; }
.report-tile { transition: transform .12s, box-shadow .12s; }
.report-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(79,70,229,.12); }
.card-header { background: #fff; border-bottom: 1px solid #f1f2f6; font-weight: 600; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* status pill */
.status-pill { display: inline-block; padding: .25rem .6rem; border-radius: 1rem; font-size: .78rem; font-weight: 600; color: #fff; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding-left: 1.6rem; padding-bottom: 1.1rem; border-left: 2px solid #e5e7eb; margin-left: .4rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }

/* ===== Auth ===== */
.auth-body { background: linear-gradient(135deg, #4f46e5, #7c3aed); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card-wrap { width: 100%; max-width: 400px; padding: 1rem; }
.auth-brand { text-align: center; color: #fff; margin-bottom: 1.5rem; }
.auth-brand i { font-size: 2.5rem; }
.auth-brand h1 { font-size: 1.4rem; margin-top: .5rem; font-weight: 700; }
.auth-card-wrap .card { border: none; box-shadow: 0 12px 40px rgba(0,0,0,.2); }

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .app-sidebar { position: fixed; z-index: 1050; margin-left: calc(-1 * var(--sidebar-w)); box-shadow: 2px 0 20px rgba(0,0,0,.2); }
    .app-shell.sidebar-open .app-sidebar { margin-left: 0; }
    .app-shell.sidebar-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1040; }
}
@media (min-width: 993px) { .sidebar-toggle { display: none; } }
