.recast-comparison-wrap {
    margin-top: 20px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.recast-comparison {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    background: var(--input);
}

.recast-comparison caption {
    padding: 16px 18px;
    color: var(--muted);
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.recast-comparison th,
.recast-comparison td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.recast-comparison thead th {
    color: var(--text);
    background: var(--background);
}

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

.recast-comparison tbody th {
    color: var(--text);
}

.recast-comparison tbody td {
    color: var(--muted);
}

.recast-comparison tbody tr:last-child th,
.recast-comparison tbody tr:last-child td {
    border-bottom: 0;
}

.recast-comparison tbody tr:nth-child(2) {
    background: rgba(255, 180, 84, 0.05);
}

.mortgage-recast-input-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
    .mortgage-recast-input-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recast-comparison-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    .recast-comparison {
        display: block;
        min-width: 0;
        background: transparent;
    }

    .recast-comparison caption {
        display: block;
        margin-bottom: 12px;
        padding: 14px 16px;
        background: var(--input);
        border: 1px solid var(--border);
        border-radius: 10px;
    }

    .recast-comparison thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .recast-comparison tbody {
        display: grid;
        gap: 12px;
    }

    .recast-comparison tbody tr {
        display: block;
        overflow: hidden;
        background: var(--input);
        border: 1px solid var(--border);
        border-radius: 10px;
    }

    .recast-comparison tbody tr:nth-child(2) {
        background: rgba(255, 180, 84, 0.05);
    }

    .recast-comparison tbody th,
    .recast-comparison tbody td {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 16px;
        width: auto;
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
        text-align: right;
        white-space: normal;
    }

    .recast-comparison tbody th {
        display: block;
        color: var(--text);
        font-size: 1rem;
        text-align: left;
        background: var(--background);
    }

    .recast-comparison tbody td::before {
        content: attr(data-label);
        color: var(--text);
        font-weight: 700;
        text-align: left;
    }

    .recast-comparison tbody td[colspan] {
        display: block;
        text-align: left;
    }

    .recast-comparison tbody td[colspan]::before {
        content: none;
    }

    .recast-comparison tbody tr > :last-child {
        border-bottom: 0;
    }
}

@media (max-width: 620px) {
    .mortgage-recast-input-grid {
        grid-template-columns: 1fr;
    }
}
