/**
 * 다중대출 상환전략 최적화 계산기 (스노우볼/아발란치)
 * @package Zipper
 */

.dpsc-hidden {
    display: none !important;
}

.dpsc-main-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.dpsc-input-col {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.dpsc-result-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.dpsc-section,
.dpsc-result-summary,
.dpsc-chart-section,
.dpsc-table-section,
.dpsc-schedule-section {
    border: 1px solid #e8e4dc;
    border-radius: 18px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 4px 14px rgba(45, 42, 38, 0.05);
    min-width: 0;
    box-sizing: border-box;
}

.dpsc-section-title,
.dpsc-block-title,
.dpsc-summary-title {
    margin: 0;
    color: #2d2a26;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dpsc-section-title i,
.dpsc-block-title i,
.dpsc-summary-title i {
    color: #d4af37;
}

.dpsc-section-desc,
.dpsc-block-sub,
.dpsc-summary-note {
    margin: 4px 0 0;
    color: #5f5a56;
    font-size: 12px;
    line-height: 1.5;
    max-width: 58ch;
}

.dpsc-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dpsc-label {
    color: #4a4640;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.dpsc-input {
    width: 100%;
    min-width: 0;
    border: 1px solid #ddd7cb;
    border-radius: 10px;
    background: #fbfaf8;
    color: #2d2a26;
    font-size: 14px;
    line-height: 1.3;
    padding: 12px 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dpsc-input:hover {
    border-color: #d4c67a;
}

.dpsc-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
    background: #fff;
}

.dpsc-input::placeholder {
    color: #b7b1a8;
}

.dpsc-input[type="number"] {
    -moz-appearance: textfield;
}

.dpsc-input[type="number"]::-webkit-outer-spin-button,
.dpsc-input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
}

.dpsc-amount-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
    border: 1px solid #ddd7cb;
    border-radius: 10px;
    overflow: hidden;
    background: #fbfaf8;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.dpsc-amount-row:hover {
    border-color: #d4c67a;
}

.dpsc-amount-row:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
    background: #fff;
}

.dpsc-amount-row .dpsc-input {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    text-align: right;
    font-weight: 600;
}

.dpsc-amount-row .dpsc-input:hover,
.dpsc-amount-row .dpsc-input:focus {
    border: 0;
    box-shadow: none;
    background: transparent;
}

.dpsc-amount-row-small .dpsc-input {
    text-align: left;
    font-weight: 500;
}

.dpsc-unit-badge {
    min-width: 56px;
    padding: 0 12px;
    border-left: 1px solid #e5dfd3;
    background: linear-gradient(180deg, #fcfbf8 0%, #f3efe7 100%);
    color: #7a7468;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.dpsc-amount-korean,
.dpsc-debt-count,
.dpsc-budget-preview,
.dpsc-assumption-list,
.dpsc-strategy-order,
.dpsc-warning-list,
.dpsc-disclaimer span {
    color: #5f5a56;
    font-size: 12px;
    line-height: 1.55;
}

.dpsc-debt-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.dpsc-debt-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #ece6db;
    border-radius: 14px;
    background: #fcfbf8;
    padding: 14px;
}

.dpsc-debt-card-head,
.dpsc-block-head,
.dpsc-block-head-stack,
.dpsc-add-row-wrap,
.dpsc-btn-group,
.dpsc-schedule-tabs,
.dpsc-strategy-card-head {
    display: flex;
    gap: 8px;
}

.dpsc-debt-card-head,
.dpsc-add-row-wrap,
.dpsc-btn-group,
.dpsc-strategy-card-head {
    align-items: center;
    justify-content: space-between;
}

.dpsc-block-head,
.dpsc-block-head-stack {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;
}

.dpsc-block-head-stack {
    gap: 12px;
}

.dpsc-debt-card-title {
    color: #2d2a26;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

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

.dpsc-add-row-wrap {
    margin-top: 12px;
}

.dpsc-add-row-btn,
.dpsc-quick-btn,
.dpsc-btn,
.dpsc-row-remove,
.dpsc-schedule-tab {
    border: 1px solid transparent;
    border-radius: 12px;
    min-height: 42px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.dpsc-add-row-btn:hover,
.dpsc-quick-btn:hover,
.dpsc-btn:hover,
.dpsc-row-remove:hover,
.dpsc-schedule-tab:hover {
    transform: translateY(-1px);
}

.dpsc-add-row-btn,
.dpsc-quick-btn,
.dpsc-row-remove,
.dpsc-schedule-tab {
    background: #fff;
    border-color: #ddd7cb;
    color: #4a4640;
}

.dpsc-row-remove {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
}

.dpsc-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dpsc-quick-btn {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
}

.dpsc-btn-group {
    flex-wrap: wrap;
}

.dpsc-btn {
    flex: 1 1 0;
}

.dpsc-btn-primary {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(184, 134, 11, 0.22);
}

.dpsc-btn-ghost {
    background: #f7f4ed;
    color: #4a4640;
    border-color: #e5ddd0;
}

.dpsc-budget-preview {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #faf7f0;
    border: 1px solid #ece6db;
}

.dpsc-assumption-list,
.dpsc-warning-list {
    margin: 10px 0 0;
    padding-left: 18px;
}

.dpsc-assumption-list li,
.dpsc-warning-list li {
    margin-bottom: 4px;
}

.dpsc-summary-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.12);
    color: #8e6a00;
    font-size: 12px;
    font-weight: 700;
}

.dpsc-main-kpi-grid,
.dpsc-strategy-card-grid,
.dpsc-result-dual-table {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.dpsc-main-kpi-grid,
.dpsc-strategy-card-grid,
.dpsc-result-dual-table {
    grid-template-columns: 1fr 1fr;
}

.dpsc-result-dual-table {
    grid-template-columns: 1fr;
}

.dpsc-table-section .dpsc-block-title {
    margin-bottom: 10px;
}

.dpsc-table-section .dpsc-table-wrap {
    margin-top: 0;
}

#dpscCompareSection .dpsc-table,
#dpscPrioritySection .dpsc-table {
    font-variant-numeric: tabular-nums;
}

#dpscCompareSection .dpsc-table {
    min-width: 540px;
}

