:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e5e7eb;
  --line-strong: #d5d8de;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

/* ---------- layout ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.2px;
}

.brand .mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.topbar .spacer {
  flex: 1;
}

.topbar .who {
  color: var(--muted);
  font-size: 13px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.container.narrow {
  max-width: 760px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 22px;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:hover {
  background: #fafafa;
  border-color: #c3c7cf;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-danger {
  color: var(--danger);
  border-color: #f3c8c8;
  background: #fff;
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--text);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-lg {
  height: 42px;
  padding: 0 20px;
  font-size: 14px;
}

.btn-xs {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 7px;
}

/* ---------- 管理中心 ---------- */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-tabs .tab {
  height: 34px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-tabs .tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.admin-tabs .tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.acc-type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: #f3f4f6;
  color: #4b5563;
}

.acc-type.email {
  background: #e0f2fe;
  color: #0369a1;
}

.acc-type.phone {
  background: #ede9fe;
  color: #6d28d9;
}

.add-tpl {
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-tpl .input {
  flex: 1;
  min-width: 0;
}

.add-tpl .btn {
  white-space: nowrap;
}

/* 管理端：模板等级下拉 */
.add-tpl .input.tier-pick {
  flex: 0 0 130px;
}

.tier-cell .input {
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
  width: 108px;
}

/* 卡片内的次级操作：文字链接形态，避免整行透明"假按钮" */
.link-more {
  display: block;
  text-align: center;
  font-size: 12.5px;
  color: var(--brand);
  margin-top: 9px;
  line-height: 1.4;
}

.link-more:hover {
  text-decoration: underline;
}

.link-danger {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--danger);
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
}

