/* ============================================
   我们的账本 - 样式表
   风格：美式复古 / Mid-century Americana
   - 主色：深墨绿 British Racing Green
   - 次色：芥末黄 Mustard
   - 警示：勃艮第酒红 Burgundy
   - 备用：复古蓝 Vintage Denim
   - 底色：米白 / 麦纸色 Cream Paper
   - 文字：深棕黑 Espresso（不用纯黑，避免现代冷感）
   ============================================ */

:root {
  /* 主色：深墨绿（收入/主按钮/tab 激活）—— 复古沙发绿 */
  --green: #3F6650;
  --green-light: #E8E2CE;   /* 主色淡底，用米色系而非绿色系，更贴近 vintage 感 */
  --green-dark: #2E4C3B;
  /* 次色：芥末黄（原橙色位置，用于强调/表情/图标底） */
  --orange: #C69A3D;
  --orange-light: #F3E7C6;
  /* 警示：勃艮第酒红 */
  --red: #8E3A2E;
  --red-light: #EBD6CE;
  /* 备用蓝：复古牛仔蓝（图表/渐变辅助） */
  --blue: #4E6B84;
  /* 背景：米白麦纸色（暖调，代替冷调近白） */
  --bg: #F0E7D2;
  --card: #FBF5E4;
  /* 文字：深棕黑（Espresso），不用纯黑 */
  --text: #2A1F17;
  --text-2: #6B584A;
  --text-3: #A8998A;
  /* 分隔线：暖调米棕 */
  --border: #DFD2B7;
  --border-light: #EBE1CB;
  --shadow: 0 2px 12px rgba(74,52,30,0.08);
  --shadow-lg: 0 8px 32px rgba(74,52,30,0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Helvetica, 'Microsoft Yahei', sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { min-height: 100vh; min-height: 100dvh; }
button { border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; outline: none; }
.hidden { display: none !important; }

/* ==================== Loading ==================== */
.app-loading {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 999;
}
.loading-logo { font-size: 64px; animation: bounce 1s infinite; }
.loading-text { color: var(--text-3); margin-top: 12px; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ==================== 登录页 ==================== */
#page-login {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 50%, var(--blue) 130%);
  padding: calc(var(--safe-top) + 60px) 24px calc(var(--safe-bottom) + 40px);
  color: #fff;
}
.login-wrap { max-width: 420px; margin: 0 auto; text-align: center; }
.login-logo { font-size: 64px; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 700; margin: 0 0 6px; }
.login-sub { opacity: 0.85; margin: 0 0 40px; }
.login-users {
  display: flex; gap: 20px; justify-content: center;
  margin-bottom: 40px;
}
.login-user {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(20px);
  border-radius: 20px; padding: 24px 20px;
  min-width: 120px;
  transition: transform 0.2s;
  border: 2px solid transparent;
}
.login-user:active { transform: scale(0.96); }
.login-user.active { border-color: #fff; background: rgba(255,255,255,0.25); }
.login-user-avatar { font-size: 44px; margin-bottom: 8px; }
.login-user-name { font-size: 16px; font-weight: 600; }

.pin-panel {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(20px);
  border-radius: 20px; padding: 24px 20px;
}
.pin-title { font-size: 15px; margin-bottom: 16px; opacity: 0.9; }
.pin-dots {
  display: flex; gap: 16px; justify-content: center; margin-bottom: 24px;
}
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.2s;
}
.pin-dots span.filled { background: #fff; transform: scale(1.15); }
.pin-keys {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.pin-keys button {
  height: 54px; border-radius: 14px;
  background: rgba(255,255,255,0.2);
  color: #fff; font-size: 22px; font-weight: 500;
  transition: background 0.15s;
}
.pin-keys button:active { background: rgba(255,255,255,0.35); }
.pin-back, .pin-cancel { font-size: 26px !important; opacity: 0.85; }
.pin-tip { margin-top: 16px; font-size: 12px; opacity: 0.75; }

/* ==================== 主界面 ==================== */
#page-main {
  min-height: 100vh;
  min-height: 100dvh;
  /* tabbar 高约 56px + 底部安全区 34px；再留 24px 空隙防止最后一条账单被 tabbar 盖住 */
  padding-bottom: calc(80px + var(--safe-bottom));
}
.app-header {
  padding: calc(var(--safe-top) + 16px) 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card);
  position: sticky; top: 0; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.header-hello { font-size: 15px; font-weight: 600; }
.header-hello span { color: var(--green); }
.header-date { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.header-btn {
  padding: 6px 12px; border-radius: 16px;
  background: var(--border-light); font-size: 13px; color: var(--text-2);
}

/* Scope tabs */
.scope-tabs {
  display: flex; gap: 6px;
  padding: 8px 20px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border-light);
}
.scope-tab {
  flex: 1; padding: 8px 0;
  border-radius: 10px;
  font-size: 14px; color: var(--text-2);
  background: var(--bg);
  transition: all 0.2s;
}
.scope-tab.active { background: var(--green); color: #fff; font-weight: 600; }

/* Main */
.app-main { padding: 12px 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 月份切换 */
.month-switcher {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; padding: 4px 0 12px;
}
.month-switcher button {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card); font-size: 20px; color: var(--text-2);
  box-shadow: var(--shadow);
}
.month-switcher span { font-size: 17px; font-weight: 600; min-width: 120px; text-align: center; }
/* 账单页的紧凑版：按钮小一号，纵向 padding 收紧 */
.month-switcher-mini { gap: 14px; padding: 2px 0 10px; }
.month-switcher-mini button { width: 32px; height: 32px; font-size: 18px; }
.month-switcher-mini span { font-size: 15px; min-width: 100px; }

/* 汇总卡片 */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.summary-card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 10px; text-align: center;
  box-shadow: var(--shadow);
}
.summary-card.income { border-top: 3px solid var(--green); }
.summary-card.expense { border-top: 3px solid var(--orange); }
.summary-card.balance { border-top: 3px solid var(--red); }
.s-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.s-cny { font-size: 15px; font-weight: 700; }
.s-hkd { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 筛选 */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap;
}
.filter-group { display: flex; gap: 6px; }
.filter-chip {
  padding: 6px 14px; border-radius: 16px;
  background: var(--card); font-size: 13px; color: var(--text-2);
  box-shadow: var(--shadow);
}
.filter-chip.active { background: var(--green); color: #fff; }
.filter-select {
  padding: 6px 12px; border-radius: 16px;
  background: var(--card); border: 0; font-size: 13px;
  box-shadow: var(--shadow);
  margin-left: auto;
}

/* 图表 */
.chart-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.chart-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.chart-title-row .chart-title { margin-bottom: 0; }
.chart-select {
  font-size: 12px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 22px 4px 10px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%237A7570' d='M1 3l4 4 4-4z'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; outline: none;
  max-width: 55%; text-overflow: ellipsis;
}
.chart-select:focus { border-color: var(--green); }
.chart-wrap { position: relative; height: 260px; }
/* 饼图给外部 label + 引导线留出更多纵向空间（左右空白带放 label） */
.chart-wrap.pie { height: 360px; padding: 8px 2px; }

/* 归类列表 */
.category-list {
  background: var(--card); border-radius: var(--radius);
  padding: 4px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.cat-row:last-child { border-bottom: 0; }
.cat-icon-box {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.cat-row.income .cat-icon-box { background: var(--orange-light); }
.cat-name { flex: 1; font-size: 14px; }
.cat-count { font-size: 12px; color: var(--text-3); margin-left: 4px; }
.cat-amount { font-weight: 600; text-align: right; }
.cat-amount .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* 账单列表 */
.bill-toolbar {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.bill-search {
  flex: 1; padding: 8px 14px; border-radius: 16px;
  background: var(--card); border: 0; font-size: 14px;
  box-shadow: var(--shadow);
}
.bill-list { }
.bill-day {
  background: var(--card); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden;
  box-shadow: var(--shadow);
}
.bill-day-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border-light);
  background: #FAFAFA;
}
.bill-day-title { font-size: 13px; color: var(--text-2); font-weight: 600; }
.bill-day-sum { font-size: 12px; color: var(--text-3); }
.bill-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.bill-item:last-child { border-bottom: 0; }
.bill-item:active { background: var(--border-light); }
.bill-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  background: var(--green-light);
}
.bill-item.income .bill-icon { background: var(--orange-light); }
.bill-info { flex: 1; min-width: 0; }
.bill-cat-name { font-size: 14px; font-weight: 500; }
.bill-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.bill-meta { font-size: 11px; color: var(--text-3); }
.bill-amount { font-weight: 600; font-size: 15px; text-align: right; }
.bill-amount.expense { color: var(--red); }
.bill-amount.income { color: var(--green); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); font-size: 14px; }
.empty-state .em { font-size: 48px; margin-bottom: 8px; }

/* 底部 tabbar */
.app-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 0 calc(8px + var(--safe-bottom));
  z-index: 20;
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; color: var(--text-3); font-size: 11px;
}
.tab-btn span:first-child { font-size: 20px; }
.tab-btn.active { color: var(--green); font-weight: 600; }
.tab-add {
  position: relative;
}
.tab-add .add-plus {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff; font-size: 30px; line-height: 52px;
  box-shadow: 0 6px 16px rgba(7,193,96,0.4);
  margin-top: -18px; margin-bottom: 2px;
  font-weight: 300;
}

/* 悬浮设置按钮 */
.floating-settings {
  position: fixed; top: calc(var(--safe-top) + 20px); right: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--border-light); font-size: 18px;
  z-index: 15;
  display: none; /* header 里已有切换按钮，这个先隐藏 */
}

/* ==================== 记账 Sheet ==================== */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end;
}
.sheet-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  animation: fadeIn 0.2s;
}
.sheet-body {
  position: relative;
  width: 100%; max-width: 500px; margin: 0 auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  animation: slideUp 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  /* 用 dvh 让键盘弹起时 sheet 会自适应缩小；vh fallback 给不支持的浏览器 */
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  /* padding-bottom 不再加安全区：底部粘性按钮 .sheet-actions 已经把安全区吃掉了；
     没有底部按钮的 sheet（如分类管理）由自己在最后一个内部块加 var(--safe-bottom) */
}
.sheet-body-small { max-height: 60vh; max-height: 60dvh; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--card);
  position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--border-light);
}
/* 简版 header：仅居中标题（记账 sheet 用，取消/保存已下移到底部按钮） */
.sheet-header-simple { justify-content: center; }
.sheet-cancel { color: var(--text-2); font-size: 15px; }
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet-save { color: var(--green); font-size: 15px; font-weight: 600; }

