/* 轻鳍记账 · 手机 App 界面样式 */
:root {
  --yellow: #FFC93C;
  --yellow-deep: #F5B301;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #2B2B2B;
  --sub: #9A9A9A;
  --line: #EFEFF1;
  --income: #2BC48A;
  --expense: #FF7043;
  --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; height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-user-select: none; user-select: none;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* 顶部 */
.topbar {
  flex: none; height: calc(56px + var(--safe-top)); padding: var(--safe-top) 18px 0;
  background: var(--yellow); display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 25px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.icon-btn { border: 0; background: rgba(255,255,255,.45); width: 36px; height: 36px; border-radius: 50%; font-size: 17px; }

/* 页面 */
#pages { flex: 1; overflow: hidden; position: relative; }
.page { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 96px; display: none; }
.page.active { display: block; }

/* 月份切换 */
.month-switch { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 4px 0 14px; }
.month-arrow { border: 0; background: transparent; font-size: 26px; color: #B9B9B9; width: 34px; height: 34px; line-height: 1; }
.month-label { border: 0; background: transparent; font-size: 16px; font-weight: 700; min-width: 120px; }

/* 汇总卡 */
.summary-card {
  background: linear-gradient(135deg, #FFD75E, var(--yellow));
  border-radius: 18px; padding: 20px; box-shadow: 0 6px 18px rgba(245,179,1,.25);
}
.summary-title { font-size: 13px; opacity: .75; }
.summary-expense { font-size: 34px; font-weight: 800; margin: 4px 0 16px; letter-spacing: .5px; }
.summary-row { display: flex; align-items: center; }
.summary-item { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.summary-item-label { font-size: 12px; opacity: .75; }
.summary-item-value { font-size: 17px; font-weight: 700; }
.summary-item-value.income { color: #137a53; }
.summary-divider { width: 1px; height: 30px; background: rgba(0,0,0,.12); }

/* 列表 */
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 4px 8px; font-weight: 700; font-size: 15px; }
.list-count { color: var(--sub); font-size: 12px; font-weight: 400; }
.bill-list { display: flex; flex-direction: column; gap: 8px; }
.bill-day { font-size: 12px; color: var(--sub); padding: 6px 4px 2px; }
.bill-item {
  background: var(--card); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.03); border: 0; width: 100%; text-align: left;
}
.bill-icon { width: 42px; height: 42px; border-radius: 12px; background: #FFF6DA; display: flex; align-items: center; justify-content: center; font-size: 21px; flex: none; }
.bill-info { flex: 1; margin-left: 11px; min-width: 0; }
.bill-cat { font-size: 15px; font-weight: 600; }
.bill-note { font-size: 12px; color: var(--sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-amount { font-size: 16px; font-weight: 700; white-space: nowrap; }
.bill-amount.income { color: var(--income); }
.bill-amount.expense { color: var(--text); }
.empty-state { text-align: center; padding: 50px 0; color: var(--sub); font-size: 14px; }
.empty-state .empty-icon { font-size: 46px; display: block; margin-bottom: 12px; }

/* 统计 */
.stats-card { background: var(--card); border-radius: 18px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.04); }
.stats-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.stats-tab { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--sub); }
.stats-tab.active { background: var(--yellow); color: #000; }
.stats-total { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 20px; }
.stats-bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-icon { width: 30px; font-size: 18px; text-align: center; }
.bar-body { flex: 1; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--yellow), var(--yellow-deep)); border-radius: 4px; }

/* 我的 */
.me-card { background: linear-gradient(135deg, #FFD75E, var(--yellow)); border-radius: 18px; padding: 22px; text-align: center; box-shadow: 0 6px 18px rgba(245,179,1,.25); }
.me-avatar { font-size: 44px; }
.me-title { font-size: 19px; font-weight: 800; margin-top: 6px; }
.me-sub { font-size: 12px; opacity: .7; margin-top: 4px; }
.me-menu { background: var(--card); border-radius: 16px; margin-top: 16px; overflow: hidden; }
.me-item { width: 100%; border: 0; background: transparent; padding: 15px 16px; display: flex; align-items: center; gap: 12px; font-size: 15px; border-bottom: 1px solid var(--line); }
.me-item:last-child { border-bottom: 0; }
.me-item > span:first-child { font-size: 19px; }
.me-item .chev { margin-left: auto; color: var(--sub); }
.me-note { font-size: 11px; color: var(--sub); text-align: center; margin-top: 18px; line-height: 1.6; }

/* 悬浮按钮 */
.fab {
  position: absolute; right: 20px; bottom: calc(78px + var(--safe-bottom)); width: 54px; height: 54px;
  border-radius: 50%; border: 0; background: var(--yellow); color: #3A2A00; font-size: 32px; font-weight: 300;
  box-shadow: 0 6px 18px rgba(245,179,1,.5); z-index: 20; line-height: 1;
}

/* 底部导航 */
.tabbar {
  flex: none; height: calc(62px + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: flex; align-items: stretch; z-index: 30;
}
.tab { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--sub); }
.tab.active { color: var(--yellow-deep); font-weight: 700; }
.tab-icon { font-size: 21px; filter: grayscale(1); opacity: .6; }
.tab.active .tab-icon { filter: none; opacity: 1; }
.tab-add .tab-icon { font-size: 23px; }

/* 弹层 */
.sheet-mask, .dialog-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 100; display: none; align-items: flex-end; }
.sheet-mask.show, .dialog-mask.show { display: flex; }
.sheet {
  width: 100%; background: var(--card); border-radius: 20px 20px 0 0; padding: 8px 18px calc(24px + var(--safe-bottom));
  max-height: 92vh; overflow-y: auto; animation: slideUp .22s ease-out;
}
.small-sheet { border-radius: 20px 20px 0 0; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 38px; height: 4px; background: #DDD; border-radius: 2px; margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-title { font-size: 17px; font-weight: 700; }
.sheet-cancel, .sheet-save { border: 0; background: transparent; font-size: 15px; width: 60px; }
.sheet-cancel { text-align: left; color: var(--sub); }
.sheet-save { text-align: right; color: var(--yellow-deep); font-weight: 700; }
.type-switch { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.type-btn { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--sub); }
.type-btn.active[data-type="expense"] { background: var(--expense); color: #fff; }
.type-btn.active[data-type="income"] { background: var(--income); color: #fff; }
.amount-input-wrap { display: flex; align-items: center; padding: 10px 0 18px; border-bottom: 1px solid var(--line); }
.amount-symbol { font-size: 26px; font-weight: 700; }
.amount-input { flex: 1; border: 0; outline: 0; font-size: 34px; font-weight: 800; padding-left: 8px; background: transparent; color: var(--text); }
.cat-title { font-size: 13px; color: var(--sub); margin: 16px 0 10px; }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.cat-item { border: 0; background: var(--bg); border-radius: 12px; padding: 9px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text); }
.cat-item .cat-icon { font-size: 22px; }
.cat-item.active { background: #FFF3CC; color: var(--yellow-deep); font-weight: 700; box-shadow: inset 0 0 0 1px var(--yellow); }
.field-row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field-row label { width: 62px; font-size: 14px; color: var(--sub); }
.field-row input { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; color: var(--text); text-align: right; }
.sheet-error { color: #E53935; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* 详情 */
.detail-content { padding: 8px 0 18px; }
.detail-amount { font-size: 32px; font-weight: 800; text-align: center; margin: 6px 0 18px; }
.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-row span:first-child { color: var(--sub); }
.detail-actions { display: flex; gap: 10px; }
.detail-btn { flex: 1; border: 0; background: var(--yellow); border-radius: 12px; padding: 13px; font-size: 15px; font-weight: 700; }
.detail-btn.danger { background: #FFECE8; color: #E53935; }

/* 搜索 */
.search-box { margin-bottom: 12px; }
.search-box input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 12px 14px; font-size: 15px; outline: 0; }
.search-scope { display: flex; gap: 18px; font-size: 14px; margin-bottom: 14px; }
.search-scope label { display: flex; align-items: center; gap: 5px; }

/* 对话框 */
.dialog-mask { align-items: center; justify-content: center; }
.dialog { width: 82%; max-width: 320px; background: var(--card); border-radius: 16px; padding: 22px; }
.dialog-title { font-size: 17px; font-weight: 700; text-align: center; }
.dialog-message { font-size: 14px; color: #666; text-align: center; margin: 12px 0 20px; line-height: 1.6; white-space: pre-wrap; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-btn { flex: 1; border: 0; border-radius: 10px; padding: 11px; background: var(--bg); font-size: 15px; }
.dialog-btn.primary { background: var(--yellow); font-weight: 700; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
