/* =====================================================================
   小垚问卷 v3 · 全局样式（浅色 · 精致版）
   设计要点：柔和中性底色 + 渐变主色 + 分层阴影 + 细腻微交互
   兼容性：不使用 color-mix() / :has() / CSS 嵌套（兼容微信 X5 内核）
   ===================================================================== */

/* ===== 设计令牌 ===== */
:root {
  --bg: #f5f7fb;
  --bg-2: #eef2f9;
  --card: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e8edf4;
  --border-2: #dbe3ee;
  --primary: #3b5bfd;
  --primary-2: #6d5cf7;
  --primary-soft: #eef2ff;
  --primary-ink: #2f4bd8;
  --primary-grad: linear-gradient(135deg, #4f7cf7 0%, #6d5cf7 100%);
  --danger: #e11d48;
  --danger-soft: #fff1f4;
  --ok: #0f9d58;
  --ok-soft: #ecfdf5;
  --warn: #c2740a;
  --warn-soft: #fff8eb;

  --radius-xl: 20px;
  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 9px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 24px -14px rgba(15, 23, 42, .22);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, .05), 0 18px 38px -18px rgba(15, 23, 42, .26);
  --shadow-lg: 0 32px 64px -24px rgba(15, 23, 42, .34), 0 2px 6px rgba(15, 23, 42, .06);
  --ring: 0 0 0 4px rgba(79, 124, 247, .16);
  --ease: cubic-bezier(.32, .72, .24, 1);
}

