:root {
    --ink: #17212b;
    --muted: #68727d;
    --line: #dde3e8;
    --soft: #f4f6f8;
    --paper: #ffffff;
    --navy: #0b2442;
    --navy-light: #14395f;
    --teal: #0d8a7d;
    --teal-dark: #087267;
    --teal-soft: #e6f5f2;
    --amber: #b9680b;
    --amber-soft: #fff3df;
    --red: #b43c3c;
    --red-soft: #fff0f0;
    --shadow: 0 18px 50px rgba(19, 38, 57, 0.09);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: #eef2f4;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.topbar {
    background: var(--navy);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.topbar__content {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 1.08rem;
}

.brand__mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--teal);
    font-size: 1.2rem;
}

.topbar__tag {
    font-size: 0.87rem;
    color: #bec9d5;
}

.page {
    padding-block: 58px 80px;
}

.hero {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 54px;
    align-items: center;
    margin-bottom: 34px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--teal-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

h1 {
    max-width: 760px;
    margin-bottom: 15px;
    color: var(--navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.4rem, 5.2vw, 4.35rem);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.hero__text {
    max-width: 670px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.04rem;
}

.rate-card {
    min-height: 166px;
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: 24px;
    align-items: center;
    padding: 30px;
    color: #fff;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.rate-card__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rate-card__item span,
.rate-card__item small {
    color: #bfd0df;
    font-size: 0.78rem;
}

.rate-card__item strong {
    color: #5fd3c4;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.25rem;
    line-height: 1.2;
}

.rate-card__divider {
    width: 1px;
    height: 74px;
    background: rgba(255, 255, 255, 0.16);
}

.panel,
.table-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel--form {
    padding: 30px;
}

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

.section-heading h2 {
    margin-bottom: 3px;
    color: var(--navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
    letter-spacing: -0.025em;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.step {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--teal);
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.88rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field--wide {
    grid-column: span 2;
}

.field label {
    color: #293846;
    font-size: 0.84rem;
    font-weight: 750;
}

.optional {
    color: #89929b;
    font-weight: 500;
}

.field input,
.field select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    color: var(--ink);
    background: #fbfcfd;
    border: 1px solid #cfd7de;
    border-radius: 9px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input:focus,
.field select:focus {
    background: #fff;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(13, 138, 125, 0.13);
}

.field select {
    appearance: none;
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, #64717c 50%),
        linear-gradient(135deg, #64717c 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 21px,
        calc(100% - 13px) 21px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.field .calculated-input {
    color: var(--navy);
    background: #eef5f4;
    border-color: #c7dcda;
    font-weight: 750;
    cursor: default;
}

.field small {
    min-height: 18px;
    color: #7d8791;
    font-size: 0.75rem;
}

.money-input {
    position: relative;
}

.money-input span {
    position: absolute;
    z-index: 1;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--teal-dark);
    font-weight: 800;
    font-size: 0.85rem;
}

.money-input input {
    padding-left: 45px;
}

.alert {
    margin-top: 22px;
    padding: 12px 14px;
    color: #8d2929;
    background: var(--red-soft);
    border: 1px solid #f2caca;
    border-radius: 9px;
    font-size: 0.88rem;
}

.form-actions {
    display: flex;
    gap: 11px;
    margin-top: 28px;
}

.button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 20px;
    border: 0;
    border-radius: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

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

.button:focus-visible {
    outline: 3px solid rgba(13, 138, 125, 0.24);
    outline-offset: 2px;
}

.button--primary {
    min-width: 205px;
    color: #fff;
    background: var(--teal);
    box-shadow: 0 9px 22px rgba(13, 138, 125, 0.2);
}

.button--primary:hover {
    background: var(--teal-dark);
}

.button--ghost,
.button--print {
    color: #465360;
    background: #edf1f4;
}

.results {
    margin-top: 42px;
}

.section-heading--results {
    align-items: center;
}

.button--print {
    margin-left: auto;
    min-height: 40px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.summary-card {
    min-width: 0;
    padding: 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 3px solid #a8b2bc;
    border-radius: 12px;
}

.summary-card > span,
.summary-card small {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
}

.summary-card strong {
    display: block;
    margin: 7px 0 3px;
    overflow-wrap: anywhere;
    color: var(--navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.25rem, 2.2vw, 1.75rem);
    line-height: 1.1;
}

.summary-card--warning {
    border-top-color: var(--amber);
}

.summary-card--accent {
    border-top-color: var(--teal);
}

.summary-card--total {
    color: #fff;
    background: var(--navy);
    border-color: var(--navy);
    border-top-color: #5fd3c4;
}

.summary-card--total > span,
.summary-card--total small {
    color: #bfd0df;
}

.summary-card--total strong {
    color: #68dacb;
}

.table-panel {
    overflow: hidden;
}

.table-panel__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.table-panel__heading h3 {
    margin-bottom: 2px;
    color: var(--navy);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
}

.table-panel__heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.legend {
    display: flex;
    gap: 16px;
    color: var(--muted);
    font-size: 0.75rem;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot--late {
    background: var(--red);
}

.dot--open {
    background: var(--teal);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1030px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

th,
td {
    padding: 15px 16px;
    text-align: left;
    border-bottom: 1px solid #e8ecef;
    vertical-align: middle;
}

thead th {
    color: #65717c;
    background: #f7f9fa;
    font-size: 0.7rem;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:hover {
    background: #f9fbfb;
}

.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.boleto-number {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
}

.status-dot--late {
    background: var(--red);
    box-shadow: 0 0 0 4px var(--red-soft);
}

.status-dot--open {
    background: var(--teal);
    box-shadow: 0 0 0 4px var(--teal-soft);
}

.description-cell {
    max-width: 260px;
    color: #3d4b57;
}

.days-late {
    display: inline-flex;
    padding: 3px 7px;
    color: #983535;
    background: var(--red-soft);
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 750;
    white-space: nowrap;
}

.days-open {
    color: var(--muted);
    white-space: nowrap;
}

tbody .total-cell,
tfoot .total-cell {
    color: var(--teal-dark);
    font-weight: 850;
}

tfoot th,
tfoot td {
    background: #f1f5f5;
    border-bottom: 0;
    font-weight: 850;
}

.formula-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
    padding: 16px 18px;
    color: #596671;
    background: #e8eeee;
    border-left: 3px solid var(--teal);
    border-radius: 0 10px 10px 0;
    font-size: 0.8rem;
}

.formula-note p {
    margin: 0;
}

.formula-note__icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--teal);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-weight: 800;
}

.formula-note code {
    color: var(--navy);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 700;
}

footer {
    color: #b9c4cf;
    background: var(--navy);
}

.footer__content {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.76rem;
}

.footer__content p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .rate-card {
        max-width: 560px;
    }

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

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

@media (max-width: 620px) {
    .container {
        width: min(100% - 24px, 1180px);
    }

    .topbar__content {
        min-height: 64px;
    }

    .topbar__tag {
        display: none;
    }

    .page {
        padding-block: 38px 58px;
    }

    h1 {
        font-size: 2.55rem;
    }

    .rate-card {
        gap: 15px;
        padding: 22px 18px;
    }

    .rate-card__item strong {
        font-size: 1.75rem;
    }

    .panel--form {
        padding: 22px 17px;
    }

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

    .field--wide {
        grid-column: auto;
    }

    .form-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .section-heading--results {
        flex-wrap: wrap;
    }

    .button--print {
        width: auto;
        margin-left: 48px;
    }

    .table-panel__heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer__content {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding-block: 22px;
    }
}

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

    .topbar,
    .hero,
    .panel--form,
    .button--print,
    footer {
        display: none !important;
    }

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

    .results {
        margin: 0;
    }

    .summary-card,
    .table-panel {
        box-shadow: none;
        break-inside: avoid;
    }

    .table-scroll {
        overflow: visible;
    }

    table {
        min-width: 0;
        font-size: 9px;
    }

    th,
    td {
        padding: 8px 6px;
    }
}
