:root {
  --teal: #0f766e;
  --teal-light: #14b8a6;
  --bg: #f6f8f8;
  --card: #ffffff;
  --ink: #10231f;
  --muted: #6b7f7b;
  --line: #e3eae9;
  --red: #dc2626;
  --amber: #d97706;
  --green: #16a34a;
  --radius: 16px;
  --tabbar-h: 60px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 12px 14px calc(var(--tabbar-h) + 24px);
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 12px;
}
.topbar h1 { font-size: 20px; margin: 0; }
.badge {
  font-size: 12px; background: #e6f4f1; color: var(--teal);
  padding: 3px 10px; border-radius: 999px; font-weight: 600;
}
.badge.warn { background: #fef3e2; color: var(--amber); }
.badge.danger { background: #fef2f2; color: var(--red); }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.onboard h2 { margin: 0 0 4px; font-size: 18px; }
.onboard p { margin: 0 0 12px; color: var(--muted); }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
label:last-child { margin-bottom: 0; }
label.check {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-size: 14px; cursor: pointer;
  padding: 4px 0; min-height: 30px;
  transition: opacity .1s ease;
}
label.check:active { opacity: .6; }
input, select {
  display: block; width: 100%; margin-top: 5px;
  padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfdfd; color: var(--ink);
  appearance: none;
}
input:focus, select:focus { outline: 2px solid var(--teal-light); border-color: transparent; }
input[readonly] { color: var(--muted); background: #f2f5f5; }

/* 复选框：基类的 appearance:none 会抹掉原生对勾，这里统一自绘，尺寸一致且勾选有明显反馈 */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border: 1.5px solid #c3d3d0;
  border-radius: 7px;
  background-color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, transform .08s ease;
}
input[type="checkbox"]:checked {
  background-color: var(--teal);
  border-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 74%;
  animation: checkPop .18s ease;
}
input[type="checkbox"]:active { transform: scale(.86); }
input[type="checkbox"]:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .3);
}
@keyframes checkPop { from { transform: scale(.78); } to { transform: scale(1); } }

/* 下拉框：appearance:none 会去掉原生箭头，补一个 */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7f7b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 12px 8px;
  padding-right: 34px;
  cursor: pointer;
}

/* 时间选择器：保留可点的时钟图标 */
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type="time"]:focus::-webkit-calendar-picker-indicator { opacity: .9; }
.muted { color: var(--muted); font-size: 12.5px; }
.input-row { display: flex; gap: 8px; flex-wrap: wrap; }
.input-row input { margin-top: 0; }
.input-row input[type="datetime-local"] { flex: 1 1 155px; min-width: 150px; }
.input-row .btn { white-space: nowrap; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); cursor: pointer;
  transition: transform .1s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-ghost { color: var(--red); border-color: #f3c6c6; background: #fff7f7; }
.btn.soft { background: #eff7f6; border-color: #cfe6e3; color: var(--teal); width: 100%; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.quick-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

/* 充电器估算容量 */
.est-box {
  margin-top: 10px; padding: 12px;
  background: #f7fbfa; border: 1px dashed #cfe6e3; border-radius: 12px;
}
.est-box .btn { width: 100%; }

/* 充电记录输入行 */
.chg-row { align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.chg-row input[type="number"] { min-width: 88px; flex: 1 1 88px; }
.chg-row .check { margin-bottom: 0; white-space: nowrap; font-size: 14px; padding: 0; min-height: 0; }
/* 注意：此处不要再写 width:auto，会盖掉复选框的统一 22px 尺寸 */
.chg-row input[type="checkbox"] { margin-top: 0; }

/* 仪表盘 */
.gauge-wrap { position: relative; width: 210px; margin: 8px auto 4px; }
.gauge { width: 100%; display: block; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: #e7edec; stroke-width: 14; }
.gauge-arc {
  fill: none; stroke: var(--teal-light); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 527.8; stroke-dashoffset: 527.8;
  transition: stroke-dashoffset .8s cubic-bezier(.4,0,.2,1), stroke .4s;
}
.gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.soc-value { font-size: 46px; font-weight: 700; line-height: 1; }
.soc-value span { font-size: 20px; font-weight: 600; margin-left: 2px; }
.soc-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

.stat-row { display: flex; gap: 8px; margin: 14px 0 4px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 6px; text-align: center;
}
.stat-num { font-size: 20px; font-weight: 700; }
.stat-cap { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* 提醒条 */
.alert {
  border-radius: 12px; padding: 12px 14px; margin: 10px 0;
  font-size: 14px; font-weight: 600; line-height: 1.5;
  border: 1px solid transparent;
}
.alert.warn { background: #fff7e8; border-color: #f5d9a6; color: #92400e; }
.alert.danger { background: #fef2f2; border-color: #f5c2c2; color: #991b1b; }
.alert.ok { background: #effaf3; border-color: #c3ebd2; color: #166534; }

/* 提示列表 */
.tips ul { margin: 6px 0 0; padding-left: 18px; }
.tips li { font-size: 13.5px; color: #3c514d; margin-bottom: 4px; }

/* 图表 */
.chart { width: 100%; height: 120px; display: block; }

/* 列表 */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main b { font-size: 15px; }
.list-item .li-sub { color: var(--muted); font-size: 12.5px; }
.li-act { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.li-edit, .li-del { border: none; background: none; color: var(--muted); padding: 4px 7px; cursor: pointer; line-height: 1; }
.li-edit { font-size: 15px; }
.li-del { font-size: 17px; }
.li-main .li-muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; font-size: 13.5px; }

/* 行程进行中 */
.trip-live { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
#trip-live-meta { margin-top: 8px; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 520px; margin: 0 auto;
  height: var(--tabbar-h);
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; border: none; background: none; cursor: pointer;
  font-size: 18px; color: var(--muted);
}
.tab span { font-size: 11px; }
.tab.active { color: var(--teal); font-weight: 600; }

/* 弹窗 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(16,35,31,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px; background: #fff;
  border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px);
  transform: translateX(-50%); z-index: 200;
  background: #10231f; color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; max-width: 86%;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.about p { margin: 4px 0; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
