/* ========== 按钮 ========== */
.btn-calc {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    padding: 10px 36px;
    font-size: 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-calc:hover, .btn-calc:focus {
    background: #5a6fd6;
    border-color: #5a6fd6;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}
.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ========== 贷款类型切换 ========== */
.loan-type-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.loan-type-switcher .switch-container {
    display: flex;
    width: 100%;
    background: #f0f2f5;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.loan-type-switcher .switch-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    flex: 1;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    color: #666;
    user-select: none;
    white-space: nowrap;
    z-index: 1;
}
.loan-type-switcher .switch-btn .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s ease;
}
.loan-type-switcher .switch-btn.active {
    background: #fff;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102,126,234,0.25);
}
.loan-type-switcher .switch-btn.active[data-type="gjj"] .dot {
    background: #3498db;
    box-shadow: 0 0 6px rgba(52,152,219,0.5);
}
.loan-type-switcher .switch-btn.active[data-type="sy"] .dot {
    background: #27ae60;
    box-shadow: 0 0 6px rgba(39,174,96,0.5);
}
.loan-type-switcher .switch-btn.active[data-type="combine"] .dot {
    background: #e67e22;
    box-shadow: 0 0 6px rgba(230,126,34,0.5);
}
.loan-type-switcher .switch-btn:not(.active):hover {
    color: #333;
}
@media (max-width: 480px) {
    .loan-type-switcher .switch-container {
        width: 100%;
        border-radius: 10px;
    }
    .loan-type-switcher .switch-btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 12px;
    }
    .loan-type-switcher .switch-btn .dot {
        display: none;
    }
    .result-comparison-cards {
        flex-direction: column;
    }
}

/* ========== 贷款区域 ========== */
.loan-section { display: none; }
.loan-section.active { display: block; }

