 /* ==================== CSS变量（便于主题定制） ==================== */
:root {
    --primary: #1a6fb5;
    --primary-dark: #155a8f;
    --primary-light: #e8f2fa;
    --bg: #f5f6f8;
    --white: #ffffff;
    --text: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-light: #8c9aab;
    --border: #e2e7ec;
    --border-light: #eef1f5;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --transition: 0.2s ease;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'Monaco', 'Menlo', monospace;
    --sidebar-width: 230px;
    --header-height: 52px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
    网站头部 - Header（可提取为 header.php）
    ============================================================ */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    height: var(--header-height);
}
.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 20px;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    flex-shrink: 0;
}
.header-logo .logo-icon {
    width: 30px;
    height: 30px;
    background: var(--primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}
.header-logo .logo-text {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}
.header-nav::-webkit-scrollbar {
    display: none;
}
.header-nav a {
    text-decoration: none;
    color: #4a5568;
    font-size: 13px;
    padding: 6px 11px;
    border-radius: 5px;
    transition: all var(--transition);
    white-space: nowrap;
    font-weight: 500;
}
.header-nav a:hover {
    background: #f7f9fb;
    color: var(--primary);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.btn-outline,
.btn-primary-sm {
    padding: 6px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: #4a5568;
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-primary-sm {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary-sm:hover {
    background: var(--primary-dark);
}
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #4a5568;
    font-size: 18px;
}
/* ==================== 头部结束 ==================== */

/* ==================== 主内容区 ==================== */
.main-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    gap: 16px;
    flex: 1;
    width: 100%;
}

/* ============================================================
    左侧工具导航 - Sidebar（可提取为 sidebar.php）
    ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px 0;
    align-self: flex-start;
    position: sticky;
    top: calc(var(--header-height) + 16px);
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
    border: 1px solid var(--border-light);
}
.sidebar-nav-group-title {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    padding: 8px 16px 4px;
    font-weight: 600;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    text-decoration: none;
    color: #4a5568;
    font-size: 12.5px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    border-radius: 0 4px 4px 0;
    margin-right: 3px;
}
.sidebar-nav-item:hover {
    background: #f8fafb;
    color: var(--primary);
}
.sidebar-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nav-item .nav-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #cbd5e0;
    flex-shrink: 0;
}
.sidebar-nav-item.active .nav-dot {
    background: var(--primary);
}
.sidebar-toggle-btn {
    display: none;
    width: 100%;
    padding: 9px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    justify-content: space-between;
    align-items: center;
}
/* ==================== 侧边栏结束 ==================== */

/* ==================== 右侧内容区 ==================== */
.content-area {
    flex: 1;
    min-width: 0;
}

/* 工具卡片 - 紧凑版 */
.tool-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    border: 1px solid var(--border-light);
}
.tool-card-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid #f0f3f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.tool-card-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
    margin: 0;
}
.tool-card-header .subtitle {
    font-size: 11.5px;
    color: var(--text-light);
    font-weight: 400;
}

