/* ==========================================================================
   style.css —— 客户 LIFF 前端全局样式（T4.3）
   现代商务 · 玻璃拟态 · 蓝色主色（用户指定 rgb 98,172,225 / 182,221,246）· 引导式
   与商户端同一视觉体系，面向手机 LIFF 单列全宽布局。
   ⚠️ 手写 CSS（不引 Tailwind CDN）：第三方 CDN 是供应链风险（生产待办清单工程化项）。
   ========================================================================== */

:root {
  --primary: #62ace1;          /* rgb(98,172,225) 主色 */
  --primary-light: #7fb9e7;
  --primary-dark: #4a96cf;
  --primary-pale: #b6ddf6;     /* rgb(182,221,246) 浅色 */
  --bg: #f4f9fd;
  --bg-accent: #e6f3fb;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --text-invert: #ffffff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(98, 172, 225, 0.12);
  --shadow-lg: 0 24px 60px rgba(98, 172, 225, 0.2);
  --font: "PingFang SC", "Noto Sans Thai", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(98, 172, 225, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(182, 221, 246, 0.35), transparent 55%),
    linear-gradient(160deg, #e6f3fb 0%, #f4f9fd 45%, #ffffff 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 布局容器 */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 品牌区 */
.brand {
  text-align: center;
}

.brand-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-invert);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  box-shadow: 0 8px 20px rgba(98, 172, 225, 0.35);
}

.brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* 玻璃拟态卡片 */
.card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-title {
  font-size: 22px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 4px 0 20px;
}

/* 按钮 */
.btn {
  min-height: 46px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  width: 100%;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  color: var(--text-invert);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  box-shadow: 0 8px 20px rgba(98, 172, 225, 0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 26px rgba(98, 172, 225, 0.4);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

/* 提示 / 错误 */
.hint {
  font-size: 13px;
  color: var(--text-muted);
}

.error {
  min-height: 20px;
  font-size: 13px;
  color: var(--danger);
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

/* 页头（向导） */
.wizard-header .brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.wizard-header .brand-logo {
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 22px;
  border-radius: 14px;
}

.wizard-header .brand-name {
  font-size: 18px;
}

.wizard-header .brand-sub {
  font-size: 12px;
}

.wizard-title {
  font-size: 24px;
  font-weight: 700;
}

.wizard-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 版本徽标 */
.version-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  background: rgba(182, 221, 246, 0.5);
  border-radius: 999px;
}

.version-badge:empty {
  display: none;
}

/* ⚠️ [hidden] 兜底：HTML hidden 属性的默认 display:none 会被 .panel/.section 等
   display:flex 类规则覆盖。这里用 !important 强制：凡带 hidden 属性的元素一律不显示。 */
[hidden] {
  display: none !important;
}

/* 同意书 iframe */
.agreement-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.agreement-frame {
  width: 100%;
  height: 420px;
  border: none;
  display: block;
}

/* 分项勾选 */
.consent-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.consent-title {
  font-size: 16px;
  font-weight: 700;
}

.consent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.consent-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  transition: border-color 0.2s, background 0.2s;
}

.consent-item:has(.consent-check:checked) {
  border-color: var(--primary);
  background: rgba(182, 221, 246, 0.22);
}

.consent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.consent-check {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.consent-text {
  font-size: 14px;
}

/* 必需项徽标：靠右，蓝色系小标签 */
.consent-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: rgba(182, 221, 246, 0.5);
  white-space: nowrap;
}

/* 占位页 */
.placeholder {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   初审材料提交页（T4.4）
   ========================================================================== */

/* 上传区 */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-title {
  font-size: 16px;
  font-weight: 700;
}

/* 上传卡片 */
.upload-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.upload-card:has(.upload-status-done) {
  border-color: var(--success);
}

/* 预览区：虚线空态 / 缩略图。本身就是上传入口（点击触发选图）。 */
.upload-preview {
  position: relative;
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(182, 221, 246, 0.25), transparent 70%),
    rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s;
}

.upload-preview:hover {
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(182, 221, 246, 0.4), transparent 70%),
    rgba(255, 255, 255, 0.55);
}

.upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--text-muted);
}

/* 虚线框占位图标（纯 CSS：圆角虚线框 + 中心加号） */
.upload-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border: 2px dashed var(--primary);
  border-radius: 14px;
  opacity: 0.75;
}

.upload-icon::before,
.upload-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--primary);
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

.upload-icon::before {
  width: 22px;
  height: 2.5px;
}

.upload-icon::after {
  width: 2.5px;
  height: 22px;
}

.upload-label {
  font-size: 14px;
  font-weight: 600;
}

