:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #697386;
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --teal: #14b8a6;
    --purple: #7c3aed;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --sidebar: #101828;
    --sidebar-soft: #182235;
    --border: #e6eaf2;
    --radius: 22px;
    --shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
body {
    background: radial-gradient(circle at top left, rgba(59,130,246,.10), transparent 32%), var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 292px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 35% 0%, rgba(20,184,166,.22), transparent 34%),
        linear-gradient(180deg, #0f172a 0%, #111827 55%, #0b1120 100%);
    color: #fff;
    padding: 24px 18px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 14px 0 45px rgba(15, 23, 42, .18);
}
.brand-wrap { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; padding: 6px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand-logo {
    width: 48px; height: 48px; display: grid; place-items: center; border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--teal)); color: #fff; font-size: 1.35rem;
    box-shadow: 0 15px 30px rgba(59, 130, 246, .25);
}
.brand-title { font-weight: 800; font-size: 1.12rem; letter-spacing: .2px; }
.brand-subtitle { color: rgba(255,255,255,.66); font-size: .86rem; }
.user-card-mini {
    display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid rgba(255,255,255,.09);
    background: rgba(255,255,255,.06); border-radius: 22px; margin-bottom: 18px; backdrop-filter: blur(12px);
}
.avatar-circle {
    width: 44px; height: 44px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 auto;
    background: rgba(255,255,255,.14); font-weight: 800;
}
.sidebar-nav { display: grid; gap: 6px; }
.sidebar-nav .nav-link {
    color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: 16px; font-weight: 600; transition: .2s ease; letter-spacing: .1px;
}
.sidebar-nav .nav-link i { width: 22px; text-align: center; font-size: 1.05rem; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); transform: translateX(2px); }
.sidebar-nav .nav-link.active { color: #fff; background: linear-gradient(135deg, rgba(59,130,246,.95), rgba(20,184,166,.90)); box-shadow: 0 14px 28px rgba(20, 184, 166, .16); }
.sidebar-footer { margin-top: auto; }

.main-content { margin-left: 292px; width: calc(100% - 292px); min-height: 100vh; }
.topbar {
    min-height: 92px; display: flex; align-items: center; gap: 16px; padding: 22px 30px 10px;
}
.page-title { font-size: 1.58rem; font-weight: 850; letter-spacing: -.5px; }
.page-subtitle { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.topbar-date { align-items: center; color: var(--muted); background: #fff; border: 1px solid var(--border); padding: 11px 16px; border-radius: 16px; box-shadow: 0 10px 25px rgba(16,24,40,.04); }
.content-wrap { padding: 18px 30px 36px; }

.stat-card, .panel-card, .table-card {
    background: rgba(255,255,255,.94); border: 1px solid rgba(230,234,242,.95); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-card { padding: 22px; position: relative; overflow: hidden; min-height: 138px; }
.stat-card::after { content: ''; position: absolute; right: -28px; bottom: -38px; width: 126px; height: 126px; background: rgba(59,130,246,.08); border-radius: 50%; }
.stat-label { color: var(--muted); font-size: .9rem; font-weight: 700; }
.stat-value { font-size: 1.58rem; font-weight: 850; margin-top: 8px; letter-spacing: -.5px; }
.stat-icon { width: 48px; height: 48px; border-radius: 17px; display: grid; place-items: center; font-size: 1.32rem; }
.icon-primary { background: rgba(59,130,246,.12); color: var(--primary-dark); }
.icon-success { background: rgba(16,185,129,.12); color: var(--success); }
.icon-danger { background: rgba(239,68,68,.12); color: var(--danger); }
.icon-warning { background: rgba(245,158,11,.14); color: var(--warning); }
.icon-purple { background: rgba(124,58,237,.12); color: var(--purple); }

.panel-card { padding: 22px; }
.card-title-line { display:flex; align-items:center; justify-content:space-between; gap: 12px; margin-bottom: 16px; }
.card-title-line h5 { font-weight: 800; margin: 0; }
.table-card { overflow: hidden; }
.table-card .table { margin: 0; }
.table thead th { background: #f8fafc; color: #475467; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.table tbody td { padding: 14px 16px; vertical-align: middle; color: #263246; border-bottom-color: #edf1f7; }
.table tbody tr:hover { background: #fbfdff; }
.badge { font-weight: 700; }
.form-control, .form-select { border-radius: 15px; padding: 11px 13px; border-color: #d9e1ec; }
.form-control:focus, .form-select:focus { border-color: rgba(59,130,246,.60); box-shadow: 0 0 0 .24rem rgba(59,130,246,.10); }
.btn { font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: 0; box-shadow: 0 12px 24px rgba(59,130,246,.18); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); border: 0; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); border: 0; }
.btn-outline-primary, .btn-outline-danger, .btn-outline-secondary, .btn-outline-success { border-radius: 14px; }
.soft-alert { border: 0; border-radius: 18px; box-shadow: 0 10px 25px rgba(16,24,40,.05); }

.hero-panel {
    padding: 28px; border-radius: 28px; color: #fff; overflow: hidden; position: relative;
    background: linear-gradient(135deg, #1d4ed8, #0f766e 58%, #111827);
    box-shadow: 0 22px 55px rgba(30,64,175,.20);
}
.hero-panel::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.11); right: -80px; top: -90px; }
.hero-panel::after { content: ''; position: absolute; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.08); left: 35%; bottom: -120px; }
.hero-panel > * { position: relative; z-index: 1; }
.hero-kicker { opacity: .82; font-weight: 700; }
.hero-value { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 900; letter-spacing: -1.5px; }
.hero-meta { opacity: .84; }

.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(59,130,246,.20), transparent 28%),
        radial-gradient(circle at 85% 20%, rgba(20,184,166,.18), transparent 30%),
        linear-gradient(135deg, #f8fafc, #eef5ff);
}
.login-card { width: min(1040px, 100%); background: #fff; border-radius: 34px; box-shadow: 0 30px 80px rgba(15,23,42,.13); overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(230,234,242,.9); }
.login-visual { padding: 42px; color: #fff; background: linear-gradient(145deg, #1d4ed8, #0f766e); position: relative; overflow: hidden; }
.login-visual::after { content:''; position:absolute; width:320px; height:320px; right:-120px; top:-120px; border-radius:50%; background:rgba(255,255,255,.12); }
.login-form { padding: 42px; }
.login-logo { width: 62px; height: 62px; border-radius: 22px; display:grid; place-items:center; background: rgba(255,255,255,.15); font-size: 1.7rem; margin-bottom: 28px; }
.demo-pill { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18); border-radius: 18px; padding: 12px; }

.print-only { display: none; }

@media (max-width: 991px) {
    .sidebar { transform: translateX(-110%); transition: .25s ease; }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .topbar { padding: 18px 18px 8px; }
    .content-wrap { padding: 14px 18px 28px; }
    .login-card { grid-template-columns: 1fr; }
    .login-visual { display: none; }
}

@media print {
    body { background: #fff; }
    .sidebar, .topbar, .no-print, .btn, form, .alert { display: none !important; }
    .main-content { margin-left: 0; width: 100%; }
    .content-wrap { padding: 0; }
    .panel-card, .table-card, .stat-card { box-shadow: none; border: 1px solid #ddd; }
    .print-only { display: block; }
}