.link-danger:hover {
  background: var(--danger-soft);
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

.icon-btn:hover {
  background: #f3f4f6;
  color: var(--text);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 20px;
}

.card h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.card .hint {
  color: var(--muted);
  font-size: 12.5px;
  margin: 0 0 14px;
}

/* ---------- forms ---------- */
.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.6;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.field {
  margin-bottom: 16px;
}

.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.field .desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
  min-width: 140px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

/* ---------- misc ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
  white-space: nowrap;
}

.badge.brand {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.draft {
  background: #f3f4f6;
  color: #6b7280;
}

.badge.closed {
  background: #fef2f2;
  color: #b91c1c;
}

/* ---------- 会员等级 ---------- */
.tier-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tier-chip.free {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

.tier-chip.gold {
  background: #fdf6e3;
  color: #a16207;
  border-color: #f2e2b5;
}

.tier-chip.platinum {
  background: #eef1f7;
  color: #334155;
  border-color: #cfd8e6;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .big {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 6px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.banner {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.banner.show {
  display: block;
}

.banner.error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.banner.ok {
  background: var(--ok-soft);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.banner.warn {
  background: var(--warn-soft);
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* ---------- 站内提示条 ---------- */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid;
  margin-bottom: 16px;
}

.notice-bar.warn {
  background: var(--warn-soft);
  border-color: #fcd34d;
  color: #92400e;
}

.notice-bar.danger {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

.notice-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.notice-bar.warn .notice-icon {
  background: #fde68a;
  color: #92400e;
}

.notice-bar.danger .notice-icon {
  background: #fecaca;
  color: #991b1b;
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice-title {
  font-size: 13.5px;
  font-weight: 600;
}

.notice-msg {
  font-size: 12.5px;
  margin-top: 2px;
  opacity: 0.85;
}

.notice-bar .btn {
  background: rgba(255, 255, 255, 0.8);
  border-color: currentColor;
  color: inherit;
  flex-shrink: 0;
}

.notice-close {
  color: inherit;
  opacity: 0.55;
  flex-shrink: 0;
}

.notice-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: #111827;
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- survey list ---------- */
.survey-list {
  display: grid;
  gap: 12px;
}

.survey-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.survey-row:hover {
  border-color: #c7cbd4;
  box-shadow: var(--shadow);
}

.survey-row .main {
  flex: 1;
  min-width: 0;
}

.survey-row .title {
  font-weight: 500;
  font-size: 14.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.survey-row .meta {
  margin-top: 5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
  align-items: center;
}

.survey-row .actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ---------- editor ---------- */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 306px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.doc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.doc-head {
  padding: 26px 26px 20px;
  border-top: 5px solid var(--brand);
  background: linear-gradient(180deg, #fbfbfd, #fff);
}

.doc-title {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid transparent;
  font-size: 24px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  padding: 4px 0;
  outline: none;
  background: transparent;
}

.doc-title:hover {
  border-bottom-color: var(--line);
}

.doc-title:focus {
  border-bottom-color: var(--brand);
}

.doc-desc {
  width: 100%;
  border: none;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--muted);
  padding: 6px 0 0;
  outline: none;
  resize: none;
  background: transparent;
  line-height: 1.6;
  min-height: 26px;
}

.doc-body {
  padding: 6px 26px 0;
}

.qcard {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.qcard:hover {
  border-color: #cbd0d8;
}

.qcard.active {
  border-color: #b9b5f5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.07);
}

.qcard.dragging {
  opacity: 0.45;
}

.qcard.drop-target {
  border-top: 2px solid var(--brand);
}

.qcard-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
}

.handle {
  cursor: grab;
  color: #c3c7cf;
  font-size: 13px;
  letter-spacing: -1px;
  user-select: none;
  padding: 0 2px;
}

.handle:active {
  cursor: grabbing;
}

.qtitle-input {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1.5px solid transparent;
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  padding: 4px 2px;
  outline: none;
  background: transparent;
}

.qtitle-input:hover {
  border-bottom-color: var(--line);
}

.qtitle-input:focus {
  border-bottom-color: var(--brand);
}

.qcard-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.qcard-body {
  padding: 2px 14px 14px 40px;
}

.qcard-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 12px 40px;
  flex-wrap: wrap;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.opt-mark {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--line-strong);
  flex-shrink: 0;
}

.opt-mark.radio {
  border-radius: 50%;
}

.opt-mark.box {
  border-radius: 3px;
}

.opt-input {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #fafafa;
  color: var(--text);
}

.opt-input:hover {
  background: #f5f5f7;
}

.opt-input:focus {
  background: #fff;
  border-color: var(--brand);
}

.add-opt {
  margin-left: 23px;
  color: var(--brand);
  background: none;
  border: none;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 3px 0;
}

.addbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 26px 24px;
  border-top: 1px dashed var(--line);
  margin-top: 10px;
}

.addbar .label {
  color: var(--muted);
  font-size: 12.5px;
  align-self: center;
  margin-right: 2px;
}

.type-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.type-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.type-btn-page {
  border-style: solid;
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

/* 分页符卡片 */
.section-card {
  border: 1px solid var(--brand);
  background: var(--brand-soft);
}

.section-card .qcard-head {
  background: transparent;
}

.badge.page {
  background: var(--brand);
  color: #fff;
}

.section-hint {
  padding: 4px 16px 12px;
  font-size: 12px;
  color: var(--brand-dark);
}

.side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 76px;
}

.side .card-pad {
  padding: 16px;
}

.link-box {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.link-box input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  outline: none;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  color: var(--muted);
}

.stat-row b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- fill page ---------- */
.fill-wrap {
  max-width: 700px;
  margin: 0 auto;
  padding: 34px 20px 90px;
}

.fill-head {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.fill-head .bar {
  height: 6px;
  background: var(--brand);
}

.fill-head .inner {
  padding: 26px 28px;
}

.fill-head h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.fill-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  white-space: pre-wrap;
}

.q-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.q-block:hover {
  border-color: #d8dce3;
}

.q-block.invalid {
  border-color: #f0a8a8;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.06);
}

.q-block .q-title {
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 3px;
  display: flex;
  gap: 6px;
}

.q-block .q-title .req {
  color: var(--danger);
}

.q-block .q-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.q-block .q-body {
  margin-top: 10px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  font-size: 13.5px;
  line-height: 1.5;
}

.opt:hover {
  border-color: #c7cbd4;
  background: #fcfcfd;
}

.opt.checked {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.opt input {
  margin: 3px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  flex-shrink: 0;
  cursor: pointer;
}

.stars {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.star {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 15px;
  color: #6b7280;
  font-family: inherit;
  transition: all 0.12s;
}

.star:hover {
  border-color: #f5b74e;
  color: #f59e0b;
}

.star.on {
  background: #fff7e6;
  border-color: #f5b74e;
  color: #b45309;
  font-weight: 600;
}

.star svg {
  width: 20px;
  height: 20px;
}

.rating-label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fcfcfd;
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.file-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  background: #fff;
}

.file-item img,
.file-item video {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
  flex-shrink: 0;
}

.file-item .fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .fsize {
  color: var(--muted-2);
  font-size: 12px;
}

.progress {
  height: 4px;
  background: #eef0f4;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--brand);
  width: 0%;
  transition: width 0.2s;
}

.fill-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* 分页导航 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#submitWrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pager-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  padding: 4px 2px 12px;
  margin-bottom: 4px;
}

.submit-note {
  color: var(--muted);
  font-size: 12px;
}

/* 蜜罐字段：正常用户看不到、也不会碰到；脚本会把它当普通输入框填满 */
.hp-field {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.success {
  text-align: center;
  padding: 70px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.success .tick {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 26px;
}

.success h2 {
  font-size: 19px;
  margin-bottom: 8px;
}

.success p {
  color: var(--muted);
  margin: 0;
  font-size: 13.5px;
}

/* ---------- results ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tab {
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  margin-bottom: -1px;
}

.tab.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 500;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-card .k {
  font-size: 12px;
  color: var(--muted);
}

.stat-card .v {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.3px;
}

.rq {
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.rq-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.rq-head .n {
  color: var(--muted-2);
  font-size: 13px;
}

.rq-head .q {
  font-size: 14.5px;
  font-weight: 500;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr 74px;
  gap: 12px;
  align-items: center;
  margin-bottom: 9px;
  font-size: 13px;
}

.bar-row .lb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
}

.bar-row .track {
  height: 22px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
}

.bar-row .fill {
  height: 100%;
  background: var(--brand);
  border-radius: 6px;
  min-width: 2px;
  transition: width 0.4s;
}

.bar-row .fill.alt {
  background: #a5b4fc;
}

.bar-row .num {
  text-align: right;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.text-answers {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.text-answer {
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #f0f1f4;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-answer .t {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 4px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.media-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  background: #f9fafb;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.media-item .cap {
  padding: 5px 7px;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 72vh;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data th,
table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f1f4;
  vertical-align: top;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.data th {
  position: sticky;
  top: 0;
  background: #fafbfc;
  font-weight: 500;
  color: #4b5563;
  z-index: 1;
  border-bottom: 1px solid var(--line);
}

table.data tr:hover td {
  background: #fcfcfd;
}

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, #eef2ff, transparent 45%), var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 24px;
  font-size: 17px;
}

.auth-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-card .switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- logic jump ---------- */
.logic-btn {
  height: 26px;
  padding: 0 8px;
  margin-right: 2px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.logic-btn:hover {
  border-color: #c7cbd4;
  color: var(--text);
}

.logic-btn.has {
  border-color: #c7d2fe;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.logic-btn.on {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.logic-panel {
  margin: 0 14px 14px 40px;
  padding: 12px 14px;
  border: 1px solid #e2e2f7;
  background: #f8f8fe;
  border-radius: 10px;
}

.logic-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.logic-title {
  font-size: 12.5px;
  font-weight: 500;
  color: #4338ca;
}

.logic-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.logic-txt {
  font-size: 12.5px;
  color: #4b5563;
}

.logic-mini {
  width: auto;
  min-width: 88px;
  max-width: 160px;
  height: 30px;
  padding: 4px 26px 4px 9px;
  font-size: 12.5px;
  border-radius: 7px;
}

.logic-mini.wide {
  min-width: 168px;
  max-width: 240px;
}

.logic-panel .add-opt {
  margin-left: 0;
}

@media (max-width: 640px) {
  .logic-panel {
    margin-left: 14px;
  }
}

/* ---------- template copy ---------- */
.tpl-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.tpl-top {
  padding: 20px 24px 0;
}

.tpl-body {
  padding: 8px 28px 2px;
}

.tpl-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.tpl-card h1 {
  font-size: 20px;
  margin-bottom: 8px;
}

.tpl-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13.5px;
  white-space: pre-wrap;
}

.tpl-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
}

.tpl-qs-wrap {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.tpl-qs {
  margin: 0;
  padding-left: 4px;
  max-height: 216px;
  overflow: auto;
  font-size: 13px;
  color: #374151;
  list-style: none;
  counter-reset: tq;
}

.tpl-qs li {
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  counter-increment: tq;
}

/* li 是 flex 容器，原生序号不会渲染，用伪元素补 */
.tpl-qs li::before {
  content: counter(tq) ".";
  flex-shrink: 0;
  min-width: 14px;
  font-size: 12px;
  color: var(--muted-2);
}

.tpl-qs li span:first-child {
  flex: 1;
  min-width: 0;
}

.tpl-foot {
  padding: 18px 28px 24px;
}

.tpl-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  font-size: 22px;
}

.tpl-icon.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tpl-icon.warn {
  background: #fef3c7;
  color: #b45309;
}

/* ---------- member ---------- */
.member-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 4px solid #e5e7eb;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.member-hero.on {
  border-left-color: var(--brand);
  background: #f8f8ff;
}

.mh-main {
  flex: 1;
  min-width: 200px;
}

.mh-status {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.mh-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 5px;
}

.mh-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: #4b5563;
}

.code-list {
  margin-top: 12px;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 8px;
}

.code-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fafafa;
}

.code-item.used {
  opacity: 0.5;
}

.code-item .tier-chip {
  flex: 0 0 auto;
  height: 19px;
  padding: 0 6px;
  font-size: 11px;
}

.code-val {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
}

/* ---------- matrix ---------- */
.matrix {
  display: table;
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.matrix-row {
  display: table-row;
}

.matrix-cell {
  display: table-cell;
  padding: 7px 8px;
  vertical-align: middle;
  border-bottom: 1px solid #f0f1f4;
  text-align: center;
  font-size: 12.5px;
}

.matrix-head .matrix-cell {
  font-weight: 500;
  color: #4b5563;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.matrix-corner {
  width: 180px;
  max-width: 180px;
  text-align: left;
}

.matrix-row-label {
  text-align: left;
  color: #374151;
  font-size: 13px;
  white-space: normal;
  line-height: 1.5;
}

.matrix-col {
  font-size: 12px;
  line-height: 1.4;
}

.matrix-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  cursor: pointer;
  position: relative;
}

.matrix-radio input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.matrix-radio.on {
  border-color: var(--brand);
  background: var(--brand);
}

.matrix-radio.on::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

/* 移动端矩阵横向滚动 */
.matrix-scroll {
  overflow-x: auto;
}

/* ---------- template library ---------- */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(278px, 1fr));
  gap: 14px;
}

