:root {
    --bg: #f3f5f7;
    --card: #ffffff;
    --text: #18212b;
    --muted: #65717d;
    --line: #dce2e7;
    --accent: #1f4f7a;
    --accent-dark: #173d5e;
    --accent-soft: #e9f1f8;
    --success: #1f6b45;
    --error: #9b2c2c;
    --shadow: 0 10px 30px rgba(20, 35, 50, 0.07);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 38px 0 28px;
}

.header {
    margin-bottom: 28px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1.05;
}

.subtitle {
    max-width: 780px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 17px;
}

.card {
    margin-bottom: 20px;
    padding: 26px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.section-title {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.section-title.compact {
    margin-bottom: 18px;
}

.section-title h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.section-title p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.section-number {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 18px;
    align-items: end;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
    font-size: 14px;
}

.field small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

input,
select,
button {
    width: 100%;
    min-height: 46px;
    border-radius: 10px;
    font: inherit;
}

input,
select {
    padding: 0 13px;
    border: 1px solid #c9d1d8;
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
button:focus {
    outline: 3px solid rgba(31, 79, 122, 0.18);
    outline-offset: 1px;
}

button {
    padding: 0 22px;
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.hidden {
    display: none !important;
}

.error {
    border-color: #e7b8b8;
    background: #fff7f7;
    color: var(--error);
}

.balls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0 26px;
}

.ball {
    display: inline-flex;
    width: 62px;
    height: 62px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: #fff;
    color: var(--accent);
    font-size: 22px;
    font-weight: 800;
}

.reintegro {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.reintegro .label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.reintegro-number {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--success);
    border-radius: 50%;
    color: var(--success);
    font-size: 20px;
    font-weight: 800;
}

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

.metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.metric {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
}

.metric-label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
}

.metric-value {
    font-weight: 800;
}

.explanation-box {
    min-height: 150px;
    padding: 16px;
    border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: var(--accent-soft);
}

.explanation-box p {
    margin-bottom: 0;
}

.process {
    margin: 0;
    padding-left: 25px;
}

.process li {
    margin-bottom: 10px;
    padding-left: 5px;
}

.methodology {
    display: flex;
    gap: 16px;
    margin: 24px 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #eef2f5;
}

.methodology-icon {
    display: flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--text);
    color: #fff;
    font-weight: 800;
}

.methodology h2 {
    margin-bottom: 7px;
    font-size: 18px;
}

.methodology p {
    margin-bottom: 8px;
    color: #4f5c67;
    font-size: 14px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 2px 0;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 820px) {
    .controls,
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .container {
        width: min(100% - 20px, 1120px);
        padding-top: 24px;
    }

    .card {
        padding: 20px;
    }

    .ball {
        width: 54px;
        height: 54px;
        font-size: 19px;
    }

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

    .footer {
        flex-direction: column;
        gap: 4px;
    }
}

/* Gráfica de métricas */

.chart-container {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.chart-container h3 {
    margin: 0 0 5px;
    font-size: 17px;
}

.chart-description {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
}

.metrics-chart {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chart-row {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr) 55px;
    align-items: center;
    gap: 10px;
}

.chart-label {
    color: var(--text);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.chart-track {
    height: 19px;
    overflow: hidden;
    border-radius: 5px;
    background: #e9edf1;
}

.chart-bar {
    height: 100%;
    width: 0;
    border-radius: 5px;
    background: var(--accent);
    transition: width 350ms ease;
}

.chart-value {
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chart-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

@media (max-width: 480px) {
    .chart-row {
        grid-template-columns: 80px minmax(0, 1fr) 45px;
        gap: 7px;
    }

    .chart-label,
    .chart-value {
        font-size: 11px;
    }
}