/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-header-dashboard: #667BFD;
    --color-header-month: #4B4DFD;
    --color-title-bg: #F2F6FC;
    --color-income-bg: #e8f5e9;
    --color-expense-bg: #fff3e0;
    --color-income-text: #2e7d32;
    --color-expense-text: #e65100;
    --color-balance-positive: #2e7d32;
    --color-balance-negative: #c62828;
    --color-border: #e0e0e0;
    --color-text: #333;
    --color-text-secondary: #666;
    --color-bg: #f5f6fa;
    --color-card-bg: #fff;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --radius: 8px;
}

body {
    font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

/* ========== 布局 ========== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    background: var(--color-title-bg);
    border-radius: var(--radius);
    padding: 24px 32px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 24px;
    color: #333;
    font-weight: 600;
}

.page-header .actions {
    display: flex;
    gap: 10px;
}

/* ========== 页头标题区（月度页） ========== */
.page-header .title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.page-header .title-line {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-header h1 .h1-icon {
    font-size: 22px;
}

.month-nav {
    display: flex;
    gap: 6px;
}

.month-nav .btn {
    min-width: 66px;
    justify-content: center;
    padding: 4px 12px;
    font-size: 12px;
}

/* ========== 更多下拉菜单 ========== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 200;
    padding: 6px;
}

.dropdown.open .dropdown-menu {
    display: block;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--color-title-bg);
}

.dropdown-form {
    margin: 0;
}

.dropdown-form .dropdown-item {
    color: var(--color-balance-negative);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 0;
}

/* ========== 导航（胶囊式切换卡） ========== */
.nav-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
}

/* 首页标签独占一行，12 个月份呈 3 行 × 4 列排列 */
.nav-tabs .nav-tab:first-child {
    grid-column: 1 / -1;
}

.nav-tab {
    padding: 9px 8px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    color: var(--color-text-secondary);
    font-size: 14px;
    text-decoration: none;
    display: block;
    text-align: center;
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
}

.nav-tab:hover {
    background: var(--color-title-bg);
    color: var(--color-header-month);
    border-color: var(--color-header-month);
}

.nav-tab.active {
    background: var(--color-header-dashboard);
    color: #fff;
    border-color: var(--color-header-dashboard);
}

/* 当前月份标记（首页高亮"本月"为默认显示项，与 .active 区分） */
.nav-tab.current {
    background: var(--color-title-bg);
    color: var(--color-header-month);
    font-weight: 600;
    border-color: var(--color-header-month);
}

/* ========== 卡片 ========== */
.card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-header-dashboard);
}

/* ========== 汇总卡片 ========== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.summary-card:hover {
    box-shadow: var(--shadow-hover);
}

.summary-card .label {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 32px;
    font-weight: 700;
    font-family: "Segoe UI", sans-serif;
}

.summary-card.income .value { color: var(--color-income-text); }
.summary-card.expense .value { color: var(--color-expense-text); }
.summary-card.balance .value { color: var(--color-text); }

.summary-card .percentage {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* ========== 表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--color-header-month);
    color: #fff;
    padding: 10px 8px;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.1);
}

.data-table.dashboard-table th {
    background: var(--color-header-dashboard);
}

.data-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.data-table tr.total-row td {
    background: #E8EAF6;
    font-weight: 600;
}

.data-table .amount {
    font-family: "Consolas", "Courier New", monospace;
    text-align: right;
    padding-right: 12px;
}

.data-table .amount.income { color: var(--color-income-text); }
.data-table .amount.expense { color: var(--color-expense-text); }

/* ========== 月度双表格布局 ========== */
.month-tables {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

.month-tables .table-section {
    overflow-x: auto;
}

.month-tables .table-title {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 10px;
    background: var(--color-title-bg);
    border-radius: var(--radius) var(--radius) 0 0;
}

.month-tables .income-title { border-bottom: 3px solid var(--color-income-text); }
.month-tables .expense-title { border-bottom: 3px solid var(--color-expense-text); }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    color: #fff;
}

