:root {
    --bg-body: #f8fafc; --bg-card: #ffffff; --text-heading: #0f172a; --text-body: #334155; 
    --text-muted: #64748b; --border-light: #e2e8f0; --primary-blue: #1e40af; 
    --danger-red: #dc2626; --success-green: #16a34a; --disabled-bg: #f1f5f9;
}

body { font-family: 'Inter', sans-serif; background-color: var(--bg-body); color: var(--text-body); line-height: 1.6; padding: 40px 20px; max-width: 1300px; margin: 0 auto; box-sizing: border-box; }

.header { text-align: center; margin-bottom: 30px; }
.header h1 { color: var(--text-heading); font-size: 2.5rem; font-weight: 800; margin-bottom: 5px; }
.header p { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; margin-bottom: 20px; }

.social-links { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.social-links a { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 20px; text-decoration: none; color: var(--text-heading); font-weight: 600; font-size: 0.9rem; transition: all 0.2s; }
.social-links a:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.social-links i { width: 16px; height: 16px; }

.info-box { background: #eff6ff; border-left: 4px solid var(--primary-blue); padding: 25px; border-radius: 8px; margin-bottom: 30px; }
.disclaimer { font-size: 0.85rem; color: var(--text-muted); margin-top: 15px; border-top: 1px solid #bfdbfe; padding-top: 10px; }

.controls-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.controls-right { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; border: none; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.btn-outline { background: var(--bg-card); border: 1px solid var(--border-light); color: var(--text-heading); }
.btn-outline:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.btn-danger-outline { background: #fff1f2; border: 1px solid #fecdd3; color: var(--danger-red); }
.btn-danger-outline:hover { background: #ffe4e6; }
.btn-primary { background: var(--primary-blue); color: white; box-shadow: 0 4px 6px -1px rgba(30, 64, 175, 0.2); }
.btn-primary:hover { background: #1e3a8a; transform: translateY(-1px); }

.dashboard-top { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.metric-card { background: var(--bg-card); padding: 30px; border-radius: 16px; border: 1px solid var(--border-light); text-align: center; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.metric-label { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-value { font-size: 2.2rem; font-weight: 800; color: var(--text-heading); }
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; margin-top: 10px; }
.status-good { background: #dcfce7; color: #166534; }
.status-bad { background: #fee2e2; color: #991b1b; }
.status-surplus { background: #fef08a; color: #92400e; }

.levers-container { background: var(--bg-card); padding: 25px; border-radius: 16px; border: 1px solid var(--border-light); margin-bottom: 20px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.lever-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; }
.lever-item { display: flex; flex-direction: column; gap: 8px; }
.lever-header { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.95rem; color: var(--text-heading); }
.lever-value { color: var(--primary-blue); font-weight: 800; }
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 20px; width: 20px; border-radius: 50%; background: var(--primary-blue); cursor: pointer; margin-top: -8px; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; cursor: pointer; background: #cbd5e1; border-radius: 3px; }
input[type=range]:focus { outline: none; }

.chart-container { background: var(--bg-card); padding: 25px; border-radius: 16px; border: 1px solid var(--border-light); margin-bottom: 40px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); width: 100%; box-sizing: border-box; }

.section-title { font-size: 1.5rem; font-weight: 800; color: var(--text-heading); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid var(--border-light); }
.inputs-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px; margin-bottom: 40px; }
.input-group { background: var(--bg-card); padding: 25px; border-radius: 12px; border: 1px solid var(--border-light); }
.input-group h3 { margin-top: 0; color: var(--text-heading); margin-bottom: 20px; font-size: 1.2rem; border-bottom: 1px solid var(--border-light); padding-bottom: 10px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; color: var(--text-heading); }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--border-light); border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 1rem; box-sizing: border-box; transition: 0.2s; }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1); }
.field input[readonly] { background-color: #f8fafc; color: var(--text-muted); cursor: not-allowed; font-weight: 600; border-color: var(--border-light); }

.error-msg { font-size: 0.85rem; color: var(--danger-red); margin-top: 5px; font-weight: 600; display: none; }
.warn-msg { font-size: 0.85rem; color: #b45309; margin-top: 5px; font-weight: 600; display: none; background: #fef3c7; padding: 6px; border-radius: 4px;}
.input-error { border-color: var(--danger-red) !important; background-color: #fef2f2 !important; }

.hc-insight { font-size: 0.85rem; font-weight: 600; color: var(--primary-blue); margin-top: 6px; }
.stress-test-box { background: #fffbeb; border: 1px solid #fde68a; padding: 15px; border-radius: 8px; margin-bottom: 15px; }
.stress-test-box label { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 0; font-weight: 600; color: #92400e; }

.goals-container { background: var(--bg-card); padding: 25px; border-radius: 12px; border: 1px solid var(--border-light); margin-bottom: 40px; overflow-x: auto; }
.goal-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr auto; gap: 15px; align-items: end; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #f1f5f9; min-width: 800px; }
.btn-remove { background: #fee2e2; color: var(--danger-red); border: none; padding: 10px 15px; border-radius: 8px; font-weight: 600; cursor: pointer; }

.surplus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; }
.surplus-card { background: #fffbeb; border: 1px solid #fde68a; padding: 20px; border-radius: 8px; }
.surplus-title { font-weight: 700; color: #92400e; margin-bottom: 10px; font-size: 1.1rem; }

/* PERFECT PDF EXPORT STYLES */
#pdf-export-container { display: none; font-family: 'Inter', sans-serif; color: #0f172a; background: white; width: 297mm; margin: 0; padding: 0; }
.pdf-page { width: 297mm; height: 209mm; padding: 12mm 15mm; box-sizing: border-box; page-break-after: always; break-after: page; position: relative; background: white; overflow: hidden; }
.pdf-page:last-child { page-break-after: auto; break-after: auto; }
.pdf-header { text-align: center; border-bottom: 2px solid #1e40af; padding-bottom: 10px; margin-bottom: 15px; }
.pdf-title { font-size: 24px; font-weight: 800; color: #0f172a; margin: 0 0 5px 0; letter-spacing: -0.5px; }
.pdf-subtitle { font-size: 11px; color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.pdf-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.pdf-p { font-size: 13.5px; line-height: 1.5; margin: 0 0 8px 0; color: #334155; text-align: justify; }
.pdf-h2 { font-size: 18px; color: #1e40af; font-weight: 800; margin: 0 0 8px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px; }
.pdf-data-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 12px; margin-top: 10px; }
.pdf-data-row { display: flex; justify-content: space-between; border-bottom: 1px solid #f1f5f9; padding: 5px 0; font-size: 12.5px; }
.pdf-data-row:last-child { border-bottom: none; }
.pdf-data-label { color: #64748b; font-weight: 600; }
.pdf-data-value { color: #0f172a; font-weight: 800; text-align: right; }
.pdf-highlight-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-left: 5px solid #16a34a; padding: 15px; border-radius: 6px; margin-bottom: 12px; }
.pdf-highlight-box.deficit { background: #fef2f2; border-color: #fecaca; border-left-color: #dc2626; }
.pdf-highlight-box.surplus { background: #fffbeb; border-color: #fde68a; border-left-color: #ca8a04; }
.pdf-metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,0.05); }
.pdf-metric-title { font-size: 11px; text-transform: uppercase; color: #64748b; font-weight: 700; margin-bottom: 2px; }
.pdf-metric-data { font-size: 22px; font-weight: 800; color: #0f172a; }
.pdf-section { margin-top: 5px; }
.pdf-chart-img { width: 100%; max-height: 125mm; object-fit: contain; margin: 10px 0; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); background: white; }
.pdf-footer { position: absolute; bottom: 10mm; left: 15mm; right: 15mm; padding-top: 8px; border-top: 2px solid #e2e8f0; font-size: 10px; color: #64748b; text-align: center; background: white; z-index: 10; }

/* Modal Styles */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--bg-card); width: 95%; max-width: 650px; max-height: 90vh; overflow-y: auto; border-radius: 16px; padding: 30px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); position: relative; }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--danger-red); }
.modal-title { font-size: 1.5rem; font-weight: 800; color: var(--text-heading); margin-bottom: 10px; display: flex; align-items: center; gap: 10px;}
.modal-body { font-size: 0.95rem; color: var(--text-body); margin-bottom: 10px; line-height: 1.6;}
.modal-footer { margin-top: 15px; border-top: 1px solid var(--border-light); padding-top: 20px; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 20px; font-weight: 600; font-size: 0.9rem; cursor: pointer; color: var(--text-heading);}
.consent-check input { margin-top: 4px; }

@media (max-width: 768px) { 
    .dashboard-top { grid-template-columns: 1fr; } 
    .modal-content { padding: 20px; }
}