/* 车险拜访台账 · 移动端样式
   视觉语言对齐企业微信 H5 微应用：品牌蓝 + 白底卡片 + 浅灰分隔线，单色线性图标。 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --brand: #0082ef;
  --brand-2: #0068c9;
  --brand-soft: #e7f2fe;
  --bg: #f7f8fa;
  --card: #ffffff;
  --line: #ebedf0;
  --line-2: #f2f3f5;
  --text: #191919;
  --text-2: #4e5359;
  --muted: #8c939d;
  --muted-2: #a8afb8;
  --green: #07c160;
  --green-soft: #e8f8ee;
  --amber: #e58600;
  --amber-soft: #fff4e5;
  --red: #fa5151;
  --red-soft: #ffedec;
  --radius: 10px;
}

html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 11px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding-top: calc(10px + env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  flex: 0 0 32px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
}

.brand-title { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.25; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 1px; }

.topbar-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 视图 ---------------- */
.views { padding: 10px 12px 4px; }

.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.card-count { font-size: 13px; color: var(--muted-2); white-space: nowrap; }

/* ---------------- 统计条 ---------------- */
.stat-strip {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.stat { flex: 1 1 0; padding: 12px 8px; text-align: center; position: relative; }
.stat + .stat::before {
  content: "";
  position: absolute; left: 0; top: 18%; height: 64%;
  width: 1px; background: var(--line-2);
}
.stat b { display: block; font-size: 21px; line-height: 1.2; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.stat span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- 表单控件 ---------------- */
.input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  -webkit-appearance: none;
}
.input:focus { border-color: var(--brand); }
.input::placeholder { color: var(--muted-2); }

textarea.input {
  height: auto;
  min-height: 78px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

select.input { padding-right: 8px; }

.form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.field-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.field-label { font-size: 13px; color: var(--muted); }

.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: #fff; color: var(--brand); border-color: #cfe4fb; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 7px; }

/* ---------------- 分段 / 纸片 ---------------- */
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg-item {
  height: 32px; padding: 0 12px; border: 0; border-radius: 6px;
  background: transparent; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.seg-item.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 8px; }
.chip {
  flex: 0 0 auto;
  height: 32px; padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px; color: var(--text-2);
  cursor: pointer;
}
.chip.active { background: var(--brand-soft); border-color: #b9dcfa; color: var(--brand); font-weight: 600; }

.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input { flex: 1 1 auto; }

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; }

.empty {
  padding: 26px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted-2);
  line-height: 1.7;
}

.poi {
  display: flex;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.poi:last-child { border-bottom: 0; }

.poi-main { flex: 1 1 auto; min-width: 0; }
.poi-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.4;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.poi-meta { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 2px; word-break: break-all; }
.poi-side {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  min-width: 72px;
}
.poi-dist { font-size: 13px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.st-0 { background: #f2f3f5; color: #7a8089; }
.st-1 { background: var(--brand-soft); color: var(--brand); }
.st-2 { background: var(--amber-soft); color: var(--amber); }
.st-3 { background: var(--green-soft); color: var(--green); }
.st-4 { background: var(--red-soft); color: var(--red); }

.more-wrap { padding: 4px 0 12px; }

.notice {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #9a5c00;
  font-size: 13px;
  line-height: 1.6;
}

.demo-strip {
  margin: 10px 12px 0;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------------- 我的 ---------------- */
.me-row { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.me-info { min-width: 0; }
.me-name { font-size: 16px; font-weight: 600; color: var(--text); }
.me-sub { font-size: 12px; color: var(--muted); word-break: break-all; }

.tips { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.85; }

/* ---------------- 底栏 ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1 1 0;
  height: 54px;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.tab svg {
  width: 21px; height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.active { color: var(--brand); }
.tab.active svg { stroke-width: 1.9; }

/* ---------------- 弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, .45);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 640px; margin: 0 auto;
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: 14px 14px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-bar {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--line-2);
}
.sheet-grab {
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 2px; background: #dcdfe3;
}
.sheet-close {
  height: 32px; padding: 0 10px;
  border: 0; background: transparent;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.sheet-body { padding: 14px 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.detail-head { margin-bottom: 12px; }
.detail-name { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.4; }
.detail-sub { font-size: 13px; color: var(--muted); margin-top: 3px; word-break: break-all; }

.kv { display: grid; grid-template-columns: 66px 1fr; gap: 6px 10px; font-size: 14px; margin: 12px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-all; }

.section-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 16px 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--brand);
  line-height: 1.4;
}

.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.tl-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.tl-top b { color: var(--brand-2); font-weight: 600; }
.tl-body { font-size: 14px; color: var(--text-2); margin-top: 4px; line-height: 1.6; word-break: break-all; }
.tl-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tl-photos img { width: 82px; height: 82px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn { flex: 1 1 0; }

.dist-tip { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.dist-ok { color: var(--green); }
.dist-far { color: var(--amber); }

.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---------------- 轻提示 ---------------- */
.toast {
  position: fixed;
  left: 50%; bottom: 108px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 78%;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(17, 17, 17, .86);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

[hidden] { display: none !important; }
