/* ==========================================================================
   车辆里程登记 · 司机移动端样式
   按 Figma 设计稿 1:1 还原（画板 390 宽「车辆里程登记」，色值/字号/间距取自标注）
   ========================================================================== */

/* ---------- Tokens（取自 Figma） ---------- */
:root {
  --ink: #202B38;        /* 主文字 */
  --sub: #657184;        /* 次级文字 */
  --ph: #9AA5B3;         /* 占位文字 */
  --bg: #F3F5F7;         /* 页面底色 */
  --paper: #FFFFFF;
  --line: #DCE2E9;       /* 输入框/上传区描边 */
  --divider: #E7EBF0;    /* 导航栏/分组标题/提交区分隔线 */
  --primary: #173F68;    /* 主色（按钮/强调） */
  --ok: #238148;         /* 已选择/成功 */
  --danger: #C03A30;
  --info-bg: #F1F5FA;    /* 提示条底色 */
  --zone-bg: #F8FAFC;    /* 上传区底色 */
  --plate-g1: #EAFFD0;   /* 新能源号牌渐变（顶） */
  --plate-g2: #4FD620;
  --plate-g3: #2DB800;   /* 底 */
  --plate-ink: #0A1A0A;  /* 牌面文字/边框 */
  --plate-bolt: #1A6B2A; /* 新能源标识 */
  --font-body: "Noto Sans SC", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", sans-serif;
  --r: 10px;             /* 卡片圆角 */
  --r-sm: 6px;           /* 控件圆角 */
}

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}
svg { display: block; flex: none; }
button { font-family: inherit; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 顶部导航栏（白底 47px + 底部分隔线） ---------- */
.navbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--divider);
  padding-top: env(safe-area-inset-top);
}
.navbar-inner {
  max-width: 480px; margin: 0 auto;
  height: 47px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center;
}
.nav-title { font-size: 17px; font-weight: 700; color: var(--ink); }

/* ---------- 访问密码解锁层 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lock-card {
  width: 100%; max-width: 320px;
  background: var(--paper);
  border-radius: var(--r);
  padding: 28px 20px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.lock-title { font-size: 17px; font-weight: 700; color: var(--ink); text-align: center; }
.lock-sub { font-size: 13px; color: var(--sub); text-align: center; margin-top: -8px; }
.lock-err { font-size: 12px; color: var(--danger); text-align: center; min-height: 16px; }

/* ---------- 内容区（卡片间距 12） ---------- */
.container {
  max-width: 480px; margin: 0 auto;
  padding: 16px 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.card {
  background: var(--paper);
  border-radius: var(--r);
  padding: 16px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.card-head.divide {
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}
.head-note { font-size: 11px; color: var(--sub); }
.req { margin-left: 2px; }

/* ---------- 选择车辆 ---------- */
.search-area { position: relative; margin-top: 14px; }
.search-box {
  height: 48px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .15s ease;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box > svg { color: var(--sub); }
#searchInput {
  flex: 1; min-width: 0; height: 100%;
  border: none; outline: none; background: none;
  font-size: 16px; font-family: inherit; color: var(--ink);
}
#searchInput::placeholder { color: var(--ph); }
#searchInput::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: none; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none; padding: 0;
  border: none; background: none; color: var(--ph); cursor: pointer;
}
.search-box.has-value .search-clear { display: flex; }
.search-btn {
  flex: none; border: none; background: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--primary);
  padding: 6px 0 6px 6px;
}
.search-btn:active { opacity: .7; }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 6px 18px rgba(23, 63, 104, .1);
  max-height: 236px; overflow-y: auto;
  z-index: 20;
  display: none;
}
.suggest.open { display: block; animation: drop .14s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.suggest-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.suggest-row:last-child { border-bottom: none; }
.suggest-row:active { background: var(--zone-bg); }
.suggest-row .plate { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.suggest-row .chev { margin-left: auto; color: var(--ph); }
.chip {
  font-size: 12px; color: var(--sub);
  background: var(--bg); border-radius: 4px;
  padding: 2px 7px;
}
.suggest-loading, .suggest-empty {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 14px; font-size: 13.5px; color: var(--sub);
}
.suggest-empty.err { color: var(--danger); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 已选车辆（新能源号牌：渐变绿底 + 深色边框） ---------- */
.selected-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px;
}
.nev-plate {
  display: inline-flex; align-items: stretch;
  padding: 4px 8px;
  background: linear-gradient(180deg, var(--plate-g1) 0%, var(--plate-g2) 52%, var(--plate-g3) 100%);
  border: 2.5px solid var(--plate-ink);
  border-radius: 5px;
  white-space: nowrap; flex: none;
}
.nev-inner {
  display: flex; align-items: center; gap: 3px;
  border: 1px solid var(--plate-ink);
  border-radius: 2px;
  padding: 3px 7px;
}
.nev-region, .nev-no {
  font-size: 22px; font-weight: 900; line-height: 26px;
  color: var(--plate-ink); letter-spacing: 1px;
}
.nev-bolt { color: var(--plate-bolt); margin: 0 1px; }
.sel-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ok);
}