/* 主题色（填写页 / 后台可用） */
body[data-theme="blue"]   { --primary:#3b5bfd; --primary-2:#6d5cf7; --primary-soft:#eef2ff; --primary-ink:#2f4bd8; --primary-grad:linear-gradient(135deg,#4f7cf7,#6d5cf7); }
body[data-theme="teal"]   { --primary:#0e9384; --primary-2:#0ea5e9; --primary-soft:#ecfdf7; --primary-ink:#0b7768; --primary-grad:linear-gradient(135deg,#12b3a0,#0ea5e9); }
body[data-theme="purple"] { --primary:#7c4dff; --primary-2:#c04ce0; --primary-soft:#f6f1ff; --primary-ink:#6733e0; --primary-grad:linear-gradient(135deg,#8b5cf6,#c04ce0); }
body[data-theme="orange"] { --primary:#e8610c; --primary-2:#f0a020; --primary-soft:#fff5ec; --primary-ink:#c24f08; --primary-grad:linear-gradient(135deg,#f97316,#f0a020); }
body[data-theme="green"]  { --primary:#12965a; --primary-2:#84b81a; --primary-soft:#eefbf3; --primary-ink:#0c7a48; --primary-grad:linear-gradient(135deg,#17b26a,#84b81a); }

/* ===== 基础 ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background-color: #f1f5fc;
  background-image:
    /* 顶部双主光晕 */
    radial-gradient(1150px 560px at 10% -10%, rgba(79, 124, 247, .34), transparent 62%),
    radial-gradient(980px 520px at 92% -6%, rgba(139, 92, 246, .30), transparent 60%),
    /* 底部次光晕 */
    radial-gradient(940px 540px at 86% 106%, rgba(14, 165, 233, .24), transparent 62%),
    radial-gradient(820px 460px at 2% 104%, rgba(16, 185, 129, .20), transparent 62%),
    /* 细网点纹理 */
    radial-gradient(rgba(15, 23, 42, .06) 1px, transparent 1.2px);
  background-size: auto, auto, auto, auto, 24px 24px;
  background-attachment: fixed, fixed, fixed, fixed, scroll;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px; line-height: 1.65; letter-spacing: .002em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-ink); text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; color: var(--text); }
::selection { background: rgba(79, 124, 247, .18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3dbe8; border-radius: 999px; border: 2.5px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bcc7d8; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid rgba(79, 124, 247, .55); outline-offset: 2px; }
html.noanim *, html.noanim *::before, html.noanim *::after { animation: none !important; transition: none !important; }
.hidden { display: none !important; }

/* ===== 通用控件 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: #fff; color: var(--text-2);
  font-weight: 550; font-size: 13.5px; line-height: 1.3; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: transform .14s var(--ease), box-shadow .18s var(--ease), border-color .16s, background .16s, color .16s;
}
.btn:hover { border-color: #b9c6f5; color: var(--primary-ink); background: #fdfdff; box-shadow: 0 4px 14px -6px rgba(15, 23, 42, .22); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn-primary {
  background: var(--primary-grad); border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(63, 92, 240, .75), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { color: #fff; background: var(--primary-grad); filter: brightness(1.06) saturate(1.02); box-shadow: 0 10px 24px -10px rgba(63, 92, 240, .85); transform: translateY(-1.5px); }
.btn-danger { color: var(--danger); border-color: #f6ccd6; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #eda2b4; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; box-shadow: none; }
.btn-sm { padding: 5.5px 11px; font-size: 12.5px; border-radius: var(--radius-xs); gap: 5px; }
.btn-lg { padding: 13px 30px; font-size: 15.5px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn .ic { font-size: 14px; line-height: 1; }

.input, .textarea, .select {
  width: 100%; padding: 9.5px 13px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); background: #fff; outline: none;
  transition: border-color .16s, box-shadow .18s, background .16s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .textarea:hover, .select:hover { border-color: #c6d0e2; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: var(--ring); background: #fff; }
.input:read-only { background: var(--surface-2); color: var(--text-2); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.65; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 550; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.7; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-draft { background: var(--surface-3); color: #64748b; }
.badge-published { background: var(--ok-soft); color: #0b8a4b; }
.badge-closed { background: var(--danger-soft); color: #d81f47; }
.hr { height: 1px; background: var(--border); border: 0; margin: 14px 0; }
.section-title { font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 20px;
  background-color: #eef3fd;
  background-image:
    radial-gradient(1200px 620px at 6% -12%, rgba(79, 124, 247, .38), transparent 60%),
    radial-gradient(1000px 560px at 96% 4%, rgba(139, 92, 246, .30), transparent 58%),
    radial-gradient(900px 620px at 82% 112%, rgba(14, 165, 233, .26), transparent 60%),
    radial-gradient(780px 480px at 8% 104%, rgba(16, 185, 129, .20), transparent 60%),
    radial-gradient(rgba(15, 23, 42, .05) 1px, transparent 1.3px);
  background-size: auto, auto, auto, auto, 26px 26px;
  position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ""; position: absolute; inset: -30% -10% auto -10%; height: 70%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .8), transparent);
  pointer-events: none;
}
.login-card {
  position: relative; width: 100%; max-width: 396px; background: rgba(255, 255, 255, .96);
  border-radius: var(--radius-xl); padding: 40px 34px 32px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .9);
  animation: cardIn .34s var(--ease);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 64px; height: 64px; margin-bottom: 20px;
  filter: drop-shadow(0 16px 24px rgba(76, 54, 240, .32));
}
.login-logo svg { display: block; width: 100%; height: 100%; }
.login-card h1 { font-size: 23px; margin-bottom: 6px; letter-spacing: -.01em; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.login-card .input { padding: 11px 14px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.auth-switch a { font-weight: 600; cursor: pointer; }
.auth-switch span.sep { color: var(--border-2); margin: 0 8px; }
.login-err, .auth-err {
  background: var(--danger-soft); color: #c81e42; border: 1px solid #f7d0da;
  border-radius: var(--radius-sm); padding: 9px 13px; font-size: 13px; margin-bottom: 14px;
}

/* ===== 密保 / 额度 相关 ===== */
.secq-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 6px;
}
.secq-box .label { margin-bottom: 8px; }
.secq-row { margin-bottom: 10px; }
.secq-row .secq-q { width: 100%; margin-bottom: 6px; }
.secq-row .secq-a { width: 100%; }
.secq-box .btn-block { margin-top: 2px; }
#card-forgot .fg-who {
  background: var(--primary-soft); color: var(--primary-ink); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 16px;
}
#card-forgot .label { margin-top: 10px; }
.sec-title { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; color: var(--text-2); }

.quota-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
  font-size: 13px; color: var(--text-2);
  box-shadow: var(--shadow-xs);
}
.quota-bar.danger { background: var(--danger-soft); border-color: #f7d0da; color: #b91c40; }
.quota-bar .qi { font-size: 15px; }
.quota-bar .sep { color: var(--border-2); }
.quota-bar b { color: var(--text); }
.quota-bar.danger b { color: #b91c40; }

@media (max-width: 720px) {
  .quota-bar { font-size: 12.5px; }
}

/* ===== 后台布局 ===== */
.topbar {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(232, 237, 244, .9);
  padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 8px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 16.5px; margin-right: 14px; letter-spacing: -.02em; }
.topbar .brand .dot {
  width: 34px; height: 34px; border-radius: 10px;
  filter: drop-shadow(0 8px 14px rgba(76, 54, 240, .28));
}
.topbar .brand .dot svg { display: block; width: 100%; height: 100%; }
.topbar .nav-btn {
  border: 1px solid transparent; background: transparent; color: var(--muted); padding: 7px 13px;
  border-radius: 999px; font-size: 13.5px; font-weight: 550; transition: all .16s var(--ease);
  text-decoration: none;
}
.topbar .nav-btn:hover { background: var(--surface-3); color: var(--text-2); }
.topbar .nav-btn.on { background: var(--primary-soft); color: var(--primary-ink); font-weight: 650; }
.topbar .nav-group { display: flex; align-items: center; gap: 4px; }
.topbar .spacer { flex: 1; }
#whoami {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: var(--text-2); font-weight: 550; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#whoami::before {
  content: ""; width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236d7ef7'/%3E%3Cstop offset='1' stop-color='%235b3df5'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='240' height='240' rx='58' fill='url(%23g)'/%3E%3Crect x='48' y='44' width='144' height='152' rx='28' fill='%23fff'/%3E%3Crect x='76' y='82' width='34' height='34' rx='10' fill='%235b3df5'/%3E%3Cpath d='M84 99l8 8.5 16-19' fill='none' stroke='%23fff' stroke-width='7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.page { max-width: 1140px; margin: 0 auto; padding: 28px 24px 96px; animation: pageIn .28s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 23px; letter-spacing: -.025em; }
.page-head .spacer { flex: 1; }
.page-head .sub { color: var(--muted); font-size: 13px; padding-bottom: 3px; }

/* ===== 卡片 / 问卷列表 ===== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.survey-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 14px; box-shadow: var(--shadow); transition: all .2s var(--ease);
  display: flex; flex-direction: column; gap: 11px; position: relative; overflow: hidden;
}
.survey-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--primary-grad); opacity: .35; transition: opacity .2s;
}
.survey-card::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 140px; height: 140px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(79, 124, 247, .10), transparent);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.survey-card:hover { border-color: #cdd9f7; transform: translateY(-4px); box-shadow: var(--shadow-md); }
.survey-card:hover::before { opacity: 1; }
.survey-card:hover::after { opacity: 1; }
.survey-card.st-published::before { opacity: 1; background: linear-gradient(90deg, #10b981, #34d399); }
.survey-card.st-closed::before { opacity: 1; background: linear-gradient(90deg, #f43f5e, #fb7185); }
.survey-card .t { font-weight: 650; font-size: 15.5px; line-height: 1.45; word-break: break-word; letter-spacing: -.01em; }
.survey-card .meta { display: flex; gap: 8px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.survey-card .meta > span {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 9px; font-variant-numeric: tabular-nums;
}
.survey-card .meta b { color: var(--primary-ink); }
.survey-card .acts { display: flex; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.survey-card .acts .btn { box-shadow: none; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(218px, 1fr)); gap: 13px; }
.tpl-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; transition: all .18s var(--ease); text-align: left; box-shadow: var(--shadow-xs);
}
.tpl-card:hover { border-color: #cdd9f7; background: linear-gradient(180deg, #fff, var(--primary-soft)); transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl-card .ico { font-size: 26px; line-height: 1; }
.tpl-card .nm { font-weight: 650; margin-top: 10px; font-size: 14.5px; }
.tpl-card .ds { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.6; }

.empty { text-align: center; padding: 66px 20px; color: var(--muted); }
.empty .big {
  font-size: 34px; margin: 0 auto 16px; width: 84px; height: 84px; border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fff, var(--surface-2)); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.empty .empty-t { font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

/* ===== 编辑器 ===== */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 328px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .editor-layout { grid-template-columns: 1fr; } }
.editor-side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 14px; }

.page-block { margin-bottom: 16px; }
.page-block-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 12px;
  background: linear-gradient(180deg, #fff, var(--surface-2));
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.page-block-head .pt {
  flex: 1; border: none; background: transparent; outline: none; font-weight: 650; font-size: 14px; padding: 2px 0; color: var(--text-2);
}
.page-block-head .pt::placeholder { color: var(--muted-2); font-weight: 500; }

.q-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); position: relative;
  transition: box-shadow .2s var(--ease), border-color .18s, transform .18s var(--ease);
}
.q-card::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary-grad); opacity: 0; transition: opacity .18s;
}
.q-card:hover { border-color: #d7e0f2; box-shadow: var(--shadow-md); }
.q-card:hover::before { opacity: .85; }
.q-card.dragging { opacity: .4; }
.q-card.drop-target { border-color: var(--primary); box-shadow: var(--ring); }
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-index {
  min-width: 25px; height: 25px; padding: 0 6px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary-ink);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
  font-variant-numeric: tabular-nums;
}
.q-type-sel {
  border: 1px solid var(--border-2); border-radius: 8px; padding: 4px 9px; font-size: 12.5px;
  background: var(--surface-2); color: var(--muted); outline: none; cursor: pointer; transition: all .15s;
}
.q-type-sel:hover { border-color: #c6d0e2; color: var(--text-2); background: #fff; }
.q-title-input {
  flex: 1; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px;
  font-weight: 600; font-size: 14.5px; outline: none; background: transparent; min-width: 0; color: var(--text);
}
.q-title-input:hover { border-color: var(--border); background: var(--surface-2); }
.q-title-input:focus { border-color: var(--primary); background: #fff; box-shadow: var(--ring); }
.q-tools { display: flex; gap: 2px; flex: none; }
.q-tools button {
  border: none; background: transparent; color: var(--muted-2); padding: 5px 7px; border-radius: 7px; font-size: 13px; line-height: 1;
  transition: all .14s;
}
.q-tools button:hover { background: var(--surface-3); color: var(--text); }
.q-tools button.del:hover { background: var(--danger-soft); color: var(--danger); }

.opt-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.opt-dot { width: 15px; height: 15px; border: 1.8px solid var(--border-2); border-radius: 50%; flex: none; background: #fff; }
.opt-dot.sq { border-radius: 5px; }
.opt-input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; outline: none;
  background: var(--surface-2); min-width: 0; transition: all .15s;
}
.opt-input:hover { background: #fff; border-color: var(--border-2); }
.opt-input:focus { border-color: var(--primary); background: #fff; box-shadow: var(--ring); }
.opt-acts { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity .16s; }
.opt-row:hover .opt-acts { opacity: 1; }
.opt-acts button { border: none; background: transparent; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: 12px; line-height: 1; }
.opt-acts button:hover { background: var(--surface-3); color: var(--text); }
.add-opt {
  border: 1.5px dashed var(--border-2); background: transparent; color: var(--muted);
  padding: 7px 11px; border-radius: 9px; font-size: 13px; width: 100%; margin-top: 3px; transition: all .16s;
}
.add-opt:hover { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-soft); border-style: solid; }

.q-foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; }
.switch input { display: none; }
.switch .track { width: 36px; height: 21px; border-radius: 999px; background: #cfd8e6; position: relative; transition: background .2s var(--ease); flex: none; }
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
}
.switch:hover .track { background: #c2cddd; }
.switch input:checked + .track { background: var(--primary-grad); }
.switch input:checked + .track::after { transform: translateX(15px); }

.q-extra { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.logic-panel { margin-top: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 13px; }
.logic-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.logic-row select { border: 1px solid var(--border-2); border-radius: 8px; padding: 4px 7px; background: #fff; outline: none; max-width: 190px; }
.mrow-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 13px; margin-top: 10px; background: var(--surface-2); }

/* ===== 统计 ===== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 13px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease);
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px;
  background: var(--primary-grad); opacity: .85;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .k, .stat-card .l { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-card .v, .stat-card .n {
  font-size: 26px; font-weight: 750; margin-top: 4px; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.25; color: var(--text);
}
.stat-card .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.stat-q { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.stat-q .qt { font-weight: 650; font-size: 14.5px; margin-bottom: 3px; }
.stat-q .qs { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.opt-bar { margin-bottom: 11px; }
.opt-bar .lb { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.opt-bar .lb .nm { word-break: break-word; color: var(--text-2); }
.opt-bar .lb .vl { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.opt-bar .tr { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.opt-bar .fl { height: 100%; border-radius: 999px; background: var(--primary-grad); transition: width .6s var(--ease); box-shadow: 0 0 10px -2px rgba(79, 124, 247, .6); }

.mx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mx-table th, .mx-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; }
.mx-table th { background: var(--surface-2); font-weight: 600; color: var(--text-2); }
.mx-table tbody tr:hover td { background: #fbfcfe; }
.mx-table td:first-child, .mx-table th:first-child { text-align: left; font-weight: 550; }

.img-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.img-grid a { display: block; border-radius: 12px; }
.img-grid img {
  width: 94px; height: 94px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); box-shadow: var(--shadow-xs); transition: transform .18s var(--ease), box-shadow .18s;
}
.img-grid img:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }

.text-list { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.text-list .it { padding: 9px 13px; border-bottom: 1px solid var(--border); font-size: 13px; transition: background .14s; }
.text-list .it:last-child { border-bottom: none; }
.text-list .it:hover { background: var(--surface-2); }

.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 92px; padding: 6px 0; }
.mini-chart .bar { flex: 1; background: var(--surface-3); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.mini-chart .bar span { position: absolute; inset: auto 0 0 0; background: var(--primary-grad); border-radius: 4px 4px 0 0; display: block; }

/* ===== 数据表 ===== */
.table-wrap {
  overflow: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow);
}
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 10px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th {
  background: rgba(248, 250, 252, .96);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .02em;
  position: sticky; top: 0; white-space: nowrap; z-index: 1;
}
table.data tbody tr { transition: background .14s; }
table.data tbody tr:hover td { background: #fbfcfe; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td { max-width: 320px; word-break: break-word; color: var(--text-2); }
table.data td b { color: var(--text); }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s ease;
  -webkit-backdrop-filter: blur(6px) saturate(120%); backdrop-filter: blur(6px) saturate(120%);
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--radius-xl); width: 100%; max-width: 470px;
  box-shadow: var(--shadow-lg); animation: popIn .22s var(--ease); max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide { max-width: 820px; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }
.modal-head {
  padding: 20px 24px 14px; font-size: 16.5px; font-weight: 700; letter-spacing: -.015em;
  border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fff, #fcfdff);
}
.modal-body { padding: 18px 24px; overflow: auto; }
.modal-foot {
  padding: 14px 24px; display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border); background: var(--surface-2);
}

/* ===== toast ===== */
#toast-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(15, 23, 42, .93); color: #fff; padding: 10px 20px 10px 16px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: toastIn .24s var(--ease); max-width: 90vw; text-align: center;
  display: inline-flex; align-items: center; gap: 9px; font-weight: 550;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.toast::before { content: "•"; font-size: 22px; line-height: 0; }
.toast.err { background: rgba(190, 18, 60, .95); }
.toast.ok { background: rgba(5, 138, 88, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96) } to { opacity: 1; transform: none } }

/* ===== 填写页 ===== */
.fill-body {
  background-color: #f1f5fc;
  background-image:
    radial-gradient(1100px 560px at 50% -18%, rgba(79, 124, 247, .30), transparent 60%),
    radial-gradient(900px 520px at 100% 4%, rgba(139, 92, 246, .20), transparent 60%),
    radial-gradient(820px 520px at 0% 30%, rgba(14, 165, 233, .16), transparent 62%),
    radial-gradient(760px 460px at 90% 100%, rgba(16, 185, 129, .16), transparent 62%),
    radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1.2px);
  background-size: auto, auto, auto, auto, 24px 24px;
  background-attachment: fixed, fixed, fixed, fixed, scroll;
  min-height: 100vh;
}
/* 填写页背景跟随问卷主题 */
body.fill-body[data-theme="teal"] {
  background-image:
    radial-gradient(1100px 560px at 50% -18%, rgba(14, 147, 132, .32), transparent 60%),
    radial-gradient(900px 520px at 100% 4%, rgba(14, 165, 233, .22), transparent 60%),
    radial-gradient(820px 520px at 0% 30%, rgba(20, 184, 166, .16), transparent 62%),
    radial-gradient(760px 460px at 90% 100%, rgba(16, 185, 129, .16), transparent 62%),
    radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1.2px);
}
body.fill-body[data-theme="purple"] {
  background-image:
    radial-gradient(1100px 560px at 50% -18%, rgba(124, 77, 255, .32), transparent 60%),
    radial-gradient(900px 520px at 100% 4%, rgba(192, 76, 224, .22), transparent 60%),
    radial-gradient(820px 520px at 0% 30%, rgba(139, 92, 246, .16), transparent 62%),
    radial-gradient(760px 460px at 90% 100%, rgba(217, 70, 239, .14), transparent 62%),
    radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1.2px);
}
body.fill-body[data-theme="orange"] {
  background-image:
    radial-gradient(1100px 560px at 50% -18%, rgba(232, 97, 12, .30), transparent 60%),
    radial-gradient(900px 520px at 100% 4%, rgba(240, 160, 32, .22), transparent 60%),
    radial-gradient(820px 520px at 0% 30%, rgba(249, 115, 22, .15), transparent 62%),
    radial-gradient(760px 460px at 90% 100%, rgba(245, 158, 11, .15), transparent 62%),
    radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1.2px);
}
body.fill-body[data-theme="green"] {
  background-image:
    radial-gradient(1100px 560px at 50% -18%, rgba(18, 150, 90, .30), transparent 60%),
    radial-gradient(900px 520px at 100% 4%, rgba(132, 184, 26, .22), transparent 60%),
    radial-gradient(820px 520px at 0% 30%, rgba(5, 150, 105, .16), transparent 62%),
    radial-gradient(760px 460px at 90% 100%, rgba(16, 185, 129, .15), transparent 62%),
    radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1.2px);
}
.fill-wrap { max-width: 660px; margin: 0 auto; padding: 28px 18px 76px; }
.fill-head {
  position: relative; background: #fff; border-radius: var(--radius-xl); padding: 30px 26px 26px;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); overflow: hidden; margin-bottom: 18px;
  animation: pageIn .3s var(--ease);
}
.fill-head::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--primary-grad);
}
.fill-head::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(79, 124, 247, .13), transparent); pointer-events: none;
}
.fill-head h1 { font-size: 22px; line-height: 1.42; word-break: break-word; letter-spacing: -.02em; }
.fill-head .d { color: var(--muted); margin-top: 11px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.75; }
.fill-head .tag {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 15px; font-size: 12px; color: var(--primary-ink);
  background: var(--primary-soft); padding: 4px 12px; border-radius: 999px; font-weight: 600;
}

