/* 问卷工具样式：移动优先，无外部资源依赖 */

:root {
  --bg: #f5f3ee;
  --card: #fffdfa;
  --ink: #1f2421;
  --ink-2: #3d443e;
  --muted: #6f7469;
  --line: #e4ded2;
  --line-2: #d5cfc1;
  --accent: #35604f;
  --accent-2: #4a7a64;
  --accent-soft: #e9f1ec;
  --danger: #a6392a;
  --warn-bg: #fdf3dc;
  --warn-br: #ecd9a8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 36, 33, .04), 0 12px 28px -18px rgba(31, 36, 33, .25);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191a;
    --card: #1d2220;
    --ink: #e8eae5;
    --ink-2: #d2d6cf;
    --muted: #9aa197;
    --line: #2c3330;
    --line-2: #3a423e;
    --accent: #7fb79c;
    --accent-2: #9acbb3;
    --accent-soft: #23342c;
    --danger: #e08877;
    --warn-bg: #3a3323;
    --warn-br: #5a4c2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -18px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1100px 520px at 50% -260px, rgba(53, 96, 79, .09), transparent 70%);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); }

h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 进度条 ---------- */
.pbar {
  position: fixed; inset: 0 0 auto 0; height: 3px; background: transparent; z-index: 40;
}
.pbar i {
  display: block; height: 100%; width: 0; background: var(--accent);
  transition: width .25s ease;
}

/* ---------- 首页 ---------- */
.landing, .done, .login {
  max-width: 720px; margin: 0 auto; padding: 12vh 20px 60px;
}
.landing { max-width: 820px; }

.kicker {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin: 0 0 14px;
}
.landing h1, .done h1, .login h1 {
  font-size: clamp(30px, 7vw, 46px); font-weight: 700; margin-bottom: 18px;
}
.lead { color: var(--ink-2); font-size: 16px; margin: 0 0 10px; max-width: 46em; }

.roles {
  display: grid; gap: 14px; margin: 34px 0 28px;
}
@media (min-width: 680px) {
  .roles { grid-template-columns: 1fr 1fr; gap: 18px; }
}
.role {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 20px 18px; box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.role:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.role:active { transform: translateY(0); }
.role .ico {
  display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px;
}
.role .ico svg { width: 24px; height: 24px; }
.role strong { display: block; font-size: 19px; margin-bottom: 6px; }
.role .desc { display: block; color: var(--muted); font-size: 14px; line-height: 1.55; }
.role em {
  display: block; margin-top: 14px; font-style: normal; font-size: 12px;
  letter-spacing: .04em; color: var(--accent); font-weight: 600;
}
.foot { color: var(--muted); font-size: 13px; margin-top: 26px; }

/* ---------- 表单 ---------- */
.form-page { padding-bottom: 0; }

.hero {
  max-width: 760px; margin: 0 auto; padding: 40px 20px 6px;
}
.hero h1 { font-size: clamp(26px, 5.6vw, 34px); margin: 8px 0 10px; }
.hero .meta {
  color: var(--muted); font-size: 13px; margin: 0 0 14px;
  letter-spacing: .02em;
}
.hero .lead { font-size: 15px; color: var(--ink-2); }
.hero .prog {
  margin: 18px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}

#survey { max-width: 760px; margin: 0 auto; padding: 0 20px 120px; }

.hp {
  position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}

.sec { margin-top: 26px; }
.sec-t {
  font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 600;
  text-transform: uppercase; margin: 0 0 10px; padding-left: 2px;
}

.q {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px; margin: 0 0 12px; box-shadow: var(--shadow);
  min-width: 0;
}
.q-error { border-color: var(--danger); }

.qhead {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  align-items: start; margin: 0 0 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.qno {
  min-width: 24px; height: 24px; text-align: center;
  font: 600 12px/24px var(--mono);
  color: var(--accent); background: var(--accent-soft); border-radius: 7px;
}
.qt { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.45; }
.tag {
  font-size: 11px; font-weight: 500; color: var(--muted);
  letter-spacing: .02em; white-space: nowrap; line-height: 24px; align-self: start;
}

.hint { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }

.opts { display: grid; gap: 8px; }
@media (min-width: 620px) {
  .opts { grid-template-columns: 1fr 1fr; }
  .q[data-kind="single"] .opts { grid-template-columns: 1fr 1fr; }
}

.opt {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  cursor: pointer; font-size: 15px; line-height: 1.45;
  transition: border-color .15s ease, background .15s ease;
}
.opt:hover { border-color: var(--line-2); }
.opt input {
  flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent);
  cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt .grp {
  display: inline-block; margin-left: 6px; font-style: normal; font-size: 11px;
  color: var(--muted); letter-spacing: .02em;
}

.other-input {
  margin: 8px 0 2px 0; width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; grid-column: 1 / -1;
}
.other-input:focus, textarea:focus, input[type="password"]:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
.other-input[hidden] { display: none; }

textarea {
  width: 100%; min-height: 96px; padding: 12px 14px; font: inherit; font-size: 15px;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; resize: vertical; line-height: 1.6;
}
textarea::placeholder { color: var(--muted); opacity: .75; }

.err {
  margin: 10px 0 0; font-size: 13px; color: var(--danger); font-weight: 500;
}

/* 矩阵题：每行一个指标，横行选项，窄屏自动换两列 */
.mx-row {
  display: grid; grid-template-columns: minmax(110px, 30%) 1fr;
  gap: 12px; align-items: center; padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.mx-row:first-child { padding-top: 2px; }
.mx-row:last-child { border-bottom: 0; }
.mx-label { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.mx-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mx-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px;
  font-size: 12.5px; line-height: 1.3; text-align: center; cursor: pointer;
  color: var(--muted); transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.mx-opt input {
  flex: none; appearance: none; -webkit-appearance: none; width: 14px; height: 14px; margin: 0;
  border: 1.5px solid var(--line-2); border-radius: 50%; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.mx-opt input:checked {
  border-color: var(--accent); background: var(--accent);
  box-shadow: inset 0 0 0 2.5px var(--card);
}
.mx-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mx-opt:hover { border-color: var(--accent-2); }
@media (max-width: 620px) {
  .mx-row { grid-template-columns: 1fr; gap: 7px; padding: 11px 0; }
  .mx-opts { grid-template-columns: repeat(2, 1fr); }
  .mx-opt { padding: 10px 8px; font-size: 13px; }
}

/* 提交条：浮在底部的小卡片 */
.submitbar {
  position: sticky; bottom: 12px; z-index: 20;
  margin: 18px 0 12px; padding: 12px 14px 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px -14px rgba(31, 36, 33, .38);
}
.submitbar .btn.primary { width: 100%; }
.submitbar .tiny { margin: 8px 0 0; }
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 12px;
  padding: 13px 22px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center; line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn.primary { background: var(--accent); color: #fff; width: 100%; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost {
  background: transparent; color: var(--accent); border-color: var(--line-2); width: auto;
}
.btn.ghost:hover { border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 9px; }
.tiny { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* 浮层提示 */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); z-index: 60;
  background: #23282a; color: #f6f4ef; font-size: 14px; line-height: 1.4;
  padding: 10px 16px; border-radius: 999px; max-width: calc(100vw - 40px);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-color-scheme: dark) {
  .toast { background: #eef1ec; color: #1b1f1c; }
}

.noticedraft {
  max-width: 760px; margin: 14px auto 0; padding: 11px 16px;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 12px;
  font-size: 14px; color: var(--ink-2);
}
.noticedraft a { margin-left: 6px; }

.notice {
  max-width: 760px; margin: 14px auto 0; padding: 12px 16px;
  background: var(--warn-bg); border: 1px solid var(--warn-br); border-radius: 12px;
  font-size: 14px; color: var(--ink-2);
}

/* ---------- 完成页 ---------- */
.done { text-align: left; }
.tick {
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
}
.tick svg { width: 28px; height: 28px; }

/* ---------- 登录 ---------- */
.login { max-width: 380px; padding-top: 18vh; }
.login form { margin-top: 8px; }
.field { display: block; margin: 18px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="password"] {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}

/* ---------- 后台 ---------- */
.admin-page { background: var(--bg); }
.anav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 0 16px; min-height: 54px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.anav .brand { font-weight: 700; margin-right: 14px; font-size: 15px; }
.anav a {
  text-decoration: none; color: var(--muted); font-size: 14px; padding: 6px 10px;
  border-radius: 8px;
}
.anav a:hover { background: var(--accent-soft); color: var(--accent); }
.anav a.on { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.anav .sp { flex: 1; }
.anav .out { color: var(--muted); }

.admin { max-width: 980px; margin: 0 auto; padding: 26px 16px 64px; }
.admin.narrow { max-width: 780px; }

.atop {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.atitle { flex: 1; min-width: 0; }
.atop h1 { font-size: 24px; }
.atop .sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.atop .btn { margin-left: auto; align-self: center; }
.atop .exps { margin-left: auto; display: flex; gap: 8px; align-self: center; }

table.list {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  font-size: 15px;
}
table.list thead th {
  text-align: left; font-size: 12px; letter-spacing: .06em; color: var(--muted);
  font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: var(--accent-soft); }
table.list .act { text-align: right; }
table.list .act a { text-decoration: none; font-weight: 600; font-size: 14px; }
.mono { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; letter-spacing: .02em;
}
.badge.coach { background: #f3e7d2; color: #8a5a17; }
.badge.client { background: #dfeee5; color: #2e6047; }
@media (prefers-color-scheme: dark) {
  .badge.coach { background: #3d2f1b; color: #e0b878; }
  .badge.client { background: #22372c; color: #93c8ac; }
}

.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 20px; font-size: 14px; }
.pager a { text-decoration: none; }
.pager span { color: var(--muted); }

.empty {
  padding: 48px 20px; text-align: center; color: var(--muted);
  background: var(--card); border: 1px dashed var(--line-2); border-radius: 12px;
}

.back { margin: 0 0 10px; font-size: 14px; }
.back a { text-decoration: none; color: var(--muted); }
.back a:hover { color: var(--accent); }

.dsec { margin-top: 26px; }
.dsec h2 {
  font-size: 12px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase;
  margin-bottom: 10px;
}
.qa {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.qq { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.aa { margin: 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.aa.muted { color: var(--muted); }
.mrow { display: flex; gap: 10px; justify-content: space-between; margin: 0 0 2px; font-size: 14px; }
.mrow em { font-style: normal; color: var(--accent); font-weight: 600; }
.del { margin-top: 26px; }

.switcher { display: flex; gap: 8px; margin-bottom: 18px; }
.switcher a {
  text-decoration: none; font-size: 14px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.switcher a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.stq { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.strow { margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.stlabel { font-weight: 600; }
.bar-row {
  display: grid; grid-template-columns: minmax(96px, 34%) 1fr 72px;
  gap: 10px; align-items: center; padding: 3px 0; font-size: 13px;
}
.bar-row .bl { color: var(--ink-2); line-height: 1.4; }
.bar-row .bt { display: block; height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-row .bt i { display: block; height: 100%; background: var(--accent-2); border-radius: 999px; }
.bar-row .bn {
  font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums;
}
.bar-row .bn em { font-style: normal; display: inline-block; min-width: 34px; color: var(--ink-2); }
.quotes { margin: 6px 0 0; padding-left: 16px; border-left: 2px solid var(--line-2); }
.quotes li { margin: 8px 0; font-size: 14px; white-space: pre-wrap; }

@media (max-width: 560px) {
  .bar-row { grid-template-columns: minmax(84px, 40%) 1fr 62px; font-size: 12px; }
  .hero { padding-top: 30px; }
  .q { padding: 15px 14px 16px; }
  table.list { font-size: 14px; }
  table.list thead th:nth-child(4), table.list td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
