/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────── */
header {
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
    color: #fff;
    padding: 1.1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    position: sticky;
    top: 0;
    z-index: 100;
}
header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: .5px; }
header .subtitle { font-size: .85rem; opacity: .8; margin-top: .15rem; }

/* ── Tab Bar ──────────────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 2px solid #d4edda;
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.tab {
    flex: 0 0 auto;
    padding: .7rem 1.2rem;
    border: none;
    background: transparent;
    font-size: .82rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all .2s;
    white-space: nowrap;
}
.tab:hover { color: #2d6a4f; background: #f0faf4; }
.tab.active {
    color: #1b4332;
    border-bottom-color: #2d6a4f;
    background: #f0faf4;
}

/* ── Panels ───────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

main {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.panel-intro {
    margin-bottom: 1.2rem;
}
.panel-intro h2 {
    font-size: 1.35rem;
    color: #1b4332;
    margin-bottom: .4rem;
}
.panel-intro p {
    font-size: .92rem;
    color: #444;
    line-height: 1.55;
    max-width: 900px;
}

.panel-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* ── Controls Column ──────────────────────────────────────────── */
.controls {
    flex: 0 0 300px;
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.controls h3 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #777;
    margin: 1rem 0 .5rem;
}
.controls label {
    display: block;
    font-size: .84rem;
    color: #333;
    margin-bottom: .9rem;
    font-weight: 500;
}
.controls input[type="range"] {
    width: 100%;
    margin-top: .3rem;
    accent-color: #2d6a4f;
}
.controls select {
    width: 100%;
    margin-top: .3rem;
    padding: .4rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: .84rem;
}
.slider-val {
    display: inline-block;
    float: right;
    font-weight: 700;
    color: #2d6a4f;
    font-size: .84rem;
    min-width: 3rem;
    text-align: right;
}

/* ── Key Insight Box ──────────────────────────────────────────── */
.key-insight {
    background: #e8f5e9;
    border-left: 4px solid #2d6a4f;
    border-radius: 0 8px 8px 0;
    padding: .8rem 1rem;
    margin-bottom: 1rem;
}
.key-insight strong {
    display: block;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #1b4332;
    margin-bottom: .3rem;
}
.key-insight p {
    font-size: .82rem;
    line-height: 1.5;
    color: #2e4a3e;
}

/* ── Checkbox labels ──────────────────────────────────────────── */
.cb-label {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    margin-bottom: .55rem !important;
}
.cb-label input[type="checkbox"] {
    accent-color: #2d6a4f;
    width: 16px;
    height: 16px;
}
.cb-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Pill Buttons ─────────────────────────────────────────────── */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
}
.pill {
    padding: .35rem .75rem;
    border: 1.5px solid #2d6a4f;
    border-radius: 20px;
    background: transparent;
    color: #2d6a4f;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.pill:hover { background: #e8f5e9; }
.pill.active {
    background: #2d6a4f;
    color: #fff;
}

/* ── Plot Area ────────────────────────────────────────────────── */
.plot-area {
    flex: 1;
    min-width: 0;
}
.plot {
    width: 100%;
    height: 520px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
}

/* Two-plot layout */
.plot-area.two-plots {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.plot-half {
    width: 100%;
    height: 310px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
}

/* ── Footer ───────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: .8rem;
    font-size: .75rem;
    color: #888;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 960px) {
    .panel-body {
        flex-direction: column;
    }
    .controls {
        flex: 0 0 auto;
        width: 100%;
    }
    .plot, .plot-half {
        height: 400px;
    }
    main {
        padding: 1rem;
    }
}
