/* ============================================================
   车辆能耗与全生命周期管理系统 - 样式
   移动优先 / 响应式 / 深色·浅色主题（CSS 变量）
   视觉语言：统一设计令牌（色彩/阴影/圆角/间距/焦点环）
   ============================================================ */

:root {
  /* 色彩 */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #1f2d3d;
  --text-soft: #5b6b7b;
  --border: #e2e8ee;
  --primary: #2c7be5;
  --primary-2: #1f5fd6;        /* 渐变终点 */
  --primary-soft: #e8f1fd;
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  /* 主色渐变（按钮/品牌） */
  --grad: linear-gradient(135deg, #3b8bf0 0%, #2c7be5 55%, #1f5fd6 100%);
  /* 阴影层级（统一视觉语言） */
  --shadow-sm: 0 1px 3px rgba(20, 40, 60, 0.06);
  --shadow: 0 2px 10px rgba(20, 40, 60, 0.08);
  --shadow-lg: 0 8px 28px rgba(20, 40, 60, 0.14);
  /* 焦点环（键盘可达性） */
  --ring: 0 0 0 3px rgba(44, 123, 229, 0.28);
  /* 圆角 */
  --radius: 14px;
  --radius-sm: 9px;
  /* 油价涨跌语义色（中国习惯：涨=红 / 跌=绿），浅色主题 */
  --up: #d0362c;
  --down: #1a9d5a;
  --up-soft: rgba(208, 54, 44, .09);
  --down-soft: rgba(26, 157, 90, .09);
  --up-border: rgba(208, 54, 44, .30);
  --down-border: rgba(26, 157, 90, .30);
  /* 价格条渐变（深色主题单独覆盖，避免浅色叠加导致发灰） */
  --bar-grad: linear-gradient(90deg, var(--primary-soft), rgba(44, 123, 229, .45));
}

[data-theme="dark"] {
  --bg: #10151b;
  --surface: #1a2129;
  --surface-2: #232c37;
  --text: #e7edf3;
  --text-soft: #9aa9b8;
  --border: #2b3644;
  --primary: #4a9bf5;
  --primary-2: #2c7be5;
  --primary-soft: #1d2c40;
  --grad: linear-gradient(135deg, #4a9bf5 0%, #3b82e8 55%, #2c6fd0 100%);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(74, 155, 245, 0.32);
  /* 深色主题下提高涨跌色明度，保证在深色背景上的对比度 */
  --up: #ff7a6e;
  --down: #5ad08a;
  --up-soft: rgba(255, 122, 110, .14);
  --down-soft: rgba(90, 208, 138, .14);
  --up-border: rgba(255, 122, 110, .38);
  --down-border: rgba(90, 208, 138, .38);
  --bar-grad: linear-gradient(90deg, var(--primary-soft), rgba(74, 155, 245, .55));
}

* { box-sizing: border-box; }

/* 防意外横向滚动：在 html 上裁剪（不影响 sticky 顶栏）；图片不撑破容器 */
html { overflow-x: hidden; }
img { max-width: 100%; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* 移动端触控体验：去掉点按高亮闪光、消除 300ms 点按延迟 */
body { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea, label, [role="button"] { touch-action: manipulation; }

a { color: var(--primary); text-decoration: none; }

/* 键盘焦点统一环（无障碍） */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  /* 刘海屏/全面屏安全区：顶栏内容不被状态栏遮挡 */
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
.brand {
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
  letter-spacing: .2px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary); /* 不支持 background-clip:text 时回退 */
}
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ---------------- 布局 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 16px 14px 60px; }
.page-title { font-size: 22px; font-weight: 800; margin: 6px 0 14px; letter-spacing: .2px; }
.section-title { font-size: 16px; font-weight: 700; margin: 18px 0 10px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.grid { display: grid; gap: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 44px; /* 移动端触控目标下限（Apple HIG / WCAG） */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, border-color .15s, filter .15s;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--shadow); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 10px; font-size: 13px; min-height: 40px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 5px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  min-height: 44px; /* 输入框触控目标与可点击区域 */
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* ≥16px 防止 iOS Safari 聚焦时自动放大页面 */
  line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-soft); }
.field input[type="checkbox"] {
  width: 20px; height: 20px; /* 复选框可点区域 */
  min-height: 0;
  accent-color: var(--primary);
  flex: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--ring);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------- 徽标 / 标签 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-fuel { background: #fde9e7; color: #c0392b; }
.badge-ev { background: #e6f6ee; color: #1e8449; }
.badge-phev { background: #eef3ff; color: #2c5fd0; }
.badge-admin { background: var(--grad); color: #fff; }
[data-theme="dark"] .badge-fuel { background: #3a2422; color: #ff8a7a; }
[data-theme="dark"] .badge-ev { background: #1c3326; color: #5ad08a; }
[data-theme="dark"] .badge-phev { background: #1e2c44; color: #7aa7ff; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); font-size: 12px; color: var(--text-soft);
}
/* 口径徽标：满箱/满充法=绿，估算=灰，数据不足=黄 */
.chip-ok { background: rgba(30,132,73,.14); color: #1e8449; font-weight: 600; }
.chip-warn { background: rgba(243,156,18,.16); color: #b9770e; font-weight: 600; }
[data-theme="dark"] .chip-ok { background: rgba(90,208,138,.16); color: #5ad08a; }
[data-theme="dark"] .chip-warn { background: rgba(243,156,18,.2); color: #f0b34d; }

/* 多车对比：维度最优标绿 / 最差标红（费用类维度统一"越低越好"） */
.cell-best { background: rgba(30,132,73,.12); color: #1e8449; font-weight: 600; }
.cell-worst { background: rgba(231,76,60,.12); color: #c0392b; font-weight: 600; }
[data-theme="dark"] .cell-best { background: rgba(90,208,138,.14); color: #5ad08a; }
[data-theme="dark"] .cell-worst { background: rgba(255,138,122,.14); color: #ff8a7a; }

/* 提醒级别 */
.lv-ok { color: var(--success); }
.lv-warning { color: var(--warning); }
.lv-urgent { color: var(--danger); }
.lv-err { color: var(--danger); }
.lv-overdue { color: var(--danger); font-weight: 700; }
.bg-warning { background: rgba(243,156,18,.12); border-color: var(--warning) !important; }
.bg-urgent { background: rgba(231,76,60,.12); border-color: var(--danger) !important; }
.bg-overdue { background: rgba(231,76,60,.18); border-color: var(--danger) !important; }

/* ---------------- 提醒横幅 ---------------- */
.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.banner-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 8px; }
.banner .reminder-item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm); margin-top: 6px; font-size: 14px;
  border: 1px solid transparent;
}
.reminder-item .rem-text { color: var(--text-soft); }

/* ---------------- 车辆卡片 ---------------- */
.vcard { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; gap: 8px; }
.vcard:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.vcard .vtop { display: flex; justify-content: space-between; align-items: flex-start; }
.vcard .vname { font-size: 17px; font-weight: 700; }
.vcard .vmeta { color: var(--text-soft); font-size: 13px; }
.vcard .vstats { display: flex; gap: 14px; margin-top: 4px; }
.vcard .vstat .k { font-size: 12px; color: var(--text-soft); }
.vcard .vstat .val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vcard .vstat .val .u { font-size: 11px; font-weight: 500; color: var(--text-soft); margin-left: 3px; }
.vcard .vactions { display: flex; gap: 6px; margin-top: 6px; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs button {
  background: none; border: none; padding: 12px 14px; cursor: pointer;
  color: var(--text-soft); font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent;
  flex: none; transition: color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs::-webkit-scrollbar { height: 0; }

/* ---------------- 表格 ---------------- */
.table-wrap {
  overflow-x: auto;
  /* 移动端横滑更跟手（惯性滚动），滚动条更窄不占视觉空间 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-radius: var(--radius-sm);
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-soft); font-weight: 600; background: var(--surface-2); }
td { font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--surface-2); }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; cursor: pointer; }
/* 表格里的操作按钮恢复紧凑尺寸（触控下限由 .btn-sm 保证） */
td .btn-sm { min-height: 36px; }

/* ---------------- 统计数字 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px;
  border: 1px solid var(--border);
}
.stat .k { font-size: 12px; color: var(--text-soft); }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .u { font-size: 12px; color: var(--text-soft); }

/* ---------------- 骨架屏 ---------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 14px; margin: 8px 0; }
.sk-block { height: 120px; }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center; padding: 40px 16px; color: var(--text-soft);
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface);
}
.empty .em-icon { font-size: 42px; }
.empty .em-title { font-weight: 700; margin: 8px 0 4px; color: var(--text); }
.empty .em-desc { font-size: 14px; }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--success); color: #fff; }

/* ---------------- 对比选择 ---------------- */
.compare-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.pick-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; display: flex; align-items: center; gap: 8px; background: var(--surface);
  transition: .15s;
}
.pick-card:hover { border-color: var(--primary); }
.pick-card.checked { border-color: var(--primary); background: var(--primary-soft); }
.pick-card input { accent-color: var(--primary); width: 18px; height: 18px; }

/* ---------------- 记录类型选择（新增记录独立入口） ---------------- */
.kind-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kind-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 20px 12px; min-height: 120px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
  box-shadow: var(--shadow-sm);
}
.kind-card:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kc-icon { font-size: 28px; line-height: 1; }
.kc-title { font-weight: 700; font-size: 15px; }
.kc-sub { font-size: 12px; color: var(--text-soft); }
@media (max-width: 480px) {
  .kind-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kind-card { min-height: 96px; padding: 16px 10px; }
}

/* ---------------- 图片上传 ---------------- */
.img-prev { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-prev .ip { position: relative; }
.img-prev img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.img-prev .ip-x {
  position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff;
  border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; border: none; padding: 0;
}
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-row input[type=file] { font-size: 13px; max-width: 100%; }

/* ---------------- 多图缩略图与画廊 ---------------- */
.img-cell { position: relative; display: inline-block; cursor: pointer; line-height: 0; }
.img-cell .thumb { display: block; }
.img-count {
  position: absolute; right: 2px; bottom: 2px; line-height: 1;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px;
  padding: 3px 5px; border-radius: 6px; font-variant-numeric: tabular-nums;
}
/* 用 .modal.gallery-modal 提高特异性：下方 .modal 的 max-width:520px 定义更靠后，
   单类选择器会被它覆盖，导致 PDF 预览器被压窄（历史 720px 规则同样因此未生效）。 */
.modal.gallery-modal { max-width: 920px; }
.gallery-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.gallery-img { display: block; max-width: 100%; max-height: 68vh; margin: 0 auto; border-radius: var(--radius-sm); }
.gallery-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }

/* ---------------- 附件（图片 / PDF）统一展示与预览 ---------------- */
/* 表单缩略：PDF 卡片与图片缩略同尺寸，点击可直接预览 */
.img-prev .att-pdf-card {
  box-sizing: border-box; width: 64px; height: 64px; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 11px; text-align: center; overflow: hidden;
}
.img-prev .att-pdf-card:hover { border-color: var(--primary); }
.att-pdf-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 1; padding: 3px 5px; border-radius: 4px; letter-spacing: .5px;
}
.att-pdf-name {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10px; color: var(--text-soft);
}
/* 列表缩略：PDF 占位块 / 图片加载失败占位（与 .thumb 同尺寸） */
.att-pdf-thumb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface-2);
}
.att-thumb-failed {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 2px;
  border: 1px dashed var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--text-soft);
  font-size: 10px; line-height: 1.2; text-align: center; cursor: pointer;
}
/* 预览器：PDF 内嵌容器 + 明确的失败 / 不支持提示 */
.viewer-pdf { display: flex; flex-direction: column; gap: 10px; }
.viewer-pdf-obj {
  display: block; width: 100%;
  height: 72vh;                    /* 不支持 min() 的浏览器兜底 */
  height: min(72vh, 720px);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.viewer-pdf-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.viewer-pdf-foot .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-fallback, .viewer-fail {
  box-sizing: border-box; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 20px; text-align: center; color: var(--text);
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.viewer-fallback { height: 100%; min-height: 200px; }
.viewer-fail { min-height: 200px; }
.viewer-fallback-icon, .viewer-fail-icon { font-size: 34px; line-height: 1; }
.viewer-fail-title { font-weight: 700; color: var(--danger); }
.viewer-fail-slot:empty { display: none; }
.viewer-hidden { display: none; }
.viewer-pdf-failed { min-height: 0; }
@media (max-width: 480px) {
  .gallery-img { max-height: 56vh; }
  .modal.gallery-modal { max-width: 100%; }
  .viewer-pdf-obj { height: 60vh; }
  .viewer-pdf-foot .row { width: 100%; justify-content: flex-end; }
  .att-pdf-thumb, .att-thumb-failed { width: 44px; height: 44px; }
}

/* ---------------- 油价查询 ---------------- */
.fp-prov-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fp-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.fp-toolbar .field { margin-bottom: 0; }
.fp-prov {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 18px; padding: 6px 14px; font-size: 13px; cursor: pointer; min-height: 34px;
}
.fp-prov:hover { border-color: var(--primary); color: var(--primary); }
.fp-prov.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fp-prov.active .muted { color: rgba(255,255,255,.75); }
.fp-prov-list .muted.small { font-size: 11px; margin-left: 3px; }
/* 行内加载占位（避免区块空白） */
.fp-loading-inline { padding: 4px 0; }
.fp-loading-inline .skeleton { margin: 4px 0; }
/* 阶段横幅：省份 + 执行日期，视觉锚点 */
.fp-stage-banner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px;
}
.fp-sb-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fp-sb-prov { font-size: 17px; font-weight: 800; }
.fp-sb-date { font-size: 13px; color: var(--text-soft); }
.fp-sb-date b { color: var(--text); }
/* 油品价格卡片网格：大数字首屏一目了然 */
.fp-price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fp-price-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center; min-height: 104px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
}
.fp-pc-name { font-size: 12px; color: var(--text-soft); }
.fp-pc-price { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fp-pc-unit { font-size: 11px; font-weight: 400; color: var(--text-soft); margin-left: 3px; }
.fp-pc-change { font-size: 12px; min-height: 17px; }
/* 涨跌语义类：不再复用提醒等级 lv-urgent / lv-ok（语义混淆且深色下对比度不足） */
.fp-up { color: var(--up); font-weight: 700; font-variant-numeric: tabular-nums; }
.fp-down { color: var(--down); font-weight: 700; font-variant-numeric: tabular-nums; }
.fp-pc-change .fp-up, .fp-pc-change .fp-down { font-weight: 700; }
/* 省份选择：默认折叠，避免 31 个按钮占满首屏；搜索时自动展开 */
.fp-prov-wrap { margin-top: 10px; }
.fp-prov-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.fp-prov-current { font-size: 13px; }
.fp-prov-current b { color: var(--primary); }
.fp-prov-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 18px; padding: 5px 12px; font-size: 12px; cursor: pointer; min-height: 30px;
}
.fp-prov-toggle:hover { border-color: var(--primary); color: var(--primary); }
.fp-prov-list.is-collapsed { display: none; }
/* 明细折叠区 */
.fp-details { margin-top: 10px; }
.fp-details summary {
  cursor: pointer; color: var(--text-soft); font-size: 13px; padding: 6px 0; user-select: none;
}
.fp-details summary:hover { color: var(--primary); }
/* 全国极值卡：背景/边框改用主题变量，深色下不再叠加浅色 rgba */
.fp-extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.fp-ext {
  border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.fp-ext-min { background: var(--down-soft); border: 1px solid var(--down-border); }
.fp-ext-max { background: var(--up-soft); border: 1px solid var(--up-border); }
.fp-ext-tag { font-size: 11px; color: var(--text-soft); letter-spacing: 1px; }
.fp-ext-min .fp-ext-tag { color: var(--down); }
.fp-ext-max .fp-ext-tag { color: var(--up); }
.fp-ext b { font-size: 15px; }
.fp-ext-price { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fp-ext-price i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--text-soft); }
/* 全国排行：价格条 + 当前省高亮 */
.fp-bar-cell { position: relative; min-width: 120px; }
.fp-bar {
  display: inline-block; height: 16px; border-radius: 3px;
  background: var(--bar-grad);
  vertical-align: middle; margin-right: 8px;
}
.fp-bar-val { font-variant-numeric: tabular-nums; vertical-align: middle; }
.fp-cur-row td { background: var(--primary-soft); }
/* 响应式：手机 2 列价格卡，平板 3 列 */
@media (max-width: 480px) {
  .fp-price-grid { grid-template-columns: repeat(2, 1fr); }
  .fp-extremes { grid-template-columns: 1fr; }
  .fp-sb-prov { font-size: 15px; }
  .fp-pc-price { font-size: 20px; }
}
@media (min-width: 481px) and (max-width: 719px) {
  .fp-price-grid { grid-template-columns: repeat(3, 1fr); }
}
/* 阶段下拉选择器 */
#fpStageSelect { width: 100%; }

/* ---------------- 模态 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
  z-index: 150; padding: 16px;
}
.modal { background: var(--surface); border-radius: var(--radius); max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; padding: 18px; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-lg); }
.modal img { max-width: 100%; border-radius: var(--radius-sm); }
/* 小屏弹窗贴边铺满，避免内容被裁切 */
@media (max-width: 480px) {
  .modal-mask { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; padding: 16px 14px calc(14px + env(safe-area-inset-bottom)); }
}

/* ---------------- 登录页 ---------------- */
.auth-wrap { max-width: 380px; margin: 8vh auto 0; }
.auth-wrap .logo {
  text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 6px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
}
.auth-wrap .sub { text-align: center; color: var(--text-soft); margin-bottom: 18px; }

/* ---------------- 工具 ---------------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--text-soft); }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.right { text-align: right; }
.small { font-size: 13px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ---------------- 页脚版本信息 ---------------- */
.app-footer {
  max-width: 1080px;
  margin: 32px auto 0;
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.8;
}
.app-footer .ver, .ver { color: var(--primary); font-weight: 600; }

/* ============================================================
   移动端适配
   断点体系：
   ≤480px  小屏手机（竖屏 iPhone SE / 窄安卓）——单列布局
   481-719px 大屏手机 / 小平板竖屏——双列表格化简
   ≥720px  平板 / 桌面（原有样式，仅微调）
   ============================================================ */

/* ---------- 小屏手机（≤480px） ---------- */
@media (max-width: 480px) {
  html { font-size: 15px; }
  body { font-size: 14.5px; }

  /* 顶栏：品牌 + 图标一行，导航独立成第二行横滑，避免挤压换行 */
  .topbar-inner { flex-wrap: wrap; padding: 8px 12px; row-gap: 2px; }
  .brand { font-size: 16px; }
  .nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 13px; font-size: 14px; flex: none; } /* 横向可点目标 ≥ 36px */

  .container { padding: 12px 12px 40px; }
  .page-title { font-size: 19px; margin: 4px 0 12px; }
  .section-title { font-size: 15px; }

  /* 表单：多列布局全部改单列，杜绝小屏挤压 */
  .field-row, .field-row-3 { grid-template-columns: 1fr; gap: 10px; }
  .field-row .field { min-width: 0; }

  /* 统计卡两列排布；数字过大时自动缩小防溢出 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .v { font-size: 18px; word-break: break-all; }
  .stat-grid .stat:nth-child(n+5) { grid-column: span 2; } /* 第 5 张起占整行，避免孤卡 */

  /* 卡片与车卡间距收紧 */
  .grid-cards { grid-template-columns: 1fr; }
  .vcard .vstats { flex-wrap: wrap; gap: 10px; }
  .vcard .vactions .btn { flex: 1; } /* 详情/记一笔平铺整行，更好点 */

  /* 行内操作按钮组在窄屏下允许换行，不与文本重叠 */
  .row { row-gap: 8px; }
  .row .btn { flex: none; }

  /* 页面标题行（标题+返回按钮）不重叠 */
  .row.spread { gap: 8px; }
  .row.spread > .btn { flex: none; }

  /* 提醒条目允许换行 */
  .banner .reminder-item { flex-wrap: wrap; }

  /* 图片放大预览按钮可点区域 */
  .thumb { width: 44px; height: 44px; }
}

/* ---------- 横屏手机（高度不足时压缩垂直空间） ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar-inner { padding: 6px 14px; }
  .topbar { padding-top: env(safe-area-inset-top); }
  .nav a { padding: 6px 12px; }
  .container { padding: 10px 14px 32px; }
  .page-title { font-size: 18px; margin: 2px 0 10px; }
  .field { margin-bottom: 8px; }
  .stat { padding: 8px 10px; }
  .stat .v { font-size: 17px; }
  .modal { max-height: 94vh; }
}

/* ---------- 大屏微调 ---------- */
@media (min-width: 720px) {
  .container { padding: 22px 18px 60px; }
  .field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- 触屏设备：hover 悬停效果无意义，去掉位移动画防误触 ---------- */
@media (hover: none) {
  .vcard:hover, .kind-card:hover { transform: none; }
}

/* ---------- 尊重系统"减弱动态效果"设置（无障碍） ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 保险多保单区块 ---------- */
.ins-policies { display: flex; flex-direction: column; gap: 8px; }
.policy-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.policy-row input {
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.policy-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.policy-remove {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 14px; padding: 8px 12px; border-radius: var(--radius-sm);
  transition: background .15s;
}
.policy-remove:hover { background: rgba(231,76,60,.12); }
.policy-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface-2);
  margin: 2px 4px 2px 0;
}
.premium-sum {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- 管理员：油价一键批量获取 ---------- */
.fp-sync-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.fp-sync-actions [hidden] { display: none !important; }
.fp-sync-actions b { font-variant-numeric: tabular-nums; }
.fp-sync-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 12px; margin-bottom: 10px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
}
.fp-sync-summary b { font-variant-numeric: tabular-nums; color: var(--text); }
.sync-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.sync-badge-ok { color: var(--down); background: var(--down-soft); border: 1px solid var(--down-border); }
.sync-badge-partial { color: var(--warning); background: rgba(243, 156, 18, .12); border: 1px solid rgba(243, 156, 18, .35); }
.sync-badge-failed { color: var(--up); background: var(--up-soft); border: 1px solid var(--up-border); }
.fp-sync-alert {
  padding: 10px 12px; margin-bottom: 10px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6;
}
.fp-sync-alert-warn { background: rgba(243, 156, 18, .10); border: 1px solid rgba(243, 156, 18, .30); color: var(--text); }
.fp-sync-alert-err { background: var(--up-soft); border: 1px solid var(--up-border); color: var(--text); }
.fp-sync-loading { padding: 14px 12px; font-size: 13px; color: var(--text-soft); }
/* 结果表格列较多时允许横向滚动，不撑破卡片 */
#fpSyncResult .table-wrap { max-height: 340px; overflow: auto; }

/* ============================================================
   v1.9.0 备份 / 恢复 与 账号删除
   - 危险区（danger-zone）：注销账号 / 覆盖恢复
   - 备份预览（pv-*）：摘要网格 / 风险提示 / 结果报告
   ============================================================ */
.danger-zone { border-color: rgba(231, 76, 60, .38); box-shadow: 0 0 0 1px rgba(231, 76, 60, .06) inset; }
.danger-zone .section-title { color: var(--danger); }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-soft); margin-right: 14px; }
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.tabs-sm { margin-bottom: 10px; }
.tabs-sm button { font-size: 13px; padding: 8px 10px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mt-s { margin-top: 6px; }

.pv-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 12px; margin-top: 10px;
}
.pv-head { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.pv-grid { display: grid; gap: 6px; }
.pv-row {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border);
}
.pv-row:last-child { border-bottom: 0; }
.pv-k { min-width: 42px; color: var(--text-soft); }
.pv-add { color: var(--down); font-variant-numeric: tabular-nums; }
.pv-danger {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6;
  background: var(--up-soft); border: 1px solid var(--up-border); color: var(--text);
}
.pv-warn {
  margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6;
  background: rgba(243, 156, 18, .10); border: 1px solid rgba(243, 156, 18, .30);
}
.pv-list { margin: 6px 0 0; padding-left: 18px; }
.pv-list li { font-size: 12px; color: var(--text-soft); word-break: break-all; }
.pv-actions { margin-top: 12px; display: grid; gap: 8px; }
.pv-actions .field { margin-bottom: 0; }
.pv-ok { border-color: rgba(39, 174, 96, .45); background: rgba(39, 174, 96, .07); }
.pv-ok .pv-head { color: var(--success); }
.pv-error { border-color: var(--up-border); background: var(--up-soft); }
.pv-error .pv-head { color: var(--danger); }
