:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e2e5e9;
  --line-strong: #cfd4da;
  --text: #1a1d21;
  --muted: #6b7280;
  --faint: #9aa1a9;
  --accent: #2563eb;
  --accent-soft: #eaf1fe;
  --green: #0f9d58;
  --green-soft: #e8f6ee;
  --amber: #f29900;
  --amber-soft: #fff4e0;
  --red: #d93025;
  --red-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

/* hidden 属性必须压过 .btn 的 display，否则按钮藏不住 */
[hidden] {
  display: none !important;
}

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

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

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

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:hover {
  background: #f8f9fb;
  border-color: #b9c0c8;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: #1d4fd8;
}
.btn.danger {
  color: var(--red);
  border-color: #f0c6c2;
}
.btn.danger:hover {
  background: var(--red-soft);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.btn.ghost:hover {
  background: #eef0f3;
  color: var(--text);
}
.btn.sm {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.65;
}
label.field {
  display: block;
  margin-bottom: 12px;
}
label.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
}
label.field > span em {
  font-style: normal;
  color: var(--red);
}
.hint {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.6;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: #eef0f3;
  color: var(--muted);
  white-space: nowrap;
}
.badge.green {
  background: var(--green-soft);
  color: var(--green);
}
.badge.blue {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.amber {
  background: var(--amber-soft);
  color: #a86500;
}
.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12.5px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  white-space: nowrap;
}
table.tbl td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
table.tbl td.wrap {
  white-space: normal;
}
table.tbl tbody tr:hover {
  background: #fafbfd;
}
table.tbl tbody tr.clickable {
  cursor: pointer;
}

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* ---------- 登录 ---------- */
#login {
  position: fixed;
  inset: 0;
  background: rgba(24, 28, 33, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
/* hidden 属性必须压过上面的 display:flex，否则登录框会一直盖着 */
#login[hidden] {
  display: none;
}
#login .box {
  width: 340px;
  background: #fff;
  border-radius: 14px;
  padding: 26px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
#login h2 {
  font-size: 17px;
  margin-bottom: 4px;
}
#login .hint {
  margin-bottom: 18px;
}

/* ---------- 应用外壳 ---------- */
header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
header.top .brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
header.top .brand i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: inline-block;
}
header.top .spacer {
  flex: 1;
}
nav.tabs {
  display: flex;
  gap: 2px;
}
nav.tabs button {
  padding: 6px 12px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
}
nav.tabs button:hover {
  background: #f0f2f5;
  color: var(--text);
}
nav.tabs button.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

main {
  padding: 18px 20px 60px;
  max-width: 1320px;
  margin: 0 auto;
}

.pane {
  display: none;
}
.pane.on {
  display: block;
}

.row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.row.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.mt {
  margin-top: 14px;
}
.mt-s {
  margin-top: 8px;
}
.mb {
  margin-bottom: 14px;
}
.flex {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flex.wrap {
  flex-wrap: wrap;
}
.right {
  margin-left: auto;
}
.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
}

.panel-pad {
  padding: 16px 18px;
}
.sect-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.sect-title h3 {
  font-size: 14px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: #1f2937;
  color: #fff;
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
  max-width: 80vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.err {
  background: var(--red);
}

/* ---------- 岗位编辑 ---------- */
.dim-row {
  display: grid;
  grid-template-columns: 1.1fr 90px 1.6fr 28px;
  gap: 8px;
  align-items: center;
  margin-bottom: 7px;
}
.dim-row input {
  padding: 6px 9px;
  font-size: 13px;
}
.weight-sum {
  font-size: 12px;
  color: var(--muted);
}
.weight-sum.bad {
  color: var(--red);
}

.q-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 13px;
  margin-bottom: 10px;
  background: #fcfcfd;
}
.q-item .q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.q-item .q-idx {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex: none;
}
.q-item textarea {
  min-height: 56px;
  font-size: 13.5px;
}
.q-item .q-meta {
  display: grid;
  grid-template-columns: 1fr 1fr 90px;
  gap: 8px;
  margin-top: 8px;
}
.q-item .q-meta select,
.q-item .q-meta input {
  padding: 5px 8px;
  font-size: 12.5px;
}

/* ---------- 拖拽上传 ---------- */
.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  background: #fcfcfd;
}
.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.drop b {
  color: var(--text);
}

/* ---------- 排行榜 ---------- */
.rank-table td.num {
  font-variant-numeric: tabular-nums;
}
.rank-no {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 600;
  font-size: 12.5px;
  background: #eef0f3;
  color: var(--muted);
}
.rank-no.r1 {
  background: #fff3cd;
  color: #8a6100;
}
.rank-no.r2 {
  background: #e9eef5;
  color: #4a5568;
}
.rank-no.r3 {
  background: #f7ece2;
  color: #8a5a2b;
}
.score-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bar {
  height: 5px;
  background: #eceff3;
  border-radius: 3px;
  overflow: hidden;
  min-width: 54px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* ---------- 详情抽屉 ---------- */
#drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 92vw);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(16, 24, 40, 0.12);
  transform: translateX(102%);
  transition: transform 0.22s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
#drawer.open {
  transform: none;
}
#drawer .dh {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
#drawer .db {
  overflow: auto;
  padding: 16px 18px 40px;
  flex: 1;
}
#scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 55;
}
#scrim.on {
  opacity: 1;
  pointer-events: auto;
}

.answer-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 12px;
}
.answer-card .ac-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 9px;
}
.answer-card .qtext {
  font-weight: 500;
  line-height: 1.55;
}
.answer-card .scorepill {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.transcript {
  background: #f8f9fb;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #eef0f3;
}
.quote {
  border-left: 2px solid var(--accent);
  padding-left: 9px;
  color: #374151;
  font-size: 12.8px;
  margin: 4px 0;
}
.mini-sect {
  margin-top: 9px;
}
.mini-sect > b {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.flagline {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 12.8px;
  margin-top: 3px;
}
video.rec {
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
  background: #0b0e12;
  margin-top: 6px;
}

/* ---------- 设置 ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .dim-row {
    grid-template-columns: 1fr 70px;
  }
  .dim-row .dim-desc {
    grid-column: 1 / -1;
  }
}

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #cfd4da;
  position: relative;
  cursor: pointer;
  transition: background 0.16s;
  flex: none;
  margin: 0;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch input:checked {
  background: var(--green);
}
.switch input:checked::after {
  transform: translateX(16px);
}

.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}
.kv > span {
  color: var(--muted);
}

.linkbox {
  display: flex;
  gap: 6px;
  align-items: center;
}
.linkbox input {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  padding: 5px 8px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 130;
  backdrop-filter: blur(2px);
}

/* ---------- 批量导入列表 ---------- */
.batch-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  background: #fff;
}
.batch-item .bi-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-item .bi-note {
  font-size: 12px;
  color: var(--faint);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-item.ok {
  border-color: #bfe3cd;
  background: #f6fdf9;
}
.batch-item.skip {
  border-color: #f0e0b8;
  background: #fffbf1;
}
.batch-item.err {
  border-color: #f2c6c2;
  background: #fef7f6;
}
