:root {
    --sidebar-width: 240px;
}

body {
    background: #f4f6fb;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.25s ease;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .nav-link .ms-2,
.sidebar.collapsed .fw-bold { display: none; }

.sidebar .nav-link {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff !important;
}

/* Main */
.main-content {
    min-height: 100vh;
    overflow-x: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 99;
    min-height: 54px;
}

.content-area {
    min-height: calc(100vh - 110px);
}

/* Cards */
.stat-card {
    border-radius: 14px;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Tables */
.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

/* Badges */
.badge { font-weight: 500; }

/* Print report */
@media print {
    .sidebar, .topbar, footer, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
    body { background: #fff; }
    .print-report { max-width: 100%; }
}

/* Login page */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
}

.login-card {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

/* Report print layout */
.report-header-line {
    border-top: 3px solid #0d6efd;
    border-bottom: 1px solid #dee2e6;
}

.result-table th { background: #e9ecef; }
.result-abnormal { color: #dc3545; font-weight: 600; }

/* ===== Mobile responsive ===== */
.sb-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1049;
}
.sb-backdrop.show { display: block; }

@media (max-width: 767.98px) {
    .sidebar {
        position: fixed !important;
        top: 0; left: 0;
        height: 100vh;
        width: 240px !important;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1050;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        width: 100%;
    }
    .content-area {
        padding: 1rem !important;
    }
    .topbar {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
    /* Reduce stat card padding on small screens */
    .stat-card .p-3 { padding: .75rem !important; }
}
