/* ============ 基础与设计令牌 ============ */
:root {
  --primary: #0c6e60;
  --primary-deep: #084d43;
  --primary-soft: #e7f3f0;
  --gold: #c2a25c;
  --gold-soft: #f6efdd;
  --ink: #0a2622;
  --bg: #f2f5f4;
  --card: #ffffff;
  --text: #1f2b28;
  --text-2: #586a66;
  --muted: #84948f;
  --border: #e4eae7;
  --border-2: #eef1f0;
  --danger: #b84a3d;
  --danger-soft: #fbeae7;
  --warning: #c08a2e;
  --warning-soft: #faf1de;
  --success: #2e7d56;
  --success-soft: #e7f3ec;
  --slate: #4a6b74;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(12, 40, 34, 0.05);
  --shadow: 0 6px 24px -8px rgba(12, 40, 34, 0.12);
  --shadow-lg: 0 24px 60px -16px rgba(8, 40, 34, 0.25);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "DIN Alternate", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.18s ease;
  white-space: nowrap;
  background: #fff;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px -4px rgba(12, 110, 96, 0.6); }
.btn-primary:hover { background: #0a5f53; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: #cdd6d2; color: var(--text); background: #fafbfb; }
.btn-danger { background: #fff; border-color: #e6c4bf; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-gold { background: linear-gradient(135deg, #c9a864, #b3903f); color: #fff; box-shadow: 0 4px 12px -4px rgba(179, 144, 63, 0.6); }
.btn-gold:hover { filter: brightness(1.05); }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ============ 登录页 ============ */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.login-bg { position: absolute; inset: 0; background: linear-gradient(150deg, #06201d 0%, #0a332d 45%, #0c3f37 100%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55; }
.orb1 { width: 480px; height: 480px; background: radial-gradient(circle, #177a68, transparent 70%); top: -140px; left: -100px; }
.orb2 { width: 420px; height: 420px; background: radial-gradient(circle, rgba(194, 162, 92, 0.7), transparent 70%); bottom: -160px; right: -80px; }
.orb3 { width: 360px; height: 360px; background: radial-gradient(circle, #0e5a4f, transparent 70%); top: 40%; left: 55%; }
.login-card {
  position: relative;
  width: 400px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  padding: 42px 40px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.login-card h1 { font-size: 23px; letter-spacing: 1px; }
.login-sub { color: var(--muted); margin: 8px 0 28px; font-size: 13px; letter-spacing: 2px; }
.login-form { text-align: left; }
.field { display: block; margin-bottom: 18px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  background: #fbfcfc;
  transition: all 0.15s;
  outline: none;
}
.field textarea { height: auto; padding: 10px 14px; resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(12, 110, 96, 0.12);
}
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 12px 0 0; text-align: center; }
.login-foot { color: var(--muted); font-size: 12px; margin: 22px 0 0; }

/* ============ 应用骨架 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 238px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0a2823 0%, #08201c 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.brand-text strong { color: #f2f7f5; font-size: 16px; letter-spacing: 1px; display: block; }
.brand-text span { color: rgba(216, 226, 222, 0.4); font-size: 9px; letter-spacing: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.nav-group-title { font-size: 11px; color: rgba(216, 226, 222, 0.38); letter-spacing: 1.5px; padding: 14px 10px 7px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 9px;
  color: rgba(226, 235, 232, 0.75);
  font-size: 13.5px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: rgba(12, 110, 96, 0.55); color: #fff; box-shadow: inset 0 0 0 1px rgba(194, 162, 92, 0.25); }
.nav-item .nav-ico { width: 17px; text-align: center; flex-shrink: 0; font-size: 14px; opacity: 0.85; }
.nav-item .nav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  background: var(--gold);
  color: #1a2b27;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.nav-item.archived .nav-name { color: rgba(216, 226, 222, 0.5); font-size: 13px; }

.sidebar-user {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .su-name { color: #eef4f2; font-size: 13px; display: block; }
.sidebar-user .su-role { color: rgba(216, 226, 222, 0.45); font-size: 11px; }
.sidebar-user .su-avatar { flex-shrink: 0; }
.sidebar-user .su-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(226, 235, 232, 0.7);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }

/* ============ 主内容 ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 19px; flex-shrink: 0; }
.topbar .top-sub { color: var(--muted); font-size: 13px; }
.topbar .top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.content { padding: 26px 32px 50px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ============ 卡片 ============ */
.card { background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border-2); }
.card-head h3 { font-size: 15px; }
.card-head .card-actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 20px 22px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 19px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-card .stat-value { font-family: var(--num); font-size: 27px; font-weight: 700; margin-top: 9px; letter-spacing: 0.3px; font-variant-numeric: tabular-nums; }
.stat-card .stat-note { font-size: 12px; color: var(--muted); margin-top: 5px; }
.stat-card.accent { background: linear-gradient(135deg, #0c6e60, #0a574c); border-color: transparent; }
.stat-card.accent .stat-label, .stat-card.accent .stat-note { color: rgba(255,255,255,0.7); }
.stat-card.accent .stat-value { color: #fff; }
.stat-card .stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.v-out { color: var(--danger); }
.v-in { color: var(--success); }
.v-gold { color: var(--gold); }
.v-slate { color: var(--slate); }

/* ============ 成员/标签 ============ */
.member-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f4f7f6;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px 3px 4px;
  font-size: 12.5px;
}
.chip .avatar { width: 22px; height: 22px; font-size: 11px; }
.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}
.avatar.lg { width: 38px; height: 38px; font-size: 15px; }

/* 确认头像堆叠 */
.conf-stack { display: inline-flex; align-items: center; }
.conf-stack .avatar { width: 24px; height: 24px; font-size: 10.5px; border: 2px solid #fff; margin-left: -7px; }
.conf-stack .avatar:first-child { margin-left: 0; }
.conf-stack .avatar.confirmed { background: var(--primary); }
.conf-stack .avatar.pending { background: #d7dedb; color: #8a9692; border-style: dashed; }
.conf-stack .avatar.rejected { background: var(--danger); }

/* ============ 状态标签 ============ */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 11px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-pending { background: var(--warning-soft); color: var(--warning); }
.pill-confirmed { background: var(--success-soft); color: var(--success); }
.pill-rejected { background: var(--danger-soft); color: var(--danger); }
.pill-archived { background: #eef0f3; color: #677185; }
.pill-system { background: var(--gold-soft); color: #8a6d33; }

/* ============ 流水列表 ============ */
.entry-tabs { display: flex; gap: 4px; background: #eef1f0; padding: 4px; border-radius: 10px; }
.entry-tab { border: none; background: transparent; padding: 6px 15px; border-radius: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; transition: all 0.15s; }
.entry-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }
.entry-tab .tab-n { font-size: 11px; color: var(--muted); margin-left: 4px; }

.entry-list { display: flex; flex-direction: column; }
.entry-row {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-2);
  transition: background 0.12s;
}
.entry-row:last-child { border-bottom: none; }
.entry-row:hover { background: #fafbfb; }
.entry-row.is-rejected { background: #fdf7f6; }
.type-badge {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600;
  flex-shrink: 0;
}
.t-expense { background: var(--danger-soft); color: var(--danger); }
.t-income { background: var(--success-soft); color: var(--success); }
.t-advance { background: var(--warning-soft); color: var(--warning); }
.t-loan { background: var(--gold-soft); color: #8a6d33; }
.t-repayment { background: #e9eff1; color: var(--slate); }

.entry-main { flex: 1; min-width: 0; }
.entry-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entry-desc { font-size: 14px; font-weight: 500; }
.entry-flow {
  font-size: 12px; color: var(--text-2);
  background: #f4f7f6; border-radius: 7px; padding: 1px 9px;
  display: inline-flex; align-items: center; gap: 5px;
}
.entry-flow .arrow { color: var(--gold); }
.entry-meta { display: flex; align-items: center; gap: 13px; margin-top: 7px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.entry-meta .conf-stack .avatar { border-color: #fff; }
.entry-right { text-align: right; flex-shrink: 0; }
.entry-amount { font-family: var(--num); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 7px; }
.reject-note { margin-top: 6px; font-size: 12px; color: var(--danger); }
.reject-note b { font-weight: 600; }
.system-tag { font-size: 11px; color: #8a6d33; background: var(--gold-soft); padding: 1px 8px; border-radius: 6px; }

.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-state .es-ico { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { margin: 4px 0; }

/* ============ 扎帐横幅 ============ */
.closing-banner {
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, #fbf6ea, #f7ecd4);
  border: 1px solid #e8d6a8;
  display: flex;
  gap: 20px;
  align-items: center;
}
.closing-banner .cb-ico {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #c9a864, #b3903f);
  color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.closing-banner .cb-main { flex: 1; }
.closing-banner h3 { font-size: 16px; color: #7a5d24; }
.closing-banner .cb-meta { color: #92773f; font-size: 12.5px; margin-top: 5px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.closing-banner .cb-actions { display: flex; gap: 9px; flex-shrink: 0; }

/* 存档提示 */
.archive-banner {
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
  background: #f0f2f5;
  border: 1px solid #dde2e7;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #5f6b78;
}
.archive-banner .ab-ico { font-size: 24px; }

/* 期数切换 */
.period-pills { display: flex; gap: 7px; flex-wrap: wrap; }
.period-pill {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 9px;
  padding: 7px 15px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.period-pill:hover { border-color: var(--primary); color: var(--primary); }
.period-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 13px 18px; border-bottom: 1px solid var(--border-2); font-size: 13.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfb; }
.data-table .num { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; }
.t-user-cell { display: flex; align-items: center; gap: 9px; }
.row-actions { display: flex; gap: 6px; }
.link-btn { border: none; background: transparent; color: var(--primary); padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.link-btn:hover { background: var(--primary-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

/* ============ 弹窗 ============ */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 26, 22, 0.45); backdrop-filter: blur(3px); }
.modal {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.22s ease;
}
.modal.lg { width: 780px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid var(--border-2); }
.modal-head h3 { font-size: 16px; }
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 15px 24px; border-top: 1px solid var(--border-2); display: flex; gap: 10px; justify-content: flex-end; background: #fafbfb; }

/* 类型选择 */
.type-selector { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.type-option {
  border: 1.5px solid var(--border);
  background: #fbfcfc;
  border-radius: 11px;
  padding: 11px 4px 9px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.type-option .to-ico { font-size: 19px; display: block; margin-bottom: 3px; }
.type-option .to-label { font-size: 12.5px; color: var(--text-2); }
.type-option:hover { border-color: #b9c5c0; }
.type-option.active { border-color: var(--primary); background: var(--primary-soft); }
.type-option.active .to-label { color: var(--primary-deep); font-weight: 600; }

.form-row { display: flex; gap: 14px; }
.form-row .field { flex: 1; }
.form-note { font-size: 12.5px; color: var(--muted); background: #f6f8f7; border-radius: 9px; padding: 10px 14px; margin-top: 4px; }

/* 复选成员列表 */
.check-list { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.check-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.check-item:hover { background: #f6f8f7; }
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-item .ci-name { font-size: 13.5px; }
.check-item .ci-un { color: var(--muted); font-size: 12px; margin-left: auto; }

/* ============ 扎帐汇总内容 ============ */
.sum-section { margin-bottom: 22px; }
.sum-section h4 { font-size: 14px; margin-bottom: 11px; display: flex; align-items: center; gap: 8px; }
.sum-section h4::before { content: ''; width: 3px; height: 13px; background: var(--gold); border-radius: 2px; }
.sum-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sum-table th { font-size: 12px; color: var(--muted); font-weight: 500; padding: 9px 14px; background: #f8faf9; text-align: right; border-bottom: 1px solid var(--border); }
.sum-table th:first-child { text-align: left; }
.sum-table td { padding: 10px 14px; font-size: 13px; text-align: right; border-bottom: 1px solid var(--border-2); font-variant-numeric: tabular-nums; }
.sum-table td:first-child { text-align: left; font-weight: 500; }
.sum-table tr:last-child td { border-bottom: none; }
.sum-table tfoot td { background: #f6f9f8; font-weight: 600; }
.settle-pos { color: var(--success); font-weight: 600; }
.settle-neg { color: var(--danger); font-weight: 600; }

.transfer-list { display: flex; flex-direction: column; gap: 9px; }
.transfer-item {
  display: flex; align-items: center; gap: 11px;
  background: #f7faf9; border: 1px solid var(--border); border-radius: 11px; padding: 11px 16px;
}
.transfer-item .t-arrow { color: var(--gold); font-size: 18px; }
.transfer-item .t-amount { margin-left: auto; font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--primary-deep); }
.pair-item { background: var(--gold-soft); border-color: #e8dcc0; }
.pair-item .t-amount { color: #8a6d33; }

/* ============ Toast ============ */
.toasts { position: fixed; top: 20px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff;
  border-radius: 11px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-2);
  padding: 12px 18px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 240px;
  animation: toastIn 0.25s ease;
}
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* 工具类 */
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-22 { margin-bottom: 22px; }
.flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
.text-muted { color: var(--muted); }
.divider { height: 1px; background: var(--border-2); margin: 18px 0; }

/* ============ 移动端菜单按钮（桌面隐藏） ============ */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  flex-shrink: 0;
}
.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 平板及以下 ============ */
@media (max-width: 900px) {
  /* 侧边栏改为抽屉 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: 270px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(8, 26, 22, 0.4);
    backdrop-filter: blur(2px);
  }

  /* 顶栏显示菜单按钮 */
  .menu-toggle { display: inline-flex; }

  .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  .topbar h1 { font-size: 17px; }
  .topbar .top-actions { gap: 8px; }
  .content { padding: 18px 16px 40px; }

  /* 弹窗加宽边距 */
  .modal { max-width: calc(100vw - 24px); max-height: calc(100vh - 40px); }
}

/* ============ 手机 ============ */
@media (max-width: 620px) {
  body { font-size: 13.5px; }

  /* 登录页 */
  .login-card {
    width: calc(100vw - 36px);
    padding: 34px 26px 24px;
    border-radius: 18px;
  }
  .login-card h1 { font-size: 20px; }
  .login-sub { margin-bottom: 22px; }
  .orb1 { width: 320px; height: 320px; }
  .orb2 { width: 280px; height: 280px; }

  /* 顶栏 */
  .topbar { padding: 10px 14px; }
  .topbar .top-actions { width: 100%; margin-left: 0; }
  .topbar .top-actions .btn { flex: 1; height: 40px; }
  .content { padding: 14px 14px 36px; }

  /* 卡片 */
  .card-head { padding: 15px 16px; }
  .card-body { padding: 16px; }

  /* 统计卡片：2 列，数值缩小 */
  .stat-grid { gap: 10px; margin-bottom: 14px; }
  .stat-card { padding: 14px 14px; border-radius: 12px; }
  .stat-card .stat-value { font-size: 21px; margin-top: 6px; }
  .stat-card .stat-label { font-size: 12px; }

  /* 流水行：改为纵向布局 */
  .entry-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }
  .type-badge { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
  .entry-main { flex: 1 1 calc(100% - 46px); }
  .entry-right {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 46px;
  }
  .entry-amount { font-size: 17px; }
  .entry-actions { margin-top: 0; }
  .entry-meta { gap: 9px; font-size: 11.5px; }
  .entry-meta .conf-stack .avatar { width: 21px; height: 21px; font-size: 9.5px; }

  /* 流水筛选标签 */
  .entry-tabs { width: 100%; overflow-x: auto; }
  .entry-tab { padding: 6px 11px; white-space: nowrap; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head .card-actions { width: 100%; }
  .card-head .entry-tabs { width: 100%; }

  /* 类型选择：5 个一排，紧凑 */
  .type-selector { gap: 6px; margin-bottom: 14px; }
  .type-option { padding: 9px 2px 7px; border-radius: 9px; }
  .type-option .to-ico { font-size: 17px; }
  .type-option .to-label { font-size: 11.5px; }

  /* 表单：金额/日期纵向堆叠 */
  .form-row { flex-direction: column; gap: 0; }
  .field input, .field select, .field textarea { height: 46px; }
  .field textarea { height: auto; min-height: 80px; }

  /* 弹窗：底部弹出 */
  .modal {
    width: 100%;
    max-width: 100vw;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    align-self: flex-end;
    margin-bottom: 0;
    animation: modalSlideUp 0.25s ease;
  }
  @keyframes modalSlideUp { from { transform: translateY(100%); } to { transform: none; } }
  .modal-root { align-items: flex-end; }
  .modal-head { padding: 18px 18px 13px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 13px 18px; }
  .modal-foot .btn { flex: 1; height: 46px; }

  /* 扎帐/存档横幅：纵向 */
  .closing-banner, .archive-banner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 18px; }
  .closing-banner .cb-ico { width: 44px; height: 44px; font-size: 20px; }
  .closing-banner .cb-actions { width: 100%; }
  .closing-banner .cb-actions .btn { flex: 1; }

  /* 期数切换 */
  .period-pill { padding: 7px 12px; font-size: 12.5px; }

  /* 表格：字体缩小 */
  .data-table th, .data-table td { padding: 11px 13px; font-size: 12.5px; }
  .row-actions { flex-wrap: wrap; gap: 3px; }

  /* 汇总表：横向滚动 */
  .sum-table { display: block; overflow-x: auto; white-space: nowrap; }
  .sum-table thead, .sum-table tbody, .sum-table tfoot { display: table; width: 100%; }
  .transfer-item { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .transfer-item .t-amount { margin-left: 0; width: 100%; text-align: right; }

  /* Toast：底部全宽 */
  .toasts { top: auto; right: 12px; bottom: 16px; left: 12px; }
  .toast { min-width: 0; width: 100%; }
  @keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
  @keyframes toastOut { to { opacity: 0; transform: translateY(20px); } }
}
