/* 全局重置：统一盒模型、清除默认边距 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

/* 页面整体：使用微软雅黑字体，蓝紫渐变背景 */
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f0f7ff 50%, #f5f0ff 100%);
  min-height: 100%;
  padding: 24px 20px;
}

/* ---- 顶部标题区域 ---- */
.page-header { text-align: center; margin-bottom: 22px; }
.page-header h1 { font-size: 22px; color: #1a1a2e; font-weight: 700; letter-spacing: 1px; }
.page-header p  { font-size: 13px; color: #8890a8; margin-top: 6px; }

/* ---- 步骤指示器：三步走进度导航 ---- */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
/* 每个步骤项：圆点 + 文字标签纵向排列 */
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
/* 步骤圆点：默认灰色未激活状态 */
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e0e6f5;
  color: #aab;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.4s;
  border: 2px solid transparent;
}
.step-label { font-size: 12px; color: #aab; white-space: nowrap; transition: color 0.4s; }
/* 当前步骤：蓝色高亮 + 外发光 */
.step.active .step-dot {
  background: #4f6ef7; color: #fff;
  border-color: #c5ceff;
  box-shadow: 0 0 0 4px rgba(79,110,247,0.15);
}
.step.active .step-label { color: #4f6ef7; font-weight: 600; }
/* 已完成步骤：绿色 */
.step.done .step-dot { background: #18a058; color: #fff; border-color: #b3e8ca; }
.step.done .step-label { color: #18a058; }
/* 步骤之间的连接线 */
.step-line {
  flex: 1; max-width: 72px; height: 2px;
  background: #e0e6f5; margin: 0 8px; margin-bottom: 18px;
  transition: background 0.4s;
}
.step-line.done   { background: #18a058; }
/* 当前进行中的连接线：绿蓝渐变 */
.step-line.active { background: linear-gradient(90deg, #18a058, #4f6ef7); }

/* ---- 主内容卡片：白色圆角卡片，带阴影 ---- */
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(60,80,180,0.08), 0 1px 4px rgba(0,0,0,0.04);
  padding: 28px 32px;
  width: 100%;
}

/* ---- 文件上传区域：虚线边框拖拽区 ---- */
.upload-area {
  border: 2px dashed #d0d7e8;
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  background: #fafbff;
}
/* 悬停或拖拽时高亮边框 */
.upload-area:hover, .upload-area.drag-over {
  border-color: #4f6ef7; background: #f3f5ff;
}
/* 已选中文件时绿色背景 */
.upload-area.has-file {
  border-color: #2ecc71; border-style: dashed; background: rgba(46, 204, 113, 0.05);
}
.upload-area.has-file:hover, .upload-area.has-file.drag-over {
  border-color: #27ae60; background: rgba(46, 204, 113, 0.10);
}
/* 透明的文件选择 input 覆盖整个上传区 */
.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-icon { font-size: 44px; margin-bottom: 10px; }
.upload-area p { color: #444; font-size: 15px; font-weight: 500; }
.upload-area .hint { color: #b0b8cc; font-size: 12px; margin-top: 6px; }
/* 文件名显示区：选中文件后通过 JS 设为 display:flex 显示 */
.file-name {
  margin-top: 10px; font-size: 13px; color: #4f6ef7; font-weight: 600;
  display: none; align-items: center; justify-content: center; gap: 4px;
}

/* ---- 通用按钮样式 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 26px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #5b7ef8, #4f6ef7); color: #fff; box-shadow: 0 2px 8px rgba(79,110,247,0.3); }
.btn-success { background: linear-gradient(135deg, #22b468, #18a058); color: #fff; box-shadow: 0 2px 8px rgba(24,160,88,0.3); }
.btn-row { display: flex; align-items: center; gap: 12px; margin-top: 20px; }

/* ---- 提取结果卡片 ---- */
.result-card {
  margin-top: 20px;
  border: 1px solid #e8ecf5;
  border-radius: 14px;
  overflow: hidden;
  display: none;
  box-shadow: 0 2px 12px rgba(60,80,180,0.06);
}
.result-card.show { display: block; }
.result-header {
  background: linear-gradient(90deg, #f0f4ff, #f8f5ff);
  padding: 13px 20px;
  font-size: 14px; font-weight: 700; color: #2a2a4a;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #e8ecf5;
}
.result-header-left { display: flex; align-items: center; gap: 8px; }
.result-badge {
  background: #4f6ef7; color: #fff;
  font-size: 10px; padding: 2px 7px;
  border-radius: 99px; font-weight: 600;
}
.result-body { padding: 0; }
.result-footer {
  padding: 14px 20px;
  background: #f8faff;
  border-top: 1px solid #e8ecf5;
  display: flex; justify-content: flex-end;
}
.info-row {
  display: flex; border-bottom: 1px solid #f2f4fb; font-size: 14px;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.35s, transform 0.35s;
}
.info-row.visible { opacity: 1; transform: translateY(0); }
.info-row:last-child { border-bottom: none; }
.info-label {
  width: 130px; min-width: 130px;
  padding: 11px 18px;
  color: #7880a0; background: #fafbff;
  border-right: 1px solid #f2f4fb;
  font-size: 13px;
}
.info-value {
  padding: 11px 16px; color: #1a1a2e;
  flex: 1; word-break: break-all; line-height: 1.6;
}
.info-value--conflict { color: #d03050 !important; background: #fff5f7; }
.conflict-badge {
  font-size: 11px; color: #d03050; padding: 2px 16px 4px;
  cursor: pointer; user-select: none;
}
.conflict-badge:hover { text-decoration: underline; }
.conflict-detail { padding: 4px 16px 8px; font-size: 12px; color: #555; }
.conflict-item {
  padding: 3px 0 3px 8px; margin: 2px 0;
  border-left: 3px solid #f0a0b0;
}
.conflict-src { color: #aaa; font-size: 11px; }
.info-value[contenteditable="true"] { outline: none; }
.info-value[contenteditable="true"]:focus { background: #f5f7ff; }
.info-value-wrap { flex: 1; display: flex; flex-direction: column; }
.info-value-wrap .info-value { flex: none; }
.info-source { font-size: 11px; color: #b0bbd0; padding: 0 16px 7px; line-height: 1.4; }

/* ---- Toast 轻提示 ---- */
.toast {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #1a1a2e; color: #fff;
  padding: 10px 24px; border-radius: 10px;
  font-size: 14px; transition: transform 0.3s;
  z-index: 999; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.show    { transform: translateX(-50%) translateY(0); }
.toast.success { background: #18a058; }
.toast.error   { background: #d03050; }

/* ---- 分析视图：呼吸扩散圆圈 ---- */
.analyze-view { display: none; padding: 30px 0 20px; text-align: center; }
.analyze-view.show { display: block; }
.arc-wrap { position: relative; width: 200px; height: 200px; margin: 0 auto 22px; }
.arc-breath {
  position: absolute; inset: 55px; border-radius: 50%;
  border: 2px solid rgba(168,216,234,0.75);
  box-shadow: 0 0 10px rgba(168,216,234,0.18);
  animation: breathOut 2.8s infinite ease-out;
}
.arc-breath-2 { animation-delay: 1.4s; }
@keyframes breathOut {
  0%   { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(2.6);  opacity: 0; }
}
.arc-center {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(168,216,234,0.95);
  box-shadow: 0 0 10px rgba(168,216,234,0.9), 0 0 26px rgba(120,190,220,0.5);
  animation: centerPulse 2.8s infinite ease-in-out;
}
@keyframes centerPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(168,216,234,0.8), 0 0 20px rgba(120,190,220,0.4); transform: translate(-50%,-50%) scale(1); }
  50%       { box-shadow: 0 0 16px rgba(168,216,234,1), 0 0 36px rgba(120,190,220,0.7); transform: translate(-50%,-50%) scale(1.35); }
}
.analyze-status { font-size: 15px; font-weight: 600; color: #2a3a6a; margin-bottom: 18px; letter-spacing: 0.5px; }
.analyze-steps-list { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; }
.ast-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #5a6285;
  opacity: 0; transform: translateY(8px);
  animation: astFadeIn 0.45s forwards ease-out;
}
@keyframes astFadeIn { to { opacity: 1; transform: translateY(0); } }
.ast-indicator {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.ast-item.s-loading .ast-indicator {
  border: 2px solid #4f6ef7; border-top-color: transparent;
  animation: astIndicatorSpin 0.7s linear infinite;
}
@keyframes astIndicatorSpin { to { transform: rotate(360deg); } }
.ast-item.s-done .ast-indicator { background: #18a058; color: #fff; border: none; animation: none; }
.ast-item.s-done .ast-indicator::after { content: "✓"; }
.ast-item.s-loading { color: #4f6ef7; font-weight: 600; }
.ast-item.s-done    { color: #5a6285; }

/* ---- 字段输入控件 ---- */
.field-input {
  border: 1px solid #dde3f0; border-radius: 6px; padding: 5px 9px;
  font-size: 13px; color: #1a1a2e; background: #fff; outline: none;
  transition: border-color 0.2s; font-family: inherit; line-height: 1.5;
}
textarea.field-input { resize: none; overflow: hidden; display: block; }
.field-input:focus { border-color: #4f6ef7; }
.field-del {
  color: #c0c8d8; cursor: pointer; font-size: 16px; line-height: 1;
  border: none; background: none; padding: 2px 4px; border-radius: 4px;
  flex-shrink: 0; transition: color 0.2s;
}
.field-del:hover { color: #d03050; }
.field-add-btn {
  margin-top: 10px; width: 100%; padding: 8px; border-radius: 8px;
  border: 2px dashed #c5ceff; background: #f5f7ff; color: #6070c0;
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.field-add-btn:hover { border-color: #4f6ef7; background: #eef1ff; }

/* ---- 保存/加载设置按钮行 ---- */
.settings-io-row {
  display: flex; gap: 6px; margin-top: 10px; align-items: center;
}
.preset-label {
  font-size: 11px; color: #a0aac0; white-space: nowrap; flex-shrink: 0;
}
.preset-select {
  width: 150px; flex-shrink: 0;
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid #c8d3ea; background: #fff; color: #5a6a8a;
  font-size: 12px; cursor: pointer; outline: none;
  transition: border-color 0.15s;
}
.preset-select:focus { border-color: #4f6ef7; }
.btn-io {
  padding: 5px 14px; border-radius: 6px;
  border: 1px solid #c8d3ea; background: #fff; color: #7a8aaa;
  font-size: 12px; font-weight: 400; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-io:hover { border-color: #4f6ef7; color: #4f6ef7; background: #fff; }
.btn-io-del { color: #c05060; border-color: #e8c0c8; }
.btn-io-del:hover { border-color: #d03050; color: #d03050 !important; background: #fff8fa; }

/* ---- 已保存结果工具栏 ---- */
.saved-results-bar {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.saved-results-label {
  font-size: 13px; color: #7080b0; white-space: nowrap;
}

/* ---- 主页补充提示词输入区 ---- */
.main-prompt-wrap {
  margin-top: 14px; padding: 14px 16px;
  background: #f8faff; border: 1px solid #e0e6f5; border-radius: 12px;
}
.main-prompt-label {
  font-size: 12px; font-weight: 700; color: #5a6a8a;
  letter-spacing: 0.6px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.main-prompt-hint { font-size: 11px; color: #a0aac0; font-weight: 400; letter-spacing: 0; }
.main-prompt-textarea {
  width: 100%; min-height: 72px; resize: none;
  border: 1px solid #dde3f0; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; line-height: 1.6;
  color: #1a1a2e; background: #fff; outline: none; overflow: hidden;
  font-family: inherit; transition: border-color 0.2s;
  box-sizing: border-box;
}
.main-prompt-textarea:focus { border-color: #4f6ef7; }
.main-prompt-textarea::placeholder { color: #c0c8d8; }

.readonly-badge {
  background: #f0f2fa; color: #9aa8c0; border: 1px solid #dde3f0;
  font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}

/* ---- 系统字段芯片 ---- */
.sys-chips-wrap {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: #f8faff; border: 1px solid #e8ecf5; border-radius: 10px;
  padding: 10px 12px; min-height: 42px; align-content: flex-start;
}
.field-chip {
  background: #eef1ff; color: #4f6ef7; border: 1px solid #c5ceff;
  border-radius: 6px; font-size: 12px; padding: 3px 10px; font-weight: 500;
}

/* ---- 用户自定义字段行 ---- */
.user-field-hdr {
  display: flex; gap: 8px; font-size: 11px; color: #9aa8c0;
  font-weight: 600; padding: 0 6px 4px; letter-spacing: 0.3px;
}
.ufh-label { flex: 0 0 130px; }
.uf-label  { flex: 0 0 auto; min-width: 210px; max-width: 320px; }
.uf-req    { flex: 1; }
.user-field-row {
  display: flex; align-items: flex-start; gap: 8px;
  background: #f8faff; border: 1px solid #e8ecf5; border-radius: 10px;
  padding: 8px 10px; margin-bottom: 8px; transition: border-color 0.2s;
}
.user-field-row:hover { border-color: #c5ceff; }