/* ---------- 提示信息条（首次登记 / 上次记录） ---------- */
.info-row {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 14px; padding: 9px 10px;
  background: var(--info-bg);
  border-radius: 5px;
  font-size: 11px; line-height: 1.6; color: var(--sub);
}
.info-row svg { color: var(--primary); margin-top: 2px; }
.info-row b { color: var(--ink); font-weight: 600; }
.info-row b.ok { color: var(--ok); }
.info-row b.bad { color: var(--danger); }
.info-row.loading { flex-direction: column; gap: 7px; }
.skeleton { position: relative; overflow: hidden; height: 11px; border-radius: 4px; background: #E5EAF0; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- 空状态 / 提交成功 ---------- */
.empty-tip { padding: 20px 0 6px; text-align: center; color: var(--sub); }
.empty-tip b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.empty-tip span { font-size: 12.5px; }

.success-banner {
  display: none;
  margin-bottom: 16px; padding: 10px 12px;
  background: var(--info-bg);
  border-left: 3px solid var(--ok);
  border-radius: var(--r-sm);
}
.success-banner.show { display: flex; align-items: flex-start; gap: 8px; }
.success-banner svg { color: var(--ok); margin-top: 1px; }
.success-banner b { display: block; font-size: 13px; color: var(--ok); }
.success-banner span { display: block; font-size: 12px; color: var(--sub); margin-top: 2px; }

/* ---------- 登记表单（字段间距 16，标签-控件间距 7） ---------- */
#fields .field + .field { margin-top: 16px; }
.field > label {
  display: block;
  font-size: 14px; font-weight: 400; color: var(--ink); line-height: 21px;
  margin-bottom: 7px;
}
.control {
  height: 44px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .15s ease;
}
.control:focus-within { border-color: var(--primary); }
.control input {
  flex: 1; min-width: 0; height: 100%;
  border: none; outline: none; background: none;
  font-size: 16px; font-family: inherit; color: var(--ink);
}
.control input::placeholder { color: var(--ph); }
.control .suffix { font-size: 13px; color: var(--sub); flex: none; }
.control .suffix-icon { color: var(--sub); pointer-events: none; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { display: none; }

/* 备注多行 + 字数统计 */
.control-area { display: block; position: relative; height: auto; padding: 0; }
.control-area textarea {
  display: block; width: 100%; height: 80px;
  border: none; outline: none; background: none; resize: none;
  padding: 12px 12px 24px;
  font-size: 16px; font-family: inherit; line-height: 1.6; color: var(--ink);
}
.control-area textarea::placeholder { color: var(--ph); }
.control-area .counter {
  position: absolute; right: 12px; bottom: 8px;
  font-size: 11px; color: var(--ph);
}

/* ---------- 首保单选（圆形，选中为深蓝粗环） ---------- */
.radio-group { display: flex; align-items: center; gap: 34px; padding: 4px 0; }
.radio-opt {
  display: flex; align-items: center; gap: 7px;
  border: none; background: none; cursor: pointer; padding: 0;
  font-size: 14px; color: var(--ink);
}
.radio-dot {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: 1.2px solid var(--line);
  background: var(--paper);
  transition: border-color .12s ease;
}
.radio-opt.selected .radio-dot { border: 5px solid var(--primary); }

/* ---------- 仪表台里程数照片 ---------- */
#photoCount { font-size: 12px; }
.upload-zone {
  margin-top: 12px;
  background: var(--zone-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
}
.upload-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.upload-empty > svg { color: var(--sub); }
.up-main { font-size: 13px; color: var(--ink); text-align: center; }
.up-sub { font-size: 12px; line-height: 18px; color: var(--sub); text-align: center; }
.up-actions { display: flex; gap: 10px; }
.up-btn {
  height: 40px; padding: 0 18px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--primary);
  cursor: pointer;
}
.up-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.up-btn:active { transform: scale(.98); }
.upload-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.upload-preview img {
  max-width: 100%; max-height: 240px;
  border-radius: 4px; background: #fff; border: 1px solid var(--line);
}
.file-note { margin-top: 10px; font-size: 11px; color: var(--sub); }

/* ---------- 底部提交区（固定，白底 + 顶部分隔线） ---------- */
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--paper);
  border-top: 1px solid var(--divider);
  padding: 14px 16px calc(10px + env(safe-area-inset-bottom));
}
.submit-bar-inner { max-width: 480px; margin: 0 auto; }
.btn-primary {
  width: 100%; height: 46px;
  border: none; border-radius: var(--r-sm);
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .15s ease, transform .1s ease;
}
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.submit-hint { margin-top: 10px; font-size: 11px; color: var(--sub); text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: calc(14% + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  display: none; align-items: center; gap: 8px;
  max-width: 82vw;
  background: #23272E; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-size: 14px;
  z-index: 99;
}
.toast.show { display: flex; animation: toast-in .18s ease; }
.toast.ok svg { color: #5FD08C; }
.toast.err svg { color: #F09A92; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
