/* ==========================================================================
   家庭收支台账 - 样式表
   ========================================================================== */

/* ---------- 基础重置 ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* 主题色 */
    --color-primary:   #4f6bed;
    --color-primary-d: #3b54c4;
    --color-income:    #e85d3a;  /* 收入 = 红色（中国习惯） */
    --color-expense:   #2ea36b;  /* 支出 = 绿色（中国习惯） */
    --color-warning:   #f59e0b;
    --color-danger:    #dc2626;

    /* 中性色 */
    --bg-app:        #f0f2f5;
    --bg-card:       #ffffff;
    --bg-hover:      #f8f9fb;
    --bg-sidebar:    #1e293b;
    --bg-sidebar-h:  #334155;
    --text-primary:  #1e293b;
    --text-secondary:#64748b;
    --text-muted:    #94a3b8;
    --text-light:    #f1f5f9;
    --border-color:  #e2e8f0;

    /* 间距 */
    --radius:    10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow:    0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul,ol { list-style: none; }

/* ---------- 布局 ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    font-size: 1.25rem;
    font-weight: 700;
}
.logo-icon { font-size: 1.5rem; }

.nav {
    flex: 1;
    padding: 8px 12px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    transition: all .15s;
    margin-bottom: 2px;
    font-size: .95rem;
}
.nav-item:hover { background: var(--bg-sidebar-h); color: #fff; }
.nav-item.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.year-switch { font-size: .85rem; color: #94a3b8; }
.year-switch .dot { margin: 0 6px; }

/* ---------- 主内容 ---------- */
.main {
    flex: 1;
    margin-left: 240px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title { font-size: 1.3rem; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

.menu-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.content {
    padding: 24px 28px;
    flex: 1;
    max-width: 1400px;
    width: 100%;
}
.app-version {
    flex: 0 0 auto;
    text-align: center;
    padding: 8px 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    user-select: none;
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ---------- 统计卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    min-width: 0;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-primary);
    min-width: 0;
}
.stat-card.stat-income  { border-left-color: var(--color-income); }
.stat-card.stat-expense { border-left-color: var(--color-expense); }
.stat-card.stat-balance { border-left-color: var(--color-primary); }
.stat-card.stat-total   { border-left-color: var(--text-muted); }

.stat-label { font-size: .85rem; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
    min-width: 0;
    overflow-wrap: anywhere;
}
.stat-sub   { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

/* ---------- 图表 ---------- */
.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    min-width: 0;
}
.chart-grid > .card { min-width: 0; }
.chart-card .card-body { padding: 16px 20px 24px; }

/* ---------- 工具栏 ---------- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}
.toolbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}
.year-month-picker { display: flex; gap: 8px; align-items: center; }
.year-month-picker .select {
    width: auto;
    min-width: 108px;
    flex: 0 0 auto;
}
.year-month-picker #monthSelect { min-width: 84px; }

/* 日期输入：保留系统日期控件，同时提供独立年份快速选择 */
.date-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.date-input-wrap .input {
    flex: 1 1 auto;
    min-width: 0;
}
.date-year-quick {
    width: auto;
    min-width: 108px;
    flex: 0 0 auto;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--color-primary-d); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-sm  { padding: 6px 12px; font-size: .85rem; }
.btn-lg  { padding: 12px 24px; font-size: 1rem; }
.btn-xs  { padding: 4px 8px; font-size: .8rem; }

/* ---------- 表单 ---------- */
.input, .select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    background: #fff;
    color: var(--text-primary);
    transition: border-color .15s;
    outline: none;
    width: 100%;
}
.input:focus, .select:focus { border-color: var(--color-primary); }
.textarea { resize: vertical; }

.form { max-width: 600px; }
.form-container { max-width: 640px; margin: 0 auto; }
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-primary);
}
.required { color: var(--color-danger); }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}
.form-inline {
    display: flex;
    gap: 8px;
    align-items: end;
    flex-wrap: wrap;
}

/* ---------- 银行字段折叠区 ---------- */
.extra-fields {
    margin: 16px 0 24px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 6px 14px;
    background: var(--bg-secondary, #fafbfc);
}
.extra-fields > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color, #3b82f6);
    padding: 8px 0;
    list-style: none;
    user-select: none;
}
.extra-fields > summary::before {
    content: '▶ ';
    font-size: 0.7em;
    margin-right: 4px;
    transition: transform 0.2s;
    display: inline-block;
}
.extra-fields[open] > summary::before {
    transform: rotate(90deg);
}
.extra-fields > summary::-webkit-details-marker { display: none; }
.extra-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding: 10px 0 6px;
}
.extra-grid .form-group { margin-bottom: 12px; }
.extra-grid .form-group-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .extra-grid { grid-template-columns: 1fr; }
}