.upload-thumb {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

/* 上传按钮行 */
.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.btn-upload {
  flex: 1;
  min-height: 40px;
  font-size: 14px;
  color: var(--primary-dark);
  background: rgba(182, 221, 246, 0.4);
  border: 1px solid var(--primary-pale);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-upload:hover:not(:disabled) {
  background: rgba(182, 221, 246, 0.65);
}

.btn-upload:active {
  transform: translateY(1px);
}

.btn-upload:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 上传状态徽标 */
.upload-status {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
}

.upload-status:empty {
  display: none;
}

.upload-status-done {
  color: var(--success);
  font-weight: 600;
}

/* 成功终态 */
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 16px 0;
}

.done-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-invert);
  background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.35);
  animation: done-pop 0.4s ease;
}

.done-title {
  font-size: 22px;
  font-weight: 700;
}

.done-desc {
  font-size: 14px;
  color: var(--text-muted);
}

/* 老客户提示（重复提交时的温馨提醒） */
.done-notice {
  font-size: 13px;
  color: var(--warning-text, #b45309);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 4px;
}

@keyframes done-pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ==========================================================================
   完整信息补填页（T4.5）
   ========================================================================== */

/* 表单分区 */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 8px;
}

.form-section + .form-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.form-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.form-section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -8px;
}

/* 表单字段 */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; /* grid 子项防溢出 */
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* 必填字段 label 的红色星号（T4.5 全部可编辑字段必填） */
.form-label.required::after {
  content: " *";
  color: #ef4444;
}

.form-input {
  width: 100%;
  min-width: 0; /* 防双列布局下溢出卡片（T4.5 踩坑） */
  min-height: 46px;
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(98, 172, 225, 0.18);
  background: #fff;
}

.form-input::placeholder {
  color: #94a3b8;
}

/* 下拉选单：去掉原生箭头，用 CSS 画一个，视觉与 input 一致 */
select.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2347598a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* 只读字段：置灰、不可编辑（身份字段 disabled + 邮编 readonly） */
.form-input:disabled,
.form-input[readonly] {
  color: var(--text-muted);
  background: rgba(226, 232, 240, 0.55);
  border-color: transparent;
  -webkit-text-fill-color: var(--text-muted);
  opacity: 1;
  cursor: not-allowed;
}

/* 双列字段行（名/姓、府/县、分区/邮编 等） */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ==========================================================================
   合同签署页（T4.6）
   ========================================================================== */

/* 订单说明卡 */
.sign-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(182, 221, 246, 0.18);
}

.sign-info-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.sign-info-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  word-break: break-all;
}

.sign-info-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* 功能分区 */
.sign-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sign-section + .sign-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.sign-section-title {
  font-size: 16px;
  font-weight: 700;
}

.sign-section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -4px;
}

/* 自拍舞台：圆形取景框 */
.selfie-stage,
.retry-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(182, 221, 246, 0.22), transparent 70%),
    rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

#selfie-video,
#retry-video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

.selfie-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-muted);
  /* 现在它是 <button>：重置默认样式，整块可点击，做成「占位即按钮」。 */
  width: 100%;
  align-self: stretch;
  min-height: 240px;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.selfie-placeholder:active {
  transform: scale(0.98);
}

.selfie-placeholder:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.selfie-placeholder-text {
  font-size: 13px;
  font-weight: 600;
}

/* 自拍占位图标：圆形虚线 + 中心人形 */
.selfie-icon {
  position: relative;
  width: 72px;
  height: 72px;
  border: 2px dashed var(--primary);
  border-radius: 50%;
  opacity: 0.75;
}

.selfie-icon::before {
  content: "";
  position: absolute;
  top: 16px;
  left: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateX(-50%);
}

.selfie-icon::after {
  content: "";
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 34px;
  height: 20px;
  border-radius: 50% 50% 8px 8px;
  background: var(--primary);
  transform: translateX(-50%);
}

.selfie-thumb {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

/* 操作按钮行 */
.sign-actions {
  display: flex;
  gap: 10px;
}

.sign-actions .btn {
  flex: 1;
}

.btn-outline {
  min-height: 42px;
  font-size: 14px;
  color: var(--primary-dark);
  background: rgba(182, 221, 246, 0.35);
  border: 1px solid var(--primary-pale);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-outline:hover:not(:disabled) {
  background: rgba(182, 221, 246, 0.6);
}

.btn-outline:active {
  transform: translateY(1px);
}

/* 签名画板 */
.signature-pad-wrap {
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.signature-pad {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* 重传证件自救区（仅 E421 出现） */
.sign-retry {
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.06);
  padding: 16px;
}

.retry-notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.retry-title {
  font-size: 14px;
  font-weight: 700;
  color: #b45309;
}

.retry-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 终态合同编号 */
.sign-contract-no {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  background: rgba(182, 221, 246, 0.35);
  border-radius: 999px;
  padding: 6px 16px;
  word-break: break-all;
}

/* 响应式 */
@media (max-width: 480px) {
  .page {
    padding: 24px 14px 48px;
  }

  .card {
    padding: 24px 18px;
  }

  .agreement-frame {
    height: 360px;
  }

  /* 窄屏双列改单列，防输入框挤压溢出（T4.5 踩坑） */
  .form-row {
    grid-template-columns: 1fr;
  }
}
