* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #ff8c42;
  --primary-dark: #f57c1f;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #888;
  --border: #eee;
  --green: #4caf50;
  --red: #f44336;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}
.hidden { display: none !important; }

/* 登录 */
.login-page {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #ff9f5a 0%, #ff7a2f 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.login-box {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 20px; padding: 36px 28px;
  text-align: center; box-shadow: 0 16px 48px rgba(0,0,0,.15);
}
.login-logo { font-size: 56px; margin-bottom: 8px; }
.login-box h1 { font-size: 26px; color: var(--primary-dark); margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.login-box input {
  width: 100%; padding: 14px 16px; border: 1px solid #ddd; border-radius: 12px;
  font-size: 16px; outline: none; margin-bottom: 16px;
}
.login-box input:focus { border-color: var(--primary); }
.login-error { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 22px; }
.app-name { font-size: 18px; font-weight: 600; }
.icon-btn { background: rgba(255,255,255,.2); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; }

/* 页面 */
.page { display: none; padding: 16px 16px calc(env(safe-area-inset-bottom) + 84px); }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h2 { font-size: 20px; }
.count-badge { background: #fff; color: var(--muted); padding: 4px 12px; border-radius: 20px; font-size: 13px; }

/* 车辆卡片 */
.car-card {
  background: linear-gradient(135deg, #ff9f5a, #ff7a2f);
  color: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(255,124,31,.25);
}
.car-card-row { display: flex; justify-content: space-between; align-items: center; }
.car-name { font-size: 20px; font-weight: 600; }
.car-model { font-size: 12px; opacity: .85; margin-top: 2px; }
.odometer-box { text-align: right; }
.odometer-label { font-size: 11px; opacity: .85; }
.odometer { font-size: 26px; font-weight: 700; line-height: 1.2; }
.odometer-unit { font-size: 11px; opacity: .85; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.stat-card.highlight { background: #fff5ed; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-value small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 4px; }

/* 区块标题 */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 600; margin: 20px 0 12px;
}
.link-btn { background: none; border: 0; color: var(--primary); font-size: 13px; cursor: pointer; }

/* 记录列表 */
.record-list { display: flex; flex-direction: column; gap: 10px; }
.record-item {
  background: var(--card); border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
  cursor: pointer; transition: transform .1s;
}
.record-item:active { transform: scale(.98); }
.record-date { font-size: 13px; color: var(--muted); min-width: 74px; }
.record-main { flex: 1; min-width: 0; }
.record-liters { font-size: 15px; font-weight: 600; }
.record-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.record-amount { text-align: right; }
.record-money { font-size: 16px; font-weight: 600; color: var(--primary-dark); }
.record-cspt { font-size: 12px; color: var(--green); margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* 图表 */
.chart-card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.chart-title span { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.chart { position: relative; height: 200px; overflow: hidden; }
.chart svg { width: 100%; height: 100%; }
.summary-list { display: flex; flex-direction: column; gap: 8px; }
.summary-item { background: var(--card); border-radius: 10px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.summary-month { font-weight: 600; }
.summary-meta { font-size: 12px; color: var(--muted); }
.summary-cspt { color: var(--primary-dark); font-weight: 700; font-size: 16px; }

/* 菜单 */
.menu-list { background: var(--card); border-radius: 14px; overflow: hidden; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 16px; background: none; border: 0; border-bottom: 1px solid var(--border);
  text-align: left; cursor: pointer; font-size: 15px; color: var(--text);
}
.menu-item:last-child { border-bottom: 0; }
.menu-icon { font-size: 20px; width: 28px; }
.menu-text { flex: 1; }
.menu-desc { font-size: 12px; color: var(--muted); }
.menu-arrow { color: #ccc; font-size: 20px; }
.version { text-align: center; color: #bbb; font-size: 12px; margin-top: 24px; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 30;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px);
}
.tab {
  flex: 1; background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; cursor: pointer;
}
.tab.active { color: var(--primary); }
.tab-icon { font-size: 20px; }
.tab-add .add-circle {
  background: var(--primary); color: #fff; width: 46px; height: 46px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin-top: -18px; box-shadow: 0 4px 12px rgba(255,124,31,.4);
}

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-content {
  position: relative; width: 100%; max-width: 520px; margin: 0 auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 20px 20px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 92vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 18px; }
.close-btn { background: none; border: 0; font-size: 28px; color: var(--muted); cursor: pointer; line-height: 1; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-row input {
  width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 10px;
  font-size: 16px; outline: none; background: #fafafa;
}
.form-row input:focus { border-color: var(--primary); background: #fff; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-preview { background: #fff5ed; color: var(--primary-dark); border-radius: 10px; padding: 12px; font-size: 13px; text-align: center; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; }
.btn-primary {
  background: var(--primary); color: #fff; border: 0; border-radius: 10px;
  padding: 13px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: #f0f0f0; color: #555; border: 0; border-radius: 10px; padding: 13px; font-size: 16px; cursor: pointer; }
.btn-danger { background: #fff0f0; color: var(--red); border: 1px solid #ffd6d6; border-radius: 10px; padding: 13px; font-size: 16px; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 12px 20px; border-radius: 24px;
  font-size: 14px; z-index: 200; white-space: nowrap;
}
