/* ==========================================================================
   泓盾企服诊断系统 —— 前台主样式
   ========================================================================== */

:root {
  --brand: #1e3a8a;
  --brand-2: #2563eb;
  --brand-soft: #eef3ff;
  --accent: #0f766e;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #ea580c;
  --warn-soft: #fff7ed;
  --caution: #ca8a04;
  --caution-soft: #fefce8;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f4f6fb;
  --card: #ffffff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 12px 32px -12px rgba(15, 23, 42, .12);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 布局 */
.topbar {
  background: linear-gradient(120deg, #0f2557 0%, var(--brand) 55%, #1d4ed8 100%);
  color: #fff;
  padding: 14px 0;
}
.topbar .inner {
  max-width: 960px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 9px;
  background: rgba(255,255,255,.16);
  display: grid; place-items: center; font-size: 15px;
}
.topbar .nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topbar .nav a { color: rgba(255,255,255,.85); }
.topbar .nav a:hover { color: #fff; }

.wrap { max-width: 960px; margin: 0 auto; padding: 26px 20px 72px; }
.wrap-narrow { max-width: 520px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 26px;
  margin-bottom: 18px;
}
.card.tight { padding: 20px; }

footer.foot {
  text-align: center; color: var(--text-3); font-size: 13px;
  padding: 22px 20px 40px; line-height: 1.9;
}

/* ---------------------------------------------------------------- 标题 */
h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -.2px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 17px; margin: 0 0 8px; }
.lead { color: var(--text-2); font-size: 15px; }
.muted { color: var(--text-3); font-size: 13px; }
.small { font-size: 14px; }
.center { text-align: center; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 12px 26px; font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: .18s; background: var(--brand); color: #fff;
  line-height: 1.2; text-decoration: none;
}
.btn:hover { background: #1b3276; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 32px; font-size: 16px; }
.btn-ghost { background: #fff; color: var(--brand); border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-line { background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-line:hover { background: #f8fafc; color: var(--text); }
.btn-wechat { background: #07c160; }
.btn-wechat:hover { background: #06ad56; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 7px 15px; font-size: 13px; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 20px; }
.field > label {
  display: block; font-weight: 600; font-size: 14.5px;
  margin-bottom: 8px; color: var(--text);
}
.field .req { color: var(--danger); margin-left: 3px; }
.field .hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }

input[type=text], input[type=tel], input[type=number], input[type=month],
input[type=password], textarea, select {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: var(--font);
  color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: .16s; outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.unit { color: var(--text-3); font-size: 14px; margin-left: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}

/* 选项卡片 */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; background: #fff;
  transition: .16s; user-select: none;
}
.option:hover { border-color: #bfd3f8; background: #fbfcff; }
.option input { margin: 2px 0 0; width: 18px; height: 18px; accent-color: var(--brand-2); flex: none; }
.option .txt { font-size: 15px; line-height: 1.55; }
.option .key {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 700; display: grid; place-items: center; margin-top: 1px;
}
.option input:checked ~ .key { background: var(--brand); color: #fff; }
.option:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }
.option.checked { border-color: var(--brand-2); background: var(--brand-soft); }

/* ---------------------------------------------------------------- 进度 */
.progress-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--text-2); margin-bottom: 8px;
}
.progress-bar {
  height: 7px; background: #e6ecf7; border-radius: 99px; overflow: hidden;
}
.progress-bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand) 0%, #3b82f6 100%);
  border-radius: 99px; transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.section-tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--brand); background: var(--brand-soft);
  padding: 3px 11px; border-radius: 99px; margin-bottom: 12px;
}

/* ---------------------------------------------------------------- 答题 */
.q-title { font-size: 21px; font-weight: 700; line-height: 1.5; margin: 4px 0 6px; }
.q-desc { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }
.q-hint { display: inline-block; font-size: 12px; color: var(--accent); background: #effcf9;
          padding: 2px 9px; border-radius: 6px; margin-left: 8px; font-weight: 600; }

.step-anim { animation: fadeUp .32s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-2);
}
.actions .spacer { flex: 1; }
.autosave { font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- 首页 */
.hero {
  background: linear-gradient(150deg, #0f2557 0%, #1e3a8a 50%, #2563eb 100%);
  color: #fff; border-radius: 20px; padding: 40px 34px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -70px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.hero h1 { font-size: 29px; color: #fff; margin-bottom: 12px; letter-spacing: -.4px; }
.hero p { color: rgba(255,255,255,.82); font-size: 15px; margin: 0 0 6px; max-width: 640px; }
.hero .actions-hero { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-white { background: #fff; color: var(--brand); }
.hero .btn-white:hover { background: #eef3ff; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow-sm); text-align: center;
}
.stat .n { font-size: 25px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.stat .l { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.feature { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line-2); }
.feature:last-child { border-bottom: 0; }
.feature .ico {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 16px;
}
.feature .t { font-weight: 600; font-size: 15px; }
.feature .d { color: var(--text-2); font-size: 13.5px; }

.notice {
  background: var(--caution-soft); border-left: 4px solid var(--caution);
  border-radius: 10px; padding: 14px 16px; font-size: 14px; color: #713f12;
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------------------------------------------------------------- 报告 */
.score-hero {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding: 26px; border-radius: var(--radius);
  background: linear-gradient(120deg, #0f2557, #1e3a8a);
  color: #fff;
}
.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .val {
  position: absolute; inset: 0; display: grid; place-items: center;
  align-content: center; text-align: center;
}
.ring .val .num { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1.5px; }
.ring .val .unit { font-size: 12px; opacity: .78; margin-top: 4px; letter-spacing: .5px; }
.score-hero .info { flex: 1; min-width: 240px; }
.score-hero .info h2 { color: #fff; font-size: 22px; margin-bottom: 6px; }
.level-pill {
  display: inline-block; padding: 5px 15px; border-radius: 99px;
  font-size: 14px; font-weight: 700; margin-bottom: 10px;
}
.lv-low { background: var(--ok-soft); color: var(--ok); }
.lv-medium { background: var(--caution-soft); color: #a16207; }
.lv-high { background: var(--warn-soft); color: var(--warn); }
.lv-critical { background: var(--danger-soft); color: var(--danger); }
.score-hero .meta { color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.9; }

.dim-list { display: flex; flex-direction: column; gap: 14px; }
.dim { }
.dim .head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14.5px; }
.dim .head .name { font-weight: 600; }
.dim .head .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.dim .track { height: 9px; background: #edf1f8; border-radius: 99px; margin-top: 7px; overflow: hidden; }
.dim .track > i { display: block; height: 100%; border-radius: 99px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.dim .sub { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }

.risk-item {
  border: 1px solid var(--line); border-left: 4px solid var(--caution);
  border-radius: 10px; padding: 13px 15px; margin-bottom: 10px; background: #fff;
}
.risk-item.r4, .risk-item.r5 { border-left-color: var(--danger); }
.risk-item.r3 { border-left-color: var(--warn); }
.risk-item .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.risk-item .q { font-weight: 600; font-size: 14.5px; }
.risk-item .tag {
  flex: none; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 6px;
  background: var(--danger-soft); color: var(--danger);
}
.risk-item .a { font-size: 13.5px; color: var(--text-2); margin-top: 5px; }
.risk-item .h { font-size: 13px; color: var(--accent); margin-top: 6px; }

/* 锁定层 */
.lock-box { text-align: center; padding: 8px 0 4px; }
.lock-box .icon {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 27px;
}
.qr-wrap {
  display: inline-block; padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; margin: 14px 0;
}
.qr-wrap img, .qr-wrap svg { display: block; width: 200px; height: 200px; }
.blur-lock { position: relative; max-height: 320px; overflow: hidden; }
.blur-lock .mask {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 78%);
}
.blur-text { filter: blur(4.5px); user-select: none; pointer-events: none; opacity: .6; }

.steps-inline { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 16px 0 4px; }
.steps-inline .s {
  font-size: 12.5px; color: var(--text-2); background: #f6f8fc;
  border: 1px solid var(--line-2); border-radius: 99px; padding: 6px 14px;
}

/* 顾问微信引导块 —— 问卷完成页 / 报告审核中页 / 报告待验证页 共用
   （结构见 templates/_wecom.html 与 survey.js 的 renderEnd，两处要保持一致） */
.wecom-box {
  text-align: center; margin: 20px 0 4px; padding: 18px 16px 6px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.wecom-box .wecom-title { font-weight: 700; font-size: 15.5px; color: var(--text); }
.wecom-box .wecom-sub { font-size: 12.5px; margin-top: 4px; }
.wecom-box .qr-wrap { margin: 12px 0 10px; }
.wecom-box .steps-inline { margin-top: 14px; }
a.qr-wrap { text-decoration: none; }

/* Markdown 正文 */
.md { font-size: 15.5px; line-height: 1.85; color: #1e293b; }
.md h2 {
  font-size: 20px; margin: 34px 0 14px; padding-bottom: 9px;
  border-bottom: 2px solid var(--brand-soft); color: var(--brand);
}
.md h2:first-child { margin-top: 6px; }
.md h3 { font-size: 16.5px; margin: 24px 0 10px; color: var(--text); }
.md h3::before {
  content: ""; display: inline-block; width: 4px; height: 15px;
  background: var(--brand-2); border-radius: 2px; margin-right: 9px;
  vertical-align: -2px;
}
.md p { margin: 10px 0; }
.md ul, .md ol { padding-left: 22px; margin: 10px 0; }
.md li { margin: 5px 0; }
.md strong { color: #b91c1c; font-weight: 700; }
.md blockquote {
  margin: 14px 0; padding: 11px 16px; background: #f8fafc;
  border-left: 4px solid #cbd5e1; border-radius: 8px; color: var(--text-2); font-size: 14px;
}
.md hr { border: 0; border-top: 1px dashed var(--line); margin: 24px 0; }
.md code {
  background: #f1f5f9; padding: 2px 6px; border-radius: 5px;
  font-size: 13.5px; color: #be123c;
}
.md-table-wrap { overflow-x: auto; margin: 16px 0; border-radius: 10px; border: 1px solid var(--line); }
.md-table { border-collapse: collapse; width: 100%; font-size: 14px; background: #fff; }
.md-table th {
  background: #f1f5fb; color: var(--brand); font-weight: 700;
  padding: 11px 13px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.md-table td { padding: 11px 13px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table tbody tr:nth-child(even) { background: #fafbfe; }

/* 提示条 */
.alert {
  border-radius: 10px; padding: 12px 15px; font-size: 14px; margin-bottom: 12px;
  border: 1px solid transparent;
}
.alert-info { background: var(--brand-soft); color: #1e3a8a; }
.alert-warn { background: var(--warn-soft); color: #9a3412; border-color: #fed7aa; }
.alert-ok { background: var(--ok-soft); color: #166534; }
.alert-danger { background: var(--danger-soft); color: #991b1b; }

.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translate(-50%, 20px);
  background: #0f172a; color: #fff; padding: 11px 22px; border-radius: 99px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .28s; z-index: 3000;
  box-shadow: 0 10px 30px rgba(0,0,0,.22); max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 列表 */
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 15px 0; border-bottom: 1px solid var(--line-2);
}
.list-item:last-child { border-bottom: 0; }
.list-item .t { font-weight: 600; font-size: 15px; }
.list-item .d { font-size: 13px; color: var(--text-3); margin-top: 3px; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .ico { font-size: 38px; margin-bottom: 10px; }

/* ---------- 状态标签（我的报告） ---------- */
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: .2px;
}
.pill-wait { background: #fef3c7; color: #92400e; }
.pill-lock { background: var(--brand-soft); color: #1e40af; }
.pill-ok { background: var(--ok-soft); color: #166534; }

/* ---------- 验证码输入 ---------- */
.code-box { margin: 22px auto 6px; }
.code-box input {
  height: 52px; font-size: 19px; text-align: center; border-radius: 12px;
  border: 1.5px solid var(--brand); background: #fff;
}
.code-box input:focus { outline: none; box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---------- 新题型 ---------- */
.input-wrap { display: flex; align-items: center; gap: 8px; }
.content-note {
  background: var(--brand-soft); color: #1e3a8a; border-radius: 12px;
  padding: 13px 15px; font-size: 14px; line-height: 1.75;
}
.divider { border: 0; border-top: 1px dashed var(--line); margin: 6px 0; }
.list-inputs { display: flex; flex-direction: column; gap: 10px; }
.list-inputs .li { display: flex; align-items: center; gap: 10px; }
.list-inputs .li .key { flex: none; }
.options.scale-row { display: flex; gap: 8px; flex-wrap: wrap; }
.options .option.scale { padding: 12px 18px; justify-content: center; min-width: 54px; }
.options .option.scale .txt { font-weight: 700; }

select {
  width: 100%; height: 46px; padding: 0 12px; border-radius: 11px;
  border: 1.5px solid var(--line); background: #fff; font-size: 15px; color: var(--text);
}
select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---------- 深度咨询 CTA ---------- */
.consult-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 60%, #2563eb 100%);
  color: #fff; border: 0;
}
.consult-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.consult-card h2 { color: #fff; margin-top: 0; }
.consult-card .lead { color: rgba(255,255,255,.86); max-width: 620px; }
.consult-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-consult {
  background: #fbbf24 !important; color: #7c2d12 !important; font-weight: 800;
  box-shadow: 0 8px 20px rgba(251,191,36,.32);
}
.btn-consult:hover { background: #f59e0b !important; }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 60px; }
  .card { padding: 20px 17px; border-radius: 14px; }
  .hero { padding: 28px 20px; border-radius: 16px; }
  .hero h1 { font-size: 23px; }
  .q-title { font-size: 18.5px; }
  .score-hero { padding: 20px 18px; gap: 18px; }
  .ring { width: 118px; height: 118px; }
  .ring svg { width: 118px; height: 118px; }
  .ring .val .num { font-size: 31px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1; min-width: 120px; }
}

@media print {
  .topbar, .actions, .no-print, footer.foot { display: none !important; }
  body, .wrap { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0; }
  .md h2 { page-break-after: avoid; }
  .md-table { font-size: 12px; }
}