/* ---------- 表格辅助 ---------- */
.text-lighter { color: #c4c9d0; }

/* 金额输入 */
.amount-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.amount-prefix {
    padding: 0 12px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 1.1rem;
}
.amount-input-wrap .input {
    border: none;
    border-radius: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.input-amount { width: 100%; }

/* 类型切换 Tab */
.type-tabs {
    display: flex;
    gap: 8px;
}
.type-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s;
    font-weight: 500;
}
.type-tab input { display: none; }
.type-tab.active { border-color: var(--color-primary); background: rgba(79,107,237,.06); color: var(--color-primary); }

/* 分类网格 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}
.category-item input { display: none; }
.category-item:hover { border-color: var(--color-primary); background: var(--bg-hover); }
.category-item.active { border-color: var(--color-primary); background: rgba(79,107,237,.06); }
.cat-emoji { font-size: 1.5rem; }
.cat-name { font-size: .8rem; color: var(--text-secondary); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
.table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}
.table-hover tbody tr:hover { background: var(--bg-hover); }
.table tfoot td { border-top: 2px solid var(--border-color); border-bottom: none; }
.table-total { background: var(--bg-hover); }

/* ====== 表格布局：固定列宽 + ellipsis 截断 ======
   设计目标：在 1400px 容器内完整显示 10 列，无需横向滚动 */
.table-fixed { table-layout: fixed; }
.table-fixed col.col-date    { width: 100px; }   /* 日期 */
.table-fixed col.col-type    { width: 64px;  }   /* 类型 */
.table-fixed col.col-cat     { width: 150px; }   /* 分类 */
.table-fixed col.col-member  { width: 90px;  }   /* 成员 */
.table-fixed col.col-account { width: 130px; }   /* 账户 */
.table-fixed col.col-text    { width: 180px; }   /* 摘要 / 对方户名 */
.table-fixed col.col-money   { width: 110px; }   /* 金额 */
.table-fixed col.col-balance { width: 120px; }   /* 余额 */
.table-fixed col.col-op      { width: 84px;  }   /* 操作 */
.table-fixed .truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.table-fixed .text-nowrap { white-space: nowrap; }

/* ---------- v22：紧凑列表（账户/日期/类型/金额 + 操作 5 列） ---------- */
.table-compact { table-layout: fixed; width: 100%; }
.table-compact col.col-account { width: 100px; }
.table-compact col.col-date    { width: 130px; }
.table-compact col.col-type    { width: 90px; }
.table-compact col.col-money   { width: 130px; }
.table-compact col.col-op      { width: 130px; }
.table-compact tbody td { padding: 10px 8px; }
.table-compact tbody td:nth-child(1),
.table-compact tbody td:nth-child(2),
.table-compact tbody td:nth-child(3) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-compact .account-cell {
    color: var(--text-primary);
    font-weight: 600;
}
.cat-mini {
    margin-left: 4px;
    font-size: .9em;
    opacity: .65;
    cursor: help;
}

/* ---------- v12：详情弹窗（遮罩 + 居中卡片 + 字段网格） ---------- */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: detailFade .15s ease-out;
}
.detail-overlay[hidden] { display: none; }
@keyframes detailFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.detail-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    overflow-y: auto;
    padding: 28px 32px 24px;
    position: relative;
    animation: detailPop .18s ease-out;
}
@keyframes detailPop {
    from { transform: translateY(10px) scale(.97); opacity: 0; }
    to   { transform: translateY(0) scale(1);    opacity: 1; }
}
.detail-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: 0;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background .15s;
}
.detail-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.detail-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 18px;
    padding-right: 32px;
}
.detail-grid {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 10px 16px;
    font-size: .94rem;
}
.detail-k {
    color: var(--text-secondary);
    text-align: right;
    padding-top: 2px;
}
.detail-v {
    color: var(--text-primary);
    word-break: break-word;
    padding-top: 2px;
}
.btn-detail { padding: 4px 6px; }

.text-right { text-align: right; }
.text-center{ text-align: center; }
.text-muted { color: var(--text-muted); }
.text-income  { color: var(--color-income); font-weight: 600; }
.text-expense { color: var(--color-expense); font-weight: 600; }
.text-danger  { color: var(--color-danger); }

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-income  { background: rgba(232,93,58,.12);  color: var(--color-income); }
.badge-expense { background: rgba(46,163,107,.12); color: var(--color-expense); }

