:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-focus: #3b82f6;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --status-normal-bg: #ecfdf5;
    --status-normal-text: #047857;
    --status-normal-border: #a7f3d0;
    
    --status-warning-bg: #fffbeb;
    --status-warning-text: #b45309;
    --status-warning-border: #fde68a;
    
    --status-danger-bg: #fef2f2;
    --status-danger-text: #b91c1c;
    --status-danger-border: #fecaca;
    
    --status-info-bg: #eff6ff;
    --status-info-text: #1d4ed8;
    --status-info-border: #bfdbfe;

    --status-neutral-bg: #f1f5f9;
    --status-neutral-text: #475569;
    --status-neutral-border: #cbd5e1;

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-xs);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-text span {
    color: var(--primary);
}

.nav-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--primary-border);
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 2.25rem;
    padding-bottom: 3.5rem;
}

.hero-section {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-tag {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.85rem;
}

.hero-section h1 {
    font-size: 2.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.hero-section p {
    color: var(--text-muted);
    max-width: 780px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.6;
}

/* Kartu & Form */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
}

.profile-generator-card {
    border-top: 4px solid var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.2rem;
}

.live-status-pill {
    padding: 0.35rem 0.8rem;
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
    border: 1px solid var(--status-neutral-border);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.live-status-pill.active {
    background: var(--status-normal-bg);
    color: var(--status-normal-text);
    border-color: var(--status-normal-border);
}

/* Grid & Input Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.profile-controls {
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.input-group label .req {
    color: #ef4444;
}

.input-group label .opt {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}

.input-group input, 
.input-group select {
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.input-group input:focus, 
.input-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.input-addon-wrapper {
    display: flex;
    align-items: stretch;
}

.input-addon-wrapper input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.addon-select {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-left: none !important;
    background-color: #f8fafc !important;
    font-weight: 600;
    cursor: pointer;
    width: 105px;
}

.actions-inline {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: flex-start;
}

/* Tombol */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.4rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
    flex: 2;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid var(--border);
    flex: 1;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-sm {
    padding: 0.45rem 0.95rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Banner Notifikasi Terpilih */
.reference-banner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--primary-border);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1.15rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-xs);
    animation: fadeIn 0.3s ease-out;
}

.banner-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.banner-content {
    flex: 1;
}

.banner-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.15rem;
}

.banner-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Sub Navigasi (Sub Menu Tab Utama) */
.main-sub-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sub-nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.sub-nav-btn:hover {
    border-color: var(--primary-border);
    background: #fafcff;
}

.sub-nav-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-text strong {
    font-size: 1rem;
    color: var(--text-main);
}

.nav-text small {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.sub-nav-btn.active .nav-text strong {
    color: var(--primary);
}

/* Kontrol Tampilan Sub View */
.sub-view-section {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.sub-view-section.active {
    display: block;
}

/* Tab Bar Filter Kategori Lab */
.filter-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
}

/* Toolbar Pencarian */
.search-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
}

.search-box input {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    background: #ffffff;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.quick-stats-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tabel Klinis */
.table-responsive {
    overflow-x: auto;
}

.clinical-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.clinical-table th {
    background: #f8fafc;
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: #334155;
    border-bottom: 2px solid var(--border);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.clinical-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.clinical-table tr:hover {
    background-color: #fbfdff;
}

.param-title {
    font-weight: 700;
    color: var(--text-main);
    display: block;
}

.param-category-label {
    font-size: 0.72rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.range-highlight {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    background: #f1f5f9;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.unit-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.patient-input-cell input {
    width: 100%;
    max-width: 130px;
    padding: 0.45rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
}

.patient-input-cell input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Badges Status */
.badge {
    display: inline-block;
    padding: 0.28rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-normal {
    background: var(--status-normal-bg);
    color: var(--status-normal-text);
    border-color: var(--status-normal-border);
}

.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
    border-color: var(--status-warning-border);
}

.badge-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
    border-color: var(--status-danger-border);
}

.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info-text);
    border-color: var(--status-info-border);
}

.badge-neutral {
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
    border-color: var(--status-neutral-border);
}

.clinical-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Grid Kartu Skor Antropometri */
.score-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.score-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--shadow-xs);
}

.score-card-title {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.score-card-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.score-card-status {
    font-size: 0.8rem;
    font-weight: 700;
}

/* Disclaimer Box */
.clinical-disclaimer {
    margin-top: 1.5rem;
    padding: 1.1rem 1.4rem;
    background: #f8fafc;
    border-left: 4px solid #64748b;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.disclaimer-badge {
    background: #475569;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.clinical-disclaimer p {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.5;
}

/* Loader */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1.75rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
}

.footer-sub {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* Cetak / Print */
@media print {
    .navbar, 
    .hero-section, 
    .profile-generator-card, 
    .main-sub-nav,
    .filter-tab-bar, 
    .search-toolbar, 
    .banner-actions,
    .footer,
    #antropoSubForm {
        display: none !important;
    }
    body {
        background: #ffffff;
        font-size: 10pt;
    }
    .card {
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    .sub-view-section {
        display: block !important;
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .main-sub-nav {
        grid-template-columns: 1fr;
    }
    .actions-inline {
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
    .reference-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}