#dpscPrioritySection .dpsc-table {
    min-width: 660px;
}

#dpscCompareSection .dpsc-table th,
#dpscCompareSection .dpsc-table td,
#dpscPrioritySection .dpsc-table th,
#dpscPrioritySection .dpsc-table td {
    padding: 9px 7px;
    font-size: 11px;
    line-height: 1.35;
}

#dpscCompareSection .dpsc-table th,
#dpscPrioritySection .dpsc-table th {
    white-space: normal;
}

#dpscCompareSection .dpsc-table td:nth-child(2) {
    white-space: normal;
}

.dpsc-main-kpi,
.dpsc-strategy-card {
    border: 1px solid #ece6db;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.dpsc-main-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 15px;
}

.dpsc-main-kpi-label {
    color: #7a7468;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.dpsc-main-kpi-value {
    color: #2d2a26;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.dpsc-strategy-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.1);
    color: #8e6a00;
    font-size: 12px;
    font-weight: 700;
}

.dpsc-strategy-card h3 {
    margin: 0;
    color: #2d2a26;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dpsc-strategy-card h3 i {
    color: #d4af37;
}

.dpsc-strategy-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin: 12px 0 0;
}

.dpsc-strategy-stats div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dpsc-strategy-stats dt {
    color: #7a7468;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.dpsc-strategy-stats dd {
    margin: 0;
    color: #2d2a26;
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.dpsc-strategy-order {
    margin: 10px 0 0;
}

.dpsc-chart-wrap {
    position: relative;
    min-height: 280px;
}

.dpsc-chart-wrap canvas {
    width: 100% !important;
    height: 280px !important;
}

.dpsc-chart-fallback {
    margin: 12px 0 0;
    color: #8c8579;
    font-size: 13px;
    line-height: 1.5;
}

.dpsc-fallback-table-wrap,
.dpsc-table-wrap {
    overflow-x: auto;
    border: 1px solid #eee6d9;
    border-radius: 14px;
    background: #fff;
}

.dpsc-table,
.dpsc-fallback-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
    font-variant-numeric: tabular-nums;
}

.dpsc-table th,
.dpsc-table td,
.dpsc-fallback-table th,
.dpsc-fallback-table td {
    padding: 10px 9px;
    border-bottom: 1px solid #ece6db;
    color: #2d2a26;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    vertical-align: top;
    word-break: keep-all;
}

.dpsc-table th,
.dpsc-fallback-table th {
    background: #faf7f0;
    color: #5f5a56;
    font-weight: 700;
    white-space: nowrap;
}

.dpsc-empty-row td {
    color: #8c8579;
}

.dpsc-schedule-tabs {
    flex-wrap: wrap;
}

