/* 客户查询端（只读）—— 移动端优先 */
:root {
  --brand: #1668dc;
  --brand-deep: #0e4fa8;
  --brand-soft: #eaf2ff;
  --ok: #12a86a;
  --warn: #f59e0b;
  --text: #16202e;
  --text-2: #5a6b81;
  --text-3: #94a2b5;
  --line: #e6ecf5;
  --bg: #f2f5fa;
  --danger: #e5484d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(22, 104, 220, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ---------- 头部 ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  padding: calc(22px + env(safe-area-inset-top)) 20px 40px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -50px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.hero .org { margin: 0 0 12px; font-size: 12.5px; opacity: 0.85; letter-spacing: 0.3px; }
.hero h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.hero p { margin: 0; font-size: 13px; opacity: 0.88; }
.hero .logout {
  position: absolute;
  right: 18px;
  top: calc(20px + env(safe-area-inset-top));
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12.5px;
}
.hero .logout:active { background: rgba(255, 255, 255, 0.25); }

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin: 0 16px;
  box-shadow: var(--shadow);
}
.card-lift { margin-top: -26px; position: relative; }
.card-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.label .req { color: var(--danger); margin-left: 3px; }
.field input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  font-size: 15px;
  color: var(--text);
  background: #fbfcfe;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus { border-color: var(--brand); background: #fff; }
.field input.err { border-color: var(--danger); background: #fff7f7; }

.err-msg {
  display: none;
  color: var(--danger);
  font-size: 13px;
  background: #fff1f1;
  border-radius: 9px;
  padding: 8px 11px;
  margin-bottom: 12px;
}
.err-msg.show { display: block; }

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 6px 18px rgba(22, 104, 220, 0.28);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; }

.tip { font-size: 12px; color: var(--text-3); margin: 12px 0 0; line-height: 1.6; }

/* ---------- 统计 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: -22px 16px 0;
  position: relative;
  z-index: 1;
}
.stat {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 8px;
  text-align: center;
}
.stat .n { font-size: 21px; font-weight: 700; line-height: 1.2; }
.stat .t { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat .n.pending { color: var(--warn); }
.stat .n.done { color: var(--ok); }

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 22px 20px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.section-title .hint { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: auto; }

/* ---------- 记录卡片 ---------- */
.rec {
  background: #fff;
  border-radius: var(--radius);
  margin: 0 16px 12px;
  padding: 15px 16px;
  box-shadow: 0 2px 10px rgba(22, 32, 46, 0.05);
}
.rec-hd { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.rec-title { font-size: 15px; font-weight: 600; flex: 1; line-height: 1.45; }
.rec-cat {
  display: inline-block;
  font-size: 11px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
  vertical-align: middle;
  font-weight: 400;
}
.rec-meta { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.badge {
  flex: none;
  font-size: 11.5px;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.pending { color: #b45309; background: #fef3c7; }
.badge.contacted { color: #1d4ed8; background: #dbeafe; }
.badge.appointed { color: #5b21b6; background: #ede9fe; }
.badge.done { color: #0f7a4f; background: #d1fae5; }
.badge.invalid { color: #64748b; background: #f1f5f9; }

.rec-answers {
  background: #f8fafc;
  border-radius: 10px;
  padding: 9px 12px;
}
.rec-answers .row {
  display: flex;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}
.rec-answers .row > span:first-child { color: var(--text-3); flex: none; min-width: 76px; }
.rec-answers .row > span:last-child { color: var(--text); flex: 1; word-break: break-word; }

/* 状态时间线 */
.timeline { margin-top: 10px; padding-left: 4px; }
.timeline .tl-item { display: flex; gap: 8px; font-size: 12px; color: var(--text-3); padding: 2px 0; }
.timeline .tl-item .dot {
  display: block;
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
  margin-top: 7px; flex: none;
}
.timeline .tl-item:first-child .dot { background: var(--ok); }

/* ---------- 任务筛选标签 ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  margin-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  line-height: 1.2;
}
.chip b { font-weight: 600; color: var(--brand); margin-left: 2px; }
.chip em { font-style: normal; font-size: 11px; color: var(--text-3); }
.chip.on {
  color: var(--brand-deep);
  border-color: #bcd6fb;
  background: var(--brand-soft);
  font-weight: 600;
}
.chip.on b { color: var(--brand-deep); }
.chip-empty {
  margin: 0 16px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-3);
  background: #fff;
  border-radius: var(--radius);
}

.foot-note {
  margin: 22px 20px 0;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}

.empty {
  margin: 0 16px;
  padding: 34px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  background: #fff;
  border-radius: var(--radius);
}

/* ---------- 加载 / 错误 ---------- */
.state {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px;
  text-align: center;
  color: var(--text-2);
}
.state .ico { font-size: 34px; }
.state h3 { margin: 6px 0 0; font-size: 17px; color: var(--text); }
.state p { margin: 0; font-size: 13.5px; color: var(--text-3); max-width: 300px; }
