:root {
    --app-primary: #0d6efd;
    --app-sidebar: #111827;
    --app-sidebar-2: #1f2937;
    --app-bg: #f3f5f9;
}

* { box-sizing: border-box; }

body {
    background: var(--app-bg);
    color: #1f2937;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .9rem;
    min-height: 100vh;
}

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

.app-sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--app-sidebar) 0%, var(--app-sidebar-2) 100%);
    color: #fff;
    border: 0;
}

.app-sidebar-header { padding: 1.15rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.app-sidebar-header strong { font-size: 1rem; letter-spacing: .2px; }
.app-sidebar-header small { font-size: .7rem; }

.app-logo {
    width: 38px; height: 38px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--app-primary); color: #fff; font-size: 1.15rem;
    flex: 0 0 auto;
}

.app-nav-label {
    padding: 1.25rem 1.4rem .5rem;
    font-size: .67rem; letter-spacing: 1.4px; font-weight: 700;
    color: rgba(255,255,255,.42);
}

.app-nav .nav-link {
    color: rgba(255,255,255,.72);
    padding: .65rem .85rem;
    margin-bottom: .2rem;
    border-radius: 9px;
    display: flex; align-items: center;
    transition: .15s ease;
}
.app-nav .nav-link i { font-size: 1.05rem; }
.app-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-nav .nav-link.active { color: #fff; background: var(--app-primary); box-shadow: 0 6px 16px rgba(0,0,0,.18); }

.app-sidebar-user { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: .85rem; }
.app-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.12); color: #fff; font-size: 1.2rem;
}
.app-avatar-light { background: #eef2f7; color: #495057; }
.min-w-0 { min-width: 0; }

.app-content { min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: nowrap;
    gap: 1rem;
    min-height: 70px;
    padding: .7rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e9f0;
}
.app-page-title { font-size: 1.1rem; font-weight: 700; }
.app-breadcrumb { margin-top: .1rem; }

.app-topnav {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    gap: .15rem;
}
.app-topnav::-webkit-scrollbar { display: none; }
.app-topnav .nav-link {
    padding: .45rem .6rem;
    border-radius: 8px;
    color: #64748b;
    font-size: .82rem;
    white-space: nowrap;
}
.app-topnav .nav-link i { font-size: .95rem; }
.app-topnav .nav-link:hover { color: #0f172a; background: #f1f5f9; }
.app-topnav .nav-link.active {
    color: var(--app-primary);
    background: rgba(var(--bs-primary-rgb), .1);
    font-weight: 600;
}

.app-main { flex: 1 1 auto; padding-top: 1.5rem; padding-bottom: 2rem; }
.app-footer { padding: 1rem 1.5rem; text-align: center; color: #94a3b8; font-size: .78rem; border-top: 1px solid #e5e9f0; background: #fff; }

.card { border: 1px solid #e5e9f0; border-radius: 14px; box-shadow: 0 2px 10px rgba(15,23,42,.035); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f5; padding: .9rem 1.15rem; }
.card-body { padding: 1.15rem; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.3rem; background: rgba(13,110,253,.1); color: var(--app-primary);
}
.stat-card .stat-icon.green { background: rgba(25,135,84,.1); color: #198754; }
.stat-card .stat-icon.orange { background: rgba(255,193,7,.15); color: #b58100; }
.stat-card .stat-icon.purple { background: rgba(111,66,193,.1); color: #6f42c1; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.5px; }
.stat-card .stat-label { color: #6c757d; font-size: .78rem; }

.filter-bar { background: #fff; border: 1px solid #e5e9f0; border-radius: 14px; padding: 1rem; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .85rem; }
.filter-bar label { font-size: .72rem; font-weight: 600; color: #6c757d; text-transform: uppercase; letter-spacing: .4px; }

.table { --bs-table-bg: transparent; }
.table thead th {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .5px;
    color: #7c8798; font-weight: 700; white-space: nowrap;
    background: #f8fafc; border-bottom: 1px solid #e5e9f0;
}
.table tbody td { vertical-align: middle; font-size: .84rem; border-bottom: 1px solid #f0f2f6; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-actions { white-space: nowrap; }
.table-actions .btn { padding: .25rem .45rem; line-height: 1; }

.cell-title { font-weight: 600; color: #1f2937; }
.cell-sub { font-size: .74rem; color: #94a3b8; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }

.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

.badge { font-weight: 600; font-size: .7rem; }

.login-page { background: linear-gradient(135deg, #eef4ff 0%, #f8fafc 55%, #e9f7f1 100%); min-height: 100vh; }
.login-card { border: 0; border-radius: 18px; box-shadow: 0 18px 50px rgba(15,23,42,.09); }
.login-aside { background: linear-gradient(155deg, var(--app-sidebar) 0%, #1e3a5f 100%); }
.login-aside h2 { letter-spacing: -.5px; }
.login-feature { display: flex; gap: .7rem; align-items: flex-start; color: rgba(255,255,255,.85); }
.login-feature i { color: #7dd3fc; font-size: 1.1rem; margin-top: .15rem; }

.info-list dt { font-size: .72rem; text-transform: uppercase; color: #94a3b8; font-weight: 700; letter-spacing: .4px; }
.info-list dd { font-size: .86rem; margin-bottom: .8rem; word-break: break-word; }

@media (min-width: 992px) {
    .app-sidebar {
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1030 !important;
        width: 250px !important;
        height: 100vh !important;
        flex-grow: 0 !important;
        visibility: visible !important;
        transform: none !important;
        border: 0 !important;
        background: linear-gradient(180deg, var(--app-sidebar) 0%, var(--app-sidebar-2) 100%) !important;
    }
    .app-sidebar .offcanvas-header { display: flex !important; }
    .app-sidebar-body {
        flex: 1 1 auto !important;
        height: 100% !important;
        overflow-y: auto !important;
    }
    .app-content { margin-left: 250px; }
}

@media (max-width: 991.98px) {
    .offcanvas-lg { width: min(290px, 85vw); }
    .app-topbar { padding: .65rem 1rem; min-height: 62px; }
    .app-main { padding-left: 1rem; padding-right: 1rem; }
    .stat-card .stat-value { font-size: 1.35rem; }
    .chart-box { height: 230px; }
    .table { font-size: .8rem; }
}

@media (max-width: 575.98px) {
    .app-page-title { font-size: 1rem; }
    .filter-bar .btn { width: 100%; }
    .card-body { padding: .9rem; }
    .chart-box { height: 220px; }
    .table-actions .btn { padding: .3rem; }
}