.btn-primary { background: var(--color-header-dashboard); }
.btn-primary:hover { background: #5568d4; }

.btn-success { background: #43a047; }
.btn-success:hover { background: #388e3c; }

.btn-danger { background: #e53935; }
.btn-danger:hover { background: #c62828; }

.btn-warning { background: #ff9800; }
.btn-warning:hover { background: #f57c00; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover { background: var(--color-title-bg); }

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-icon {
    padding: 4px 8px;
    font-size: 14px;
}

/* ========== 本月合计汇总表（month.php 日汇总下方） ========== */
.month-total-summary.data-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    background: #E8EAF6;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 16px;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.month-total-summary.data-table thead th {
    background: #E8EAF6;
    color: var(--color-text);
    font-weight: 600;
    text-align: center;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.month-total-summary.data-table tbody td {
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    color: var(--color-text-secondary);
}

.month-total-summary.data-table tbody tr:last-child td {
    border-bottom: none;
}

.month-total-summary.data-table tbody td:first-child {
    text-align: left;
    color: var(--color-text);
}

.month-total-summary.data-table tbody td:last-child {
    text-align: right;
    font-weight: 600;
}

.month-total-summary.data-table .amount.income {
    color: var(--color-balance-positive);
}

.month-total-summary.data-table .amount.expense {
    color: var(--color-expense);
}

.month-total-summary.data-table .amount {
    padding-right: 0;
}

@media (max-width: 480px) {
    .month-total-summary.data-table {
        font-size: 12.5px;
        margin-top: 12px;
    }
    .month-total-summary.data-table thead th,
    .month-total-summary.data-table tbody td {
        padding: 9px 12px;
    }
}

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-header-dashboard);
    box-shadow: 0 0 0 3px rgba(102,123,253,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

/* 类型选择 */
.type-selector {
    display: flex;
    gap: 10px;
}

.type-option {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.type-option.active.income {
    border-color: var(--color-income-text);
    background: var(--color-income-bg);
    color: var(--color-income-text);
}

.type-option.active.expense {
    border-color: var(--color-expense-text);
    background: var(--color-expense-bg);
    color: var(--color-expense-text);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.success { background: #43a047; }
.toast.error { background: #e53935; }
.toast.info { background: var(--color-header-dashboard); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== 统计行 ========== */
.stat-row {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 12px 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-item .stat-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.stat-item .stat-value {
    font-size: 18px;
    font-weight: 600;
    font-family: "Consolas", monospace;
}

/* ========== 导入导出区 ========== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* ========== 日汇总表 ========== */
.daily-summary {
    overflow-x: auto;
}

/* ========== 通用网格 / 表格滚动容器 ========== */
/* 两列布局（首页：本周 + 本月卡片） */
.two-col-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

/* 三列布局（首页：本月收入 / 支出 / 结余小卡） */
.three-col-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* 首页"本月收支概况"三小卡（默认桌面端：居中卡片式） */
.month-overview-item {
    text-align: center;
    padding: 16px;
    border-radius: 8px;
    min-width: 0;
}

.month-overview-item .ov-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.month-overview-item .ov-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.3;
    word-break: break-all;
}

.month-overview-item .ov-sub {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* 金额/说明右侧栏（移动端横条布局时右对齐，桌面端随父级居中） */
.month-overview-item .ov-wrap {
    min-width: 0;
}

/* 表格横向滚动容器（移动端表格超宽时内部滚动，避免撑破页面） */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 月度页标题区（标题 + 上月/下月），窄屏允许换行 */
.title-group {
    flex-wrap: wrap;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .month-tables {
        grid-template-columns: minmax(0, 1fr);
    }
    .summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .two-col-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    .page-header {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .page-header h1 {
        font-size: 20px;
    }
    /* 页头操作按钮自动换行，避免溢出 */
    .page-header .actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .page-header .actions > * {
        min-width: 0;
    }
    .page-header .actions .btn,
    .page-header .actions select {
        flex: 1 1 auto;
        justify-content: center;
    }
    /* 新增收入/支出按钮自适应均分；更多下拉占整行 */
    .page-header .actions > .btn-add {
        flex: 1 1 auto;
    }
    .page-header .actions > .dropdown {
        flex: 1 1 100%;
        display: flex;
    }
    .page-header .actions > .dropdown .dropdown-toggle {
        flex: 1;
        justify-content: center;
    }
    .page-header .actions > .dropdown .dropdown-menu {
        left: 0;
        right: 0;
    }
    .page-header .title-line {
        flex-wrap: wrap;
    }
    /* 导航：胶囊网格，移动端保持 4 列 × 3 行，无需横向滑动 */
    .nav-tabs {
        margin-left: 0;
        margin-right: 0;
        border-radius: var(--radius);
        padding: 8px;
        gap: 6px;
    }
    .nav-tab {
        padding: 8px 4px;
        font-size: 13px;
    }
    .summary-card {
        padding: 18px 12px;
    }
    .summary-card .value {
        font-size: 26px;
    }
    /* 本月收支三小卡：改为紧凑横条式（标签在左、金额在右），避免纵向堆叠过长 */
    .three-col-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
    .month-overview-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding: 12px 14px;
    }
    .month-overview-item .ov-value {
        font-size: 20px;
        margin-top: 0;
    }
    .month-overview-item .ov-sub {
        margin-top: 2px;
    }
    .month-overview-item .ov-wrap {
        text-align: right;
    }
    .card {
        padding: 16px;
    }
    /* 模态框：小屏全宽 + 内容超高内部滚动 */
    .modal {
        min-width: 0;
        width: calc(100vw - 32px);
        max-width: 500px;
        max-height: 85vh;
        overflow-y: auto;
        padding: 20px;
    }
    /* Toast 居中显示，避免超出屏幕 */
    .toast {
        left: 16px;
        right: 16px;
        top: 12px;
        text-align: center;
    }
    .stat-row {
        flex-wrap: wrap;
        gap: 12px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    /* 表格保持最小宽度，内容完整、靠容器横向滚动 */
    .data-table {
        min-width: 600px;
    }
    /* 本周收支明细表：仅 3 列内容较窄，移动端取消 min-width 撑宽，直接自适应整卡宽度 */
    .week-detail {
        min-width: 0;
    }
    /* 收入/支出明细表：移动端改为卡片式列表，每行一条卡片，日期作标题、金额/摘要/备注/操作直接可见，无需横向滚动 */
    .income-detail,
    .expense-detail {
        min-width: 0;
    }
    .income-detail thead,
    .expense-detail thead {
        display: none;
    }
    .income-detail tr,
    .expense-detail tr {
        display: block;
        background: var(--color-card-bg);
        border: 1px solid var(--color-border);
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 2px 12px;
    }
    .income-detail td,
    .expense-detail td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 7px 0;
        border: 0;
        border-bottom: 1px dashed var(--color-border);
        font-size: 13px;
        text-align: right;
    }
    .income-detail td::before,
    .expense-detail td::before {
        content: attr(data-label);
        color: var(--color-text-secondary);
        font-size: 12px;
        flex-shrink: 0;
    }
    /* 日期列作为卡片标题 */
    .income-detail td:first-child,
    .expense-detail td:first-child {
        font-size: 14px;
        font-weight: 600;
        border-bottom: 1px solid var(--color-border);
    }
    .income-detail td:first-child::before,
    .expense-detail td:first-child::before {
        content: none;
    }
    /* 操作列：按钮靠右排布 */
    .income-detail td:last-child,
    .expense-detail td:last-child {
        justify-content: flex-end;
        gap: 8px;
        border-bottom: 0;
    }
    .income-detail td:last-child::before,
    .expense-detail td:last-child::before {
        content: none;
    }
    .income-detail .amount,
    .expense-detail .amount {
        padding-right: 0;
    }
    /* 空状态行 */
    .income-detail td.empty-state,
    .expense-detail td.empty-state {
        display: block;
        border: 0;
        padding: 20px 0;
        text-align: center;
    }
    .income-detail td.empty-state::before,
    .expense-detail td.empty-state::before {
        content: none;
    }
    /* 合计行：合计 + 金额两端对齐 */
    .income-detail tr.total-row,
    .expense-detail tr.total-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: #E8EAF6;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        padding: 4px 12px;
    }
    .income-detail tr.total-row td,
    .expense-detail tr.total-row td {
        display: block;
        border: 0;
        padding: 8px 0;
        text-align: right;
    }
    .income-detail tr.total-row td:first-child,
    .expense-detail tr.total-row td:first-child {
        color: var(--color-text);
        font-weight: 600;
        text-align: left;
    }
    .income-detail tr.total-row td:empty,
    .expense-detail tr.total-row td:empty {
        display: none;
    }
    /* 日收支汇总表：移动端改为卡片式列表，每行日期作标题、收入/支出/结余直接可见，无需横向滚动 */
    .daily-summary-table {
        min-width: 0;
    }
    .daily-summary-table thead {
        display: none;
    }
    .daily-summary-table tr {
        display: block;
        background: var(--color-card-bg);
        border: 1px solid var(--color-border);
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 2px 12px;
    }
    .daily-summary-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border: 0;
        border-bottom: 1px dashed var(--color-border);
        font-size: 13px;
        text-align: right;
    }
    .daily-summary-table td::before {
        content: attr(data-label);
        color: var(--color-text-secondary);
        font-size: 12px;
        flex-shrink: 0;
    }
    .daily-summary-table td:first-child {
        font-size: 14px;
        font-weight: 600;
        border-bottom: 1px solid var(--color-border);
    }
    .daily-summary-table td:first-child::before {
        content: none;
    }
    .daily-summary-table .amount {
        padding-right: 0;
    }
    .daily-summary-table tr.total-row {
        background: #E8EAF6;
        border: 1px solid var(--color-border);
    }
    .daily-summary-table tr.total-row td:first-child {
        color: var(--color-text);
    }

    /* 全年月度收支汇总表：移动端改为卡片式列表，结余金额/收入笔数/支出笔数等所有列直接可见，无需横向滚动 */
    .monthly-summary {
        min-width: 0;
    }
    .monthly-summary thead {
        display: none;
    }
    .monthly-summary tr {
        display: block;
        background: var(--color-card-bg);
        border: 1px solid var(--color-border);
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 2px 12px;
    }
    .monthly-summary td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 7px 0;
        border: 0;
        border-bottom: 1px dashed var(--color-border);
        font-size: 13px;
        text-align: right;
    }
    .monthly-summary td:last-child {
        border-bottom: 0;
    }
    .monthly-summary td::before {
        content: attr(data-label);
        color: var(--color-text-secondary);
        font-size: 12px;
        flex-shrink: 0;
    }
    .monthly-summary td:first-child {
        font-size: 15px;
        font-weight: 700;
        border-bottom: 1px solid var(--color-border);
    }
    .monthly-summary td:first-child a {
        color: var(--color-header-dashboard);
        text-decoration: none;
    }
    .monthly-summary td:last-child {
        justify-content: flex-start;
        padding-top: 8px;
    }
    .monthly-summary td:last-child .btn {
        width: 100%;
        justify-content: center;
    }
    .monthly-summary .amount {
        padding-right: 0;
    }
    .monthly-summary tr.total-row {
        background: #E8EAF6;
    }
    .monthly-summary tr.total-row td {
        background: transparent;
    }
    /* 加大编辑/删除按钮触控区域 */
    .btn-icon {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 18px;
    }
    /* 操作按钮两列排布，更省空间 */
    .page-header .actions .btn,
    .page-header .actions select {
        flex-basis: calc(50% - 8px);
    }
    .summary-card .value {
        font-size: 22px;
    }
    .btn-sm {
        padding: 6px 10px;
    }
    .month-overview-item {
        padding: 10px 12px;
    }
    .month-overview-item .ov-value {
        font-size: 18px;
    }
    .month-overview-item .ov-label {
        font-size: 12px;
    }
    .month-tables .table-title {
        font-size: 13px;
        padding: 8px;
    }
}

/* ========== 页脚（随机金融名言金句） ========== */
.site-footer {
    margin: 36px 0 0;
    padding: 22px 16px 30px;
    text-align: center;
    border-top: 1px solid var(--color-border);
    background: var(--color-card-bg);
}

.site-footer .footer-quote {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.9;
    max-width: 680px;
    margin: 0 auto 6px;
    padding: 0 8px;
}

.site-footer .footer-quote .quote-mark {
    color: var(--color-balance-positive);
    font-weight: 700;
}

.site-footer .footer-author {
    font-size: 12px;
    color: var(--color-text-secondary);
    opacity: 0.85;
}

.site-footer .footer-copy {
    font-size: 12px;
    color: var(--color-text-secondary);
    opacity: 0.55;
    margin-top: 10px;
}

@media (max-width: 480px) {
    .site-footer {
        margin-top: 24px;
        padding: 18px 12px 24px;
    }
    .site-footer .footer-quote {
        font-size: 12.5px;
    }
}

/* ========== 回到顶部按钮 ========== */
.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    z-index: 300;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #43a047;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background 0.2s;
}

.back-to-top:hover {
    background: #388e3c;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 480px) {
    .back-to-top {
        right: 16px;
        bottom: 18px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-header-dashboard);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 图表 ========== */
.chart-container {
    position: relative;
    height: 300px;
    margin-top: 10px;
}

#monthChartCanvas {
    width: 100% !important;
    height: 100% !important;
}
