/* =====================================================================
 * style.css — 炫风数据在线解析 · 移动端 UI
 * 金融蓝金风 · 卡片式 · 微信生态视觉
 * ===================================================================== */
:root {
  --primary: #1a56db;
  --primary-deep: #1442b0;
  --primary-light: #e8effd;
  --gold: #d9a441;
  --gold-light: #fdf3dd;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #5b6572;
  --text-3: #9aa3af;
  --line: #e6e9ef;
  --red: #d92d20;
  --red-bg: #feeceb;
  --orange: #e8820c;
  --orange-bg: #fdf1df;
  --green: #178a4a;
  --green-bg: #e6f6ec;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 40, 80, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 头部 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #143d8f 0%, #1a56db 60%, #2368f0 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(26, 86, 219, 0.35);
}
.h-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #e8b45a);
  color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}
.h-titles h1 { font-size: 16.5px; font-weight: 700; letter-spacing: 0.5px; }
.h-titles span { font-size: 11px; opacity: 0.85; display: block; }
.h-right { display: flex; align-items: center; gap: 8px; }
.ai-badge { font-size: 10px; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,0.16); }
.ai-badge.on { background: rgba(50, 220, 120, 0.28); }
.icon-btn {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: rgba(255,255,255,0.16); color: #fff; font-size: 17px;
  cursor: pointer;
}

/* ---------- 主容器 ---------- */
main { max-width: 560px; margin: 0 auto; padding: 12px 12px 24px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15.5px; font-weight: 700;
  margin-bottom: 4px;
}
.step-no {
  width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 700;
}
.step-desc { font-size: 12px; color: var(--text-2); margin: 4px 0 12px; }
.link-btn {
  margin-left: auto; border: none; background: none;
  color: var(--text-3); font-size: 12px; cursor: pointer;
}

