:root {
    --navy: #1e3a8a;
    --navy-dark: #172554;
    --gold: #f59e0b;
    --green: #22c55e;
    --red: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
}

* { box-sizing: border-box; }

body { 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    background: var(--bg); 
    margin: 0; 
    color: #1e293b; 
    /* Allows natural scrolling on smaller desktop screens */
    overflow-x: hidden; 
}

/* Header */
.main-header {
    background: var(--navy); 
    color: white; 
    padding: 1rem 2rem;
    display: flex; 
    flex-direction: column; 
    gap: 1rem; 
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo { font-size: 1.5rem; font-weight: 800; }
.logo span { color: var(--gold); }

.header-actions { 
    display: flex; 
    gap: 0.5rem; 
    width: 100%; 
    max-width: 500px; 
}

select, .btn-gold { 
    flex: 1; 
    padding: 0.6rem; 
    border-radius: 6px; 
    border: none; 
    font-weight: 600; 
    cursor: pointer;
}

.btn-gold { background: var(--gold); color: var(--navy); transition: 0.2s; }
.btn-gold:hover { background: #d97706; }

/* Responsive Grid */
.dashboard-container {
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
    padding: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
}

.panel { 
    background: var(--card); 
    padding: 1.25rem; 
    border-radius: 8px; 
    border: 1px solid var(--border); 
    margin-bottom: 1rem; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); 
}

.panel h3 { 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    color: var(--navy); 
    border-bottom: 2px solid var(--gold); 
    margin-bottom: 1.25rem; 
    padding-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* Inputs */
.input-grid { display: flex; flex-direction: column; gap: 0.8rem; }
.input-grid label { 
    font-size: 0.85rem; 
    color: #64748b; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.input-grid input { 
    width: 130px; 
    padding: 0.4rem; 
    border: 1px solid var(--border); 
    border-radius: 4px; 
    text-align: right; 
    font-weight: 700; 
    color: var(--navy);
}

/* Summary Components */
.summary-hero { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.score-card { background: var(--navy); color: white; padding: 1.5rem; border-radius: 12px; text-align: center; flex: 1; }
.score-num { font-size: 3.5rem; font-weight: 800; color: var(--gold); line-height: 1; }
.status-text { margin-top: 0.5rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.category-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.grade-item { background: white; border: 1px solid var(--border); padding: 0.75rem; border-radius: 6px; text-align: center; font-size: 0.75rem; }

/* FIX: Chart Box Height Constraint */
.chart-box { 
    position: relative; 
    height: 450px; /* Fixed ceiling for the chart */
    width: 100%;
}

/* Table Visibility Fixes */
.table-scroll { width: 100%; overflow-x: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
th, td { padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }

th:nth-child(1), td:nth-child(1) { width: 55%; } /* Metric Name */
th:nth-child(2), td:nth-child(2) { width: 30%; text-align: right; font-weight: 700; } /* Value */
th:nth-child(3), td:nth-child(3) { width: 15%; text-align: center; } /* Status Bullet */

.cat-header { background: #f8fafc; font-weight: 800; font-size: 0.7rem; color: var(--navy); text-transform: uppercase; }
.indicator { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.status-green { background: var(--green); box-shadow: 0 0 10px rgba(34, 197, 94, 0.4); }
.status-red { background: var(--red); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }

/* --- DESKTOP VIEWPORT (1200px+) --- */
@media (min-width: 1200px) {
    .main-header { flex-direction: row; justify-content: space-between; }
    .header-actions { width: auto; }
    
    .dashboard-container { 
        grid-template-columns: 320px 1fr 420px; 
        align-items: start;
        height: auto;
    }
    
    /* Stick sidebars while scrolling main body */
    .sidebar-inputs, .analysis-results { 
        position: sticky; 
        top: 100px; 
        max-height: calc(100vh - 120px); 
        overflow-y: auto; 
    }

    /* Hide scrollbar for sidebars for cleaner look */
    .sidebar-inputs::-webkit-scrollbar, .analysis-results::-webkit-scrollbar { width: 4px; }
    .sidebar-inputs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

    .summary-hero { flex-direction: row; }
}