/* ======================================================================
 *  个税年度汇算计算器 /tools/tax-settlement
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

[hidden] { display: none !important; }

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

/* ---------- 表单 ---------- */
.ats-field { margin-bottom: 14px; min-width: 0; }
.ats-field > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 7px;
}
.ats-input-wrap { position: relative; display: flex; align-items: center; }
.ats-input {
    width: 100%;
    height: 43px;
    padding: 0 60px 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;
}
.ats-input::-webkit-outer-spin-button,
.ats-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ats-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.ats-input--pre { padding-left: 34px; }
.ats-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;
}
.ats-prefix {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.ats-suffix {
    position: absolute;
    right: 14px;
    font-size: 12px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.ats-help {
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--c-text-muted);
    margin-top: 6px;
}
.ats-help b { color: var(--c-text-sub); }
.ats-row2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.ats-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 13px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-muted);
}
.ats-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border);
}

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

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

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

.ats-hero {
    padding: 22px 24px;
    border-radius: 16px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    margin-bottom: 14px;
}
.ats-hero-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.ats-hero-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1.1;
    color: var(--c-text);
}
.ats-hero-num .cur { font-size: 20px; font-weight: 700; }
.ats-hero-num b { font-size: 38px; font-weight: 800; letter-spacing: -0.035em; }
.ats-hero-sub { font-size: 12.5px; color: var(--c-text-sub); margin-top: 8px; }

.ats-hero.is-refund {
    background: linear-gradient(135deg, rgba(0, 181, 120, 0.12), rgba(0, 200, 150, 0.07));
    border-color: rgba(0, 181, 120, 0.28);
}
.ats-hero.is-refund .ats-hero-num { color: var(--c-accent-green); }
.ats-hero.is-pay {
    background: linear-gradient(135deg, rgba(255, 143, 31, 0.13), rgba(255, 90, 60, 0.07));
    border-color: rgba(255, 143, 31, 0.3);
}
.ats-hero.is-pay .ats-hero-num { color: #f0851c; }
.ats-hero.is-even {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.09), rgba(120, 90, 255, 0.07));
    border-color: rgba(0, 102, 255, 0.2);
}
.ats-hero.is-even .ats-hero-num { color: var(--c-primary); }

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

/* 明细账单 */
.ats-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.ats-bill li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--c-border);
}
.ats-bill li:last-child { border-bottom: none; }
.ats-bill .k { color: var(--c-text-sub); }
.ats-bill .v { font-weight: 700; color: var(--c-text); white-space: nowrap; }
.ats-bill li.total { background: var(--c-surface-soft); }
.ats-bill li.total .v { color: var(--c-primary); font-size: 14.5px; }

/* 年终奖方案对比 */
.ats-compare {
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: var(--c-surface-soft);
}
.ats-cmp-head {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text-sub);
    margin-bottom: 10px;
}
.ats-cmp-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.ats-cmp-item {
    padding: 11px 13px;
    border-radius: 11px;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
}
.ats-cmp-item .k { display: block; font-size: 11.5px; color: var(--c-text-muted); margin-bottom: 4px; }
.ats-cmp-item .v { display: block; font-size: 17px; font-weight: 800; color: var(--c-text); letter-spacing: -0.02em; }
.ats-cmp-item small { display: block; font-size: 10.5px; color: var(--c-text-muted); margin-top: 4px; line-height: 1.5; }
.ats-cmp-item.is-win {
    border-color: rgba(0, 181, 120, 0.4);
    background: rgba(0, 181, 120, 0.08);
}
.ats-cmp-item.is-win .v { color: var(--c-accent-green); }
.ats-cmp-tip {
    margin-top: 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-accent-green);
}

.ats-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);
}
.ats-note b { color: var(--c-text); }

/* ---------- 税率表 ---------- */
.ats-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;
}
.ats-table-head { margin-bottom: 14px; }
.ats-table-head .ats-title { margin-bottom: 4px; }
.ats-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.ats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 520px;
}
.ats-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;
}
.ats-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.ats-table tbody tr:last-child td { border-bottom: none; }
.ats-table tbody td.c-rate { color: var(--c-primary); font-weight: 700; }
.ats-table tbody tr.is-active { background: var(--c-primary-soft); }
.ats-table tbody tr.is-active td { color: var(--c-text); font-weight: 700; }
.ats-table tbody tr.is-active td.c-rate { color: var(--c-primary); }

.ats-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;
}
.ats-info { margin-bottom: 26px; }

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

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .ats-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .ats-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .ats-hero.is-refund {
    background: linear-gradient(135deg, rgba(0, 200, 150, 0.16), rgba(0, 200, 150, 0.08));
    border-color: rgba(0, 200, 150, 0.32);
}
[data-theme="dark"] .ats-hero.is-refund .ats-hero-num { color: #34d399; }
[data-theme="dark"] .ats-hero.is-pay {
    background: linear-gradient(135deg, rgba(255, 143, 31, 0.18), rgba(255, 90, 60, 0.1));
    border-color: rgba(255, 143, 31, 0.34);
}
[data-theme="dark"] .ats-hero.is-pay .ats-hero-num { color: #fbbf24; }
[data-theme="dark"] .ats-hero.is-even {
    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"] .ats-hero.is-even .ats-hero-num { color: #6ea8ff; }
[data-theme="dark"] .ats-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .ats-split-item,
[data-theme="dark"] .ats-compare,
[data-theme="dark"] .ats-bill li.total,
[data-theme="dark"] .ats-table thead th,
[data-theme="dark"] .ats-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .ats-cmp-item { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .ats-cmp-item.is-win {
    background: rgba(0, 200, 150, 0.12);
    border-color: rgba(0, 200, 150, 0.4);
}
[data-theme="dark"] .ats-cmp-item.is-win .v,
[data-theme="dark"] .ats-cmp-tip { color: #34d399; }
[data-theme="dark"] .ats-table tbody tr.is-active { background: rgba(59, 130, 246, 0.14); }

/* ---- 年度汇算操作指南 ---- */
.ats-guide-sub { font-size: 14px; font-weight: 800; color: var(--c-text, #0f172a); margin: 22px 0 10px; }
.ats-guide-list { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 2; color: var(--c-text-sub, #334155); }
.ats-guide-list li { margin-bottom: 6px; }
.ats-guide-list b { color: var(--c-text, #0f172a); }
[data-theme="dark"] .ats-guide-sub,
[data-theme="dark"] .ats-guide-list b { color: #f1f5f9; }
[data-theme="dark"] .ats-guide-list { color: #cbd5e1; }
