/* ======================================================================
 *  专项附加扣除计算器 /tools/special-deduction
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

[hidden] { display: none !important; }

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

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

/* 勾选项 */
.spd-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 9px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-surface-soft);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.spd-check:hover { border-color: var(--c-primary); }
.spd-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--c-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.spd-check-body { display: flex; flex-direction: column; gap: 3px; }
.spd-check-body b { font-size: 13.5px; color: var(--c-text); }
.spd-check-body small { font-size: 11.5px; line-height: 1.5; color: var(--c-text-muted); }
.spd-check input:checked ~ .spd-check-body b { color: var(--c-primary); }

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

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

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

.spd-hero {
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 143, 31, 0.11), rgba(255, 90, 60, 0.06));
    border: 1px solid rgba(255, 143, 31, 0.26);
    margin-bottom: 14px;
}
.spd-hero-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.spd-hero-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: #f0851c;
    line-height: 1.1;
}
.spd-hero-num .cur { font-size: 20px; font-weight: 700; }
.spd-hero-num b { font-size: 38px; font-weight: 800; letter-spacing: -0.035em; }
.spd-hero-sub { font-size: 12.5px; color: var(--c-text-sub); margin-top: 8px; }

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

/* 明细 */
.spd-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.spd-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);
}
.spd-bill li:last-child { border-bottom: none; }
.spd-bill .k { display: block; color: var(--c-text-sub); }
.spd-bill .k small { display: block; font-size: 11px; color: var(--c-text-muted); margin-top: 2px; }
.spd-bill .v { font-weight: 700; color: var(--c-text); white-space: nowrap; }
.spd-bill li.is-off { opacity: 0.5; }
.spd-bill li.is-off .v { color: var(--c-text-muted); }
.spd-bill li.is-year .v { color: var(--c-primary); }
.spd-bill li.total { background: var(--c-surface-soft); }
.spd-bill li.total .k { font-weight: 700; color: var(--c-text); }
.spd-bill li.total .v { color: var(--c-accent-green); font-size: 15px; }

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

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

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

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

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .spd-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .spd-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .spd-check { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .spd-hero {
    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"] .spd-hero-num { color: #fbbf24; }
[data-theme="dark"] .spd-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .spd-split-item,
[data-theme="dark"] .spd-bill li.total,
[data-theme="dark"] .spd-table thead th,
[data-theme="dark"] .spd-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .spd-bill li.total .v { color: #34d399; }
[data-theme="dark"] .spd-table tbody td.c-std { color: #6ea8ff; }
