.savings-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 1rem;
    background: var(--card-bg);
    border-radius: 0.375rem;
    box-shadow: var(--shadow-sm);
}

.savings-table.is-collapsed {
    display: none;
}

.savings-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: fixed;
}

.savings-table th,
.savings-table td {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    color: var(--text-color);
}

.savings-table .year-col {
    text-align: center;
    width: 80px;
}

.savings-table .amount-col {
    text-align: right;
    min-width: 160px;
}

.savings-table tbody td:first-child {
    text-align: center;
    font-weight: 500;
    background-color: var(--card-bg);
}

.savings-table tbody td {
    text-align: right;
    font-family: monospace;
    font-size: 1.1em;
    background-color: var(--card-bg);
}

.savings-table thead th {
    background-color: var(--card-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
    color: var(--text-color);
}

.savings-table td.positive {
    color: var(--positive-color);
}

.savings-table td.negative {
    color: var(--negative-color);
}

@media (max-width: 768px) {
    .savings-table {
        overflow: visible;
        margin: 0.75rem 0;
        -webkit-overflow-scrolling: touch;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    .savings-table table {
        display: block;
    }

    .savings-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .savings-table tbody {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .savings-table tbody tr {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
        background: var(--card-bg);
        box-shadow: var(--shadow-sm);
    }

    .savings-table .amount-col {
        min-width: 0;
    }

    .savings-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0;
        border: none;
        font-family: inherit;
        font-size: 0.95rem;
        white-space: normal;
    }

    .savings-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-color);
        margin-right: 0.75rem;
    }

    .savings-table tbody td:first-child {
        justify-content: center;
        font-size: 1.05rem;
        font-weight: 600;
    }

    .savings-table tbody td:first-child::before {
        display: none;
    }
}
