/* ===========================================================
   客户意向登记表 — 移动端 H5 样式
   基准 375px，适配至 430px；仅使用微信 WebView（X5 / WKWebView）
   普遍支持的特性：不使用 :has() / aspect-ratio / flex gap / dvh
   =========================================================== */

:root {
  --brand:        #1a5fd0;
  --brand-dark:   #134aa6;
  --brand-soft:   #e9f0fd;
  --brand-border: #b9d0f6;
  --ink:          #1c2430;
  --ink-sub:      #5c6676;
  --ink-mute:     #93a0b0;
  --line:         #e3e8ef;
  --bg:           #f3f5f9;
  --card:         #ffffff;
  --danger:       #d93434;
  --danger-soft:  #fdecec;
}

* { box-sizing: border-box; }

/* hidden 属性优先于任何 display 声明（否则 #csvOut 的 display:block 会把它顶出来） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100%;
  padding: 0 16px 28px;
  padding-bottom: calc(28px + constant(safe-area-inset-bottom));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* ---------- 顶部 ---------- */

.hero {
  padding: 26px 4px 20px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--ink);
  /* 连点 5 次打开工作人员入口，避免观众误触 */
  -webkit-user-select: none;
  user-select: none;
}

.hero h1::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--brand);
}

.hero p {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-sub);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px 6px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.card-hint {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 400;
  vertical-align: 2px;
}

.req {
  color: var(--danger);
  font-style: normal;
  font-weight: 700;
}

/* ---------- 文本输入 ---------- */

.field { margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-sub);
}

.text-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  color: var(--ink);
  font-size: 16px; /* 低于 16px 时 iOS 聚焦会自动放大页面 */
  font-family: inherit;
  line-height: 46px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, background-color .15s;
}

.text-input::-webkit-input-placeholder { color: var(--ink-mute); }
.text-input::placeholder { color: var(--ink-mute); }

.text-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26, 95, 208, .10);
}

/* ---------- 选项块 ---------- */

.chips {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin: 0 -5px 4px;
}

.chip {
  display: block;
  margin: 0 5px 10px;
  position: relative;
  cursor: pointer;
}

.chips-grid .chip { width: calc(50% - 10px); }
.chips-stack .chip { width: calc(100% - 10px); }

/* 原生控件隐藏但保留可聚焦与表单语义 */
.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.chip-body {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color .12s, background-color .12s, color .12s;
}

.chip-body .mark {
  -webkit-flex: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border: 1.5px solid #c3ccd8;
  background: #fff;
  position: relative;
  transition: border-color .12s, background-color .12s;
}

.mark-radio { border-radius: 50%; }
.mark-check { border-radius: 5px; }

.chip input:checked + .chip-body {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.chip input:checked + .chip-body .mark {
  border-color: var(--brand);
  background: var(--brand);
}

.chip input:checked + .chip-body .mark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}

.chip input:focus + .chip-body {
  box-shadow: 0 0 0 3px rgba(26, 95, 208, .14);
}

.chip:active .chip-body { background: #eef2f8; }

/* ---------- 错误态 ---------- */

.err {
  display: none;
  margin: 7px 0 2px;
  padding-left: 2px;
  font-size: 13px;
  color: var(--danger);
}

.has-err .err,
.err.show { display: block; }

.has-err .text-input {
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* 卡片级 / 表单级的整条错误提示 */
.err-block {
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid #f3c9c9;
  border-radius: 10px;
  background: var(--danger-soft);
  font-size: 14px;
  line-height: 1.6;
}

.has-err .text-input:focus {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 3px rgba(217, 52, 52, .12);
}

.has-err .chip-body { border-color: #f0c0c0; }

/* ---------- 按钮 ---------- */

.submit-btn {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 4px 14px rgba(26, 95, 208, .26);
  transition: background-color .15s, box-shadow .15s;
}

.submit-btn:active { background: var(--brand-dark); }

.submit-btn[disabled] {
  background: #9db6dd;
  box-shadow: none;
  cursor: default;
}

.ghost-btn {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 20px;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  background: #fff;
  color: var(--brand);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ghost-btn:active { background: var(--brand-soft); }

.foot-note {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-mute);
}

/* ---------- 成功态 ---------- */

.success {
  padding: 60px 4px 20px;
  text-align: center;
}

.success-icon { margin-bottom: 18px; }

.success h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.success-sub {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--ink-sub);
}

.success-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 16px;
  text-align: left;
}

.sum-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.sum-row:last-child { border-bottom: 0; }

.sum-key {
  -webkit-flex: none;
  flex: none;
  width: 84px;
  color: var(--ink-mute);
}

.sum-val {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  color: var(--ink);
  word-break: break-all;
}

.success-tip {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
}


/* ---------- 弹窗提示 ---------- */

.modal {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 100;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 24px;
}

.modal-mask {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(20, 28, 40, .5);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 26px 22px 22px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .22);
  -webkit-animation: modal-in .18s ease-out;
  animation: modal-in .18s ease-out;
}

@-webkit-keyframes modal-in {
  from { opacity: 0; -webkit-transform: scale(.94); }
  to   { opacity: 1; -webkit-transform: scale(1); }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-icon { margin-bottom: 12px; }

.modal-box h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.modal-box p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-sub);
}

.modal-box .submit-btn {
  height: 46px;
  margin-top: 0;
  font-size: 16px;
  letter-spacing: 1px;
}
