/* ===== BASE & RESET ===== */
*, *::before, *::after {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-w: 280px;
    --sidebar-collapsed: 80px;
    
    /* CUREBIT Enterprise Design System Tokens */
    --primary: #0f172a;
    --primary-dark: #020617;
    --primary-light: #f1f5f9;
    --brand-accent: #004d3f;
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Preserved Compatibility Colors */
    --accent: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Spacing System (8pt Grid) */
    --space-05: 4px;
    --space-1: 8px;
    --space-15: 12px;
    --space-2: 16px;
    --space-25: 20px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    
    /* Precision Radius Tokens */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    /* Precision Shadow Tokens */
    --shadow-light: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

.shadow-2xs { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04); }
.shadow-xs { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-sm { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04); }


html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

/* ===== ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.4s cubic-bezier(.4, 0, .2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.35s cubic-bezier(.4, 0, .2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    min-height: 100dvh;
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    color: white;
    z-index: 50;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(.4, 0, .2, 1);
}

/* ===== SIDEBAR PREMIUM BRANDING ===== */
.sidebar-header {
    height: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-container {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    outline: none;
}

.brand-container:hover {
    background: rgba(255, 255, 255, 0.06);
}

.logo-wrapper {
    height: 26px; /* Pixel-perfect premium sizing */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-logo {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transform-origin: left center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

/* Collapsed Branding */
.sidebar.collapsed .sidebar-header {
    padding: 0 8px;
    justify-content: center;
}

.sidebar.collapsed .brand-container {
    padding: 8px;
    justify-content: center;
}

.sidebar.collapsed .logo-wrapper {
    width: 26px; /* Shrinks the wrapper to just show the icon part of the logo */
}

.sidebar.collapsed .brand-logo {
    object-fit: cover;
    object-position: left center; /* Clips the text, keeps the icon */
    width: 26px;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-footer-text {
    display: none;
}

.sidebar.collapsed .nav-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .nav-icon {
    margin: 0;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 8px;
}

.sidebar.collapsed #userInfo > div {
    justify-content: center;
    padding: 8px 0;
}

.sidebar.collapsed .collapse-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #818cf8, #4f46e5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-subtitle {
    font-size: 10px;
    color: rgba(165, 180, 252, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    text-align: left;
    border: none;
    background: transparent;
    color: rgba(199, 210, 254, 0.8);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-left-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-btn.active-nav {
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #818cf8;
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #a5b4fc;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.collapse-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #818cf8;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapse-icon {
    transition: transform 0.3s;
}

.mobile-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left 0.3s cubic-bezier(.4, 0, .2, 1);
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
}

/* ===== TOP BAR ===== */
.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 500;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lab-name-badge {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    padding: 4px 14px;
    background: var(--gray-50);
    border-radius: 20px;
}

.mobile-menu-btn {
    display: none;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
}

.mobile-menu-btn:hover {
    background: var(--gray-100);
}

.page-container {
    padding: 24px;
}

/* ===== MOBILE ===== */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 45;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        max-width: calc(100vw - 40px);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.3s cubic-bezier(.4, 0, .2, 1), visibility 0.3s, width 0.3s;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    body.nav-open {
        overflow: hidden;
    }

    .mobile-close-btn {
        display: inline-flex;
    }

    .collapse-btn {
        display: none;
    }

    .sidebar-header {
        justify-content: space-between;
    }

    .sidebar-header .brand-container {
        width: auto;
        flex: 1;
        min-width: 0;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hide-mobile {
        display: none;
    }

    .page-container {
        padding: 16px;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-left {
        min-width: 0;
        flex: 1;
    }

    .topbar-left > div {
        min-width: 0;
        overflow: hidden;
    }

    .topbar-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-subtitle {
        display: none;
    }

    .topbar-right {
        flex-shrink: 0;
        gap: 8px;
    }

    .topbar .btn-sm {
        padding: 8px 10px;
        min-width: 36px;
        min-height: 36px;
    }

    .lab-name-badge {
        display: none;
    }
}

/* ===== BUTTONS (PREMIUM POLISH) ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    user-select: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-light);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.card-hover {
    transition: all 0.25s cubic-bezier(.4, 0, .2, 1);
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

.card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== STAT CARDS ===== */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.08;
}

.stat-card-1::before {
    background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
}

.stat-card-2::before {
    background: radial-gradient(circle, #10b981 0%, transparent 70%);
}

.stat-card-3::before {
    background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
}

.stat-card-4::before {
    background: radial-gradient(circle, #ef4444 0%, transparent 70%);
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--gray-800);
    margin-top: 8px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

.stat-sub-success {
    color: var(--success);
    font-weight: 600;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-1 {
    background: #eef2ff;
    color: var(--primary);
}

.stat-icon-2 {
    background: #ecfdf5;
    color: var(--success);
}

.stat-icon-3 {
    background: #fffbeb;
    color: var(--warning);
}

.stat-icon-4 {
    background: #fef2f2;
    color: var(--danger);
}

/* ===== FORMS ===== */
.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input-field {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all 0.2s;
    background: white;
    color: var(--text-main);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.input-field::placeholder {
    color: var(--text-muted);
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.search-input {
    padding-left: 40px;
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    font-size: 14px;
    border-collapse: collapse;
}

.data-table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    padding: 10px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody td {
    padding: 10px 20px;
}

.data-table tbody tr {
    transition: background 0.15s;
    border-bottom: 1px solid var(--gray-50);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

/* ===== STATUS BADGES ===== */
.badge {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-block;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ===== AVATAR ===== */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-md {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.avatar-indigo {
    background: #e0e7ff;
    color: var(--primary);
}

.avatar-emerald {
    background: #d1fae5;
    color: #059669;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    width: 100%;
    padding: 24px;
}

.modal-sm {
    max-width: 480px;
}

.modal-md {
    max-width: 640px;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 960px;
}

.modal-scrollable {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

/* ===== TEST CATEGORY FILTER ===== */
.test-cat-btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.test-cat-btn:hover {
    border-color: var(--gray-300);
}

.test-cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* ===== TEST SELECT CARD ===== */
.test-select-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

.test-select-card:hover {
    border-color: #c7d2fe;
    background: #fafafe;
}

.test-select-card.checked {
    border-color: var(--primary);
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-info {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

/* ===== PRINT REPORT ===== */
.report-table {
    border-collapse: collapse;
}

.report-table th {
    background: #1e40af;
    color: white;
}

.report-table td,
.report-table th {
    border: 1px solid #cbd5e8;
    padding: 6px 10px;
    font-size: 12px;
}

.report-table tr:nth-child(even) {
    background: #f0f4ff;
}

.abnormal {
    color: #dc2626;
    font-weight: 700;
}

@media print {
    body * {
        visibility: hidden !important;
    }

    #printArea,
    #printArea * {
        visibility: visible !important;
    }

    #printArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        z-index: 99999;
        background: white !important;
    }

    #printArea table {
        page-break-inside: avoid;
    }

    #printArea div[style*="page-break-inside"] {
        page-break-inside: avoid;
    }

    @page {
        margin: 5mm 6mm 6mm 6mm;
        size: A4;
    }

    /* Force print colors */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Hide scrollbars */
    ::-webkit-scrollbar {
        display: none;
    }

    /* Ensure grayscale compatibility */
    #printArea img {
        max-width: 100%;
    }

    /* Tighter spacing for print */
    #printArea td,
    #printArea th {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ===== GRID HELPERS ===== */
.grid {
    display: grid;
}

.grid-1 {
    grid-template-columns: 1fr;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-5 {
    gap: 20px;
}

.gap-6 {
    gap: 24px;
}

@media (max-width: 1024px) {
    .lg-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4,
    .lg-grid-3 {
        grid-template-columns: 1fr;
    }

    .sm-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .sm-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ===== M1 RESPONSIVE FOUNDATION UTILITIES ===== */
.main-content,
.page-container,
.card,
.container {
    max-width: 100%;
    min-width: 0;
}

.flex-child-safe {
    min-width: 0;
    max-width: 100%;
}

.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.responsive-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.action-group,
.responsive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.responsive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.scrollable-data-region {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

@media (max-width: 768px) {
    .responsive-grid,
    .responsive-form-grid {
        grid-template-columns: 1fr;
    }

    .mobile-stack {
        flex-direction: column;
        align-items: stretch;
    }

    .full-width-mobile {
        width: 100%;
        max-width: 100%;
    }
}

/* ===== FLEX HELPERS ===== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

/* ===== SPACING ===== */
.space-y-1>*+* {
    margin-top: 4px;
}

.space-y-2>*+* {
    margin-top: 8px;
}

.space-y-3>*+* {
    margin-top: 12px;
}

.space-y-4>*+* {
    margin-top: 16px;
}

.space-y-5>*+* {
    margin-top: 20px;
}

.space-y-6>*+* {
    margin-top: 24px;
}

/* ===== TEXT ===== */
.text-xs {
    font-size: 12px;
}

.text-sm {
    font-size: 14px;
}

.text-base {
    font-size: 16px;
}

.text-lg {
    font-size: 18px;
}

.text-xl {
    font-size: 20px;
}

.text-2xl {
    font-size: 24px;
}

.text-3xl {
    font-size: 30px;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.font-extrabold {
    font-weight: 800;
}

.text-gray-400 {
    color: var(--gray-400);
}

.text-gray-500 {
    color: var(--gray-500);
}

.text-gray-600 {
    color: var(--gray-600);
}

.text-gray-700 {
    color: var(--gray-700);
}

.text-gray-800 {
    color: var(--gray-800);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-white {
    color: white;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    padding: 48px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--gray-300);
}

/* ===== INFO GRID (Patient details in report) ===== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    font-size: 13px;
}

.info-label {
    font-size: 11px;
    color: var(--gray-400);
}

.info-value {
    font-weight: 600;
    color: var(--gray-800);
}

/* ===== TEMPLATE DETAIL ===== */
.template-detail {
    display: none;
}

.template-detail.show {
    display: block;
}

/* ===== SECTION TITLE ===== */
.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* ===== CHECKBOX ===== */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    border-radius: 4px;
    cursor: pointer;
}

input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
}

/* ===== GRADIENT BAR (for print) ===== */
.gradient-bar {
    height: 4px;
    border-radius: 2px;
}

/* ===== REPORT ENTRY TABLE ===== */
.test-panel-header {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.test-panel-title {
    font-weight: 700;
    font-size: 14px;
}

.test-panel-cat {
    font-size: 12px;
    color: rgba(199, 210, 254, 0.8);
}

.test-panel-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 20px;
}

/* ===== DASHED EMPTY ===== */
.dashed-empty {
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 40px 20px;
    text-align: center;
    background: var(--gray-50);
}

/* ===== AUTH SCREEN (SYNCHROMEDICS / CUREBIT SPLIT LAYOUT) ===== */
.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f7ff 50%, #dbeafe 100%);
    position: relative;
    overflow: hidden;
    padding: 24px 16px;
}

.auth-screen::before {
    content: '';
    position: absolute;
    top: -150px;
    left: -150px;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-screen::after {
    content: '';
    position: absolute;
    bottom: -150px;
    right: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

/* Split Card Container */
.synchro-auth-card {
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(0, 0, 0, 0.03);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 560px;
}

/* Left Hero Panel */
.synchro-hero-panel {
    background: linear-gradient(140deg, #0284c7 0%, #0369a1 40%, #1e3a8a 100%);
    padding: 48px 40px;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.synchro-dot-matrix {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 80px;
    height: 80px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.25) 2px, transparent 2px);
    background-size: 12px 12px;
    pointer-events: none;
}

.synchro-dot-matrix-br {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 100px;
    height: 100px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 2px);
    background-size: 12px 12px;
    pointer-events: none;
}

.synchro-hero-title {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: #ffffff;
}

.synchro-hero-subtitle {
    font-size: 14px;
    color: rgba(224, 242, 254, 0.85);
    margin-bottom: 36px;
    font-weight: 500;
}

.synchro-feature-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.synchro-feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #f0f9ff;
}

.synchro-feature-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Right Form Panel */
.synchro-form-panel {
    background: #f8fafc;
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.synchro-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.synchro-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.synchro-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.synchro-brand-name {
    font-size: 16px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: 0.05em;
}

.synchro-top-link {
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 11px;
    font-weight: 800;
    color: #475569;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.synchro-top-link:hover {
    border-color: #0284c7;
    color: #0284c7;
    background: #f0f9ff;
}

.synchro-form-title {
    font-size: 24px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

/* Segmented Role Switcher */
.synchro-tab-switcher {
    display: flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 22px;
}

.synchro-tab-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.synchro-tab-btn.active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Inputs styling for Synchromedics light mode */
.synchro-form .form-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
}

.synchro-form .input-field {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #0f172a;
    background: #ffffff;
    transition: all 0.2s ease;
}

.synchro-form .input-field:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    outline: none;
}

.synchro-btn-primary {
    width: 100%;
    height: 46px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: white;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.synchro-btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

@media (max-width: 820px) {
    .synchro-auth-card {
        grid-template-columns: 1fr;
    }
    .synchro-hero-panel {
        padding: 32px 24px;
    }
    .synchro-form-panel {
        padding: 28px 24px;
    }
}

.auth-form .btn-primary {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transition: all 0.3s;
}

.auth-form .btn-primary:hover {
    background: linear-gradient(135deg, #818cf8, #6366f1);
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transform: translateY(-2px);
}

.auth-form .btn-success {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.auth-form .btn-success:hover {
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transform: translateY(-2px);
}

.auth-form .btn-warning {
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
}

.auth-form .btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 13px 24px;
    font-weight: 600;
    transition: all 0.25s;
}

.auth-form .btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.auth-divider span {
    font-size: 11px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-link {
    background: none;
    border: none;
    color: #818cf8;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
    padding: 0;
}

.auth-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-error::before {
    content: '⚠';
    font-size: 16px;
    flex-shrink: 0;
}

.auth-form .text-sm.text-gray-400,
.auth-form .text-center.text-sm {
    color: rgba(148, 163, 184, 0.6) !important;
}

/* Auth features list */
.auth-features {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.5);
    font-weight: 500;
}

.auth-feature-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #818cf8;
    opacity: 0.6;
}

/* Btn loader spinner */
.btn-loader {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* Page loader */
.page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* Dashboard grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== PROFILE PAGE ===== */
.profile-cover {
    position: relative;
    overflow: hidden;
}

.profile-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, white 0%, rgba(255, 255, 255, 0.6) 40%, transparent 100%);
    pointer-events: none;
}

.profile-header-card {
    overflow: hidden;
    border-radius: var(--radius-xl);
}

/* Profile page: compact layout using the existing visual system */
.profile-layout {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
    gap: 16px 20px;
    align-items: start;
}

.profile-main-column,
.profile-side-column {
    display: contents;
}

.profile-section-card {
    padding: 20px !important;
}

.profile-identity-card { grid-column: 1; grid-row: 1; }
.profile-security-card { grid-column: 2; grid-row: 1; }
.profile-contact-card { grid-column: 1; grid-row: 2; }
.profile-activity-card { grid-column: 2; grid-row: 2; }
.profile-technician-card { grid-column: 1; grid-row: 3; }
.profile-pathologists-card { grid-column: 2; grid-row: 3; }

.profile-save-section {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 76px;
    padding: 16px 20px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
}

.profile-danger-card {
    grid-column: 1 / -1;
    grid-row: 5;
    padding: 20px !important;
}

.profile-page #pathologistContainer {
    gap: 12px !important;
}

.profile-header-gradient {
    height: 56px;
    background: white;
    position: relative;
    border-bottom: 1px solid var(--gray-200);
}

.profile-header-gradient::before {
    display: none;
}

.profile-header-gradient::after {
    display: none;
}

.profile-header-body {
    padding: 16px 22px 20px;
    margin-top: 0;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-main {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--gray-200);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
    font-size: 38px;
    font-weight: 800;
}

.profile-avatar-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--gray-100);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    color: var(--gray-600);
    transition: all 0.2s;
}

.profile-avatar-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
}

.profile-name {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-shadow: none;
    position: relative;
    z-index: 2;
}

.profile-role-text {
    font-size: 15px !important;
    color: #475569 !important;
    margin-top: 6px !important;
    font-weight: 600 !important;
    line-height: 1.4;
    position: relative;
    z-index: 2;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.profile-stats-box {
    display: flex;
    gap: 24px;
    padding: 14px 22px;
    background: var(--gray-50);
    border-radius: 14px;
    border: 1px solid var(--gray-200);
}

.profile-stat-item {
    text-align: center;
}

.profile-stat-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.profile-stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

/* Staff entry row */
.staff-entry-row {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    position: relative;
    transition: all 0.2s;
}

.staff-entry-row:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.staff-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.staff-remove-btn:hover {
    background: #fee2e2;
    color: var(--danger);
}

.staff-default-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1.5px solid var(--gray-200);
    background: white;
    color: var(--gray-500);
}

.staff-default-toggle.active {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.staff-default-toggle input[type="radio"] {
    display: none;
}

@media (max-width: 980px) {
    .profile-content-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-identity-card { grid-column: 1; grid-row: 1; }
    .profile-security-card { grid-column: 1; grid-row: 2; }
    .profile-contact-card { grid-column: 1; grid-row: 3; }
    .profile-activity-card { grid-column: 1; grid-row: 4; }
    .profile-technician-card { grid-column: 1; grid-row: 5; }
    .profile-pathologists-card { grid-column: 1; grid-row: 6; }
    .profile-save-section { grid-column: 1; grid-row: 7; }
    .profile-danger-card { grid-column: 1; grid-row: 8; }
}

@media (max-width: 540px) {
    .profile-layout {
        gap: 12px;
    }

    .profile-section-card,
    .profile-danger-card {
        padding: 16px !important;
    }

    .profile-save-section {
        min-height: auto;
        padding: 14px 16px;
    }

    .profile-save-section .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .profile-header-gradient {
        height: 48px;
    }

    .profile-header-body {
        padding: 16px 16px 20px;
        margin-top: 0;
    }

    .profile-avatar-main {
        width: 80px;
        height: 80px;
        font-size: 30px;
    }

    .profile-name {
        font-size: 20px;
    }

    .profile-stats-box {
        gap: 14px;
        padding: 10px 16px;
    }

    .profile-stat-value {
        font-size: 18px;
    }
}

/* Profile textarea */
.profile-page textarea.input-field {
    min-height: 80px;
}

/* Auth responsive */
@media (max-width: 480px) {
    .auth-container {
        padding: 12px;
    }

    .auth-logo {
        padding: 28px 20px 20px;
    }

    .auth-form {
        padding: 24px 20px;
    }

    .auth-features {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .auth-logo-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }

    .auth-title {
        font-size: 24px;
    }
}


/* ==================== DESKTOP GRADE ENHANCEMENTS ==================== */

/* Enhanced Button Active States */
.btn-primary:hover, .btn-success:hover, .btn-warning:hover, .btn-danger:hover {
    transform: translateY(-2px) !important;
}

.btn:active { transform: translateY(0) scale(0.98) !important; }

/* Enhanced Card Hover with Better Shadow */
.card { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 20px 45px -10px rgba(0,0,0,0.15), 0 10px 20px -8px rgba(0,0,0,0.08); }

/* Smooth Input Focus with Scale */
.input-field:focus { transform: scale(1.01); box-shadow: 0 0 0 4px rgba(79,70,229,0.12) !important; }

/* Smooth Table Row Hover */
.data-table tbody tr:hover { transform: translateX(4px); }

/* Icon Button Polish */
.btn-icon:hover { transform: scale(1.15); }
.btn-icon:active { transform: scale(0.95); }

/*  Stat Card Hover */
.stat-card:hover { transform: translateY(-3px); }

/* Skeleton Loading Animation */
@keyframes shimmer {
   0% { background-position: -1000px 0; }
   100% { background-position: 1000px 0; }
}

.skeleton {
   background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
   background-size: 1000px 100%;
   animation: shimmer 2s infinite linear;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
   *, *::before, *::after {
       animation-duration: 0.01ms !important;
       transition-duration: 0.01ms !important;
   }
}

/* Focus Visible for Better Accessibility */
*:focus-visible {
   outline: 2px solid var(--primary);
   outline-offset: 2px;
}

/* ===== OPTIMIZED REPORT FLOW STYLES ===== */
.report-flow-container {
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 120px; /* Space for sticky footer */
}

.step-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    position: relative;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--gray-100);
    padding-bottom: 16px;
}

.step-indicator {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.selection-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.search-box {
    flex: 1;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.modern-select {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 16px;
    background-color: var(--gray-50);
}

.recent-patients {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.recent-patients span {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
}

/* ==================== OPTIMIZED FLOW STYLES ==================== */
.step-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.step-card.active {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary-dark);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

/* Chips for Recent Patients */
.chip-interactive {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.chip-interactive:hover {
    background: var(--primary-light);
    border-color: var(--primary-dark);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.chip-icon {
    color: var(--gray-400);
}

/* Test Preset Cards */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.test-preset-card {
    background: white;
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.test-preset-card:hover {
    border-color: var(--primary-dark);
    background: var(--primary-light);
    transform: scale(1.02);
}

.preset-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--primary-dark);
}

.preset-desc {
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Sticky Action Bar */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 260px; /* Sidebar width */
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--gray-200);
    padding: 16px 40px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

@media (max-width: 1024px) {
    .sticky-footer { left: 0; padding: 16px 20px; }
}

.btn-xl {
    padding: 16px 32px;
    font-size: 16px;
    letter-spacing: 1px;
    font-weight: 800;
}

/* High Contrast Results Table */
.results-entry-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.results-entry-table td {
    padding: 12px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
}

.results-entry-table td:first-child { border-left: 1px solid var(--gray-200); border-radius: 8px 0 0 8px; }
.results-entry-table td:last-child { border-right: 1px solid var(--gray-200); border-radius: 0 8px 8px 0; }

.result-input {
    width: 100%;
    padding: 12px;
    border: 2px solid transparent;
    background: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    transition: all 0.2s;
}

.result-input:focus {
    border-color: var(--primary-dark);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-light);
    transform: scale(1.05);
}

.chip {
    padding: 6px 16px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--primary);
    color: white;
}

.presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.preset-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-weight: 700;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.test-grid-optimized {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.test-card-opt {
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    position: relative;
}

.test-card-opt:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.test-card-opt.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.test-card-content {
    display: flex;
    flex-direction: column;
}

.test-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-800);
}

.test-meta {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

.sticky-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    background: white;
    padding: 20px 40px;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.05);
    border-top: 1px solid var(--gray-200);
    z-index: 100;
    transition: left 0.3s ease;
}

.main-content.expanded .sticky-footer {
    left: var(--sidebar-collapsed);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-primary-xl {
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-lg);
    font-size: 18px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
    transition: all 0.3s;
}

.btn-primary-xl:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(79, 70, 229, 0.4);
}

.status-msg-opt {
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-msg-opt::before {
    content: '●';
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* ===== PREMIUM SaaS COMPONENTS ===== */

/* Progress Steps */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-8);
    position: relative;
    padding: 0 var(--space-4);
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--gray-200);
    z-index: 1;
}

.step-item {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.step-dot {
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    color: var(--gray-400);
    transition: all var(--transition-base);
}

.step-item.active .step-dot {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-item.completed .step-dot {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.step-item.active .step-label {
    color: var(--primary);
}

/* Premium Footer Action Bar */
.action-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: var(--space-4) var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: left var(--transition-base);
}

.sidebar.collapsed ~ .main-content .action-bar {
    left: var(--sidebar-collapsed);
}

.action-bar-left {
    display: flex;
    gap: var(--space-6);
}

.action-bar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
}

.action-bar-right {
    display: flex;
    gap: var(--space-4);
}

/* Billing Widget */
.billing-widget {
    background: var(--gray-50);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.billing-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.billing-value {
    font-size: 18px;
    font-weight: 900;
    color: var(--gray-900);
}

/* Specialized Buttons */
.btn-generate {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 14px 48px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

.btn-generate:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(79, 70, 229, 0.5);
}

/* Empty States */
.guidance-card {
    padding: var(--space-12) var(--space-8);
    text-align: center;
    background: linear-gradient(180deg, white 0%, var(--gray-50) 100%);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-xl);
}

.guidance-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.guidance-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-800);
    margin-bottom: var(--space-2);
}

.guidance-text {
    font-size: 14px;
    color: var(--gray-500);
    max-width: 400px;
    margin: 0 auto;
}

/* Layout Helpers */
.max-w-screen { max-width: 1200px; margin: 0 auto; }
.flex-1 { flex: 1; }
.gap-6 { gap: 24px; }
.p-10 { padding: 40px; }

/* ===== NEW REPORT PREMIUM REDESIGN ===== */
.nr-shell {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 100px 0;
    display: grid;
    gap: 16px;
}

.nr-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    padding: 20px 24px;
}

.nr-step-locked {
    opacity: 0.5;
    pointer-events: none;
}

.nr-section-head {
    margin-bottom: 14px;
}

.nr-section-head h3 {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 2px;
}

.nr-section-head p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Step Indicator (Progress Bar) */
.nr-progress {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    position: relative;
    margin-bottom: 4px;
    padding: 12px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.nr-progress__track {
    position: absolute;
    top: 26px;
    left: 40px;
    right: 40px;
    height: 4px;
    background: var(--gray-200);
    z-index: 0;
    border-radius: 2px;
}

.nr-progress__fill {
    position: absolute;
    top: 26px;
    left: 40px;
    height: 4px;
    background: var(--primary);
    z-index: 0;
    border-radius: 2px;
    transition: width 0.3s ease;
    max-width: calc(100% - 80px);
}

.nr-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: white;
    padding: 0 12px;
    min-width: 0;
    text-align: center;
}

.nr-step__dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    color: var(--gray-400);
    transition: all 0.2s;
}

.nr-step__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    max-width: 100%;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.nr-step.active .nr-step__dot {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.nr-step.completed .nr-step__dot {
    border-color: var(--primary);
    background: white;
    color: var(--primary);
}

.nr-step.active .nr-step__label,
.nr-step.completed .nr-step__label {
    color: var(--text-main);
}

@media (max-width: 720px) {
    .nr-progress {
        padding: 14px 10px;
        gap: 4px;
    }

    .nr-progress__track {
        left: 30px;
        right: 30px;
    }

    .nr-progress__fill {
        left: 30px;
        max-width: calc(100% - 60px);
    }

    .nr-step {
        padding: 0 4px;
    }

    .nr-step__label {
        font-size: 11px;
    }
}

/* Forms */
.nr-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.nr-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.nr-input-wrap {
    position: relative;
}

.nr-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.nr-input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px 0 48px;
    font-size: 14px;
    color: var(--text-main);
    background: white;
    transition: all 0.2s;
}

.nr-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Diagnostic Cards */
.nr-test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.nr-test-card {
    text-align: left;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-light);
}

