:root {
    --app-bg: #f5f7fb;
    --sidebar-bg: #0f172a;
    --sidebar-soft: #1e293b;
    --primary: #2563eb;
    --primary-soft: #dbeafe;
    --cyan: #0ea5e9;
    --text: #1f2937;
    --muted: #64748b;
    --card-border: #e5e7eb;
    --radius: 18px;
}

* { box-sizing: border-box; }

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

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

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 24px 18px;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .35);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 16px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: 0 12px 30px rgba(37, 99, 235, .35);
}

.brand-title { font-weight: 800; letter-spacing: .2px; }
.brand-subtitle { color: #94a3b8; font-size: .85rem; }

.sidebar-nav .nav-link {
    color: #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
    transition: all .18s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, .09);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-nav .nav-link i { font-size: 1.1rem; }
.sidebar-footer { margin-top: auto; }

.app-main {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: 100vh;
}

.login-main {
    margin-left: 0;
    width: 100%;
}

.topbar {
    height: 92px;
    padding: 22px 34px;
    background: rgba(245, 247, 251, .92);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.content-area { padding: 32px 34px; }

.app-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 14px 38px rgba(15, 23, 42, .06);
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 128px;
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -40px;
    top: -40px;
    border-radius: 999px;
    background: var(--primary-soft);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
}

.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: .92rem; }

.table thead th {
    color: #475569;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom-width: 1px;
}

.table td { vertical-align: middle; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 22px rgba(37, 99, 235, .18);
}

.form-control, .form-select {
    border-radius: 12px;
    border-color: #d9dee8;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.searchbox { width: 320px; }

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--card-border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    color: #475569;
    font-size: .9rem;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(37, 99, 235, .16), transparent 30%),
        radial-gradient(circle at 80% 0%, rgba(14, 165, 233, .18), transparent 28%),
        #f5f7fb;
}

.login-card {
    width: min(440px, calc(100vw - 32px));
    border: 0;
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .13);
}

.section-title {
    font-weight: 800;
    letter-spacing: -.02em;
}

.note-box {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 16px;
    padding: 16px;
}

@media (max-width: 992px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }
    .app-shell { display: block; }
    .app-main { margin-left: 0; width: 100%; }
    .topbar { height: auto; position: static; align-items: flex-start !important; gap: 16px; }
    .content-area { padding: 22px; }
}