.dpsc-schedule-section .dpsc-table-wrap {
    margin-top: 10px;
}

.dpsc-schedule-table th,
.dpsc-schedule-table td,
.dpsc-trend-fallback-table th,
.dpsc-trend-fallback-table td {
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.45;
}

.dpsc-trend-chart-wrap {
    min-height: 280px;
}

.dpsc-trend-chart-wrap canvas {
    height: 280px !important;
}

.dpsc-trend-fallback-table {
    min-width: 560px;
}

.dpsc-schedule-tab.active {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.08);
    color: #2d2a26;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.dpsc-waiting {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    border: 1px dashed #e5d7b4;
    border-radius: 14px;
    background: #fffaf0;
    padding: 16px 18px;
    color: #6c5c32;
}

.dpsc-waiting i,
.dpsc-disclaimer i {
    color: #d4af37;
}

.dpsc-waiting p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.dpsc-waiting[hidden],
.dpsc-chart-fallback[hidden],
.dpsc-fallback-table-wrap[hidden] {
    display: none !important;
}

.dpsc-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px dashed #e5d7b4;
    border-radius: 14px;
    background: #fffaf0;
    padding: 14px 16px;
}

@media (max-width: 900px) {
    .dpsc-main-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dpsc-input-col {
        position: static;
    }
}

@media (max-width: 768px) {
    .dpsc-card-grid,
    .dpsc-main-kpi-grid,
    .dpsc-strategy-card-grid,
    .dpsc-result-dual-table {
        grid-template-columns: 1fr;
    }

    .dpsc-section,
    .dpsc-result-summary,
    .dpsc-chart-section,
    .dpsc-table-section,
    .dpsc-schedule-section {
        padding: 15px;
    }

    .dpsc-debt-card,
    .dpsc-main-kpi,
    .dpsc-strategy-card {
        padding: 14px;
    }

    .dpsc-btn,
    .dpsc-add-row-btn,
    .dpsc-schedule-tab {
        width: 100%;
    }

    .dpsc-btn-group,
    .dpsc-add-row-wrap,
    .dpsc-debt-card-head {
        flex-direction: column;
        align-items: stretch;
    }

    .dpsc-chart-wrap,
    .dpsc-chart-wrap canvas {
        min-height: 260px;
        height: 260px !important;
    }

    .dpsc-trend-chart-wrap,
    .dpsc-trend-chart-wrap canvas {
        min-height: 240px;
        height: 240px !important;
    }
}