.nr-test-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.nr-test-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.nr-test-card__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.nr-test-card__desc {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Presets & Chips */
.nr-presets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: 14px;
}

.nr-preset {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    background: white;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nr-preset:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.nr-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nr-chip {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 6px 14px;
    background: white;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.nr-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Empty State */
.nr-empty-state {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    padding: 36px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nr-empty-state__icon {
    color: var(--gray-400);
    margin-bottom: 12px;
}

.nr-empty-state h4 {
    font-size: 17px;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 6px;
}

.nr-empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 400px;
}

/* Action Bar */
.nr-action-bar {
    position: fixed;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    z-index: 40;
    background: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    padding: 12px calc((100% - 1400px) / 2 + 24px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: left 0.3s, padding 0.3s;
}

@media (max-width: 1448px) {
    .nr-action-bar {
        padding: 12px 24px;
    }
}

.main-content.expanded .nr-action-bar {
    left: var(--sidebar-collapsed);
}

.nr-action-left {
    display: flex;
    align-items: center;
}

.nr-action-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nr-action-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nr-stat {
    display: flex;
    flex-direction: column;
}

.nr-stat__label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.nr-stat__value {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 800;
}

.nr-generate-btn {
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: all 0.2s;
}

.nr-generate-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.nr-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nr-cash-wrap {
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.nr-cash-wrap label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.nr-cash-wrap input {
    width: 100px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    outline: none;
}

/* Results Grid */
.nr-result-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: white;
    box-shadow: var(--shadow-light);
}

.nr-result-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.nr-result-panel__head h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.nr-result-panel__head button {
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.nr-results-table {
    width: 100%;
    border-collapse: collapse;
}

.nr-results-table th,
.nr-results-table td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.nr-results-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #fafafa;
}

.nr-results-table tr:hover {
    background-color: var(--gray-50);
}

.nr-results-table td:nth-child(1) {
    font-weight: 600;
    color: var(--text-main);
}

.nr-result-input {
    width: 100%;
    max-width: 130px;
    height: 38px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.nr-empty-state h4 {
    font-size: 17px;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 6px;
}

.nr-empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 400px;
}

/* Action Bar */
.nr-action-bar {
    position: fixed;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    z-index: 40;
    background: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    padding: 12px calc((100% - 1400px) / 2 + 24px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: left 0.3s, padding 0.3s;
}

@media (max-width: 1448px) {
    .nr-action-bar {
        padding: 12px 24px;
    }
}

.main-content.expanded .nr-action-bar {
    left: var(--sidebar-collapsed);
}

.nr-action-left {
    display: flex;
    align-items: center;
}

.nr-action-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nr-action-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nr-stat {
    display: flex;
    flex-direction: column;
}

.nr-stat__label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.nr-stat__value {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 800;
}

.nr-generate-btn {
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: all 0.2s;
}

.nr-generate-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.nr-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nr-cash-wrap {
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.nr-cash-wrap label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.nr-cash-wrap input {
    width: 100px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    outline: none;
}

/* Results Grid */
.nr-result-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: white;
    box-shadow: var(--shadow-light);
}

.nr-result-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.nr-result-panel__head h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.nr-result-panel__head button {
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.nr-results-table {
    width: 100%;
    border-collapse: collapse;
}

.nr-results-table th,
.nr-results-table td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.nr-results-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: #fafafa;
}

.nr-results-table tr:hover {
    background-color: var(--gray-50);
}

.nr-results-table td:nth-child(1) {
    font-weight: 600;
    color: var(--text-main);
}

.nr-result-input {
    width: 100%;
    max-width: 130px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s;
}

.nr-result-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Helpers */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .nr-grid-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PHASE M3: DASHBOARD RESPONSIVE ARCHITECTURE & LAYOUT HARDENING
   ========================================================================== */

/* Root Dashboard Container */
.dashboard-container {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

/* Expiration Alert Banner */
.dashboard-banner-alert {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.3);
    gap: 12px;
    min-width: 0;
}

.dashboard-banner-alert > div {
    min-width: 0;
    flex: 1;
}

/* Header Banner / Command Center */
.dashboard-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: white;
    border-radius: 14px;
    padding: 18px 24px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

/* KPI Grid */
.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    min-width: 0;
}

/* KPI Stat Card */
.dashboard-stat-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
    position: relative;
    overflow: hidden;
    cursor: default;
    min-width: 0;
}

.dashboard-stat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.dashboard-stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.03em;
    min-width: 0;
}

.dashboard-stat-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

/* Main Body Layout Grid (Primary M3 Bug Fix) */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
    min-width: 0;
}