/* ---------- 上传卡片 ---------- */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.up-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 10px;
  background: #fbfcfe;
}
.up-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.up-icon {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 17px;
  background: var(--primary-light);
}
.up-title { font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.up-title small { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.up-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%;
  padding: 8px 0;
  border: 1.5px dashed #b8c8ef;
  border-radius: 10px;
  background: #f3f7ff;
  color: var(--primary);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.up-btn:active { background: var(--primary-light); }
.file-list { margin-top: 8px; }
.f-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.f-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.f-status { flex: none; font-size: 10px; padding: 1px 7px; border-radius: 10px; }
.f-status.gray { background: #eef1f5; color: var(--text-3); }
.f-status.blue { background: var(--primary-light); color: var(--primary); }
.f-status.green { background: var(--green-bg); color: var(--green); }
.f-status.orange { background: var(--orange-bg); color: var(--orange); }
.f-status.red { background: var(--red-bg); color: var(--red); }
.f-del { border: none; background: none; color: var(--text-3); font-size: 14px; cursor: pointer; padding: 0 2px; }
.f-main { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.f-note { width: 100%; font-size: 10px; color: var(--orange); line-height: 1.5; padding: 0 2px 2px 0; word-break: break-all; }
.loan-manual-row { display: flex; gap: 4px; margin-bottom: 4px; align-items: center; }
.loan-manual-row input { font-size: 11px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.parse-msg { font-size: 10.5px; color: var(--text-3); margin-top: 4px; min-height: 14px; }

/* ---------- 按钮 ---------- */
.primary-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 14px;
  padding: 12px 0;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(26, 86, 219, 0.3);
  cursor: pointer;
  transition: opacity .15s;
}
.primary-btn:active { opacity: 0.85; }
.primary-btn:disabled { opacity: 0.55; }
.primary-btn.sm { width: auto; padding: 8px 22px; margin: 0; font-size: 13.5px; }
.secondary-btn {
  flex: 1;
  padding: 11px 0;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: #fff; color: var(--primary);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ghost-btn {
  display: block; width: 100%; margin-top: 8px;
  padding: 8px 0;
  border: 1px dashed #b8c8ef; border-radius: 10px;
  background: #f8faff; color: var(--primary);
  font-size: 12.5px; cursor: pointer;
}
.act-row { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Tab ---------- */
.tab-bar {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 20px;
  background: #fff; color: var(--text-2);
  font-size: 12.5px; cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  font-weight: 600;
}

/* ---------- 表单 ---------- */
.panel-title {
  font-size: 13px; font-weight: 700;
  color: var(--primary-deep);
  background: var(--primary-light);
  padding: 6px 10px; border-radius: 8px;
  margin: 12px 0 8px;
}
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.f-row { display: flex; flex-direction: column; gap: 3px; }
.f-row.wide { grid-column: 1 / -1; }
.f-row label { font-size: 11.5px; color: var(--text-2); }
.f-ctrl { display: flex; align-items: center; gap: 4px; }
.f-ctrl input, .f-ctrl select {
  flex: 1; min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fbfcfe;
  font-size: 13px; color: var(--text);
  outline: none;
}
.f-ctrl input:focus, .f-ctrl select:focus { border-color: var(--primary); background: #fff; }
.f-ctrl input::placeholder { color: #c2c9d4; }
.unit { font-size: 11px; color: var(--text-3); flex: none; }
.prefix { font-size: 11px; color: var(--text-3); }

/* ---------- 明细表 ---------- */
.dt-head, .dt-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr 0.8fr 1fr 24px;
  gap: 4px; align-items: center;
}
.dt-head-fixed { font-size: 10px; color: var(--text-3); padding: 4px 2px; border-bottom: 1px solid var(--line); }
.dt-row { margin: 5px 0; }
.dt-row input {
  min-width: 0; width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 11px; background: #fbfcfe; outline: none;
}
.dt-row input:focus { border-color: var(--primary); }
.dt-del {
  width: 22px; height: 22px;
  border: none; border-radius: 6px;
  background: var(--red-bg); color: var(--red);
  font-size: 13px; cursor: pointer; line-height: 1;
}
.empty-tip { font-size: 12px; color: var(--text-3); padding: 6px 0; }

/* ---------- 报告 ---------- */
.grade-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f2f6b, #1a56db);
  color: #fff;
  margin-bottom: 12px;
}
.grade-left { display: flex; align-items: center; gap: 12px; flex: none; }
.grade-badge {
  width: 58px; height: 58px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  font-size: 30px; font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.grade-badge.gA { background: linear-gradient(135deg, #178a4a, #23b26a); }
.grade-badge.gB { background: linear-gradient(135deg, #1a56db, #3f7ff0); }
.grade-badge.gC { background: linear-gradient(135deg, #e8820c, #f5a623); }
.grade-badge.gD { background: linear-gradient(135deg, #b42318, #d92d20); }
.grade-badge.gN { background: linear-gradient(135deg, #8a94a6, #b3bcc9); }
.grade-label { font-size: 14.5px; font-weight: 700; }
.grade-score { font-size: 11.5px; opacity: 0.85; margin-top: 2px; }
.grade-summary { flex: 1; font-size: 12px; line-height: 1.6; opacity: 0.95; }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric {
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
}
.m-label { font-size: 11px; color: var(--text-2); }
.m-value { font-size: 15.5px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.m-sub { font-size: 10px; color: var(--text-3); margin-top: 1px; }

.block { margin-top: 12px; }
.block-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.risk-list { list-style: none; }
.risk-list li {
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 9px;
  margin-bottom: 6px;
  background: var(--red-bg);
  color: #a11e15;
}
.risk-list li.risk-hard { background: #ffe3e0; color: #b42318; font-weight: 600; }
.risk-list li.risk-ok { background: var(--green-bg); color: var(--green); }

.b-grid { display: grid; grid-template-columns: 1fr 0.8fr 0.8fr; gap: 8px; }
.b-item { display: flex; flex-direction: column; gap: 3px; }
.b-item label { font-size: 11.5px; color: var(--text-2); }
.b-item input {
  padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; outline: none; background: #fbfcfe;
}
.b-item input:focus { border-color: var(--primary); }
.b-result {
  margin-top: 10px;
  background: var(--gold-light);
  border: 1px solid #f0dca9;
  border-radius: 10px;
  padding: 10px 12px;
}
.b-interest { font-size: 19px; font-weight: 800; color: #a06a00; font-variant-numeric: tabular-nums; }
.b-detail { font-size: 11.5px; color: #8a6a1f; margin-top: 2px; }
.b-ref { font-size: 12px; color: var(--text-2); margin-top: 10px; }
.b-ref b { color: var(--primary); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 20px;
}
.modal.show { display: flex; }
.modal-box {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-box h3 { font-size: 16px; margin-bottom: 6px; }
.modal-desc { font-size: 12px; color: var(--text-2); margin-bottom: 12px; line-height: 1.6; }
.modal-label { display: block; font-size: 12px; color: var(--text-2); margin: 10px 0 4px; }
.modal-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; outline: none;
}
.modal-input:focus { border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ---------- 页脚 / Toast ---------- */
.app-footer { text-align: center; padding: 10px 20px 30px; }
.app-footer p { font-size: 10.5px; color: var(--text-3); line-height: 1.7; }

#toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 200;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 30, 50, 0.92);
  color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 22px;
  opacity: 0; pointer-events: none;
  transition: all .25s;
  max-width: 86vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 桌面端 ---------- */
@media (min-width: 600px) {
  .upload-grid { grid-template-columns: repeat(4, 1fr); }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .f-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===================== V2 报告模块样式 ===================== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.tbl th, .tbl td { border: 1px solid rgba(0,0,0,.08); padding: 7px 9px; text-align: left; }
.tbl th { background: rgba(0,0,0,.04); font-weight: 600; white-space: nowrap; }
.tbl tbody tr:nth-child(even) { background: rgba(0,0,0,.02); }
.sub-note { font-size: 13px; font-weight: 600; color: #555; margin: 10px 0 2px; }
.ok-tip { font-size: 13px; color: #1a7f37; background: rgba(26,127,55,.08); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
.advice-list li { line-height: 1.6; }
.risk-hard { color: #c62828; font-weight: 600; }
.empty-tip { color: #999; font-size: 13px; padding: 6px 0; }
@media (prefers-color-scheme: dark) {
  .tbl th, .tbl td { border-color: rgba(255,255,255,.12); }
  .tbl th { background: rgba(255,255,255,.06); }
  .tbl tbody tr:nth-child(even) { background: rgba(255,255,255,.03); }
  .sub-note { color: #bbb; }
  .ok-tip { color: #6fd68f; background: rgba(26,127,55,.18); }
}

/* V2.1 链接解析样式 */
.link-row { display: flex; gap: 6px; margin-top: 8px; }
.link-input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px; border: 1px solid rgba(0,0,0,.15); border-radius: 8px; background: transparent; color: inherit; }
.ghost-btn.sm { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .link-input { border-color: rgba(255,255,255,.2); }
}

/* V2.1.1 输入框允许选择/粘贴（修复移动端长按无粘贴菜单） */
.link-input, input, textarea {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}