/* 两栏布局：输入左 | 结果右 */
.calc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}
@media (max-width: 768px) {
    .calc-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* 输入区 */
.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.form-label {
    font-size: 12px;
    font-weight: 600;
    color: #3d4f5f;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.01em;
}
.form-label .label-hint {
    font-weight: 400;
    color: var(--text-light);
    font-size: 10px;
}
.input-with-tag {
    position: relative;
    display: flex;
    align-items: center;
}
.form-input {
    height: 36px;
    padding: 0 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text);
    transition: all var(--transition);
    background: #fafbfc;
    font-family: inherit;
    width: 100%;
    outline: none;
}
.form-input.input-mono {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: -0.3px;
}
.form-input:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 111, 181, 0.07);
}
.input-tag {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: var(--text-light);
    pointer-events: none;
    font-weight: 500;
}
.input-with-tag .form-input {
    padding-right: 35px;
}
.inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #5a6c7d;
}
.switch-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #5a6c7d;
}
.toggle-switch {
    position: relative;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cdd5dc;
    border-radius: 20px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 15px;
    width: 15px;
    left: 2.5px;
    bottom: 2.5px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(14px);
}
.collapse-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all var(--transition);
    background: none;
    border: none;
    font-family: inherit;
    margin-top: 2px;
}
.collapse-trigger:hover {
    background: var(--primary-light);
}
.collapse-trigger .arrow-icon {
    transition: transform var(--transition);
    font-size: 9px;
    display: inline-block;
}
.collapse-trigger.open .arrow-icon {
    transform: rotate(180deg);
}
.collapse-content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.25s ease;
    margin-top: 0;
}
.collapse-content.expanded {
    max-height: 500px;
    opacity: 1;
    margin-top: 8px;
}
.deduction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    background: #f9fafb;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    font-size: 11.5px;
}
@media (max-width: 600px) {
    .deduction-grid {
        grid-template-columns: 1fr;
    }
}
.deduction-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #4a5568;
    flex-wrap: wrap;
}
.deduction-item select,
.deduction-item input[type="number"] {
    height: 28px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11.5px;
    width: 65px;
    background: #fff;
    font-family: inherit;
}
.deduction-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}
.deduction-item label {
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

/* 结果区 - 紧凑版 */
.calc-results {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius);
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.calc-results .result-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.calc-results .result-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    transition: all var(--transition);
    letter-spacing: 0.02em;
    font-family: inherit;
    white-space: nowrap;
}
.btn-copy:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(26, 111, 181, 0.2);
}
.btn-copy:active {
    transform: scale(0.96);
    transition: 0.06s ease;
}
.btn-copy.copied {
    background: #10b981;
    pointer-events: none;
}
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px dashed #e8ecf1;
    font-size: 12.5px;
}
.result-row:last-of-type {
    border-bottom: none;
}
.result-row .result-label {
    color: #5a6c7d;
    font-weight: 500;
}
.result-row .result-value {
    font-weight: 600;
    color: #1a1a1a;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: -0.2px;
}
.result-highlight {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1.5px solid #e0e7ef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.result-highlight .highlight-label {
    font-weight: 700;
    font-size: 13px;
    color: #1a1a1a;
}
.result-highlight .highlight-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    font-family: var(--font-mono);
    letter-spacing: -0.3px;
}
.result-highlight.tax-row {
    border-color: #fde68a;
    background: #fffdf7;
}
.result-highlight.tax-row .highlight-value {
    color: #d97706;
}
.result-highlight.net-row {
    border-color: #d1fae5;
    background: #f9fdfb;
}
.result-highlight.net-row .highlight-value {
    color: #059669;
}
.tax-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 600;
    align-self: flex-start;
}
.tax-badge.low {
    background: #d1fae5;
    color: #065f46;
}
.tax-badge.mid {
    background: #fef3c7;
    color: #b45309;
}
.tax-badge.high {
    background: #fee2e2;
    color: #991b1b;
}

/* 税率表 */
.rate-summary {
    margin-top: 8px;
    font-size: 11px;
}
.rate-summary details {
    cursor: pointer;
}
.rate-summary summary {
    font-weight: 600;
    color: #4a5568;
    padding: 3px 0;
    font-size: 11.5px;
}
.rate-table-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
    margin-top: 4px;
}
.rate-table-mini th,
.rate-table-mini td {
    padding: 4px 6px;
    text-align: center;
    border: 1px solid #e2e8f0;
}
.rate-table-mini th {
    background: #f8fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 10px;
}
.rate-table-mini .highlight-row {
    background: #fffbeb;
    font-weight: 700;
}
.rate-table-mini .highlight-row td {
    color: var(--primary);
    border-color: #fde68a;
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 8px 18px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(6px);
}
.toast.success {
    background: #10b981;
}

/* ============================================================
    网站底部 - Footer（可提取为 footer.php）
    ============================================================ */
.site-footer {
    background: #1e293b;
    color: #cbd5e0;
    margin-top: 30px;
    padding: 30px 0 0;
    font-size: 12.5px;
}
.footer-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}
@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}
@media (max-width: 480px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
.footer-col h4 {
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}
.footer-col a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    padding: 3px 0;
    transition: color var(--transition);
    font-size: 12px;
}
.footer-col a:hover {
    color: #e2e8f0;
}
.footer-bottom {
    border-top: 1px solid #334155;
    margin-top: 24px;
    padding: 14px 20px;
    text-align: center;
    color: #64748b;
    font-size: 11px;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
}
.footer-bottom a {
    color: #94a3b8;
    text-decoration: none;
}
.footer-bottom a:hover {
    color: #e2e8f0;
}
.footer-contact .phone {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
}
/* ==================== 底部结束 ==================== */

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        display: none;
        border-radius: var(--radius);
        margin-bottom: 6px;
    }
    .sidebar.visible {
        display: block;
    }
    .sidebar-toggle-btn {
        display: flex;
    }
    .header-nav a {
        font-size: 12px;
        padding: 5px 8px;
    }
    .header-inner {
        gap: 10px;
        padding: 0 14px;
        height: 48px;
    }
    .tool-card {
        padding: 14px 14px;
    }
    :root {
        --header-height: 48px;
    }
}
@media (min-width: 1025px) {
    .sidebar {
        display: block !important;
    }
}
@media (max-width: 640px) {
    .header-nav {
        display: none;
    }
    .mobile-menu-btn {
        display: block;
    }
    .header-inner {
        gap: 6px;
    }
    .btn-outline,
    .btn-primary-sm {
        padding: 5px 10px;
        font-size: 11px;
    }
    .calc-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}