/* Dashboard Panel & Section Cards */
.dashboard-panel {
    overflow: hidden;
    min-width: 0;
}

.dashboard-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Table Wrapper for Touch Scrolling */
.dashboard-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dashboard-table-row {
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.dashboard-table-row:hover {
    background: #f8fafc;
}

.dashboard-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.dashboard-action-btn:hover {
    border-color: #0f172a;
    color: #0f172a;
    background: #f8fafc;
}

/* Right Sidebar Column & Quick Launch Grid */
.dashboard-sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.dashboard-quick-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.dashboard-quick-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    min-width: 0;
}

.dashboard-quick-btn:hover {
    border-color: var(--hover-border, #e2e8f0);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* System Status Card */
.dashboard-system-status {
    border-radius: 14px;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.30);
    min-width: 0;
}

/* Responsive Rules for Dashboard */
@media (max-width: 768px) {
    /* Collapse main 1fr 300px grid into single column (1fr) per Adjustment 1 */
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-banner-alert {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    /* Stack KPI cards into full-width cards on narrow phones per Adjustment 3 */
    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stat-card {
        padding: 16px;
        min-height: 110px;
    }

    .dashboard-header-card,
    .dashboard-system-status {
        padding: 16px;
    }
}

/* ==========================================================================
   PHASE M4: CORE CLINICAL WORKFLOW MOBILE REMEDIATION
   (Patients, New Report, Result Entry, Reports)
   ========================================================================== */

:root {
    --nr-mobile-action-space: 120px; /* Tablet 2-row action dock reservation */
}

/* Root Containers (Adhering to Adjustment 3 and 18: NO 100vw, NO overflow-x: hidden) */
.patient-container,
.report-container,
.nr-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    min-width: 0;
}

/* Hero & Workspace Header Cards */
.patient-hero-card,
.report-header-card,
.nr-hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    background: white;
    border-radius: 14px;
    padding: 18px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-width: 0;
}