.progress-bar { height: 6px; background: #e6ebf4; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-bar > i { display: block; height: 100%; background: var(--primary-grad); width: 0; transition: width .4s var(--ease); border-radius: 999px; box-shadow: 0 0 12px -2px rgba(79, 124, 247, .7); }

.fill-page-title { font-weight: 650; font-size: 16px; margin: 8px 0 14px; color: var(--primary-ink); display: flex; align-items: center; gap: 9px; }
.fill-page-title::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--primary-grad); }

.fq {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 14px;
  transition: box-shadow .2s var(--ease), border-color .2s;
  animation: pageIn .3s var(--ease);
}
.fq:hover { border-color: #dfe6f4; }
.fq .fq-title { font-weight: 650; font-size: 15.5px; line-height: 1.6; word-break: break-word; letter-spacing: -.01em; }
.fq .fq-title .req { color: var(--danger); margin-left: 3px; }
.fq .fq-title .ftype {
  font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 9px;
  background: var(--surface-3); padding: 2.5px 9px; border-radius: 999px; vertical-align: 1px; white-space: nowrap;
}
.fq .fq-desc { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.7; }
.fq .fq-body { margin-top: 15px; }
.fq .fq-body .input, .fq .fq-body .textarea { background: var(--surface-2); }
.fq .fq-body .input:focus, .fq .fq-body .textarea:focus { background: #fff; }
.fq.error { border-color: #f3b7c4; box-shadow: 0 0 0 4px rgba(225, 29, 72, .10), var(--shadow); }
.fq .err-msg { color: var(--danger); font-size: 12.5px; margin-top: 9px; font-weight: 550; }

.choice {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px; border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 9px; cursor: pointer; transition: all .16s var(--ease); background: #fff;
}
.choice:hover { border-color: #c3d2f7; background: #fdfdff; transform: translateX(2px); }
.choice.on { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), #fff); box-shadow: inset 0 0 0 1px var(--primary); }
.choice input { display: none; }
.choice .mark {
  width: 19px; height: 19px; border: 2px solid var(--border-2); border-radius: 50%; flex: none; margin-top: 1px;
  position: relative; transition: all .16s var(--ease); background: #fff;
}
.choice.multi .mark { border-radius: 6px; }
.choice.on .mark { border-color: var(--primary); background: var(--primary); }
.choice.on .mark::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.choice.on.radio .mark::after { content: ""; left: 4px; top: 4px; width: 7px; height: 7px; border: none; border-radius: 50%; background: #fff; transform: none; }
.choice .tx { flex: 1; word-break: break-word; line-height: 1.6; }
.choice.on .tx { color: var(--primary-ink); font-weight: 550; }

.rating { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rating .star { font-size: 33px; line-height: 1; color: #dfe4ec; cursor: pointer; transition: transform .14s var(--ease), color .16s; user-select: none; }
.rating .star:hover { transform: scale(1.14) rotate(-3deg); }
.rating .star.on { color: #fbbf24; text-shadow: 0 4px 12px rgba(251, 191, 36, .45); }
.rating .rt-val { margin-left: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }

.mx-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.mx-fill { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 430px; }
.mx-fill th, .mx-fill td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.mx-fill th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.mx-fill tbody tr:hover td { background: #fbfcfe; }
.mx-fill td:first-child, .mx-fill th:first-child { text-align: left; font-weight: 550; }
.mx-fill .dot {
  display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-2);
  border-radius: 50%; cursor: pointer; transition: all .15s var(--ease); vertical-align: middle; background: #fff;
}
.mx-fill .dot:hover { border-color: var(--primary); }
.mx-fill.multi .dot { border-radius: 6px; }
.mx-fill .dot.on { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 2.5px #fff; }

.upload-box { display: flex; gap: 11px; flex-wrap: wrap; }
.upload-thumb { position: relative; width: 88px; height: 88px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 21px; height: 21px; border-radius: 50%;
  background: rgba(15, 23, 42, .6); color: #fff; border: none; font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.upload-thumb .rm:hover { background: var(--danger); }
.upload-add {
  width: 88px; height: 88px; border: 1.6px dashed var(--border-2); border-radius: 12px;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; transition: all .17s var(--ease);
}
.upload-add:hover { border-color: var(--primary); color: var(--primary-ink); background: var(--primary-soft); border-style: solid; transform: translateY(-2px); }
.upload-add .ic { font-size: 21px; }
.upload-add:disabled { opacity: .5; }
.upload-note { font-size: 12px; color: var(--muted); margin-top: 9px; }

.fill-foot {
  display: flex; gap: 12px; align-items: center; margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.fill-foot .spacer { flex: 1; }
.fill-tip { text-align: center; color: var(--muted-2); font-size: 12px; margin-top: 26px; }

.result-box {
  position: relative; background: #fff; border-radius: var(--radius-xl); padding: 56px 26px; text-align: center;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); overflow: hidden;
  animation: pageIn .32s var(--ease);
}
.result-box::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--ok), #34d399); }
.result-box .ic {
  width: 70px; height: 70px; border-radius: 24px; background: var(--ok-soft); color: var(--ok);
  font-size: 33px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
  box-shadow: 0 12px 26px -14px rgba(15, 157, 88, .75);
}
.result-box h2 { font-size: 20px; margin-bottom: 9px; }
.result-box p { color: var(--muted); margin: 0; white-space: pre-wrap; line-height: 1.8; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .page { padding: 18px 15px 76px; }
  .topbar { padding: 0 12px; height: 56px; gap: 4px; }
  .topbar .brand { font-size: 15px; margin-right: 4px; }
  .topbar .brand .dot { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; }
  .topbar .nav-btn { padding: 6px 10px; font-size: 12.5px; }
  .topbar .brand span.full { display: none; }
  #whoami { max-width: 96px; padding: 4px 10px 4px 5px; }
  .modal { max-width: 100%; border-radius: var(--radius); }
  .modal-head { padding: 17px 18px 12px; font-size: 15.5px; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px; }
  .fill-wrap { padding: 16px 13px 56px; }
  .fill-head { padding: 24px 19px 20px; border-radius: var(--radius); }
  .fill-head h1 { font-size: 19px; }
  .fq { padding: 17px 16px; }
  .survey-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .btn { padding: 8.5px 13px; }
  .page-head h2 { font-size: 20px; }
  .stat-card .v, .stat-card .n { font-size: 23px; }
}