.lib-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 13px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lib-card:hover {
  border-color: #c7cbd4;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.07);
}

.lib-top {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lib-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.lib-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-types {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.lib-types .badge {
  font-size: 11.5px;
  height: 20px;
}

.lib-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
  flex-wrap: wrap;
}

.lib-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 等级不足的模板：卡片压暗，按钮改成「升级」引导 */
.lib-card.locked {
  background: #fcfcfd;
}

.lib-card.locked .lib-title {
  color: #4b5563;
}

.lib-card.locked .lib-types {
  opacity: 0.7;
}

/* ---------- qr ---------- */
.qr-body {
  padding: 20px;
}

.qr-frame {
  display: flex;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.qr-frame canvas {
  display: block;
}

.qr-cap {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 14px 0 12px;
}

/* ---------- modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: none;
  z-index: 60;
  overflow: hidden;
  padding: 40px 16px;
}

.modal-mask.show {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.modal {
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-head h3 {
  font-size: 14.5px;
}

@media (max-width: 640px) {
  .container {
    padding: 18px 14px 60px;
  }
  .topbar {
    padding: 0 14px;
  }
  .doc-head {
    padding: 20px 16px 14px;
  }
  .doc-body {
    padding: 0 16px;
  }
  .addbar {
    padding: 14px 16px 20px;
  }
  .qcard-body,
  .qcard-foot {
    padding-left: 14px;
  }
  .qcard-head {
    flex-wrap: wrap;
  }
  .survey-row {
    flex-wrap: wrap;
    gap: 10px;
  }
  .survey-row .actions {
    width: 100%;
    justify-content: flex-end;
  }
  .bar-row {
    grid-template-columns: 1fr 90px;
  }
  .bar-row .track {
    grid-column: 1 / -1;
    order: 3;
  }
}
