/* ============================================================
   泉德测试 - 温和治愈系视觉（v3）
   设计理念：低饱和莫兰迪配色 + 圆润字形 + 柔和光斑/微噪点背景
             + 大圆角卡片 + 呼吸感留白 + 细腻微动效
   ============================================================ */
@font-face {
  font-family: 'ZCOOL KuaiLe';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/zcool-kuaile.ttf') format('truetype');
}

:root {
  /* 温和莫兰迪配色 */
  --primary: #6f82d0;          /* 雾蓝（主色，比旧版更柔和） */
  --primary-dark: #5566b8;
  --primary-soft: #e9edfb;     /* 雾蓝浅底 */
  --accent: #e2a05a;           /* 暖杏（强调色） */
  --accent-soft: #fdf3e4;      /* 暖杏浅底 */
  --bg: #faf8f4;               /* 暖米白底 */
  --bg-deep: #f3efe8;
  --card: #ffffff;
  --text: #39415a;             /* 柔和的深蓝灰 */
  --text-strong: #2b3350;
  --muted: #8b93a7;
  --border: #ece7dd;           /* 暖灰边框 */
  --danger: #cf7d7d;
  --danger-soft: #fbefef;
  --ok: #6fa88c;
  --ok-soft: #e9f4ee;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(70, 80, 120, .05), 0 10px 28px rgba(70, 80, 120, .08);
  --shadow-hover: 0 4px 10px rgba(70, 80, 120, .08), 0 18px 40px rgba(70, 80, 120, .14);
  --font-title: 'ZCOOL KuaiLe', -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-body: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text); line-height: 1.7; font-size: 15px;
  min-height: 100vh;
}
/* 背景：柔和光斑（固定层）+ 微噪点 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(620px 420px at 12% 6%, rgba(240, 205, 150, .16), transparent 62%),
    radial-gradient(720px 480px at 88% 18%, rgba(130, 150, 225, .13), transparent 62%),
    radial-gradient(560px 420px at 55% 92%, rgba(214, 178, 214, .12), transparent 62%),
    linear-gradient(180deg, #fcfaf6 0%, var(--bg) 30%, var(--bg-deep) 100%);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
::selection { background: rgba(111, 130, 208, .25); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
#app { max-width: 860px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 顶栏：毛玻璃 ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(236, 231, 221, .8);
  padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
#btn-logout { margin-left: auto; }
.brand { font-family: var(--font-title); font-weight: 400; font-size: 18px; color: var(--primary-dark); display: flex; align-items: center; gap: 10px; letter-spacing: 1px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(135deg, #8fa0e0, #e8b98a);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; box-shadow: 0 3px 8px rgba(111, 130, 208, .35);
}
nav.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  border: none; background: none; padding: 8px 13px; font-size: 14px; color: var(--muted);
  border-radius: 12px; cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: background .2s, color .2s, transform .12s;
}
nav.tabs button.active { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(111, 130, 208, .35); font-weight: 600; }
nav.tabs button:hover { background: var(--primary-soft); color: var(--text-strong); }
nav.tabs button.active:hover { background: var(--primary-dark); color: #fff; }

main { flex: 1; padding: 20px 18px 32px; }
footer { padding: 20px 18px 26px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
  border: 1px solid rgba(236, 231, 221, .6);
  transition: box-shadow .25s, transform .25s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card h2 { font-size: 17px; margin-bottom: 10px; color: var(--text-strong); font-weight: 700; }
.card h3 { font-size: 15px; margin: 16px 0 8px; color: var(--text-strong); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 14px; padding: 11px 18px; font-size: 14.5px;
  cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, #7b8ede, var(--primary)); color: #fff;
  box-shadow: 0 4px 12px rgba(111, 130, 208, .28);
  transition: transform .12s, box-shadow .2s, opacity .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(111, 130, 208, .36); filter: brightness(1.03); }
.btn:active { transform: scale(.97); box-shadow: 0 2px 6px rgba(111, 130, 208, .25); }
.btn.secondary { background: var(--primary-soft); color: var(--primary-dark); box-shadow: none; }
.btn.secondary:hover { background: #dfe5f9; box-shadow: none; }
.btn.ghost { background: rgba(255,255,255,.7); color: var(--primary-dark); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { border-color: var(--primary); background: #fff; }
.btn.danger { background: linear-gradient(135deg, #d98d8d, var(--danger)); box-shadow: 0 4px 12px rgba(207, 125, 125, .28); }
.btn.warn { background: linear-gradient(135deg, #eeb77f, var(--accent)); color: #6b4815; box-shadow: 0 4px 12px rgba(226, 160, 90, .28); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 11px 13px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(111, 130, 208, .16);
}
textarea.input { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- 量表选择卡片 ---------- */
.scale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.scale-card {
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .2s, transform .15s, box-shadow .2s;
}
.scale-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.scale-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fffdf8, #fdf6ea);
  box-shadow: 0 0 0 3px rgba(226, 160, 90, .22), 0 8px 20px rgba(226, 160, 90, .12);
}
.scale-card.selected .title { color: #8a6a1a; }
.scale-card .title { font-weight: 600; font-size: 15px; color: var(--text-strong); }
.scale-card .desc { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.scale-card .tag {
  display: inline-block; font-size: 11px; background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 8px; padding: 2px 8px; margin-top: 10px;
}

/* ---------- 答题 ---------- */
.q-card { text-align: left; }
.q-num { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; letter-spacing: 1px; }
.q-stem { font-size: 17px; font-weight: 600; margin-bottom: 18px; color: var(--text-strong); line-height: 1.6; }
.opt-btn {
  display: block; width: 100%; text-align: left; border: 1.5px solid var(--border);
  background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 11px;
  font-size: 15px; cursor: pointer; font-family: inherit; color: var(--text); line-height: 1.6;
  transition: border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.opt-btn:hover { border-color: var(--primary); background: #fbfcff; transform: translateX(2px); }
.opt-btn.selected {
  border-color: var(--primary); background: linear-gradient(180deg, #f2f5ff, #e9edfb);
  box-shadow: 0 0 0 3px rgba(111, 130, 208, .14);
}
.opt-btn .pol {
  display: inline-block; font-size: 11px; font-weight: 700; background: var(--primary-soft);
  color: var(--primary-dark); border-radius: 8px; padding: 2px 8px; margin-right: 9px;
}
.ai-box {
  background: var(--accent-soft); border: 1px solid #f2dfc0; border-radius: 14px;
  padding: 13px 15px; margin-top: 14px; font-size: 14px; white-space: pre-wrap; line-height: 1.7;
}
.ai-box b { color: #8a6a1a; }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: #eee9df; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.progress > div {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #8fa0e0, var(--primary), var(--accent));
  transition: width .35s ease;
}

/* ---------- 结果 ---------- */
.type-badge {
  display: inline-block; font-size: 32px; font-weight: 400; letter-spacing: 4px;
  font-family: var(--font-title);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent; padding: 4px 0;
}
.strength-bar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sbar { flex: 1; min-width: 120px; background: var(--primary-soft); border-radius: 12px; padding: 9px 11px; font-size: 12.5px; }
.sbar .label { color: var(--muted); }
.sbar .val { font-weight: 700; color: var(--text-strong); }
.sbar .track { height: 6px; background: #dde2f5; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.sbar .track > div { height: 100%; background: linear-gradient(90deg, var(--primary), #9db0ea); border-radius: 3px; }

/* ---------- 报告渲染 ---------- */
.report { font-size: 14.5px; color: #33405e; line-height: 1.85; }
.report h1 {
  font-size: 21px; margin: 26px 0 12px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border); color: var(--primary-dark); font-family: var(--font-title); font-weight: 400;
}
.report h2 {
  font-size: 17px; margin: 22px 0 8px; color: var(--primary-dark);
  border-left: 4px solid var(--accent); padding-left: 11px; font-family: var(--font-title); font-weight: 400;
}
.report h3 { font-size: 15px; margin: 16px 0 6px; color: var(--text-strong); }
.report p { margin: 8px 0; }
.report ul, .report ol { margin: 8px 0 8px 24px; }
.report li { margin: 5px 0; }
.report blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 10px 14px; border-radius: 0 14px 14px 0; color: #6a5a2a; margin: 12px 0;
}
.report table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; box-shadow: 0 1px 4px rgba(70,80,120,.05); border-radius: 12px; overflow: hidden; }
.report th { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.report th, .report td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.report tr:nth-child(even) td { background: #fcfbf8; }
.report code { background: #f2f0ec; padding: 2px 7px; border-radius: 6px; font-size: 12.5px; color: #b3560f; }
.report strong { color: var(--text-strong); }

/* ---------- 维度表格 ---------- */
.dim-table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; box-shadow: 0 1px 4px rgba(70,80,120,.05); border-radius: 12px; overflow: hidden; }
.dim-table th { background: var(--primary-soft); color: var(--primary-dark); }
.dim-table th, .dim-table td { border: 1px solid var(--border); padding: 8px 11px; text-align: left; }
.dim-table tr:nth-child(even) td { background: #fcfbf8; }
.dim-table td .muted { font-size: 12px; }

/* ---------- 对话 ---------- */
.chat-box { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow-y: auto; padding: 6px 4px; }
.msg { max-width: 82%; padding: 12px 15px; border-radius: 18px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.7; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #7b8ede, var(--primary)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 4px 12px rgba(111, 130, 208, .25); }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: 0 2px 8px rgba(70,80,120,.05); }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input .input { flex: 1; }

/* ---------- 列表 ---------- */
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.pill { display: inline-block; font-size: 11.5px; border-radius: 20px; padding: 3px 11px; background: var(--primary-soft); color: var(--primary-dark); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--accent-soft); color: #8a6a1a; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(40, 48, 80, .35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 18px; animation: fadein .18s; }
.modal { background: #fff; border-radius: 22px; padding: 22px; max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(40, 48, 80, .25); animation: pop .22s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(43, 51, 80, .92); color: #fff; padding: 11px 20px; border-radius: 14px;
  font-size: 14px; z-index: 99; box-shadow: 0 10px 30px rgba(43, 51, 80, .3);
  backdrop-filter: blur(6px); animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 44px 12px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 10px; }

/* ---------- 加载 ---------- */
.loading { text-align: center; padding: 32px; color: var(--muted); }
.spinner {
  display: inline-block; width: 24px; height: 24px; border: 3px solid #e6e2d8;
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8d2c6; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c6bfb0; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 560px) {
  main { padding: 14px 12px 26px; }
  .row { flex-direction: column; gap: 8px; }
  .card { padding: 16px; }
}

/* ========== 结构化结果展示（v2） ========== */

/* 类型主卡片（Hero） */
.type-hero {
  background: linear-gradient(135deg, #6d7fd8 0%, #7f92e4 55%, #9db0ea 100%);
  border-radius: 22px; color: #fff; padding: 20px 20px 16px;
  position: relative; overflow: hidden; box-shadow: 0 10px 26px rgba(96, 115, 200, .3);
}
.type-hero::after {
  content: ''; position: absolute; right: -36px; top: -36px; width: 140px; height: 140px;
  border-radius: 50%; background: rgba(255, 255, 255, .13);
}
.type-hero::before {
  content: ''; position: absolute; left: -24px; bottom: -48px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255, 255, 255, .07);
}
.type-hero.other {
  background: linear-gradient(135deg, #e09a4e 0%, #e8ad6b 55%, #f2c08c 100%);
  box-shadow: 0 10px 26px rgba(224, 154, 78, .32);
}
.type-hero .letters { display: flex; gap: 8px; margin-bottom: 12px; position: relative; z-index: 1; }
.type-hero .letters span {
  flex: 1; text-align: center; font-size: 32px; font-weight: 400; letter-spacing: 1px; font-family: var(--font-title);
  background: rgba(255, 255, 255, .2); border-radius: 14px; padding: 10px 0;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.type-hero .who { font-size: 13px; font-weight: 600; opacity: .92; }
.type-hero .tname { font-size: 16px; font-weight: 700; margin-top: 3px; }
.type-hero .meta { font-size: 12px; opacity: .82; margin-top: 3px; }
.type-hero .strength-row { display: flex; gap: 7px; margin-top: 14px; position: relative; z-index: 1; }
.type-hero .s-cell { flex: 1; background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 7px; text-align: center; backdrop-filter: blur(2px); }
.type-hero .s-cell b { font-size: 12px; display: block; }
.type-hero .s-cell small { font-size: 10px; opacity: .88; }
.type-hero .s-cell .bar { height: 5px; background: rgba(255, 255, 255, .28); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.type-hero .s-cell .bar > div { height: 100%; background: #fff; border-radius: 3px; }

/* 两人对比网格 */
.vs-grid { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 10px; align-items: stretch; margin: 6px 0; }
.vs-mid { display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #c3c8d8; }
@media (max-width: 560px) { .vs-grid { grid-template-columns: 1fr; } .vs-mid { display: none; } }

/* 维度双条对比 */
.dim-dual { display: grid; grid-template-columns: 1fr 92px 1fr; gap: 8px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.dim-dual:last-child { border-bottom: none; }
.dim-dual .axis { text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.dim-dual .axis b { display: block; font-size: 13px; color: var(--text); }
.bar-track { display: flex; height: 24px; background: var(--primary-soft); border-radius: 12px; overflow: hidden; }
.bar-left { flex: 1; display: flex; align-items: center; justify-content: flex-start; padding-left: 8px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(90deg, #6d7fd8, #8fa0e0); border-radius: 12px 4px 4px 12px; white-space: nowrap; }
.bar-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(90deg, var(--accent), #f0bd8a); border-radius: 4px 12px 12px 4px; white-space: nowrap; }
.dim-dual .tag { text-align: center; font-size: 11px; }
.pill.same { background: var(--ok-soft); color: var(--ok); }
.pill.diff { background: var(--accent-soft); color: #a06f14; }

/* 对比结论框 */
.vs-summary { margin-top: 12px; padding: 13px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.75; }
.vs-summary.good { background: var(--ok-soft); border: 1px solid #cfe5d8; }
.vs-summary.mix { background: var(--accent-soft); border: 1px solid #f2dfc0; }
.vs-summary b { color: var(--primary-dark); }

/* 记录管理行 */
.rec-type { font-size: 12px; font-weight: 700; color: var(--primary-dark); background: var(--primary-soft); border-radius: 8px; padding: 2px 9px; }
.rec-del { color: var(--danger); font-size: 12.5px; background: none; border: none; cursor: pointer; text-decoration: underline; }
.rec-del:hover { opacity: .75; }

/* ========== 测试对象选择（选中态 + 当前对象指示） ========== */
.btn.selected,
.btn.selected.secondary {
  background: linear-gradient(135deg, #7b8ede, var(--primary)); color: #fff; font-weight: 600;
  box-shadow: 0 4px 14px rgba(111, 130, 208, .4);
  outline: 2px solid rgba(111, 130, 208, .4); outline-offset: 1px;
}
.target-status {
  margin-top: 12px; padding: 10px 15px; border-radius: 13px; font-size: 14px;
  background: var(--primary-soft); border: 1px solid #d4dbf3; color: var(--primary-dark);
  display: flex; align-items: center; gap: 8px;
}
.target-status .who { font-weight: 700; }
.target-status .hint { color: var(--muted); font-size: 12.5px; }

/* ========== 平票未定维度（?）的展示 ========== */
.type-hero .letters span.undet,
.type-hero .s-cell b.undet {
  background: rgba(255, 255, 255, .38);
  border: 1.5px dashed rgba(255, 255, 255, .9);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.undet-note {
  margin-top: 12px; padding: 9px 13px; border-radius: 10px; font-size: 12.5px; line-height: 1.65;
  background: rgba(255, 244, 220, .95); color: #7a5b10; border: 1px solid rgba(226, 160, 90, .5);
  position: relative; z-index: 1;
}

/* ========== 友善细节 ========== */
button:focus-visible, .btn:focus-visible, .opt-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }

/* ---------- 辅导老师头像与简介 ---------- */
.counselor-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 2.5px solid var(--primary-soft); box-shadow: 0 3px 10px rgba(70, 80, 120, .14);
  background: #eef0f7;
}
.counselor-avatar.no-photo {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #8b93a7; background: linear-gradient(135deg, var(--primary-soft), #f4f1ea);
}
.ellipsis {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; word-break: break-all;
}

/* ========== 移动端：折叠头部菜单（小窗口下 ☰ 抽屉） ========== */
.nav-toggle {
  display: none; align-items: center; gap: 6px;
  border: 1px solid rgba(236, 231, 221, .95); background: var(--card);
  color: var(--primary-dark); border-radius: 12px; padding: 7px 13px;
  font-size: 15px; cursor: pointer; font-family: inherit; line-height: 1;
  transition: background .18s, transform .12s;
}
.nav-toggle:hover { background: var(--primary-soft); }
.nav-toggle:active { transform: scale(.96); }
@media (max-width: 900px) {
  nav.tabs { display: none; }            /* 窄屏折叠横向菜单 */
  .nav-toggle { display: inline-flex; }
}
#nav-scrim {
  position: fixed; inset: 0; background: rgba(30, 28, 24, .36);
  z-index: 45; display: none; -webkit-tap-highlight-color: transparent;
}
.nav-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(80vw, 302px); background: #fff; overflow-y: auto;
  padding: 18px 16px 26px; display: flex; flex-direction: column;
  box-shadow: -10px 0 34px rgba(30, 28, 24, .16);
  transform: translateX(105%); transition: transform .22s ease;
}
.nav-drawer.open { transform: translateX(0); }
.nd-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; color: var(--text-strong); font-weight: 700;
  padding-bottom: 12px; border-bottom: 1px solid #f0e9dd;
}
.nd-close {
  border: none; background: var(--primary-soft); color: var(--primary-dark);
  width: 30px; height: 30px; border-radius: 10px; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
}
.nd-user { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.nd-list { display: flex; flex-direction: column; gap: 2px; }
.nd-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; padding: 11px 10px; border-radius: 12px;
  font-size: 15px; cursor: pointer; color: var(--text-strong);
  text-align: left; font-family: inherit; transition: background .15s;
}
.nd-item:hover { background: var(--primary-soft); }
.nd-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.nd-ico { width: 24px; text-align: center; flex-shrink: 0; }

/* ========== 工作台：所有主要功能入口网格 ========== */
.feat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}
.feat {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid rgba(236, 231, 221, .95); background: #fdfbf7;
  border-radius: 14px; padding: 13px 14px; cursor: pointer;
  font-family: inherit; text-align: left;
  transition: transform .12s, box-shadow .2s, border-color .2s;
}
.feat:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--primary-soft); }
.feat .fi { font-size: 23px; flex-shrink: 0; }
.feat .ft { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feat .fl { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.feat .fd { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
@media (max-width: 560px) {
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .feat { padding: 11px 12px; }
}

/* ========== 使用说明：折叠卡片（常用展开 / 不常用折叠） ========== */
.card.gg-card { margin-bottom: 10px; }
.gg-head {
  display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px;
  background: none; border: none; padding: 4px 2px; cursor: pointer; font-family: inherit;
  color: var(--text-strong); font-size: 15px; font-weight: 700; text-align: left;
}
.gg-head:hover { color: var(--primary-dark); }
.gg-head summary { list-style: none; }            /* details/summary 去掉默认三角 */
.gg-head summary::-webkit-details-marker { display: none; }
.gg-t { line-height: 1.6; }
.gg-a {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px; margin-left: auto;
  background: var(--primary-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.gg-body { padding-top: 6px; font-size: 14px; line-height: 1.9; color: var(--text); }
.gg-body p { margin: 6px 0; }
.gg-body ul, .gg-body ol { margin: 6px 0 8px; padding-left: 22px; }
.gg-body li { margin: 3px 0; }
.gg-body table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.gg-body th, .gg-body td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
.gg-body th { background: var(--primary-soft); color: var(--primary-dark); }
.gg-body code { background: #f4efe6; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; word-break: break-all; }
.gg-body .ex {
  background: #fffaf2; border: 1px solid #f0dfc0; border-radius: 10px;
  padding: 10px 13px; margin: 10px 0; font-size: 13px; line-height: 1.8;
}
.gg-body .ex b { color: #a06a00; }
.gg-img { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.gg-img img { width: 100%; display: block; }
@media (max-width: 560px) {
  .gg-body table { font-size: 12px; }
  .gg-body th, .gg-body td { padding: 5px 6px; }
}

/* ========== 青少年厌学拒学三维简式评估表（yanxue_16）：一页式填表（照 source HTML 版式） ========== */
.yx-page{max-width:880px;margin:0 auto;background:#fff;border-radius:16px;box-shadow:0 6px 28px rgba(20,60,58,.09);overflow:hidden;border:none}
.yx-head{background:linear-gradient(135deg,#2f6f6a,#46948a);color:#fff;padding:22px 28px}
.yx-head h1{font-size:20px;font-weight:700;margin:0}
.yx-head p{font-size:13px;opacity:.9;margin-top:6px}
.yx-body{padding:22px 28px 28px}
.yx-note{background:#eef7f5;border-left:4px solid #2f6f6a;padding:10px 14px;border-radius:8px;font-size:13.5px;color:#2c4a47;margin-bottom:16px}
.yx-meta{display:flex;flex-wrap:wrap;gap:10px 24px;margin-bottom:16px;font-size:14px;color:#4a5a59}
.yx-meta label{display:flex;align-items:center;gap:8px}
.yx-meta .val{border-bottom:1.5px solid #cfdedc;padding:2px 6px;min-width:64px;color:#22302f}
.yx-tip{font-size:13px;color:#5d6f6d;background:#f6faf9;border:1px dashed #cfdedc;border-radius:8px;padding:9px 14px;margin-bottom:14px;text-align:center}
/* 一页式填表的「表头信息」表单（学生姓名 / 年龄 / 年级 / 学校 / 家长姓名 / 填表人姓名）：可手填、必填带 * */
.yx-meta-form{align-items:flex-start;gap:12px 22px}
.yx-meta-form .yx-mf{display:flex;flex-direction:column;gap:4px;font-size:13.5px;color:#4a5a59}
.yx-meta-form .yx-mf .yx-req{color:#c0392b;font-style:normal;margin-left:3px}
.yx-meta-form .yx-mf input{border:1px solid #cfdedc;border-radius:8px;padding:6px 10px;font-size:14px;color:#22302f;background:#fff;min-width:210px;font-family:inherit}
.yx-meta-form .yx-mf input:focus{outline:none;border-color:#2f6f6a;box-shadow:0 0 0 3px rgba(47,111,106,.12)}
.yx-meta-form .yx-mf.bad input{border-color:#c0392b;background:#fff7f6}
.yx-meta-form > .muted{align-self:center}
.yx-dim{margin-bottom:20px}
.yx-dim h2{font-size:15.5px;color:#2f6f6a;font-weight:700;padding-bottom:8px;border-bottom:2px solid #e2efed;margin:0 0 2px;display:flex;flex-wrap:wrap;align-items:baseline;gap:10px}
.yx-dim h2 span{font-size:12.5px;font-weight:400;color:#7d8f8d}
.yx-q{display:flex;gap:16px;align-items:center;padding:10px 6px;border-bottom:1px solid #eef3f2}
.yx-q:last-child{border-bottom:none}
.yx-q:hover{background:#f8fbfa}
.yx-text{flex:1;font-size:14px;display:flex;gap:9px;line-height:1.55}
.yx-no{flex-shrink:0;width:22px;height:22px;border-radius:6px;background:#eef7f5;color:#2f6f6a;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;margin-top:1px}
.yx-opts{display:flex;gap:6px;flex-shrink:0}
.yx-opts label{cursor:pointer}
.yx-opts input{display:none}
.yx-opts i{display:flex;width:36px;height:36px;align-items:center;justify-content:center;border:1.5px solid #dbe6e4;border-radius:9px;font-style:normal;font-size:13px;color:#8a9a98;transition:.15s;font-weight:600}
.yx-opts label:hover i{border-color:#8fc4bb;color:#2f6f6a}
.yx-opts input:checked+i{background:#2f6f6a;border-color:#2f6f6a;color:#fff}
.yx-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-top:20px;padding-top:18px;border-top:1px solid #eef3f2}
.yx-progress{margin-left:auto;font-size:13px;color:#5d6f6d}
@media(max-width:640px){
  .yx-head,.yx-body{padding:18px}
  .yx-q{flex-direction:column;align-items:flex-start;gap:8px}
  /* 手机端（简式表家族一页式填表）：选项是数字方块，必须保持「圆润方框」。
     旧写法 .yx-opts i{width:100%;max-width:56px} 在窄屏会被压成又窄又高的「瘦长竖条」
     （高度固定 36px、宽度被压到 20px 左右）；2026-09-26 改为固定正方形尺寸（宽高同值 + min-width，
     不依赖百分比宽度），任何手机内核都稳定呈现方框；超窄屏再缩一档（见下方 360px 断点）。 */
  .yx-opts{width:100%;justify-content:space-between;gap:6px}
  .yx-opts label{flex:0 0 auto;display:flex}
  .yx-opts i{width:44px;height:44px;min-width:44px;border-radius:12px;font-size:14px}
}
@media(max-width:360px){
  .yx-opts{gap:4px}
  .yx-opts i{width:38px;height:38px;min-width:38px;border-radius:10px;font-size:13px}
}
@media print{ .yx-actions,.no-print{display:none!important} .yx-page{box-shadow:none} }


/* ========== 内部工作表（销售端初筛 / 辅导老师端深度评估）：一页式填表补充样式 ========== */
.yx-meta-block{background:#f6faf9;border:1px solid #e2efed;border-radius:12px;padding:14px 16px;margin-bottom:16px}
.yx-meta-block h3{margin:0 0 10px;font-size:15px;color:#2f6f6a}
.yx-meta-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px 16px}
.yx-meta-field{display:flex;flex-direction:column;gap:4px;font-size:13.5px;color:#4a5a59}
.yx-meta-field .input{font-size:13.5px}
.yx-progress-bar{height:6px;border-radius:99px;background:#e6f0ee;overflow:hidden;margin-top:6px}
.yx-progress-bar i{display:block;height:100%;border-radius:99px;background:#2f6f6a;transition:.2s}
.yx-q2{padding:10px 6px;border-bottom:1px solid #eef3f2}
.yx-q2:last-child{border-bottom:none}
.yx-q2:hover{background:#f8fbfa}
/* 内部工作表的选项：**纵向排列**（一行一个选项）、文字横向正常换行、按钮尺寸跟着文字走
   （此前的写法套用了 .yx-opts 的固定 36×36 小方块 + flex-wrap 横排，长选项文字被挤成一团）
   2026-09-18 补：容器不再带 .yx-opts，否则 .yx-opts input{display:none} 会把单选圆点隐藏掉；
   每行行首固定显示一个单选圆点/方框（单选=圆点，文字排在其后），字号收到 13px。 */
.yx-opts-wrap{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:6px;padding-left:30px;margin-top:6px}
.yx-opts-wrap .yx-opt-row{display:flex;align-items:center;gap:9px;width:100%;padding:5px 8px;border-radius:8px;font-size:13px;color:#4a5a59;cursor:pointer;line-height:1.5}
.yx-opts-wrap .yx-opt-row:hover{background:#f4faf8}
.yx-opts-wrap input[type=radio]{display:inline-block;appearance:auto;-webkit-appearance:radio;accent-color:#2f6f6a;width:15px;height:15px;flex:0 0 15px;margin:0;cursor:pointer}
.yx-opts-wrap i{display:inline-block;width:auto;height:auto;min-width:0;padding:4px 11px;border:1.5px solid #dbe6e4;border-radius:8px;background:#fff;
  font-style:normal;font-size:13px;font-weight:400;color:#4a5a59;line-height:1.5;white-space:normal;word-break:break-word}
.yx-opts-wrap .yx-opt-row:hover i{border-color:#8fc4bb;color:#2f6f6a}
.yx-opts-wrap input:checked+i{background:#2f6f6a;border-color:#2f6f6a;color:#fff;font-weight:600}
.yx-other,.yx-fill{margin:8px 0 0 30px;max-width:640px;font-size:13.5px}
/* ===== 辅导老师端记录表（家长访谈 / 孩子对谈 / 学校沟通）：选项一行排开 + 选项后就地补填 + 紧凑排版 ===== */
/* 2026-09-25 用户要求：「选项可以一行排的，不要用一列」「可以在选项后面填写的内容无需增加一题」 */
.yx-opts-wrap.compact{flex-direction:row;flex-wrap:wrap;align-items:center;gap:6px 8px;padding-left:30px;margin-top:4px}
.yx-opts-wrap.compact .yx-opt-row{width:auto;flex:0 1 auto;padding:3px 8px 3px 6px;gap:6px;font-size:12.5px;border:1px solid #e6efed;border-radius:9px;background:#fbfdfd}
.yx-opts-wrap.compact .yx-opt-row.on{border-color:#8fc4bb;background:#f1f9f7}
.yx-opts-wrap.compact i{padding:2px 8px;border:none;background:transparent;border-radius:0}
.yx-opts-wrap.compact input:checked+i{background:transparent;color:#2f6f6a;font-weight:700}
.yx-opts-wrap.compact .yx-opt-fill{flex:0 1 150px;min-width:96px;max-width:200px;margin:0 0 0 -2px;padding:3px 8px;font-size:12.5px;height:auto;border-radius:7px;align-self:center}
.yx-opt-fill{margin:2px 0 0 4px;padding:3px 8px;font-size:12.5px;max-width:220px}
/* 记录表整体更紧凑：题间距与标题收一点 */
.yx-compact .yx-q2{padding:6px 0;border-top:1px dashed #eef4f3}
.yx-compact .yx-dim{margin-top:10px}
.yx-compact .yx-text{font-size:13px;gap:6px}
@media(max-width:640px){ .yx-opts-wrap.compact{padding-left:0} .yx-opts-wrap.compact .yx-opt-fill{flex:1 1 100%} }
.yx-fill{width:calc(100% - 30px);min-height:56px}
.yx-crisis{border:1.5px solid #f3d6cf;border-radius:12px;padding:14px 16px;background:#fef9f7}
.yx-crisis h2{color:#c0392b;border-bottom-color:#f3d6cf}
.yx-crisis-intro{font-size:13px;color:#8a5a5a;background:#fff5f3;border-radius:8px;padding:8px 12px;margin:8px 0}
@media(max-width:640px){ .yx-opts-wrap{padding-left:0} .yx-other,.yx-fill{margin-left:0;width:100%} }

/* ========== 内部工作表：分页步骤条 / 预设提问（可改写） ========== */
.yx-steps{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 6px}
.yx-step{font:inherit;font-size:13px;padding:7px 12px;border-radius:9px;border:1.5px solid #cfe0de;background:#fff;color:#2f6f6a;cursor:pointer}
.yx-step:hover{border-color:#8fc4bb}
.yx-step.active{background:#2f6f6a;border-color:#2f6f6a;color:#fff;font-weight:700}
.yx-step.saved{border-color:#a6d9b8;background:#eaf7ef}
.yx-prompt{margin:8px 0 6px 30px}
.yx-prompt-label{font-size:12.5px;color:#5d6f6d;margin-bottom:4px}
.yx-prompt-input{width:calc(100% - 4px);min-height:52px;background:#f8fbfa}
@media(max-width:640px){ .yx-prompt{margin-left:0} }
