/* 现场调查备忘系统 · 移动端样式 */
:root {
  --primary: #2f6bff;
  --primary-dark: #1e54e0;
  --primary-light: #e8efff;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #66707d;
  --text-3: #9aa4b0;
  --line: #e6eaf0;
  --danger: #e5484d;
  --ok: #2fb36b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 32, 60, 0.06), 0 4px 14px rgba(20, 32, 60, 0.05);
  --topbar-h: 50px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
}
button { font-family: inherit; }
img { display: block; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center;
  height: var(--topbar-h);
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 84, 224, 0.25);
}
.topbar h1 {
  flex: 1; margin: 0; font-size: 17px; font-weight: 600;
  padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.topbar .sub { font-size: 12px; opacity: 0.85; font-weight: 400; margin-left: 6px; }
.icon-btn {
  min-width: 44px; height: 40px; border: 0; background: transparent; color: #fff;
  font-size: 16px; border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,0.18); }
.back-btn { font-size: 20px; line-height: 1; padding: 0 10px; }

/* ---------- 首页大类 ---------- */
.home { padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 14px; cursor: pointer; border: 1px solid transparent;
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.cat-card:active { border-color: var(--primary); background: var(--primary-light); }
.cat-card .ico { font-size: 32px; line-height: 1; }
.cat-card .nm { font-size: 16px; font-weight: 600; }
.cat-card .ct { font-size: 12px; color: var(--text-3); }
.cat-card .add {
  position: absolute; right: 10px; bottom: 10px;
  background: var(--primary); color: #fff; font-size: 12px;
  padding: 4px 10px; border-radius: 999px; font-weight: 500;
}
.home-tip { color: var(--text-3); font-size: 12px; text-align: center; margin-top: 14px; }

/* ---------- 通用卡片/列表 ---------- */
.page { padding: 12px 14px calc(80px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.search-box {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.search-box .inp { flex: 1; }
.rec-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; margin-bottom: 10px; display: flex; gap: 12px; cursor: pointer;
  border: 1px solid transparent;
}
.rec-card:active { border-color: var(--primary); }
.rec-thumb {
  width: 68px; height: 68px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  background: #eef1f6 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23b6bec9" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>') center/28px no-repeat;
}
.rec-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-title { font-weight: 600; font-size: 15px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rec-addr {
  color: var(--text-2); font-size: 12px; margin-top: 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.rec-meta { margin-top: auto; display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; }
.load-more {
  width: 100%; border: 0; background: var(--card); color: var(--primary);
  padding: 12px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); cursor: pointer;
}
.load-more:active { background: var(--primary-light); }
.load-more:disabled { color: var(--text-3); }

.empty {
  text-align: center; color: var(--text-3); padding: 60px 20px; font-size: 14px;
}
.empty .big { font-size: 44px; display: block; margin-bottom: 10px; }

/* ---------- 表单 ---------- */
.form-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.form-cat { display: flex; align-items: center; gap: 10px; }
.form-cat .ico { font-size: 26px; }
.form-cat .nm { font-weight: 600; font-size: 16px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; display: block; }
.field-label .req { color: var(--danger); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.inp, .txta, select.inp {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; color: var(--text); background: #fff;
  outline: none; -webkit-appearance: none; appearance: none; font-family: inherit;
}
.inp:focus, .txta:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,0.12); }
.txta { resize: vertical; min-height: 84px; }
select.inp {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%239aa4b0" stroke-width="2.4"><path d="M6 9l6 6 6-6"/></svg>');
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}

/* 位置块 */
.loc-card { border: 1px dashed #c8d4ea; border-radius: 10px; padding: 12px; background: #f8faff; }
.loc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.loc-status { font-size: 13px; color: var(--text-2); font-weight: 500; }
.loc-status.ok { color: var(--ok); }
.loc-status.err { color: var(--danger); }
.loc-status.ing { color: var(--primary); }
.btn-loc {
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
.btn-loc:active { background: var(--primary-light); }
.btn-loc:disabled { opacity: 0.6; }
.loc-coords { font-size: 12px; color: var(--text-3); margin-bottom: 8px; word-break: break-all; }
.loc-card .inp { margin-top: 0; }

/* 图片块 */
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.img-tile {
  aspect-ratio: 1; border-radius: 10px; overflow: hidden; position: relative;
  background: #eef1f6; border: 1px solid var(--line);
}
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-tile .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer;
}
.img-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-2); font-size: 13px; cursor: pointer; border-style: dashed;
}
.img-add .plus { font-size: 24px; color: var(--primary); }
.img-add:active { background: var(--primary-light); }

/* 提交栏 */
.submit-bar {
  position: sticky; bottom: 0; z-index: 15;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  max-width: 640px; margin: 0 auto; margin-top: 4px;
}
.btn-main {
  width: 100%; height: 48px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 12px rgba(47,107,255,0.3);
}
.btn-main:active { transform: scale(0.99); }
.btn-main:disabled { opacity: 0.6; }

/* ---------- 详情 ---------- */
.detail-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.detail-gallery .img-tile { cursor: pointer; }
.detail-field {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 10px;
}
.detail-field .lbl { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.detail-field .val { font-size: 15px; word-break: break-word; white-space: pre-wrap; }
.loc-val { display: flex; flex-direction: column; gap: 8px; }
.map-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  width: fit-content;
}
.meta-foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 8px 0 16px; }

/* ---------- 全屏图片 ---------- */
.gallery {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.94);
  display: flex; flex-direction: column;
}
.gallery.hidden { display: none; }
.gal-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 16px; cursor: pointer;
}
.gal-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gal-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.gal-bar {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom));
}
.gal-btn {
  width: 46px; height: 40px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 22px; cursor: pointer;
}
.gal-idx { color: #fff; font-size: 13px; min-width: 44px; text-align: center; }

/* ---------- 提示/加载 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: rgba(24,30,42,0.92); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; z-index: 200; max-width: 86vw;
  opacity: 0; pointer-events: none; transition: all 0.25s; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.splash { text-align: center; padding-top: 35vh; color: var(--text-3); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto 10px;
  border: 3px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-view { text-align: center; color: var(--text-2); padding: 60px 20px; }
.error-view .retry {
  margin-top: 14px; border: 1px solid var(--primary); background: #fff; color: var(--primary);
  padding: 8px 22px; border-radius: 999px; font-size: 14px; cursor: pointer;
}
.sk-card { background: #e9edf3; border-radius: var(--radius); height: 96px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

@media (min-width: 480px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .img-grid, .detail-gallery { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- v2 新增 ---------- */
/* 草稿横幅 */
.draft-banner {
  background: #fff8e6; border: 1px solid #f2dc9b; border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.db-text { font-size: 13px; color: #8a6d1a; }
.db-note { color: #b8a05c; font-size: 12px; }
.db-btns { display: flex; gap: 6px; flex-shrink: 0; }
.db-btns button {
  border: 1px solid #e3c86f; background: #fff; color: #8a6d1a;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.db-btns button:active { background: #f7edcd; }
.db-btns .db-del { border-color: #e8b9a5; color: #b3563a; }

/* 校验高亮 */
.invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.14) !important;
}
.loc-card.invalid { border-color: var(--danger) !important; background: #fff7f7; }
.img-grid.invalid { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 10px; }

/* 定位按钮组 */
.loc-btns { display: flex; gap: 6px; align-items: center; }
.btn-loc.ghost { border-color: #c8d4ea; color: var(--text-2); }

/* 提交成功页 */
.success-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 34px 22px; text-align: center;
}
.sc-ico { font-size: 52px; line-height: 1; margin-bottom: 12px; }
.sc-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.sc-sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.sc-btns { display: flex; flex-direction: column; gap: 10px; }
.btn-ghost2 {
  width: 100%; height: 48px; border: 1px solid var(--primary); background: #fff;
  color: var(--primary); border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-ghost2:active { background: var(--primary-light); }

/* ---------- v3 新增 ---------- */
/* 多选 */
.ms-group { display: flex; flex-direction: column; gap: 8px; }
.ms-opt {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; cursor: pointer; background: #fff;
}
.ms-opt:active { background: var(--primary-light); }
.ms-opt input { width: 18px; height: 18px; flex-shrink: 0; }
.ms-opt.has { border-color: var(--primary); background: var(--primary-light); }
.ms-group.invalid { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 10px; }

/* 关注标记 */
.rec-flag {
  display: inline-block; margin-left: 6px; font-size: 13px;
  opacity: 0.25; cursor: pointer; vertical-align: middle;
}
.rec-flag.on { opacity: 1; }

/* 详情操作按钮组 */
.detail-ops { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.detail-ops .btn-ghost2 { height: 44px; font-size: 14px; }

/* 前台管理 */
.manage-user { color: var(--text-2); font-size: 13px; margin-bottom: 10px; }
.manage-login-head { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.manage-login-sub { color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
.manage-login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 6px; }
.mcat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; margin-bottom: 10px;
}
.mcat-head { display: flex; align-items: center; gap: 10px; }
.mcat-ico { font-size: 26px; }
.mcat-info { flex: 1; min-width: 0; }
.mcat-name { font-weight: 600; font-size: 15px; }
.mcat-badge {
  display: inline-block; margin-left: 6px; font-size: 11px;
  background: #f0f1f4; color: var(--text-3); border-radius: 999px; padding: 1px 8px; vertical-align: middle;
}
.mcat-meta { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.mcat-ops { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.mcat-ops button {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.mcat-ops button:active { background: var(--primary-light); color: var(--primary); }
.mcat-ops button.danger { border-color: #f3c1c3; color: var(--danger); }
.manage-icon-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 130px; overflow-y: auto; }
.manage-icon-grid button {
  width: 40px; height: 40px; font-size: 20px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; cursor: pointer;
}
.manage-icon-grid button.sel { border-color: var(--primary); background: var(--primary-light); }
.mfield-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fafbfd;
  display: flex; flex-direction: column; gap: 8px;
}
.mfield-top { display: flex; align-items: center; gap: 8px; }
.mfield-idx {
  width: 22px; height: 22px; border-radius: 50%; background: #eef1f6; color: var(--text-2);
  font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mfield-row { display: flex; align-items: center; gap: 8px; }
.mfield-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.mfield-opt-lbl { font-size: 12px; color: var(--text-3); }
.mfield-opt { margin-top: 2px; }
.mfield-opt textarea { min-height: 64px; }
.mreq { border: 0; padding: 0; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.mreq input { width: 16px; height: 16px; }

/* ---------- v4 新增 ---------- */
/* 公告条 */
.notice-bar {
  display: flex; align-items: center; gap: 8px;
  background: #fff8e6; border: 1px solid #f2dc9b; border-radius: var(--radius);
  padding: 9px 12px; margin-bottom: 12px;
}
.nb-ico { flex-shrink: 0; }
.nb-text { flex: 1; font-size: 13px; color: #8a6d1a; line-height: 1.45; }
.nb-close {
  border: 0; background: transparent; color: #b8a05c;
  font-size: 14px; cursor: pointer; padding: 4px 6px; flex-shrink: 0;
}

/* 下拉刷新提示 */
.pull-hint {
  height: 0; overflow: hidden; text-align: center; color: var(--text-3);
  font-size: 12px; transition: height .1s; line-height: 34px;
}
.pull-hint.show { color: var(--primary); }

/* 表单必填进度 */
.form-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fp-bar { flex: 1; background: #eef1f6; border-radius: 999px; height: 8px; overflow: hidden; }
.fp-fill {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #7fa4ff);
  border-radius: 999px; transition: width .3s;
}
.fp-text { font-size: 12px; color: var(--text-2); flex-shrink: 0; }

/* 危险按钮 */
.btn-ghost2.danger { border-color: #f3c1c3; color: var(--danger); }
.btn-ghost2.danger:active { background: #fdeeee; }

/* ---------- v5 新增 ---------- */
/* 跟进时间线 */
.fup-timeline { display: flex; flex-direction: column; gap: 8px; }
.fup-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: #fafbfd; border-left: 3px solid var(--primary);
}
.fup-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.fup-user { font-size: 12px; color: var(--text-2); font-weight: 600; }
.fup-time { font-size: 11px; color: var(--text-3); }
.fup-body { font-size: 14px; word-break: break-word; white-space: pre-wrap; }
.fup-add { display: flex; gap: 8px; margin-top: 10px; }
.fup-btn {
  border: 0; background: var(--primary); color: #fff; border-radius: 10px;
  padding: 0 16px; font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.fup-btn:active { background: var(--primary-dark); }

/* ---------- v6 新增 ---------- */
/* 悬浮新增按钮 */
.fab {
  position: fixed; right: 18px; bottom: calc(26px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 20px rgba(47, 107, 255, 0.45); z-index: 30;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.93); }

/* 首页按钮 */
.home-btn { font-size: 15px; font-weight: 700; padding: 0 8px; }

/* 附近入口卡片 */
.nearby-entry {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #e8efff, #dbe7ff);
  border: 1px solid #c8d8ff; border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 12px; cursor: pointer;
}
.nearby-entry:active { background: var(--primary-light); }
.ne-ico { font-size: 26px; }
.ne-info { flex: 1; }
.ne-t { font-weight: 700; font-size: 15px; color: var(--primary-dark); }
.ne-s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.ne-arrow { color: var(--primary); font-size: 20px; }

/* 附近面板 */
.nearby-panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.nearby-status { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.nearby-radii { display: flex; gap: 8px; margin-bottom: 10px; }
.nr-chip {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.nr-chip.on { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nearby-count { color: var(--text-2); font-size: 13px; margin-bottom: 8px; }
.dist-badge {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600;
  background: var(--primary-light); color: var(--primary);
  border-radius: 999px; padding: 1px 8px; vertical-align: middle;
}
.nearby-link {
  display: block; font-size: 12px; color: var(--primary); margin-bottom: 8px;
  background: var(--primary-light); border-radius: 8px; padding: 6px 10px;
}





