* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f3f5f9;
  color: #1f2733;
  line-height: 1.6;
  padding: 24px 16px 48px;
}

.app { max-width: 720px; margin: 0 auto; }

.hd { text-align: center; margin-bottom: 24px; }
.hd h1 { font-size: 26px; font-weight: 700; color: #1a2b4a; letter-spacing: 1px; }
.sub { color: #6b7688; font-size: 14px; margin-top: 6px; }

.card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 20px;
  box-shadow: 0 6px 24px rgba(31, 39, 51, 0.06);
  margin-bottom: 18px;
}

.field { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.field > label {
  flex: 0 0 168px;
  max-width: 168px;
  font-size: 14px;
  font-weight: 600;
  color: #344054;
  padding-top: 11px;
  line-height: 1.4;
}
.field-body { flex: 1 1 auto; min-width: 0; }
.field input, .field select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 11px 12px;
  font-size: 15px;
  border: 1px solid #d6dce6;
  border-radius: 9px;
  background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  flex: 1;
  min-width: 140px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .08s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: #2f6bff; color: #fff; box-shadow: 0 4px 14px rgba(47,107,255,.3); }
.btn.wechat { background: #07c160; color: #fff; box-shadow: 0 4px 14px rgba(7,193,96,.3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hint { margin-top: 12px; font-size: 13px; color: #c0392b; min-height: 18px; }
.hint.ok { color: #07c160; }

.preview-card h2 { font-size: 16px; color: #344054; margin-bottom: 12px; }
.preview {
  font-family: "SimSun", "宋体", serif;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-all;
  background: #fafbfd;
  border: 1px dashed #d6dce6;
  border-radius: 10px;
  padding: 16px;
  max-height: 420px;
  overflow: auto;
  line-height: 1.9;
}

.ft { text-align: center; color: #9aa4b2; font-size: 12px; margin-top: 8px; }

/* 顶部标签切换 */
.tabs {
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(31, 39, 51, 0.06);
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #6b7688;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.active { background: #2f6bff; color: #fff; box-shadow: 0 4px 12px rgba(47,107,255,.3); }

/* 声明版本分段选择 */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #d6dce6;
  border-radius: 9px;
  background: #fbfcfe;
  color: #344054;
  cursor: pointer;
  transition: all .15s;
}
.seg-btn.active { background: #eaf1ff; border-color: #2f6bff; color: #2f6bff; }
.ver-desc { font-size: 12px; color: #8a94a6; margin-top: 8px; line-height: 1.5; }
.lock { color: #c0392b; font-weight: 500; margin-left: 6px; }

/* 文本域 */
.field textarea {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 11px 12px;
  font-size: 15px;
  border: 1px solid #d6dce6;
  border-radius: 9px;
  background: #fbfcfe;
  resize: vertical;
  font-family: inherit;
}
.field textarea:focus {
  outline: none;
  border-color: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

/* 特殊：分期计划表区域 —— 左侧标签+按钮，右侧表格（与上方输入框同列对齐） */
.field-schedule { align-items: flex-start; gap: 14px; }
.sched-left {
  flex: 0 0 168px;
  max-width: 168px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.sched-left > label { font-size: 14px; font-weight: 600; color: #344054; line-height: 1.4; }
.sched-right { flex: 1 1 auto; min-width: 0; }
.field-schedule #ip_schedule table th,
.field-schedule #ip_schedule table td { text-align: center; vertical-align: middle; }
.field-schedule #ip_schedule table input { text-align: center; }

/* 窄屏回退为上下排列，避免挤压 */
@media (max-width: 640px) {
  .field { flex-direction: column; gap: 6px; }
  .field > label { flex: none; max-width: none; padding-top: 0; }
  .field input, .field select, .field textarea { flex: none; width: 100%; }
}

/* OCR 上传卡片 */
.ocr-card { margin-bottom: 18px; }
.ocr-title {
  font-size: 14px;
  font-weight: 600;
  color: #344054;
  margin-bottom: 10px;
}
.ocr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.ocr-item {
  position: relative;
  border: 1px dashed #c5cbd6;
  border-radius: 12px;
  background: #fbfcfe;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.ocr-item:hover { border-color: #2f6bff; background: #f5f8ff; }
.ocr-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  min-height: 110px;
}
.ocr-icon { font-size: 28px; margin-bottom: 6px; }
.ocr-label { font-size: 13px; font-weight: 600; color: #344054; }
.ocr-status {
  font-size: 11px;
  color: #8a94a6;
  margin-top: 6px;
  min-height: 16px;
}
.ocr-status.busy { color: #2f6bff; }
.ocr-status.ok { color: #07c160; }
.ocr-status.err { color: #c0392b; }
.ocr-thumb {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  background: #fff;
}
.ocr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .85;
}
.ocr-item.has-thumb .ocr-thumb { display: block; }
.ocr-item.has-thumb .ocr-btn { position: relative; z-index: 1; background: rgba(255,255,255,.78); }
.ocr-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #8a94a6;
  min-height: 18px;
}
.ocr-hint.ok { color: #07c160; }

/* OCR 识别模块（网页版） */
.ocr-drop {
  border: 2px dashed #c2cbda;
  border-radius: 12px;
  background: #f7f9fc;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 6px;
}
.ocr-drop:hover, .ocr-drop.drag { border-color: #2f6bff; background: #eef3ff; }
.ocr-drop-text { font-size: 15px; font-weight: 600; color: #344054; }
.ocr-drop-sub { font-size: 12px; color: #8a94a6; margin-top: 6px; }
.ocr-preview { margin-top: 12px; }
.ocr-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(31,39,51,.12);
}
.ocr-result { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ocr-field { display: flex; align-items: center; gap: 8px; }
.ocr-field label { flex: 0 0 132px; font-size: 14px; font-weight: 600; color: #344054; }
.ocr-field input {
  flex: 1;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #d6dce6;
  border-radius: 9px;
  background: #fbfcfe;
}
.ocr-field input:focus { outline: none; border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.ocr-copy {
  flex: 0 0 auto;
  min-width: 64px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  background: #eaf1ff;
  color: #2f6bff;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: transform .08s, background .15s;
}
.ocr-copy:active { transform: translateY(1px); }
.ocr-copy:hover { background: #dce7ff; }
.ocr-note {
  margin: -4px 0 2px 140px;
  font-size: 12px;
  line-height: 1.5;
  color: #9a6700;
  background: #fff8e6;
  border: 1px solid #f3e0a3;
  border-radius: 8px;
  padding: 5px 9px;
}

.org-text {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #1f2733;
  border: 1px solid #d6dce6;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
}
.org-text:focus {
  outline: none;
  border-color: #2f6bff;
  box-shadow: 0 0 0 3px rgba(47,107,255,.12);
}
.ocr-field label { flex: 0 0 132px; }

optgroup { font-weight: 700; color: #344054; }
option { font-weight: 400; color: #1f2733; }

/* 统一社会信用代码根据公司名称自动回填时的高亮提示 */
.uscc-autofilled { animation: usccFlash 1.2s ease; }
@keyframes usccFlash {
  0% { background-color: #fff3bf; box-shadow: 0 0 0 3px rgba(255,193,7,.25) inset; }
  100% { background-color: #fff; box-shadow: none; }
}
