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

/* 隐藏态兜底：避免 [hidden] 被组件自身的 display:flex 规则覆盖而常显 */
[hidden] { display: none !important; }

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

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

/* 明细分组标题 */
.it-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text);
    margin: 20px 0 14px;
}
.it-divider span {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
}
.it-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border);
    order: -1;
}

/* 扣除合计提示条 */
.it-deduct-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--c-primary-soft);
    border: 1px dashed rgba(0, 102, 255, 0.3);
    margin: 6px 0 4px;
    font-size: 13px;
    color: var(--c-text-sub);
    font-weight: 600;
}
.it-deduct-box b {
    font-size: 16px;
    font-weight: 800;
    color: var(--c-primary);
    letter-spacing: -0.01em;
}

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

/* ---------- 结果区 ---------- */
.it-result-card { min-height: 320px; }
.it-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;
}
.it-result-empty .emoji { font-size: 46px; opacity: 0.75; }

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

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

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

.it-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.it-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);
}
.it-bill li:last-child { border-bottom: none; }
.it-bill .k { color: var(--c-text-sub); }
.it-bill .v { font-weight: 700; color: var(--c-text); }
.it-bill li.total { background: var(--c-surface-soft); }
.it-bill li.total .v { color: var(--c-accent-orange); }

/* 年度汇算 */
.it-settle {
    padding: 15px 18px;
    border-radius: 14px;
    border: 1px solid var(--c-border);
    background: var(--c-surface-soft);
    margin-bottom: 14px;
}
.it-settle-label { font-size: 12px; color: var(--c-text-muted); margin-bottom: 6px; }
.it-settle-num {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--c-text);
    margin-bottom: 5px;
}
.it-settle-sub { font-size: 11.5px; color: var(--c-text-muted); line-height: 1.6; }
.it-settle.is-refund { border-color: rgba(0, 200, 150, 0.35); background: rgba(0, 200, 150, 0.08); }
.it-settle.is-refund .it-settle-num { color: var(--c-accent-green); }
.it-settle.is-pay { border-color: rgba(255, 159, 67, 0.38); background: rgba(255, 159, 67, 0.08); }
.it-settle.is-pay .it-settle-num { color: var(--c-accent-orange); }
.it-settle.is-zero .it-settle-num { color: var(--c-text-sub); font-size: 16px; }

/* 年终奖对比 */
.it-bonus {
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--c-border);
    background: var(--c-surface-soft);
    margin-bottom: 14px;
}
.it-bonus-head { font-size: 13px; font-weight: 800; margin-bottom: 12px; }
.it-bonus-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.it-bonus-item {
    padding: 13px 14px;
    border-radius: 11px;
    border: 1px solid var(--c-border);
    background: var(--c-bg-card);
    transition: all 0.16s ease;
}
.it-bonus-item.is-best {
    border-color: var(--c-accent-green);
    background: rgba(0, 200, 150, 0.08);
    box-shadow: 0 4px 14px rgba(0, 200, 150, 0.14);
}
.it-bonus-tag { font-size: 11.5px; color: var(--c-text-muted); margin-bottom: 6px; }
.it-bonus-num { font-size: 18px; font-weight: 800; color: var(--c-text); letter-spacing: -0.02em; }
.it-bonus-item.is-best .it-bonus-num { color: var(--c-accent-green); }
.it-bonus-tip {
    font-size: 12px;
    line-height: 1.7;
    color: var(--c-text-sub);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--c-border);
}
.it-bonus-tip b { color: var(--c-text); }

.it-note {
    font-size: 12.5px;
    line-height: 1.75;
    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);
}
.it-note b { color: var(--c-text); }

/* ---------- 逐月表 ---------- */
.it-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;
}
.it-table-head { margin-bottom: 14px; }
.it-table-head .it-title { margin-bottom: 4px; }
.it-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.it-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}
.it-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;
}
.it-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.it-table tbody tr:last-child td { border-bottom: none; }
.it-table tbody td b { color: var(--c-text); font-weight: 700; }
.it-table tbody td.c-tax { color: var(--c-accent-orange); font-weight: 600; }
.it-table tbody td.c-net { color: var(--c-accent-green); font-weight: 700; }
.it-table-empty {
    text-align: center;
    color: var(--c-text-muted) !important;
    padding: 30px 16px !important;
}

/* ---------- 免责 / 简介 ---------- */
.it-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;
}
.it-info { margin-bottom: 26px; }

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

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .it-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .it-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .it-deduct-box { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.3); }
[data-theme="dark"] .it-deduct-box b { color: #6ea8ff; }
[data-theme="dark"] .it-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(124, 92, 255, 0.13));
    border-color: rgba(59, 130, 246, 0.28);
}
[data-theme="dark"] .it-hero-num { color: #6ea8ff; }
[data-theme="dark"] .it-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .it-settle,
[data-theme="dark"] .it-bonus,
[data-theme="dark"] .it-split-item,
[data-theme="dark"] .it-bill li.total,
[data-theme="dark"] .it-table thead th,
[data-theme="dark"] .it-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .it-bonus-item { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .it-settle.is-refund { background: rgba(0, 200, 150, 0.12); }
[data-theme="dark"] .it-settle.is-pay { background: rgba(255, 159, 67, 0.12); }
[data-theme="dark"] .it-bonus-item.is-best { background: rgba(0, 200, 150, 0.12); }
[data-theme="dark"] .it-table tbody td.c-net { color: #34d399; }
