:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

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

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

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

/* ---------- 布局 ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.topbar .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}

.topbar nav { display: flex; align-items: center; gap: 4px; }

.topbar nav a {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 7px;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.topbar nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.wrap-narrow { max-width: 460px; }

h1 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
}

.sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

/* 通用小号灰字（页内说明、表格辅助信息） */
.muted { color: var(--muted); font-size: 13px; }
p.muted { margin: 0; }

/* 注册页规则提示 */
.notice {
  margin-top: 18px;
  padding: 11px 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}
.notice strong { color: #b45309; }

/* 未填问卷的限期倒计时横幅 */
.deadline {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 22px;
  background: var(--accent-soft);
  border: 1px solid #c7d9fb;
  border-radius: var(--radius-lg);
}
.deadline-urgent { background: #fef2f2; border-color: #fecaca; }

.deadline-ico {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.deadline-urgent .deadline-ico { background: var(--danger); }

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

.deadline-title { font-size: 14.5px; font-weight: 600; margin-bottom: 5px; }
.deadline-title strong { color: var(--accent); font-size: 17px; }
.deadline-urgent .deadline-title { color: #b91c1c; }
.deadline-urgent .deadline-title strong { color: var(--danger); }

.deadline-desc { font-size: 13px; color: var(--muted); line-height: 1.65; }
.deadline-btn { margin-top: 12px; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}

.card + .card { margin-top: 16px; }

/* ---------- 表单 ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.field .hint {
  font-size: 12px;
  color: var(--faint);
  margin-top: 5px;
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

input::placeholder, textarea::placeholder { color: var(--faint); }

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

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  transition: background .12s;
}

.checkline:hover { background: var(--bg); }
.checkline input { margin: 3px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.checkline span { flex: 1; }

/* ---------- 通用：hidden 属性强制生效 ----------
   .btn 等类设了 display，会盖掉 UA 样式表里 [hidden]{display:none}，
   导致 JS 用 el.hidden = true 后元素依然显示。这里用 !important 兜住。 */
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- 提示条 ---------- */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
  display: none;
}

.alert.show { display: block; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: var(--success-soft); color: var(--success); border: 1px solid #a7f3d0; }

/* ---------- 表格 ---------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  background: #fafbfc;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid #f1f2f4;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--muted);
  white-space: nowrap;
}

.tag-done { background: var(--success-soft); color: var(--success); }

.stats {
  display: flex;
  gap: 28px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat .n { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); }

/* 统计行最右侧的操作按钮（登录且未填问卷时显示） */
.stats-cta { margin-left: auto; align-self: center; }

.empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--faint);
  font-size: 13.5px;
}

/* ---------- 题目 ---------- */

.q { padding: 18px 0; border-bottom: 1px solid #f1f2f4; }
.q:last-of-type { border-bottom: none; }
.q:first-of-type { padding-top: 4px; }

.q .qh {
  font-weight: 500;
  font-size: 14px;
  margin: 0 0 10px;
  display: flex;
  gap: 8px;
}

.q .qh .num {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 18px;
}

.q .qh .text { flex: 1; }

.q .qh .opt {
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 400;
  margin-left: 2px;
}

.q .qhint {
  font-size: 12.5px;
  color: var(--faint);
  margin: -6px 0 10px 26px;
  line-height: 1.55;
}

.q .opts { margin-left: 26px; }

.q textarea { margin-left: 0; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.spacer { flex: 1; }

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  padding: 8px 20px 40px;
}

/* ---------- 拍照识别 ---------- */

.ocr-card { border: 1px dashed var(--border-strong); background: #fcfdff; }
.ocr-head { margin-bottom: 14px; }
.ocr-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ocr-desc { font-size: 13px; margin: 0; }
.ocr-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ocr-preview { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ocr-preview img {
  max-width: 100%; max-height: 280px; display: block;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.ocr-preview-hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
.ocr-preview-hint.ok { color: var(--success); }
.ocr-preview-hint.warn { color: var(--danger); }
.ocr-notes { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--muted); }
.ocr-notes li { margin-bottom: 3px; }

/* 核对提醒：识别结果必须人工确认 */
.ocr-warn {
  margin-top: 12px; padding: 9px 12px; font-size: 12.5px; line-height: 1.55;
  color: #92400e; background: #fef3c7; border-radius: var(--radius);
  border-left: 3px solid #f59e0b;
}

/* 识别结果提示条 */
.ocr-tip {
  font-size: 12.5px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 6px 10px; margin-top: 8px; display: inline-block;
}

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 48px; }
  .card { padding: 18px 16px; }
  thead th, tbody td { padding: 10px 12px; }
  .stats { gap: 20px; }
  .topbar { padding: 0 14px; }
  .topbar nav a { padding: 6px 8px; font-size: 12.5px; }
  .ocr-actions .btn { flex: 1 1 auto; }
  .detail-grid { grid-template-columns: 96px 1fr; font-size: 13px; }
  .toolbar input[type="search"] { flex: 1 1 100%; }
}