@media (max-width: 480px) {
    .dpsc-section-title,
    .dpsc-block-title,
    .dpsc-summary-title {
        font-size: 16px;
    }

    .dpsc-main-kpi-value {
        font-size: 20px;
    }

    .dpsc-input {
        padding: 11px 12px;
        font-size: 13px;
    }

    .dpsc-unit-badge {
        min-width: 50px;
        padding: 0 10px;
    }

    .dpsc-table th,
    .dpsc-table td,
    .dpsc-fallback-table th,
    .dpsc-fallback-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

.dpsc-amount-input {
    text-align: right;
    font-weight: 600;
}

.dpsc-name-input {
    font-weight: 600;
}

.dpsc-priority-table {
    min-width: 760px;
}

.dpsc-schedule-table {
    min-width: 840px;
}

.dpsc-main-layout .dpsc-section-desc,
.dpsc-main-layout .dpsc-block-sub,
.dpsc-main-layout .dpsc-summary-note {
    margin-top: 4px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    max-width: 58ch;
}

.dpsc-main-layout .dpsc-amount-korean,
.dpsc-main-layout .dpsc-debt-count,
.dpsc-main-layout .dpsc-budget-preview,
.dpsc-main-layout .dpsc-assumption-list,
.dpsc-main-layout .dpsc-strategy-order,
.dpsc-main-layout .dpsc-warning-list,
.dpsc-main-layout .dpsc-disclaimer span {
    font-size: 12px !important;
    line-height: 1.55 !important;
}

@media (max-width: 768px) {
    .dpsc-table-wrap,
    .dpsc-fallback-table-wrap {
        overflow-x: visible;
        border: 0;
        background: transparent;
    }

    .dpsc-table,
    .dpsc-fallback-table,
    .dpsc-priority-table,
    .dpsc-schedule-table,
    .dpsc-trend-fallback-table {
        min-width: 0 !important;
        table-layout: fixed;
    }

    .dpsc-table thead,
    .dpsc-fallback-table thead {
        display: none;
    }

    .dpsc-table,
    .dpsc-fallback-table,
    .dpsc-table tbody,
    .dpsc-fallback-table tbody,
    .dpsc-table tr,
    .dpsc-fallback-table tr,
    .dpsc-table td,
    .dpsc-fallback-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .dpsc-table tbody,
    .dpsc-fallback-table tbody {
        display: grid;
        gap: 10px;
    }

    .dpsc-table tr,
    .dpsc-fallback-table tr {
        border: 1px solid #ece6db;
        border-radius: 12px;
        background: #fff;
        overflow: hidden;
    }

    .dpsc-table td,
    .dpsc-fallback-table td {
        display: grid;
        grid-template-columns: 98px minmax(0, 1fr);
        gap: 8px;
        padding: 9px 10px;
        border-bottom: 1px solid #f1eadf;
        font-size: 12px;
        line-height: 1.5;
        white-space: normal;
        word-break: break-word;
    }

    .dpsc-table tr td:last-child,
    .dpsc-fallback-table tr td:last-child {
        border-bottom: 0;
    }

    .dpsc-table td::before,
    .dpsc-fallback-table td::before {
        color: #7a7468;
        font-size: 11px;
        font-weight: 700;
        line-height: 1.45;
        content: '';
    }

    #dpscCompareSection .dpsc-table td:nth-child(1)::before { content: '전략'; }
    #dpscCompareSection .dpsc-table td:nth-child(2)::before { content: '집중 기준'; }
    #dpscCompareSection .dpsc-table td:nth-child(3)::before { content: '총이자'; }
    #dpscCompareSection .dpsc-table td:nth-child(4)::before { content: '총지급액'; }
    #dpscCompareSection .dpsc-table td:nth-child(5)::before { content: '전체 완납'; }
    #dpscCompareSection .dpsc-table td:nth-child(6)::before { content: '첫 완납'; }
    #dpscCompareSection .dpsc-table td:nth-child(7)::before { content: '월예산'; }

    #dpscPrioritySection .dpsc-table td:nth-child(1)::before { content: '대출명'; }
    #dpscPrioritySection .dpsc-table td:nth-child(2)::before { content: '잔액'; }
    #dpscPrioritySection .dpsc-table td:nth-child(3)::before { content: '금리'; }
    #dpscPrioritySection .dpsc-table td:nth-child(4)::before { content: '최소상환'; }
    #dpscPrioritySection .dpsc-table td:nth-child(5)::before { content: '스노우볼 순위'; }
    #dpscPrioritySection .dpsc-table td:nth-child(6)::before { content: '스노우볼 완납'; }
    #dpscPrioritySection .dpsc-table td:nth-child(7)::before { content: '아발란치 순위'; }
    #dpscPrioritySection .dpsc-table td:nth-child(8)::before { content: '아발란치 완납'; }

    .dpsc-schedule-table td:nth-child(1)::before { content: '월'; }
    .dpsc-schedule-table td:nth-child(2)::before { content: '집중 상환 대상'; }
    .dpsc-schedule-table td:nth-child(3)::before { content: '월 납입액'; }
    .dpsc-schedule-table td:nth-child(4)::before { content: '이자'; }
    .dpsc-schedule-table td:nth-child(5)::before { content: '원금 감소'; }
    .dpsc-schedule-table td:nth-child(6)::before { content: '남은 총잔액'; }
    .dpsc-schedule-table td:nth-child(7)::before { content: '완납 대출'; }

    #dpscChartFallbackBody td:nth-child(1)::before { content: '대출명'; }
    #dpscChartFallbackBody td:nth-child(2)::before { content: '스노우볼 완납'; }
    #dpscChartFallbackBody td:nth-child(3)::before { content: '아발란치 완납'; }
    #dpscChartFallbackBody td:nth-child(4)::before { content: '차이'; }

    #dpscTrendFallbackBody td:nth-child(1)::before { content: '개월차'; }
    #dpscTrendFallbackBody td:nth-child(2)::before { content: '스노우볼 잔액'; }
    #dpscTrendFallbackBody td:nth-child(3)::before { content: '아발란치 잔액'; }
    #dpscTrendFallbackBody td:nth-child(4)::before { content: '차이'; }

    .dpsc-empty-row td {
        display: block;
        text-align: center;
        padding: 12px 10px;
    }

    .dpsc-empty-row td::before {
        display: none;
    }
}
