:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1b1d20;
  --text2: #6b7075;
  --text3: #9aa0a6;
  --bd: #e6e8ea;
  --bd2: #d5d8db;
  --brand: #0f6e56;
  --brand-bg: #e1f5ee;
  --exp: #d93b3b;
  --exp-bg: #fcebeb;
  --inc: #12916a;
  --inc-bg: #e1f5ee;
  --r: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  overscroll-behavior-y: none;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ---------- 布局 ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(242, 243, 245, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.topbar .sub {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

.page {
  padding: 0 16px 24px;
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--bd);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar button {
  padding: 9px 4px 10px;
  font-size: 11px;
  color: var(--text3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
}

.tabbar button .dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.tabbar button.on {
  color: var(--brand);
  font-weight: 600;
}

.tabbar button.on .dot {
  background: var(--brand-bg);
  border-color: var(--brand);
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.card.tight {
  padding: 10px 14px;
}

.sec-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 18px 2px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sec-title .hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text3);
}

/* ---------- 分段控件 ---------- */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: #e8eaec;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.seg button {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text2);
  font-weight: 500;
  transition: all 0.15s;
}

.seg button.on {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.seg.exp button.on {
  color: var(--exp);
}

.seg.inc button.on {
  color: var(--inc);
}

/* ---------- 金额输入 ---------- */
.amount-box {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.amount-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.amount-row .cur {
  font-size: 22px;
  font-weight: 500;
  color: var(--text2);
}

.amount-row input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -1px;
  padding: 0;
  min-width: 0;
  color: var(--text);
}

.amount-row input::placeholder {
  color: #c8ccd0;
}

.amount-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--bd);
  font-size: 13px;
  color: var(--text2);
  flex-wrap: wrap;
}

.amount-foot input[type='date'] {
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text2);
  padding: 0;
  outline: none;
}

.amount-foot .mini {
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--text2);
  background: var(--card);
}

.amount-foot .mini.on {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-bg);
}

/* ---------- 分类选择 ---------- */
.chip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--bd);
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  transition: all 0.12s;
}

.chip .ic {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.chip.on {
  border-color: var(--brand);
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 600;
}

.chip.sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 16px;
}

.chip.ghost {
  border-style: dashed;
  color: var(--text2);
}

/* ---------- 表单块 ---------- */
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--bd);
}

.field:last-child {
  border-bottom: none;
}

.field .label {
  flex: 0 0 62px;
  font-size: 14px;
  color: var(--text2);
}

.field .val {
  flex: 1;
  text-align: right;
  font-size: 14px;
}

.field input[type='text'],
.field input[type='number'],
.field input[type='password'],
.field select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  text-align: right;
  font-size: 14px;
  min-width: 0;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.85;
}

.btn:disabled {
  background: #c9ced2;
}

.btn.ghost {
  background: var(--card);
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn.plain {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--bd);
  font-weight: 500;
  font-size: 14px;
  padding: 12px;
}

.btn.danger {
  background: var(--card);
  color: var(--exp);
  border: 1px solid #f0c8c8;
  font-weight: 500;
  font-size: 14px;
  padding: 12px;
}

.btn-row {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.btn-row.two {
  grid-template-columns: 1fr 1fr;
}

.save-bar {
  position: sticky;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-top: 10px;
  background: linear-gradient(to bottom, rgba(242, 243, 245, 0), var(--bg) 40%);
  z-index: 10;
}

/* ---------- 流水列表 ---------- */
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 6px;
  font-size: 12px;
  color: var(--text2);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--bd);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .ic {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.list-item .mid {
  flex: 1;
  min-width: 0;
}

.list-item .mid .t1 {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .mid .t2 {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .amt {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.amt.exp {
  color: var(--exp);
}

.amt.inc {
  color: var(--inc);
}

/* ---------- 统计 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--bd);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.stat-grid .cell {
  background: var(--card);
  padding: 13px 10px;
  text-align: center;
}

.stat-grid .cell .k {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 4px;
}

.stat-grid .cell .v {
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.stat-grid .cell .v.exp {
  color: var(--exp);
}

.stat-grid .cell .v.inc {
  color: var(--inc);
}

.big-num {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.big-num.exp {
  color: var(--exp);
}

.big-num.inc {
  color: var(--inc);
}

/* 条形占比 */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.bar-row .ic {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.bar-row .body {
  flex: 1;
  min-width: 0;
}

.bar-row .body .top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.bar-row .body .top .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.bar-row .body .top .a {
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  flex: 0 0 auto;
}

.bar-track {
  height: 6px;
  background: #eef0f2;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

/* 车辆区 */
.kpi {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--bd);
}

.kpi:last-child {
  border-bottom: none;
}

.kpi .k {
  font-size: 13px;
  color: var(--text2);
}

.kpi .v {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kpi .v .unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text3);
  margin-left: 2px;
}

.formula {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.7;
  padding: 9px 11px;
  background: #f7f8f9;
  border-radius: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: var(--brand-bg);
  color: var(--brand);
  margin-left: 6px;
  vertical-align: 1px;
}

.tag.warn {
  background: #fdf0e3;
  color: #a05a12;
}

/* 趋势柱 */
.trend {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 96px;
  padding: 0 2px;
}

.trend .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}

.trend .bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 100%;
}

.trend .b {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.trend .lb {
  font-size: 11px;
  color: var(--text3);
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text2);
  margin-top: 10px;
  justify-content: center;
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text3);
  font-size: 14px;
}

.empty .big {
  font-size: 15px;
  color: var(--text2);
  margin-bottom: 6px;
}

/* ---------- 弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 82vh;
  overflow-y: auto;
  animation: up 0.2s ease-out;
}

@keyframes up {
  from {
    transform: translateY(16px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.sheet .close {
  position: absolute;
  right: 18px;
  top: 16px;
  color: var(--text3);
  font-size: 20px;
  line-height: 1;
}

/* 月份切换 */
.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-nav button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--bd);
  background: var(--card);
  color: var(--text2);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-nav .m {
  font-size: 15px;
  font-weight: 600;
  min-width: 88px;
  text-align: center;
}

/* 提示条 */
.notice {
  font-size: 12px;
  color: var(--text2);
  background: #f7f8f9;
  border-radius: 8px;
  padding: 9px 11px;
  line-height: 1.6;
  margin-top: 10px;
}

.notice code {
  font-size: 11px;
  background: #e8eaec;
  padding: 1px 4px;
  border-radius: 4px;
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(27, 29, 32, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 20px;
  z-index: 80;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------------
   隐藏 EdgeOne Pages 免费版平台注入的演示声明条（#edgeone-watermark）
   说明：该条是平台在边缘层注入的提示，默认会盖住底部导航。
   如需恢复，删掉下面这段即可。
   ------------------------------------------------------------------ */
#edgeone-watermark { display: none !important; }
