/* 移动端记账 H5 样式 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #eef1f5;
    color: #263238;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 15px; outline: none; }
.mdi { font-size: 20px; vertical-align: middle; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: #f5f7fa; position: relative; padding-bottom: 70px; }

/* 登录页 */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #26a69a 0%, #00897b 45%, #00695c 100%);
    padding: 20px;
}
.login-box {
    width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 26px 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.login-brand { text-align: center; margin-bottom: 20px; }
.login-title { font-size: 21px; font-weight: 700; margin-top: 6px; }
.login-sub { font-size: 12px; color: #90a4ae; margin-top: 4px; }
.login-tip { text-align: center; font-size: 12px; color: #b0bec5; margin-top: 14px; }
.login-tip b { color: #00897b; }

/* 顶部 */
.header {
    background: linear-gradient(135deg, #26a69a 0%, #00897b 60%, #00796b 100%);
    color: #fff; padding: 18px 16px 74px; position: relative;
}
.header .row-top { display: flex; align-items: center; justify-content: space-between; }
.header .title { font-size: 17px; font-weight: 600; }
.header .month { font-size: 13px; opacity: .85; }
.month-pick {
    background: rgba(255,255,255,.16); color: #fff; border-radius: 14px;
    padding: 3px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 4px;
}
.summary {
    background: #fff; border-radius: 14px; margin-top: 16px; padding: 16px 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08); display: flex; text-align: center; color: #37474f;
}
.summary .item { flex: 1; border-right: 1px solid #eceff1; }
.summary .item:last-child { border-right: none; }
.summary .label { font-size: 12px; color: #90a4ae; }
.summary .value { font-size: 19px; font-weight: 700; margin-top: 2px; }
.summary .value.expense { color: #ef5350; }
.summary .value.income { color: #26a69a; }

/* 内容 */
.page { display: none; }
.page.active { display: block; }
.section { background: #fff; border-radius: 14px; margin: 12px; padding: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.05); position: relative; }
/* 只有页面里的第一张卡片上浮压住头部, 其余卡片保持正常间距, 否则会互相重叠 */
.page > .section:first-of-type, #stat-body > .section:first-of-type { margin-top: -56px; }
.section-title { font-size: 14px; font-weight: 600; color: #455a64; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.section-title .link { font-size: 12px; color: #00897b; font-weight: 400; }

/* 账单列表 */
.day-group { margin-bottom: 6px; }
.day-head { display: flex; justify-content: space-between; font-size: 12px; color: #90a4ae; padding: 8px 2px; }
.bill-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #f4f6f8; }
.bill-item:last-child { border-bottom: none; }
.bill-icon {
    width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px;
}
.bill-main { flex: 1; min-width: 0; }
.bill-name { font-size: 15px; font-weight: 500; }
.bill-sub { font-size: 12px; color: #b0bec5; margin-top: 2px; word-break: break-all; }
.bill-amount { font-size: 16px; font-weight: 600; white-space: nowrap; }
.bill-amount.out { color: #37474f; }
.bill-amount.in { color: #26a69a; }
.empty { text-align: center; color: #b0bec5; font-size: 13px; padding: 30px 0; }

/* 底部导航 */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto;
    background: #fff; border-top: 1px solid #eceff1; display: flex; padding: 6px 0 8px;
    z-index: 40; padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.tabbar .tab { flex: 1; text-align: center; font-size: 11px; color: #90a4ae; }
.tabbar .tab .mdi { display: block; font-size: 22px; margin-bottom: 2px; }
.tabbar .tab.active { color: #00897b; }

/* 记一笔按钮 */
.fab {
    position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%);
    width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg,#26a69a,#00796b);
    color: #fff; font-size: 30px; box-shadow: 0 6px 16px rgba(0,121,107,.4);
    z-index: 50; display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: none; }
.mask.show { display: block; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
    background: #fff; border-radius: 16px 16px 0 0; z-index: 61; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(102%); transition: transform .25s ease; max-height: 92vh; overflow-y: auto;
}
.sheet.show { transform: translateY(0); }
.sheet h3 { margin: 0 0 12px; font-size: 16px; text-align: center; font-weight: 600; }
.seg { display: flex; background: #f1f3f5; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px 0; border-radius: 8px; font-size: 14px; color: #607d8b; }
.seg button.active { background: #fff; color: #00897b; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg-sm { margin-bottom: 12px; }
.seg-sm button { padding: 6px 0; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { font-size: 12px; color: #90a4ae; display: block; margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid #eceff1; border-radius: 10px; padding: 10px 12px; background: #fafbfc;
}
.amount-input { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid #00897b; padding-bottom: 6px; margin-bottom: 14px; }
.amount-input span { font-size: 22px; color: #00897b; font-weight: 600; }
.amount-input input { border: none; background: transparent; font-size: 30px; font-weight: 700; width: 100%; padding: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 4px; }
.cat-grid .cat { text-align: center; font-size: 11px; color: #78909c; }
.cat-grid .cat i {
    width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 4px; color: #cfd8dc; background: #eceff1; font-size: 21px;
}
.cat-grid .cat.active i { color: #fff; background: #00897b; box-shadow: 0 3px 8px rgba(0,121,107,.35); }
.cat-grid .cat.active { color: #00897b; font-weight: 600; }
.submit-btn {
    width: 100%; padding: 13px; border-radius: 12px; background: #00897b; color: #fff; font-size: 16px; font-weight: 600;
}
.submit-btn:active { opacity: .85; }
.btn-plain { width: 100%; padding: 12px; border-radius: 12px; background: #f1f3f5; color: #607d8b; font-size: 15px; margin-top: 8px; }
/* 删除是危险操作: 单独放在最下面, 红色描边, 不和保存按钮挨在一起 */
.btn-danger { width: 100%; padding: 12px; border-radius: 12px; background: #fff; color: #ef5350; border: 1px solid #ffcdd2; font-size: 15px; margin-top: 16px; }
.btn-danger:active { background: #fff5f5; }

/* 统计 */
.chart-legend { display: flex; gap: 14px; justify-content: flex-end; font-size: 12px; color: #90a4ae; margin-bottom: 4px; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.chart-legend .lg::before { content: ''; width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-legend .lg.out::before { background: #ff8a65; }
.chart-legend .lg.in::before { background: #4db6ac; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.chart .col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.chart .col .bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 92px; }
.chart .col .bar { flex: 1; max-width: 9px; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .col .bar.out { background: #ff8a65; }
.chart .col .bar.in { background: #4db6ac; }
.chart .col .lb { font-size: 9px; color: #b0bec5; height: 12px; line-height: 12px; }

/* 分类占比行 */
.cat-row { margin-bottom: 12px; }
.cat-line { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 4px; }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #546e7a; }
.cat-pct { color: #90a4ae; font-size: 12px; width: 46px; text-align: right; }
.cat-amt { color: #37474f; font-weight: 600; width: 92px; text-align: right; }
.bar-track { height: 8px; background: #eceff1; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }

/* 统计 - 概览卡片 */
.stat-hero { padding: 16px 14px 14px; }
.hero-label { font-size: 12px; color: #90a4ae; }
.hero-value { font-size: 30px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.hero-value.pos { color: #00897b; }
.hero-value.neg { color: #ef5350; }
.hero-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: #eceff1; margin: 12px 0 10px; }
.hero-bar .hb-seg.in { background: #26a69a; }
.hero-bar .hb-seg.out { background: #ff8a65; }
.hero-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.hero-meta .hm { display: flex; justify-content: space-between; align-items: center; background: #f7f9fb; border-radius: 8px; padding: 8px 10px; }
.hero-meta .k { font-size: 12px; color: #90a4ae; }
.hero-meta .v { font-size: 14px; font-weight: 600; color: #37474f; }
.hero-meta .v.in { color: #00897b; }
.hero-meta .v.out { color: #ef5350; }
.hero-note { font-size: 12px; color: #b0bec5; margin-top: 10px; }

/* 统计 - 趋势图可点选 */
.chart .col { cursor: pointer; }
.chart .col.selected .bar.out { background: #e64a19; }
.chart .col.selected .bar.in { background: #00897b; }
.chart .col.selected .lb { color: #455a64; font-weight: 700; }
.trend-note { font-size: 12px; color: #78909c; margin-top: 10px; }

/* 统计 - 环形图 */
.donut-wrap { position: relative; width: 168px; height: 168px; margin: 10px auto 14px; }
.donut { width: 100%; height: 100%; }
.donut-seg { cursor: pointer; transition: opacity .2s; }
.donut-seg.dim { opacity: .25; }
.donut-center { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none; }
.donut-center .dc-label { font-size: 12px; color: #90a4ae; }
.donut-center .dc-value { font-size: 19px; font-weight: 700; color: #37474f; margin-top: 2px; }
.donut-center .dc-sub { font-size: 11px; color: #b0bec5; margin-top: 2px; }

/* 统计 - 分类排行榜 */
.cat-legend { margin-top: 2px; }
.cat-legend-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.cat-legend-item.selected { background: #eef7f6; }
.cat-legend-item .rank { width: 18px; height: 18px; border-radius: 50%; background: #eceff1; color: #78909c; font-size: 11px; text-align: center; line-height: 18px; flex: 0 0 18px; }
.cat-legend-item .rank.r1 { background: #ffb300; color: #fff; }
.cat-legend-item .rank.r2 { background: #b0bec5; color: #fff; }
.cat-legend-item .rank.r3 { background: #e0a06d; color: #fff; }
.cat-legend-item .lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #546e7a; font-size: 13px; }
.cat-legend-item .lg-pct { color: #90a4ae; font-size: 12px; width: 46px; text-align: right; }
.cat-legend-item .lg-amt { color: #37474f; font-weight: 600; font-size: 13px; width: 86px; text-align: right; }
.cat-legend > .bar-track { margin: 0 6px 6px 32px; height: 6px; }

/* 统计 - 下钻明细 */
.detail-box { margin-top: 12px; border-top: 1px solid #f0f3f6; padding-top: 8px; }
.detail-box .hint { font-size: 12px; color: #b0bec5; text-align: center; padding: 12px 0; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.detail-head .dh-title { font-weight: 600; color: #455a64; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.detail-head .dh-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.detail-head .dh-sum { color: #78909c; font-size: 12px; text-align: right; }

/* 账户 */
.acct-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #f4f6f8; }
.acct-item:last-child { border-bottom: none; }
.acct-icon { width: 40px; height: 40px; border-radius: 12px; background: #e0f2f1; color: #00897b; display: flex; align-items: center; justify-content: center; font-size: 21px; }
.acct-name { font-size: 15px; }
.acct-sub { font-size: 12px; color: #b0bec5; }
.acct-bal { font-size: 17px; font-weight: 700; }
.acct-bal.neg { color: #ef5350; }
.total-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 4px; border-top: 1px dashed #eceff1; margin-top: 6px; font-weight: 600; }
.total-line .num { font-size: 19px; color: #00897b; }

/* 我的 */
.me-card { display: flex; align-items: center; gap: 12px; }
.me-avatar { width: 52px; height: 52px; border-radius: 50%; background: #00897b; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.list-links { margin-top: 12px; border-top: 1px solid #eceff1; }
.list-links a { display: flex; justify-content: space-between; align-items: center; padding: 13px 2px; border-bottom: 1px solid #f4f6f8; color: #455a64; font-size: 14px; text-decoration: none; }
.list-links a:last-child { border-bottom: none; }

/* 提示 */
.toast {
    position: fixed; left: 50%; top: 46%; transform: translate(-50%,-50%);
    background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px; border-radius: 8px;
    font-size: 14px; z-index: 99; display: none; max-width: 80%; text-align: center;
}
.toast.show { display: block; }
.loading { text-align: center; color: #b0bec5; font-size: 13px; padding: 24px 0; }