/* ========== 子卡片 ========== */
.sub-card { border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.sub-card-gjj { background: #f5f9ff; border: 1px solid #e3edf7; }
.sub-card-sy { background: #f5fbf7; border: 1px solid #e3f0e8; }
.sub-card-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.sub-card-gjj .sub-card-title { color: #3498db; }
.sub-card-sy .sub-card-title { color: #27ae60; }

/* ========== 结果标签页 ========== */
.result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 2px solid #e8e8e8;
}
.result-tab {
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #999;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    outline: none;
    flex-shrink: 0;
}
.result-tab:hover { color: #667eea; }
.result-tab.active {
    color: #667eea;
    font-weight: 500;
    border-bottom-color: #667eea;
}
.result-tab-content { display: none; }
.result-tab-content.active { display: block; }

/* ========== 结果对比卡片 ========== */
.result-comparison-cards {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
.result-comparison-card {
    flex: 1;
    border-radius: 12px;
    padding: 18px 16px;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}
.result-comparison-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.result-comparison-card.debx {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
}
.result-comparison-card.debj {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border: 1px solid #ffe082;
}
.result-comparison-card .rc-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.result-comparison-card .rc-icon {
    font-size: 16px;
}
.result-comparison-card .rc-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}
.result-comparison-card .rc-amount {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}
.result-comparison-card .rc-amount small {
    font-size: 13px;
    font-weight: 400;
    color: #888;
}
.result-comparison-card.debx .rc-amount { color: #1e88e5; }
.result-comparison-card.debj .rc-amount { color: #f59e0b; }
.result-comparison-card .rc-desc {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* ========== 结果子卡片 ========== */
.result-sub-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}
.result-sub-card:hover { border-color: #667eea; }
.result-sub-card .rs-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}
.result-sub-card .rs-value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}
.result-sub-card .rs-value.highlight {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 对比表格 ========== */
.compare-table { margin-bottom: 0; }
.compare-table th {
    background: #f8f9fa;
    text-align: center;
    vertical-align: middle !important;
}
.compare-table td {
    text-align: center;
    vertical-align: middle;
}
.compare-table td.best {
    color: #1e88e5;
    font-weight: 600;
}
.compare-table td:nth-child(3).best {
    color: #f59e0b;
}

/* ========== 明细表格 ========== */
.detail-table-wrap {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin-top: 12px;
}
.detail-table-wrap table {
    font-size: 12px;
    margin-bottom: 0;
}
.detail-table-wrap table th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 1;
    white-space: nowrap;
    border-bottom: 1px solid #ccc;
    line-height: 1.3;
}
.detail-table-wrap table th .h-sub {
    font-weight: 400;
    font-size: 11px;
    color: #888;
}
.detail-table-wrap table th, .detail-table-wrap table td {
    text-align: center;
    vertical-align: middle;
    padding: 4px 6px;
}
.detail-table-wrap table td.bg-debx { background: #e3f2fd; }
.detail-table-wrap table td.bg-debj { background: #fff8e1; }

/* ========== 嵌入构成行 ========== */
.detail-table-wrap .embed-title-row > td,
.detail-table-wrap .embed-data-row > td {
    background: #f8f9fc !important;
    padding: 10px 8px !important;
    text-align: left !important;
    border-bottom: 2px solid #e0e0e0 !important;
    vertical-align: top !important;
}
.detail-table-wrap .embed-label-cell {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: #333 !important;
    background: #f8f9fa !important;
    vertical-align: middle !important;
    text-align: center !important;
}
.detail-table-wrap .embed-title { font-size: 12px; font-weight: 600; color: #333; margin-bottom: 4px; }
.detail-table-wrap .embed-right { border-left: 3px solid #999 !important; padding-left: 12px !important; }
.detail-table-wrap .embed-left { padding-right: 12px !important; }
/* 构成行内的 bc-row 及子元素样式 */
.detail-table-wrap .embed-title-row .bc-row,
.detail-table-wrap .embed-data-row .bc-row {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
}
.detail-table-wrap .embed-title-row .bc-item,
.detail-table-wrap .embed-data-row .bc-item {
    text-align: center !important;
    flex: 1 !important;
    min-width: 45px !important;
}
.detail-table-wrap .embed-title-row .bc-val,
.detail-table-wrap .embed-data-row .bc-val {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #333 !important;
    display: block !important;
}
.detail-table-wrap .embed-title-row .bc-val.interest-val,
.detail-table-wrap .embed-data-row .bc-val.interest-val {
    color: #ef4444 !important;
}
.detail-table-wrap .embed-title-row .bc-label,
.detail-table-wrap .embed-data-row .bc-label {
    font-size: 10px !important;
    color: #999 !important;
    display: block !important;
    margin-top: 1px !important;
}
.detail-table-wrap .embed-title-row .bc-eq,
.detail-table-wrap .embed-data-row .bc-eq {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #666 !important;
    flex-shrink: 0 !important;
}
/* 进度条 */
.detail-table-wrap .embed-title-row .bc-bar,
.detail-table-wrap .embed-data-row .bc-bar {
    height: 28px !important;
    margin-top: 10px !important;
    border-radius: 14px !important;
    display: flex !important;
    overflow: hidden !important;
    background: #eee !important;
}
.detail-table-wrap .embed-title-row .bc-bar-labels,
.detail-table-wrap .embed-data-row .bc-bar-labels {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 4px !important;
}
.detail-table-wrap .embed-title-row .bc-bar-labels span,
.detail-table-wrap .embed-data-row .bc-bar-labels span {
    font-size: 11px !important;
    color: #999 !important;
}

/* ========== 组合贷 ========== */
.combine-cards { display: flex; gap: 12px; margin-top: 12px; }
.combine-card { flex: 1; border-radius: 10px; padding: 16px; text-align: center; transition: all 0.2s; position: relative; overflow: hidden; }
.combine-card:hover { transform: translateY(-1px); }
.combine-card-gjj { background: #f5f9ff; border: 1px solid #e3edf7; }
.combine-card-sy { background: #f5fbf7; border: 1px solid #e3f0e8; }
.combine-card-label { font-size: 12px; color: #aaa; margin-bottom: 6px; }
.combine-card-amount { font-size: 26px; font-weight: 700; line-height: 1.2; }
.combine-card-amount small { font-size: 13px; font-weight: 400; color: #bbb; }
.combine-card-gjj .combine-card-amount { color: #5b9bd5; }
.combine-card-sy .combine-card-amount { color: #5cb85c; }
.combine-card-pct { font-size: 12px; color: #ccc; margin-top: 2px; }
.combine-bar-wrap { margin-top: 12px; height: 4px; background: #f0f0f0; border-radius: 2px; overflow: hidden; display: flex; }
.combine-bar-fill { height: 100%; transition: width 0.6s ease; }
.combine-bar-fill.gjj { background: #5b9bd5; border-radius: 2px 0 0 2px; }
.combine-bar-fill.sy { background: #5cb85c; border-radius: 0 2px 2px 0; }

/* ========== 建议框 ========== */
.advice-box { background: #f0f2ff; border-left: 4px solid #667eea; padding: 16px; border-radius: 6px; margin-top: 16px; }

/* ========== 优化卡片 ========== */
.optimize-cards { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.optimize-card { flex: 1; min-width: 250px; border-radius: 10px; padding: 20px; background: #f8f9fa; border: 2px solid #eee; transition: all 0.3s; cursor: pointer; }
.optimize-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.optimize-card.recommended { border-color: #667eea; background: #f0f2ff; }
.optimize-card .oc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.optimize-card .oc-icon { font-size: 24px; }
.optimize-card .oc-title { font-size: 16px; font-weight: 600; color: #333; }
.optimize-card .oc-badge { background: #667eea; color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.optimize-card .oc-desc { font-size: 13px; color: #666; margin-bottom: 12px; line-height: 1.6; }
.optimize-card .oc-benefit { font-size: 20px; font-weight: 700; color: #1e88e5; }
.optimize-card .oc-benefit small { font-size: 12px; color: #888; }

/* ========== 等额本息/等额本金独立Tab ========== */
.month-switcher { margin-top: 16px; }
.switch-bar { display: flex; background: #f0f2f5; border-radius: 10px; padding: 3px; gap: 2px; position: relative; }
.switch-bar .switch-btn-item { position: relative; flex: 1; padding: 8px 12px; border: none; border-radius: 8px; background: transparent; cursor: pointer; font-size: 13px; color: #666; z-index: 1; transition: all 0.3s; white-space: nowrap; }
.switch-bar .switch-btn-item.active { background: #fff; color: #667eea; font-weight: 600; box-shadow: 0 2px 8px rgba(102,126,234,0.15); }
.switch-bar .switch-fill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: #fff; box-shadow: 0 2px 8px rgba(102,126,234,0.15); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 0; pointer-events: none; }

.breakdown-card { background: #f8f9fc; border-radius: 12px; padding: 20px; margin-top: 16px; }
.breakdown-card .bc-title { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 2px; }
.breakdown-card .bc-subtitle { font-size: 12px; color: #aaa; margin-bottom: 16px; }
.breakdown-card .bc-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.breakdown-card .bc-item { text-align: center; flex: 1; min-width: 60px; }
.breakdown-card .bc-val { font-size: 20px; font-weight: 700; color: #333; }
.breakdown-card .bc-val.interest-val { color: #ef4444; }
.breakdown-card .bc-label { font-size: 12px; color: #999; margin-top: 2px; }
.breakdown-card .bc-eq { font-size: 18px; font-weight: 700; color: #666; }
.breakdown-card .bc-bar { height: 28px; border-radius: 14px; overflow: hidden; display: flex; margin-top: 16px; }
.breakdown-card .bc-bar-fill { height: 100%; transition: width 0.6s ease; }
.breakdown-card .bc-bar-fill.bc-bar-principal { background: linear-gradient(135deg, #4285f4, #1e88e5); }
.breakdown-card .bc-bar-fill.bc-bar-interest { background: linear-gradient(135deg, #f87171, #ef4444); }
.bc-bar-fill { height: 100%; transition: width 0.6s ease; }
.bc-bar-fill.bc-bar-principal { background: linear-gradient(135deg, #4285f4, #1e88e5); }
.bc-bar-fill.bc-bar-interest { background: linear-gradient(135deg, #f87171, #ef4444); }

/* 构成行内进度条填充（确保在表格内也显示渐变） */
.detail-table-wrap .embed-title-row .bc-bar-fill,
.detail-table-wrap .embed-data-row .bc-bar-fill {
    height: 100% !important;
    transition: width 0.6s ease;
}
.detail-table-wrap .embed-title-row .bc-bar-fill.bc-bar-principal,
.detail-table-wrap .embed-data-row .bc-bar-fill.bc-bar-principal {
    background: linear-gradient(135deg, #4285f4, #1e88e5) !important;
}
.detail-table-wrap .embed-title-row .bc-bar-fill.bc-bar-interest,
.detail-table-wrap .embed-data-row .bc-bar-fill.bc-bar-interest {
    background: linear-gradient(135deg, #f87171, #ef4444) !important;
}
.breakdown-card .bc-bar-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.breakdown-card .bc-bar-labels span { font-size: 12px; color: #999; }