/* ---------- 进度条 ---------- */
.progress-bar {
    position: relative;
    width: 100%;
    height: 22px;
    background: var(--bg-hover);
    border-radius: 11px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--color-expense);
    border-radius: 11px;
    transition: width .3s;
    min-width: 2px;
}
.progress-income { background: var(--color-income); }
.progress-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---------- 分类图标 ---------- */
.cat-icon { margin-right: 4px; }
.cat-emoji-lg { font-size: 1.3rem; }

/* 分类列表 */
.cat-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.cat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.cat-row-name { flex: 1; font-weight: 500; }

/* ---------- 筛选栏 ---------- */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-row + .filter-row { margin-top: 10px; }
.filter-sep { color: var(--text-muted); padding: 0 4px; }
.filter-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 16px;
    font-size: .9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.filter-summary .sep { color: var(--border-color); }

/* ---------- 分页 ---------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 4px 8px;
    color: var(--text-secondary);
    font-size: .88rem;
}
.pagination-bar .page-info b { color: var(--text-primary); }
.page-size-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.page-size-label { font-size: .85rem; color: var(--text-secondary); }
.select-sm { padding: 4px 8px; font-size: .85rem; width: auto; }
.page-size-select { width: auto; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 8px 0 20px;
    flex-wrap: wrap;
}
.pagination a {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: .85rem;
    transition: all .15s;
}
.pagination a:hover:not(.disabled):not(.active) {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.pagination a.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
}
.pagination a.disabled { color: var(--text-muted); cursor: default; opacity: .5; }
.pagination .ellipsis { padding: 6px 4px; color: var(--text-muted); }
.page-jump-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}
.page-jump-label { font-size: .85rem; color: var(--text-secondary); }
.page-jump-input { width: 64px; text-align: center; padding: 4px 6px; font-size: .85rem; }

/* ---------- 提示框 ---------- */
.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .9rem;
    animation: slideDown .25s ease;
}
.alert-success { background: rgba(46,163,107,.1);  color: #1a7d4f; border: 1px solid rgba(46,163,107,.2); }
.alert-error   { background: rgba(220,38,38,.1);   color: #991b1b; border: 1px solid rgba(220,38,38,.2); }
.alert-info    { background: rgba(79,107,237,.1);  color: #3730a3; border: 1px solid rgba(79,107,237,.2); }
.alert-close { cursor: pointer; opacity: .6; }
.alert-close:hover { opacity: 1; }

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

/* ---------- 导入页 ---------- */
.import-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.step {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: .9rem;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.step.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
}
.step-arrow { color: var(--text-muted); }

.input-file {
    padding: 8px;
    cursor: pointer;
}
.form-help {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.import-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .88rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.import-meta .sep { color: var(--border-color); }

.import-preview-table .row-check { cursor: pointer; }
tr.row-dup { opacity: .5; background: rgba(245,158,11,.06); }

.import-guide .guide-item {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    line-height: 1.7;
}
.import-guide .guide-note {
    background: rgba(245,158,11,.08);
    color: #92400e;
}

.text-warning { color: var(--color-warning); font-weight: 600; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #fdf2f8 100%);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(79,107,237,.15);
    padding: 36px 32px 28px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo-icon { font-size: 2.4rem; display: block; margin-bottom: 6px; }
.login-logo h1 { font-size: 1.35rem; margin: 0 0 4px; color: var(--text-primary); }
.login-sub { color: var(--text-muted); font-size: .88rem; margin: 0; }
.login-form .form-group { margin-bottom: 16px; }
.login-tip {
    margin-top: 18px;
    padding: 10px 12px;
    background: rgba(245,158,11,.08);
    color: #92400e;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    text-align: center;
}
.login-tip code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }
.btn-block { width: 100%; }

/* ---------- 侧边栏用户信息 ---------- */
.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: .88rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .75rem; color: var(--text-muted); }
.user-actions { display: flex; gap: 6px; margin-bottom: 10px; }

/* ---------- 备忘提醒 ---------- */
.reminder-banner {
    border: 1px solid rgba(232,93,58,.25);
    background: linear-gradient(135deg, #fff7ed 0%, #fff 60%);
    margin-bottom: 16px;
}
.reminder-banner-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.reminder-banner-head h3 { margin: 0; font-size: 1rem; color: #9a3412; }
.reminder-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}
.reminder-item.reminder-today {
    background: rgba(232,93,58,.1);
    border: 1px dashed rgba(232,93,58,.4);
}
.reminder-icon { font-size: 1.5rem; }
.reminder-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.reminder-info strong { font-size: .95rem; }
.reminder-info .text-muted { font-size: .82rem; }
tr.row-urgent { background: rgba(232,93,58,.06); }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    cursor: pointer;
}
.input-xs { padding: 4px 8px; font-size: .8rem; width: auto; }

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: .95rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 12px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-value { font-size: 1.3rem; }
    .form-row { grid-template-columns: 1fr; }
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-row .input, .filter-row .select, .filter-row .btn { width: 100%; }
    .page-title { font-size: 1.1rem; }
    .table { font-size: .8rem; }
    .table th, .table td { padding: 8px 10px; }
    .card-body { padding: 16px; }
    .filter-bar { padding: 12px; }

    .toolbar {
        align-items: stretch;
    }
    .year-month-picker {
        width: 100%;
    }
    .year-month-picker .select {
        min-width: 0;
        flex: 1 1 0;
    }
    .year-month-picker #yearSelect { flex-basis: 58%; }
    .year-month-picker #monthSelect { flex-basis: 42%; }

    .table-compact col.col-account { width: 13%; }
    .table-compact col.col-date    { width: 34%; }
    .table-compact col.col-type    { width: 10%; }
    .table-compact col.col-money   { width: 21%; }
    .table-compact col.col-op      { width: 22%; }
    .table-compact th,
    .table-compact td {
        padding-left: 4px;
        padding-right: 4px;
    }
    .table-compact th {
        font-size: .76rem;
    }
    .table-compact .badge {
        padding-left: 4px;
        padding-right: 4px;
        font-size: .7rem;
    }
    .table-compact .cat-mini {
        display: none;
    }
    .table-compact .btn-xs {
        width: 28px;
        height: 28px;
        padding: 0;
        font-size: .74rem;
        gap: 0;
    }
    .table-compact .transaction-actions {
        font-size: 0;
        white-space: nowrap;
    }

    /* 明细页手机端使用满屏列表模式，保留顶部导航的可用宽度 */
    .transactions-filter,
    .transactions-list-card {
        width: calc(100% + 24px);
        margin-left: -12px;
        border-radius: 0;
    }
    .transactions-filter {
        padding: 12px 10px;
    }
    .transactions-summary {
        padding-left: 8px;
        padding-right: 8px;
    }
    .transactions-list-card .card-body {
        padding: 0 6px;
    }
    .transactions-list-card .table-compact th,
    .transactions-list-card .table-compact td {
        padding-left: 3px;
        padding-right: 3px;
    }
    .transactions-list-card .table-compact tbody td:nth-child(2) {
        font-size: .78rem;
    }

    .date-input-wrap {
        gap: 6px;
    }
    .date-year-quick {
        min-width: 96px;
    }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-card {
        min-width: 0;
        padding: 14px 10px;
        border-left-width: 3px;
    }
    .stat-label {
        font-size: .76rem;
        margin-bottom: 5px;
        white-space: nowrap;
    }
    .stat-value {
        font-size: 1.06rem;
        line-height: 1.35;
        white-space: nowrap;
    }
    .stat-sub {
        font-size: .68rem;
        margin-top: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    .toolbar-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .header-actions .btn { padding: 6px 10px; font-size: .8rem; }
}

/* ===== 语音不可用时的文字提醒弹窗（兜底） ===== */
.speech-fallback-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: 92%;
    max-width: 420px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #4f6bed;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    padding: 14px 16px;
    z-index: 9999;
    cursor: pointer;
    animation: sft-in .3s ease;
}
@keyframes sft-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.speech-fallback-toast .sft-head {
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: 6px;
    color: #4f6bed;
}
.speech-fallback-toast .sft-body {
    font-size: .92rem;
    line-height: 1.6;
    color: #334155;
    word-break: break-all;
}
.speech-fallback-toast .sft-hint {
    margin-top: 8px;
    font-size: .78rem;
    color: #94a3b8;
    line-height: 1.5;
    border-top: 1px dashed #e2e8f0;
    padding-top: 8px;
}

/* ===== 隐私模式开关卡片 ===== */
.privacy-card {
    border-left: 4px solid #6366f1;
    margin-bottom: 16px;
}
.privacy-status {
    font-size: .9rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}
.privacy-status.on {
    background: #ede9fe;
    color: #6d28d9;
}
.privacy-status.off {
    background: #f1f5f9;
    color: #64748b;
}

/* ===== 返回顶部悬浮按钮 ===== */
.back-to-top {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 80;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #3167b5;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(49, 103, 181, .28);
    font: inherit;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease, background .2s ease;
}

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

.back-to-top:hover {
    background: #28589d;
}

.back-to-top:active {
    transform: translateY(1px) scale(.97);
}

.back-to-top:focus-visible {
    outline: 3px solid rgba(49, 103, 181, .3);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .back-to-top {
        right: 16px;
        bottom: 18px;
        width: 48px;
        height: 48px;
        font-size: 29px;
    }
}
