/* ======================================================================
 *  公积金贷款额度计算器 /tools/housing-fund-loan
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

[hidden] { display: none !important; }

.hl-layout {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}
.hl-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.hl-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

/* ---------- 表单 ---------- */
.hl-field { margin-bottom: 15px; min-width: 0; }
.hl-field > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 7px;
}
.hl-wrap { position: relative; display: flex; align-items: center; }
.hl-input {
    width: 100%;
    height: 43px;
    padding: 0 52px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
    -moz-appearance: textfield;
}
.hl-input::-webkit-outer-spin-button,
.hl-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hl-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.hl-input--pre { padding-left: 34px; }
.hl-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 36px;
    font-size: 13.5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}
.hl-pre {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.hl-suf {
    position: absolute;
    right: 14px;
    font-size: 12px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.hl-help {
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--c-text-muted);
    margin-top: 6px;
}
.hl-help b { color: var(--c-text-sub); }
.hl-row2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.btn-block { width: 100%; margin-top: 8px; }

/* ---------- 结果区 ---------- */
.hl-result-card { min-height: 320px; }
.hl-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 300px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13.5px;
    line-height: 1.8;
}
.hl-result-empty .emoji { font-size: 46px; opacity: 0.75; }

.hl-result-body { animation: hlFade 0.28s ease; }
@keyframes hlFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.hl-hero {
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.10), rgba(120, 90, 255, 0.08));
    border: 1px solid rgba(0, 102, 255, 0.2);
    margin-bottom: 14px;
}
.hl-hero-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.hl-hero-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--c-primary);
    line-height: 1.1;
}
.hl-hero-num .cur { font-size: 20px; font-weight: 700; }
.hl-hero-num b { font-size: 38px; font-weight: 800; letter-spacing: -0.035em; }
.hl-hero-sub { font-size: 12.5px; color: var(--c-text-sub); margin-top: 8px; }

.hl-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.hl-split-item {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
}
.hl-split-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.hl-split-key { font-size: 11.5px; color: var(--c-text-muted); }

/* 限制明细 */
.hl-limits {
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.hl-limits-head {
    padding: 11px 16px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border-bottom: 1px solid var(--c-border);
}
.hl-limits-head span { font-weight: 500; color: var(--c-text-muted); font-size: 11.5px; }
.hl-limit-list { list-style: none; }
.hl-limit-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--c-border);
    font-size: 13px;
}
.hl-limit-list li:last-child { border-bottom: none; }
.hl-limit-list li.is-bind { background: rgba(0, 200, 150, 0.07); }
.hl-limit-name { display: block; color: var(--c-text-sub); }
.hl-limit-name small { display: block; font-size: 11px; color: var(--c-text-muted); margin-top: 2px; }
.hl-limit-list li.is-bind .hl-limit-name { color: var(--c-text); font-weight: 700; }
.hl-limit-val { font-weight: 700; color: var(--c-text); white-space: nowrap; }
.hl-limit-list li.is-bind .hl-limit-val { color: var(--c-accent-green); }

.hl-bill {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.hl-bill-item {
    flex: 1;
    min-width: 150px;
    padding: 12px 15px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
}
.hl-bill-item .k { display: block; font-size: 11.5px; color: var(--c-text-muted); margin-bottom: 5px; }
.hl-bill-item .v { font-size: 15px; font-weight: 800; color: var(--c-text); }

.hl-note {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--c-text-sub);
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--c-primary-soft);
    border: 1px dashed rgba(0, 102, 255, 0.28);
}
.hl-note b { color: var(--c-text); }

/* ---------- 对照表 ---------- */
.hl-table-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}
.hl-table-head { margin-bottom: 14px; }
.hl-table-head .hl-title { margin-bottom: 4px; }
.hl-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.hl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}
.hl-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.hl-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.hl-table tbody tr:last-child td { border-bottom: none; }
.hl-table tbody td b { color: var(--c-text); font-weight: 700; }
.hl-table tbody td.c-bal { color: var(--c-primary); }
.hl-table tbody td.c-loan { color: var(--c-accent-green); font-weight: 700; }
.hl-table tbody tr.is-current { background: var(--c-primary-soft); }
.hl-table-empty {
    text-align: center;
    color: var(--c-text-muted) !important;
    padding: 30px 16px !important;
}

/* ---------- 免责 / 简介 ---------- */
.hl-disclaim {
    font-size: 12px;
    line-height: 1.85;
    color: var(--c-text-muted);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 26px;
}
.hl-info { margin-bottom: 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .hl-layout { grid-template-columns: 1fr; }
    .hl-result-card { min-height: auto; }
    .hl-result-empty { min-height: 180px; }
}
@media (max-width: 620px) {
    .hl-card, .hl-table-card { padding: 18px; }
    .hl-hero-num b { font-size: 30px; }
    .hl-split { grid-template-columns: 1fr; }
    .hl-limit-list li { flex-direction: column; align-items: flex-start; gap: 4px; }
    .hl-bill-item { min-width: 100%; }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .hl-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .hl-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .hl-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(120, 90, 255, 0.14));
    border-color: rgba(59, 130, 246, 0.28);
}
[data-theme="dark"] .hl-hero-num { color: #6ea8ff; }
[data-theme="dark"] .hl-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .hl-split-item,
[data-theme="dark"] .hl-limits-head,
[data-theme="dark"] .hl-bill-item,
[data-theme="dark"] .hl-table thead th,
[data-theme="dark"] .hl-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .hl-limit-list li.is-bind { background: rgba(0, 200, 150, 0.10); }
[data-theme="dark"] .hl-limit-list li.is-bind .hl-limit-val { color: #34d399; }
[data-theme="dark"] .hl-table tbody tr.is-current { background: rgba(59, 130, 246, 0.14); }
[data-theme="dark"] .hl-table tbody td.c-loan { color: #34d399; }
