:root {
    --navy: #001f3f;
    --ink: #182535;
    --muted: #64748b;
    --line: #d9e2ec;
    --soft: #f4f7fb;
    --white: #ffffff;
    --red: #d71920;
    --green: #0f766e;
    --amber: #b45309;
}

.investment-app {
    background: var(--soft);
    color: var(--ink);
}

.investment-wrap {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.investment-hero {
    padding: 52px 0 30px;
    background: linear-gradient(135deg, var(--navy), #163a5f);
    color: var(--white);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
    gap: 26px;
    align-items: end;
}

.eyebrow {
    margin-bottom: 10px;
    color: #b8d3ef;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.investment-hero h1 {
    max-width: 720px;
    margin: 0 0 12px;
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    line-height: 1;
}

.hero-copy {
    max-width: 760px;
    font-size: 1.05rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.88);
}

.hero-result {
    display: grid;
    gap: 8px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.09);
}

.hero-result span,
.hero-result small {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 700;
}

.hero-result strong {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
}

.calculator-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 26px 0 52px;
    align-items: start;
}

.input-panel,
.results-panel {
    min-width: 0;
}

.input-panel {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 12px 30px rgba(0, 31, 63, 0.08);
}

.panel-heading,
.table-heading {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.input-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #edf3f9;
}

.input-tab {
    min-height: 42px;
    padding: 8px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #42546a;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 900;
    cursor: pointer;
}

.input-tab.is-active {
    color: var(--white);
    background: var(--navy);
    box-shadow: 0 6px 14px rgba(0, 31, 63, 0.18);
}

.input-progress {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.input-progress span {
    height: 4px;
    border-radius: 999px;
    background: #d4deea;
}

.input-progress span.is-active {
    background: var(--red);
}

.input-panel details[data-tab] {
    display: none;
}

.input-panel[data-active-tab="setup"] details[data-tab="setup"],
.input-panel[data-active-tab="income"] details[data-tab="income"],
.input-panel[data-active-tab="tax"] details[data-tab="tax"],
.input-panel[data-active-tab="sale"] details[data-tab="sale"] {
    display: block;
}

.panel-heading h2,
.table-card h3,
.chart-card h3 {
    color: var(--navy);
}

.input-panel details {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.input-panel summary {
    cursor: pointer;
    padding: 12px 14px;
    color: var(--navy);
    font-weight: 800;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0 14px 14px;
}

.field-grid label {
    display: grid;
    gap: 5px;
    font-weight: 800;
    color: #26384e;
}

.field-grid input,
.field-grid select {
    width: 100%;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #cbd6e2;
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    background: var(--white);
}

.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: center;
    grid-column: 1 / -1;
    font-weight: 700;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.primary-btn {
    padding: 12px 18px;
    color: var(--white);
    background: var(--red);
}

.secondary-btn {
    padding: 10px 14px;
    color: var(--navy);
    background: #e8eef6;
}

.results-panel {
    display: grid;
    gap: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.metric-card,
.chart-card,
.table-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 12px 30px rgba(0, 31, 63, 0.06);
}

.metric-card {
    display: grid;
    gap: 7px;
    padding: 16px;
}

.metric-card span {
    color: var(--muted);
    font-weight: 800;
}

.metric-card strong {
    color: var(--navy);
    font-size: 1.35rem;
}

.metric-card.negative strong {
    color: var(--red);
}

.metric-card.positive strong {
    color: var(--green);
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.chart-card,
.table-card {
    padding: 18px;
}

.chart-card canvas {
    width: 100%;
    height: min(48vw, 600px);
    max-height: 600px;
    min-height: 320px;
}

.table-scroll {
    width: 100%;
    overflow: auto;
    margin-top: 12px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid #e6edf5;
    text-align: right;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: left;
}

th {
    color: var(--navy);
    background: #f0f4f9;
    font-size: 0.9rem;
}

td.positive {
    color: var(--green);
    font-weight: 800;
}

td.negative {
    color: var(--red);
    font-weight: 800;
}

@media (max-width: 980px) {
    .hero-grid,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .investment-wrap {
        width: min(100% - 22px, 1180px);
    }

    .investment-hero {
        padding-top: 34px;
    }

    .panel-heading,
    .table-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .input-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .input-progress {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
    }
}
