:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --primary: #1e3a8a;
    --primary-light: #2563eb;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success-bg: #ecfdf5;
    --success-border: #10b981;
    --success-text: #065f46;
    --danger-bg: #fef2f2;
    --danger-border: #ef4444;
    --danger-text: #991b1b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* Header */
.topbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff;
    padding: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.18);
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-icon {
    font-size: 2.4rem;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand p {
    font-size: 0.9rem;
    color: #cbd5e1;
}

.badges {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-verified {
    background: #10b981;
    color: #fff;
}

.badge-tech {
    background: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Main Navigation Tabs */
.tab-nav {
    display: flex;
    gap: 0.6rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.tab-btn {
    flex: 1;
    min-width: 170px;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.tab-btn.active {
    background: var(--primary-light);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.kpi-top {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.kpi-icon {
    font-size: 2rem;
}

.kpi-top h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.kpi-sub {
    font-size: 0.82rem;
    color: var(--muted);
}

.kpi-metrics {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid #f1f5f9;
}

.kpi-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 600;
}

.kpi-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.btn-outline {
    width: 100%;
    padding: 0.65rem;
    background: transparent;
    border: 1px solid var(--primary-light);
    color: var(--primary-light);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-outline:hover {
    background: var(--primary-light);
    color: #fff;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
}

.chart-card h3, .chart-card h4 {
    margin-bottom: 0.85rem;
    font-size: 1.05rem;
    color: var(--text);
}

.chart-card img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Forms */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

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

.form-card-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
}

.form-card-header p {
    color: var(--muted);
    font-size: 0.92rem;
}

.preset-btns {
    display: flex;
    gap: 0.65rem;
}

.btn-preset {
    padding: 0.55rem 0.95rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-healthy {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.btn-healthy:hover {
    background: #d1fae5;
}

.btn-risk {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.btn-risk:hover {
    background: #fee2e2;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.15rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: #1e293b;
}

.unit-tag {
    color: var(--muted);
    font-weight: 500;
}

.form-control {
    padding: 0.6rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #f8fafc;
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.form-actions {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.btn-submit {
    width: 100%;
    padding: 0.95rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-submit:hover {
    opacity: 0.96;
}

/* Result Card */
.result-card {
    border-radius: 14px;
    padding: 1.6rem;
    margin-bottom: 1.75rem;
    border-left: 6px solid;
    background: var(--surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.result-danger {
    border-left-color: var(--danger-border);
    background: linear-gradient(to right, #fef2f2 0%, #ffffff 100%);
}

.result-success {
    border-left-color: var(--success-border);
    background: linear-gradient(to right, #ecfdf5 0%, #ffffff 100%);
}

.result-pill {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(15, 23, 42, 0.08);
    margin-bottom: 0.4rem;
}

.result-header h2 {
    font-size: 1.45rem;
    margin-bottom: 0.25rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.result-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.result-panel h4 {
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.mini-table th, .mini-table td {
    text-align: left;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.mini-table th {
    color: var(--muted);
    font-weight: 700;
}

.recommendations-box {
    margin-top: 1.15rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.recommendations-box h4 {
    margin-bottom: 0.5rem;
}

.recommendations-box ul {
    padding-left: 1.2rem;
    font-size: 0.92rem;
}

.eval-block {
    margin-bottom: 2.5rem;
}

.eval-block h2 {
    margin-bottom: 0.35rem;
}

.eval-summary {
    color: var(--muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--muted);
    font-size: 0.88rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
