/* ============ 数据集质量标注 — 全局样式 ============ */
:root {
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --teal: #0e7490;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* 全站内容禁止复制 */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  transition: background .15s, opacity .15s, transform .05s;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 10px 28px;
  font-weight: 600;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); border-color: #cbd5e1; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #eff6ff 0%, #f0fdfa 55%, #f8fafc 100%);
  padding: 24px;
}
.login-logo { margin-bottom: 28px; }
.login-logo img { height: 72px; display: block; }
.login-card {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px 36px 28px;
}
.login-card h1 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 4px;
}
.login-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.login-error {
  display: none;
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-btn { width: 100%; padding: 12px; font-size: 16px; }
.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

/* ---------- 通用顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-logo { display: flex; align-items: center; gap: 10px; }
.topbar-logo img { height: 34px; }
.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
}
.topbar-spacer { flex: 1; }
.timer {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--primary-dark);
}
.timer .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
}
.user-chip .name { color: var(--text); font-weight: 600; }
.user-chip .group-tag {
  background: #e0e7ff; color: #3730a3;
  font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
}

/* ---------- 标注页布局 ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px 60px;
}

.progress-zone { margin-bottom: 14px; }
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted);
  margin-bottom: 6px;
}
.progress-meta b { color: var(--primary-dark); }
.progress-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  transition: width .35s ease;
}

.notice {
  background: linear-gradient(90deg, #eff6ff, #ecfeff);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  color: #1e3a8a;
  margin-bottom: 14px;
}
.notice b { color: #1e40af; }

.criteria-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border);
  color: var(--primary-dark); font-weight: 600; font-size: 14px;
  padding: 8px 16px; border-radius: 8px;
  margin-bottom: 14px;
}
.criteria-toggle:hover { border-color: var(--primary); }
.criteria-panel { display: none; margin-bottom: 18px; }
.criteria-panel.open { display: block; }
.criteria-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 13.5px;
}
.criteria-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.criteria-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.criteria-table tr:last-child td { border-bottom: none; }
.criteria-table .dim-col { font-weight: 700; color: var(--primary-dark); white-space: nowrap; }

.annotate-grid {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 18px;
  align-items: start;
}

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
}
.q-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.q-tag {
  font-size: 12.5px; font-weight: 600;
  padding: 3px 11px; border-radius: 999px;
  background: #f1f5f9; color: #475569;
  border: 1px solid var(--border);
}
.q-tag.dim { color: #fff; border: none; }
.q-tag.dim-A { background: #7c3aed; }
.q-tag.dim-B { background: #2563eb; }
.q-tag.dim-C { background: #0891b2; }
.q-tag.dim-D { background: #d97706; }
.q-tag.dim-E { background: #dc2626; }
.q-topic {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.5;
}
.q-content {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.85;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 22px;
}

.rate-section-title {
  font-size: 15px; font-weight: 700;
  color: var(--primary-dark);
  border-top: 1px dashed var(--border);
  padding-top: 18px;
  margin-top: 2px;
  margin-bottom: 14px;
}
.rate-block { margin-bottom: 18px; }
.rate-question { font-size: 14.5px; font-weight: 600; margin-bottom: 8px; }
.rate-question .hint {
  font-weight: 400; color: var(--muted); font-size: 12.5px;
  display: block; margin-top: 2px;
}
.rate-options { display: flex; flex-wrap: wrap; gap: 8px; }
.rate-options input[type=radio] { display: none; }
.rate-options label {
  min-width: 46px;
  text-align: center;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #475569;
  transition: all .13s;
  user-select: none;
}
.rate-options label:hover { border-color: var(--primary); color: var(--primary); }
.rate-options input:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29, 78, 216, .3);
}
.rate-options label.na { min-width: 88px; }
.rate-options input:checked + label.na { background: #64748b; border-color: #64748b; box-shadow: none; }

.save-status {
  height: 22px;
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
}
.save-status.saving { color: var(--amber); }
.save-status.error { color: var(--red); }

.q-nav-btns {
  display: flex; justify-content: space-between;
  margin-top: 20px; gap: 12px;
}

/* ---------- 题号导航 ---------- */
.navigator {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  position: sticky;
  top: 76px;
}
.navigator h3 {
  font-size: 14px; color: var(--muted);
  font-weight: 600; margin-bottom: 10px;
}
.nav-legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.nav-legend i {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 4px; vertical-align: -1px;
}
.nav-legend .l-done i { background: var(--green); }
.nav-legend .l-todo i { background: #e2e8f0; }
.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 2px;
}
.nav-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 6px;
  border: 1.5px solid transparent;
  cursor: pointer;
}
.nav-cell:hover { border-color: var(--primary); color: var(--primary); }
.nav-cell.done { background: var(--green-bg); color: #15803d; }
.nav-cell.current {
  background: var(--primary); color: #fff;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, .25);
}

/* ---------- 后台管理 ---------- */
.admin-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stat-card .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 16px; margin-bottom: 16px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 9px 12px;
  background: #f8fafc; border-bottom: 2px solid var(--border);
  white-space: nowrap; font-size: 13px; color: var(--muted);
}
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num-cell { font-variant-numeric: tabular-nums; }
.pct-pill {
  display: inline-block; min-width: 58px; text-align: center;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: var(--green-bg); color: #15803d;
}
.pct-pill.low { background: var(--amber-bg); color: #b45309; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .bar-name { width: 90px; color: var(--muted); flex-shrink: 0; }
.bar-row .bar-track { flex: 1; height: 14px; background: #f1f5f9; border-radius: 999px; overflow: hidden; display: flex; }
.bar-row .bar-seg { height: 100%; }
.bar-row .bar-val { width: 92px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); flex-shrink: 0; }
.chart-note { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.export-btn-row { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.admin-tabs { display: flex; gap: 8px; margin: 18px 0 4px; }
.admin-tab {
  padding: 8px 20px; border-radius: 8px 8px 0 0;
  background: #e2e8f0; color: var(--muted); font-weight: 600; font-size: 14px;
}
.admin-tab.active { background: var(--card); color: var(--primary-dark); }

.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #0f172a; color: #fff;
  padding: 11px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0;
  transition: all .3s ease; z-index: 99;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading {
  text-align: center; color: var(--muted);
  padding: 80px 0; font-size: 15px;
}

/* ---------- 试标:模型输出风险标注 ---------- */
.model-output-label {
  font-size: 14px; font-weight: 700;
  color: var(--teal);
  margin: 14px 0 8px;
}
/* 模型回答:Markdown 渲染 + 全文展开(不固定高度) */
.q-content.model {
  border-left-color: var(--teal);
  background: #f8fafc;
  max-height: none;
  overflow: visible;
}
.md { font-size: 14.5px; line-height: 1.8; }
.md h2, .md h3, .md h4, .md h5 { font-weight: 700; margin: 14px 0 6px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15.5px; }
.md h4 { font-size: 14.5px; }
.md h5 { font-size: 14px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0 6px 22px; }
.md li { margin: 3px 0; }
.md code {
  background: #e2e8f0; padding: 1px 5px; border-radius: 4px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.md strong { color: #0f172a; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md blockquote {
  border-left: 3px solid #cbd5e1; margin: 6px 0;
  padding: 2px 10px; color: var(--muted);
}
.md-table {
  border-collapse: collapse; margin: 10px 0;
  font-size: 13.5px; width: 100%;
}
.md-table th, .md-table td {
  border: 1px solid var(--border); padding: 5px 9px; text-align: left;
  vertical-align: top;
}
.md-table th { background: #f1f5f9; font-weight: 700; }

/* ---------- 评分条目:宽屏两列布局 ---------- */
.rate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 26px;
}
@media (max-width: 880px) {
  .rate-grid { grid-template-columns: 1fr; }
}
/* 分值含义提示(更直观) */
.scale-hint {
  font-size: 12px; color: var(--muted);
  margin-top: 6px; line-height: 1.55;
}
.scale-hint b { color: #475569; font-weight: 600; }
.req {
  color: var(--red);
  font-size: 13px; font-weight: 700;
  margin-left: 4px;
}

/* ---------- 全部完成后的提交横幅 ---------- */
.submit-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, #dcfce7, #d1fae5);
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 15px; color: #14532d; font-weight: 600;
  margin-bottom: 14px;
}
.submit-banner .btn-primary { padding: 9px 26px; }

/* 底部固定提交栏:全部完成后在页面底部同时提示,避免用户停留在页面下方看不到顶部横幅 */
.submit-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  gap: 18px; flex-wrap: wrap;
  background: linear-gradient(90deg, #dcfce7, #d1fae5);
  border-top: 1px solid #86efac;
  padding: 12px 24px;
  font-size: 15px; color: #14532d; font-weight: 600;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .12);
}
.submit-dock .btn-primary { padding: 9px 26px; }

/* 提交确认弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
  max-width: 460px; width: 100%;
  padding: 26px 28px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.modal-body { font-size: 14px; line-height: 1.8; color: var(--text); }
.modal-rules { margin: 6px 0 0; padding-left: 20px; }
.modal-rules li { margin: 4px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.final-level-title {
  font-size: 15px; font-weight: 700;
  color: var(--primary-dark);
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  margin: 18px 0 10px;
}
.reason-label {
  font-size: 14.5px; font-weight: 600;
  margin: 16px 0 8px;
}
.reason-input {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.reason-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.reason-input.reason-missing {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}
.reason-hint {
  font-size: 12.5px; color: var(--muted);
  margin-top: 5px;
}
.reason-hint.missing { color: var(--red); font-weight: 600; }

/* ---------- 后台管理标签页 ---------- */
.admin-tabs-bar {
  display: flex; gap: 8px;
  margin: 18px 0 16px;
  border-bottom: 2px solid var(--border);
}
.admin-mode-tab {
  padding: 9px 26px;
  background: transparent;
  color: var(--muted);
  font-weight: 600; font-size: 15px;
  border-radius: 8px 8px 0 0;
  margin-bottom: -2px;
  border-bottom: 3px solid transparent;
}
.admin-mode-tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}
.admin-mode-panel { display: none; }
.admin-mode-panel.active { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .annotate-grid { grid-template-columns: 1fr; }
  .navigator { position: static; }
  .nav-grid { grid-template-columns: repeat(10, 1fr); max-height: none; }
}
@media (max-width: 560px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .nav-grid { grid-template-columns: repeat(7, 1fr); }
  .question-card { padding: 18px; }
}