/* sheet 底部操作按钮（取消 / 保存）：大 button 样式 */
.sheet-actions {
  display: flex; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border-light);
  position: sticky; bottom: 0;
  z-index: 2;
}
.sheet-action-btn {
  flex: 1;
  min-height: 52px;
  padding: 14px 0;
  font-size: 17px; font-weight: 700;
  letter-spacing: 2px;
  border-radius: 14px;
  transition: opacity 0.15s, transform 0.05s, box-shadow 0.15s;
  cursor: pointer;
}
.sheet-action-btn:active { transform: scale(0.97); }
.sheet-action-btn.cancel {
  background: var(--card) !important;
  color: var(--text-2) !important;
  border: 1.5px solid var(--border) !important;
  box-shadow: 0 2px 6px rgba(58, 42, 28, 0.06);
}
.sheet-action-btn.save {
  background: var(--green) !important;
  color: #FBF5E4 !important;
  border: 1.5px solid var(--green) !important;
  box-shadow: 0 4px 12px rgba(76, 96, 68, 0.35);
}
.sheet-action-btn.cancel:active { background: var(--border-light) !important; }
.sheet-action-btn.save:active { box-shadow: 0 2px 4px rgba(76, 96, 68, 0.25); }

/* 收支切换 */
.type-switch {
  display: flex; gap: 6px; padding: 12px 20px 0;
}
.type-btn {
  flex: 1; padding: 8px 0; border-radius: 10px;
  background: var(--card); color: var(--text-2); font-size: 14px;
  box-shadow: var(--shadow);
}
.type-btn.active[data-type="expense"] { background: var(--orange); color: #fff; }
.type-btn.active[data-type="income"] { background: var(--green); color: #fff; }

/* 金额 */
/* 币种切换 + 金额显示紧挨在一起靠左对齐（避免"币种在最左、金额在最右"输入时看不到跳动）*/
.amount-row {
  display: flex; align-items: center; gap: 12px;
  justify-content: flex-start;
  padding: 20px; background: var(--card); margin: 12px 0;
}
.currency-toggle {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  flex-shrink: 0;
}
.cur-btn {
  padding: 6px 10px; font-size: 13px; color: var(--text-2);
  background: var(--card);
  min-width: 46px;
}
.cur-btn.active { background: var(--green); color: #fff; font-weight: 600; }
.amount-display {
  /* 不再 flex:1 撑满，改为贴着币种按钮左对齐；文字左对齐，输入时视线不会跳到最右侧 */
  text-align: left;
  font-size: 32px; font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 归类 grid */
.section-label {
  padding: 8px 20px 6px; font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.section-label .req { color: var(--red); font-weight: 700; }
.section-label .req-hint { color: var(--text-3); opacity: .65; font-size: 11px; }

/* 校验失败：抖动 + 红边 */
@keyframes shake-err {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.field-error {
  animation: shake-err .38s ease;
  box-shadow: inset 0 0 0 1.5px var(--red), 0 0 0 3px rgba(142,58,46,.15);
  border-radius: 12px;
}
.cat-grid, .sub-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding: 4px 16px 12px;
  background: var(--card);
}
.cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 10px;
  background: var(--bg);
  transition: transform 0.15s;
}
.cat-item:active { transform: scale(0.94); }
.cat-item.active {
  background: var(--green); color: #fff;
}
.cat-item-icon { font-size: 22px; }
.cat-item-name { font-size: 12px; }

.sub-grid { padding-bottom: 12px; }
.sub-item {
  padding: 8px 12px; border-radius: 16px;
  background: var(--bg); font-size: 13px; text-align: center;
  transition: all 0.15s;
}
.sub-item.active { background: var(--green); color: #fff; }

/* 备注 / 日期 */
.meta-row {
  display: flex; gap: 8px; padding: 12px 20px;
  background: var(--card); margin-top: 12px;
  flex-wrap: wrap;
}
.note-input {
  flex: 1; min-width: 140px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--bg); border: 0; font-size: 14px;
}
.date-input {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 0; font-size: 13px;
  color: var(--text-2);
}

/* 数字键盘 */
.num-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border-light); padding: 1px;
  margin-top: 12px;
}
.num-keypad button {
  background: var(--card);
  padding: 16px 0;
  font-size: 22px; font-weight: 500;
  transition: background 0.1s;
}
.num-keypad button:active { background: var(--border-light); }
.num-back { color: var(--red); font-size: 18px !important; }

/* 顶部数字键盘（紧贴金额行下方）：按钮更紧凑，避免挤掉后面的归类/类目/备注 */
.num-keypad-top {
  margin-top: 0;
  margin-bottom: 8px;
  border-radius: 10px;
  overflow: hidden;
}
.num-keypad-top button {
  padding: 12px 0;
  font-size: 20px;
}

/* ==================== 设置页 ==================== */
.settings-block {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.settings-title {
  font-size: 15px; font-weight: 600; margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.mini-btn {
  padding: 4px 10px; border-radius: 12px;
  background: var(--green); color: #fff;
  font-size: 12px;
}
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
}
.user-row-info { flex: 1; }
.user-row-name { font-size: 15px; font-weight: 500; }
.user-row-sub { font-size: 12px; color: var(--text-3); }
.user-row .mini-btn { background: var(--border-light); color: var(--text-2); }

.cat-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.cat-tab {
  flex: 1; padding: 8px 0; border-radius: 10px;
  background: var(--bg); font-size: 13px; color: var(--text-2);
}
.cat-tab.active { background: var(--green); color: #fff; }

.cat-manage-item {
  border-bottom: 1px solid var(--border-light);
  padding: 10px 0;
}
.cat-manage-item:last-child { border-bottom: 0; }
.cat-mng-head {
  display: flex; align-items: center; gap: 10px;
}
.cat-mng-name { flex: 1; font-size: 14px; font-weight: 500; }
.cat-mng-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border-light); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.del { color: var(--red); }
.sub-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; padding-left: 46px;
}
.sub-chip {
  padding: 4px 10px; border-radius: 12px;
  background: var(--bg); font-size: 12px;
  display: flex; align-items: center; gap: 4px;
}
.sub-chip .del-x {
  color: var(--red); font-size: 14px; line-height: 1;
  cursor: pointer;
}
.sub-chip.add-new { background: var(--green-light); color: var(--green); font-weight: 600; }

/* 分类编辑表单 */
.cat-form { padding: 20px; background: var(--card); }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 0; border-radius: 10px;
  font-size: 15px;
}
.form-radio { display: flex; gap: 20px; padding: 6px 0; }
.form-radio label { display: flex; align-items: center; gap: 6px; font-size: 14px; }

/* ==================== 昨日总结 ==================== */
.daily-summary { position: fixed; inset: 0; z-index: 998; display: flex; align-items: center; justify-content: center; padding: 20px; }
.daily-summary.hidden { display: none; }
.daily-summary-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); animation: fadeIn 0.2s; }
.daily-summary-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 340px;
  background: linear-gradient(160deg, #FFF8ED 0%, #F7EEDA 100%);
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 12px 40px rgba(80, 50, 20, 0.25);
  animation: dailyIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dailyIn {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.daily-summary-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.daily-summary-title { display: flex; align-items: center; gap: 12px; }
.daily-summary-emoji { font-size: 34px; line-height: 1; }
.daily-summary-h1 { font-size: 18px; font-weight: 700; color: #2A1F17; }
.daily-summary-h2 { font-size: 13px; color: #8B7D6B; margin-top: 2px; }
.daily-summary-close {
  background: transparent; border: none; font-size: 24px; color: #8B7D6B;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.daily-summary-close:hover { background: rgba(139, 125, 107, 0.15); }
.daily-summary-body { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.daily-summary-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.55);
  border-radius: 12px; padding: 12px 14px;
}
.daily-summary-row-icon { font-size: 22px; }
.daily-summary-row-main { flex: 1; }
.daily-summary-row-label { font-size: 13px; color: #8B7D6B; }
.daily-summary-row-value { font-size: 17px; font-weight: 700; margin-top: 2px; }
.daily-summary-row.expense .daily-summary-row-value { color: #C0562A; }
.daily-summary-row.income  .daily-summary-row-value { color: #4A8C4E; }
.daily-summary-row-sub { font-size: 12px; color: #8B7D6B; margin-top: 2px; }
.daily-summary-empty {
  text-align: center; padding: 20px 0; color: #8B7D6B; font-size: 14px;
}
.daily-summary-empty-emoji { font-size: 36px; margin-bottom: 8px; }
.daily-summary-ok {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, #07C160 0%, #34c48f 100%);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.25);
}
.daily-summary-ok:active { transform: scale(0.98); }

/* ==================== Toast ==================== */
.toast {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85); color: #fff;
  padding: 12px 24px; border-radius: 12px;
  font-size: 14px; z-index: 999;
  animation: toastIn 0.2s;
  pointer-events: none;
  max-width: 80vw; text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* About */
.about-info { color: var(--text-2); font-size: 14px; line-height: 1.8; }
.about-sub { font-size: 12px; color: var(--text-3); }

/* iPhone 底部横条：tabbar 底部 padding = 8px（视觉呼吸） + 安全区（避开 home indicator） */
@supports (padding: max(0px)) {
  .app-tabbar { padding-bottom: calc(8px + var(--safe-bottom)); }
}

/* 大屏适配 */
@media (min-width: 768px) {
  .app-main, #page-main { max-width: 500px; margin: 0 auto; }
  .app-header { max-width: 500px; margin: 0 auto; }
  .scope-tabs { max-width: 500px; margin: 0 auto; }
  .app-tabbar { max-width: 500px; margin: 0 auto; left: 0; right: 0; }
}


/* 退出登录按钮（设置页） */
.logout-row {
  margin-top: 12px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  text-align: center;
}
.logout-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--red) 0%, #D6A3A3 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(250,81,81,0.25);
  transition: transform .15s;
}
.logout-btn:active {
  transform: scale(0.98);
}
.logout-tip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}



/* 记账页归类/类目：新增按钮 & 长按提示 */
.cat-item.cat-add-new {
  border: 1.5px dashed var(--text-3);
  background: transparent;
  color: var(--text-2);
}
.cat-item.cat-add-new .cat-item-icon {
  opacity: 0.6;
}
.sub-item.sub-add-new {
  border: 1px dashed var(--text-3);
  background: transparent;
  color: var(--text-2);
}


/* ============ 账单表情反应 ============ */
.bill-item {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px;
  padding: 12px !important;
}
.bill-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.bill-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 48px; /* 对齐图标右侧 */
}
.reaction-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #F3F4F6;
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s, background .15s;
  line-height: 1.2;
}
.reaction-bubble:active { transform: scale(0.94); }
.reaction-bubble.me {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
}
.reaction-bubble .rc {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
}
.reaction-bubble.me .rc { color: var(--green-dark); }
.reaction-add {
  padding: 3px 10px;
  background: transparent;
  border: 1px dashed var(--text-3);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.2;
}
.reaction-add:active { background: #F3F4F6; }

/* 表情选择弹窗 */
.emoji-picker-pop {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 8px 10px;
  display: flex;
  gap: 4px;
  animation: emojiPopIn .18s ease-out;
}
.emoji-picker-pop button {
  width: 40px;
  height: 40px;
  font-size: 22px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.emoji-picker-pop button:hover { background: #F3F4F6; }
.emoji-picker-pop button:active { transform: scale(0.85); }
@keyframes emojiPopIn {
  from { opacity: 0; transform: translateY(4px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ 互动通知横幅 ============ */
.notify-banner {
  margin: 10px 16px 0;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--orange-light) 0%, var(--green-light) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(138, 166, 190, .20);
  animation: notifySlideIn .3s ease-out;
}
.notify-banner.hidden { display: none; }
.notify-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.notify-text {
  flex: 1;
  font-size: 13px;
  color: #365058;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notify-text b { color: #1F3238; font-weight: 600; }
.notify-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #547080;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 0;
}
.notify-close:hover { background: rgba(84, 112, 128, .12); }
@keyframes notifySlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 点击横幅后账单闪光高亮（淡蓝微光） */
.flash-highlight {
  animation: billFlash 2s ease-out;
}
@keyframes billFlash {
  0%, 100% { background: transparent; }
  15% { background: rgba(166, 192, 212, .38); }
  30% { background: rgba(166, 192, 212, .16); }
  50% { background: rgba(166, 192, 212, .32); }
}
