:root {
    --bg: #f5f7f8;
    --panel: #ffffff;
    --text: #14212b;
    --muted: #647384;
    --line: #dce4ea;
    --soft: #eef5f7;
    --accent: #0f5f6d;
    --accent-dark: #0a4650;
    --warn-bg: #fff7e8;
    --warn: #7a4d00;
    --ok-bg: #edf9f1;
    --ok: #166334;
    --danger-bg: #fff0f0;
    --danger: #9f2525;
    --radius: 18px;
    --shadow: 0 14px 35px rgba(20, 33, 43, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #e7f2f4 0, transparent 32rem), var(--bg);
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

.page {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 48px;
}

.hero {
    padding: 34px;
    border-radius: 26px;
    background: linear-gradient(135deg, #103844, #0f5f6d);
    color: #fff;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.eyebrow {
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .85;
    margin-bottom: 10px;
}

.hero h1,
.result-header h2,
.section h2,
.summary-box h3 {
    margin: 0;
    line-height: 1.15;
}

.hero h1 {
    font-size: clamp(30px, 4vw, 46px);
    max-width: 820px;
}

.hero p {
    max-width: 820px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, .86);
    font-size: 17px;
}

.notice {
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid #f0d8a5;
    padding: 16px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.card {
    background: var(--panel);
    border: 1px solid rgba(20, 33, 43, .07);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.section {
    padding: 26px;
    border-bottom: 1px solid var(--line);
}

.section:last-of-type {
    border-bottom: 0;
}

.section h2 {
    font-size: 21px;
    margin-bottom: 16px;
}

.section-help,
.field-note {
    color: var(--muted);
    font-size: 14px;
    margin: -6px 0 16px;
}

.grid {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
    font-size: 14px;
}

label span {
    color: var(--muted);
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

textarea {
    resize: vertical;
    min-height: 92px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 95, 109, .8);
    box-shadow: 0 0 0 4px rgba(15, 95, 109, .12);
}

.choice-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.choice {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    background: #fff;
    transition: border-color .2s, background .2s, transform .2s;
}

.choice:hover {
    transform: translateY(-1px);
}

.choice input {
    width: auto;
    margin: 0 8px 0 0;
}

.choice strong {
    display: block;
    margin-bottom: 5px;
}

.choice small {
    display: block;
    color: var(--muted);
    font-weight: 500;
}

.choice.active {
    border-color: var(--accent);
    background: var(--soft);
}

.mode-box {
    background: #fbfdfe;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.hidden {
    display: none !important;
}

.actions {
    padding: 22px 26px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: #fbfdfe;
    border-radius: 0 0 var(--radius) var(--radius);
}

button {
    border: 0;
    border-radius: 999px;
    padding: 13px 20px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s, opacity .2s;
}

button:hover {
    transform: translateY(-1px);
}

.primary {
    background: var(--accent);
    color: #fff;
}

.secondary,
.tiny {
    background: #e7eef1;
    color: var(--accent-dark);
}

.tiny {
    padding: 8px 12px;
    font-size: 13px;
}

.result {
    margin-top: 20px;
    padding: 26px;
}

.result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.result-header .eyebrow {
    color: var(--muted);
}

.result-header h2 {
    font-size: 24px;
}

#saldoDisponivel {
    font-size: clamp(28px, 4vw, 42px);
    color: var(--accent);
    line-height: 1;
    white-space: nowrap;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.result-grid div {
    padding: 16px;
    border-radius: 16px;
    background: #f7fafb;
    border: 1px solid var(--line);
}

.result-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.result-grid strong {
    font-size: 18px;
}

.alerts {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.alert {
    padding: 13px 14px;
    border-radius: 14px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert.warn {
    background: var(--warn-bg);
    color: var(--warn);
    border-color: #f0d8a5;
}

.alert.danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #f1b5b5;
}

.alert.ok {
    background: var(--ok-bg);
    color: var(--ok);
    border-color: #bde9ca;
}

.summary-box {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    background: #fbfdfe;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.summary-header > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#resumo {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    min-height: 230px;
}

.footer {
    color: var(--muted);
    font-size: 13px;
    margin-top: 18px;
    text-align: center;
}

@media (max-width: 820px) {
    .page {
        width: min(100% - 20px, 1080px);
        padding-top: 18px;
    }

    .hero,
    .section,
    .result {
        padding: 22px;
    }

    .grid.two,
    .choice-list,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-header,
    .summary-header {
        align-items: flex-start;
        flex-direction: column;
    }

    #saldoDisponivel {
        white-space: normal;
    }
}

@media print {
    body {
        background: #fff;
    }

    .hero,
    .notice,
    #formCalc,
    .footer,
    .summary-header button,
    .actions {
        display: none !important;
    }

    .page {
        width: 100%;
        padding: 0;
    }

    .result {
        box-shadow: none;
        border: 0;
        padding: 0;
    }
}
