:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --line: #e3e7ef;
  --line-strong: #d3d9e6;
  --text: #172033;
  --muted: #6d778c;
  --accent: #2f6bfe;
  --accent-dark: #2455d6;
  --soft: #edf2ff;
  --green: #0f9d67;
  --amber: #b77900;
  --red: #d43f36;
  --shadow: 0 1px 2px rgba(18, 28, 55, 0.04), 0 10px 30px rgba(18, 28, 55, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 400px at 50% -160px, #e6edff 0%, rgba(230, 237, 255, 0) 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #4a82ff, #2455d6);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 6px 14px rgba(47, 107, 254, 0.32);
  flex: none;
}

.brand h1 { font-size: 17px; margin: 0; letter-spacing: 0.2px; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }

.interviewer-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f9fd;
  border: 1px solid var(--line);
  padding: 7px 8px 7px 14px;
  border-radius: 12px;
}

.interviewer-box label { font-size: 13px; color: var(--muted); white-space: nowrap; }

.interviewer-box input {
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  width: 140px;
  padding: 2px 4px;
  outline: none;
}

.interviewer-box input::placeholder { font-weight: 400; color: #a3acbf; }

.topbar-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-toggle {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #3a4560;
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 22px 0 14px;
}

.progress-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.progress-chip b { color: var(--text); }

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

/* ---------- 候选人选择 ---------- */
.picker { margin-bottom: 18px; }
.picker h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 10px;
  letter-spacing: 0.3px;
}

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

.cand-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(18, 28, 55, 0.03);
}

.cand-chip:hover { border-color: #b9c9ee; }
.cand-chip.on {
  border-color: var(--accent);
  background: #f7faff;
  box-shadow: 0 0 0 3px rgba(47, 107, 254, 0.12);
}

.chip-idx {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.chip-body { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.chip-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-status { font-size: 12px; color: var(--muted); }

.cand-chip.done .chip-status { color: var(--green); }
.cand-chip.done .chip-idx { background: #e9f8f1; color: var(--green); }

.editor { max-width: 760px; margin: 0 auto 40px; }
.foot-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 候选人卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.candidate { padding: 18px 20px 16px; transition: border-color 0.18s, box-shadow 0.18s; }
.candidate.saved { border-color: #cfe0ff; }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 16.5px; margin: 0; flex: 1; letter-spacing: 0.2px; }

.idx {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}

.state {
  font-size: 12px;
  color: var(--muted);
  background: #f4f6fa;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.state.ok { color: var(--green); background: #e9f8f1; }

.dims { display: flex; flex-direction: column; gap: 10px; }

.dim-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #3a4560;
  margin-bottom: 5px;
}

.dim-label em { font-style: normal; color: var(--muted); font-size: 12px; }

.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }

.scale button {
  height: 32px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 8px;
  font-size: 13px;
  color: #48536b;
  cursor: pointer;
  transition: all 0.12s;
  padding: 0;
  font-family: inherit;
}

.scale button:hover { border-color: #a9c1ff; color: var(--accent-dark); background: #f3f7ff; }
.scale button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(47, 107, 254, 0.28);
}

.weighted-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 12px;
  padding: 8px 14px;
  background: var(--soft);
  border-radius: 10px;
  font-size: 13px;
  color: #34528f;
}

.weighted-row strong { font-size: 19px; color: var(--accent-dark); font-variant-numeric: tabular-nums; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }

textarea, select, input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; min-height: 66px; }

textarea:focus, select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 254, 0.12);
}

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.msg { font-size: 12.5px; color: var(--muted); min-height: 20px; }
.msg.ok { color: var(--green); }
.msg.error { color: var(--red); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c3d6; background: #fafbfe; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(47, 107, 254, 0.24);
}
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--red); border-color: #f0cdca; background: #fff7f6; }
.btn.danger:hover { background: #ffeceb; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.footer { padding: 8px 0 40px; font-size: 13px; color: var(--muted); }

/* ---------- 后台 ---------- */
.actions { display: flex; align-items: center; gap: 10px; }

.login {
  max-width: 380px;
  margin: 60px auto;
  padding: 28px 26px;
}

.login h2 { margin: 0 0 4px; font-size: 19px; }
.login p { margin: 0 0 18px; font-size: 13px; }
.login input { margin-bottom: 12px; }
.login .btn { width: 100%; }

.tabs { display: flex; gap: 8px; margin: 22px 0 16px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--text); border-color: var(--text); color: #fff; }

.panel { padding: 0 0 40px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head .left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-head .stat { font-size: 13px; color: var(--muted); }

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

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-weight: 600;
  color: #46516a;
  background: #f7f9fc;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcff; }
td.num { font-variant-numeric: tabular-nums; }
.score-cell { font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }

#summaryTable td:nth-child(2),
#detailTable td:nth-child(1) { white-space: nowrap; }

.comment-cell {
  width: 220px;
  max-width: 220px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.55;
  color: #3d465c;
}

#detailTable td:last-child,
#detailTable th:last-child { width: 68px; white-space: nowrap; }

.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-weight: 700; font-size: 13px; background: #f1f4f9; color: #6d778c; }
.rank.r1 { background: #fff3d1; color: #a57200; }
.rank.r2 { background: #eef1f6; color: #5d6a80; }
.rank.r3 { background: #fbeadd; color: #a35a20; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f9;
  color: #4b5872;
  white-space: nowrap;
  margin: 1px 3px 1px 0;
}
.pill.good { background: #e9f8f1; color: var(--green); }
.pill.warn { background: #fff5e2; color: var(--amber); }
.pill.bad { background: #ffecea; color: var(--red); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.comments-card { margin-top: 18px; padding: 4px 20px 18px; }
.comments-card h3 { font-size: 14px; margin: 18px 0 8px; }
.comment-item { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; margin-bottom: 10px; }
.comment-item .who { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.comment-item p { margin: 0; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }

/* 设置页 */
.settings { display: grid; gap: 18px; }
.section { padding: 18px 20px; }
.section h3 { margin: 0 0 4px; font-size: 15px; }
.section .desc { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.row-list { display: flex; flex-direction: column; gap: 8px; }
.row-item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-item input[type="text"] { flex: 1; min-width: 140px; }
.row-item input.w-num { width: 88px; flex: none; }
.row-item .unit { font-size: 13px; color: var(--muted); }

.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.login-msg { margin-top: 10px; font-size: 13px; }

.empty { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .form-grid { grid-template-columns: 1fr; }
  .interviewer-box { width: 100%; }
  .interviewer-box input { flex: 1; }
  .cand-tabs { grid-template-columns: repeat(2, 1fr); }
  .scale { grid-template-columns: repeat(5, 1fr); }
  .scale button { height: 32px; font-size: 13px; }
  .card-foot { flex-wrap: wrap; }
  .foot-actions { width: 100%; justify-content: flex-end; }
}