/* Toolbars (Search & Filter Bars) */
.patient-toolbar,
.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: white;
    border-bottom: 1px solid var(--gray-100);
    padding: 14px 20px;
    min-width: 0;
}

.patient-toolbar-search,
.report-toolbar-search {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 200px;
    min-width: 0;
    max-width: 420px;
}

/* Diagnostic Panel Department Grid Layout (C4.1 Responsive Remediation) */
.nr-dept-block {
    width: 100%;
    margin-bottom: 24px;
}

.nr-test-container {
    width: 100%;
}

.nr-test-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.nr-test-card {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1279px) {
    .nr-test-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (max-width: 1023px) {
    .nr-test-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 639px) {
    .nr-test-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Table Wrappers & Intrinsic Widths (Adhering to Adjustment 4, 11, 13, 17, 24) */
.patient-table-wrapper,
.report-table-wrapper,
.nr-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

/* Result Entry Table Intrinsic Width (Strategy A) */
.nr-results-table {
    min-width: 620px; /* Evidence-based width for 4 clinical columns: Parameter(200)+Result(140)+Unit(80)+Ref(200) */
    width: 100%;
}

.nr-results-table th,
.nr-results-table td {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

/* Report Preview Modal (Adhering to Adjustment 14, 15, 16, 17) */
.report-preview-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.report-preview-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

/* Sticky Action Dock Safe Area (Adhering to Adjustment 6) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .nr-action-bar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* Responsive Rules for Clinical Workflows */
@media (max-width: 768px) {
    :root {
        --nr-mobile-action-space: 130px;
    }

    /* Enforce bottom padding on shell so sticky action dock never obscures form/buttons */
    .nr-shell {
        padding-bottom: var(--nr-mobile-action-space) !important;
    }

    /* 2-row density-preserving action dock on tablet/mobile per Adjustment 7 */
    .nr-action-bar {
        flex-wrap: wrap;
        gap: 12px;
        left: 0 !important;
        padding: 12px 16px;
    }
    .nr-action-left {
        flex: 1 1 45%;
    }
    .nr-action-right {
        flex: 1 1 45%;
        justify-content: flex-end;
    }
    .nr-action-center {
        width: 100%;
        order: 3;
    }
    .nr-generate-btn {
        width: 100%;
        justify-content: center;
    }

    /* Diagnostic test cards safe auto-fill */
    .nr-test-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .report-preview-header {
        padding: 12px 16px;
    }
    .nr-results-table th,
    .nr-results-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --nr-mobile-action-space: 175px; /* 3-row stack on narrow phones */
    }

    /* Stack left and right action dock items on narrow phones */
    .nr-action-left,
    .nr-action-right {
        flex: 1 1 100%;
        width: 100%;
        justify-content: space-between;
    }

    /* Stack test cards to 1 full-width column on narrow phones per Adjustment 8 */
    .nr-test-grid {
        grid-template-columns: 1fr;
    }

    /* Step progress bar layout adaptation per Adjustment 9 */
    .nr-progress {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 12px 8px !important;
    }
    .nr-progress__track,
    .nr-progress__fill {
        display: none !important;
    }
    .nr-step {
        padding: 0 2px !important;
        justify-content: flex-start;
    }
    .nr-step__label {
        font-size: 11.5px !important;
        line-height: 1.3;
        margin-top: 4px;
    }

    /* Full width toolbars per Adjustment 10 */
    .patient-toolbar,
    .report-toolbar {
        padding: 12px 14px;
    }
    .patient-toolbar-search,
    .report-toolbar-search {
        width: 100%;
        flex-basis: 100%;
        max-width: 100%;
    }
    .patient-hero-card,
    .report-header-card,
    .nr-hero-card {
        padding: 16px;
    }
}
