:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a1d24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-soft: #eff6ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.wide { max-width: 1080px; }

h1 { font-size: 22px; margin: 8px 0 2px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}

label.field { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
label.field:first-child { margin-top: 0; }
.req::after { content: " *"; color: var(--danger); }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { min-height: 72px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.dim-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.dim-row:last-child { border-bottom: none; }
.dim-name { font-size: 14px; flex: 1; }
.score-btns { display: flex; gap: 6px; }
.score-btns button {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
}
.score-btns button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

.reco-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.reco-btns .chip { text-align: center; border-radius: 8px; }
.reco-btns .chip.on[data-v="强烈推荐"], .reco-btns .chip.on[data-v="推荐"] { background: var(--ok); border-color: var(--ok); }
.reco-btns .chip.on[data-v="待定"] { background: #d97706; border-color: #d97706; }
.reco-btns .chip.on[data-v="不推荐"] { background: var(--danger); border-color: var(--danger); }

.btn {
  display: inline-block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.small { width: auto; padding: 8px 16px; font-size: 14px; }

.error-box { color: var(--danger); font-size: 14px; margin: 10px 0; white-space: pre-line; }
.success { text-align: center; padding: 48px 0; }
.success .big { font-size: 48px; }

/* ── 管理页 ── */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; flex: 1; min-width: 140px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr.row { cursor: pointer; }
tr.row:hover { background: var(--brand-soft); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge.b-强烈推荐 { background: #dcfce7; color: #15803d; }
.badge.b-推荐 { background: #dbeafe; color: #1d4ed8; }
.badge.b-待定 { background: #fef3c7; color: #b45309; }
.badge.b-不推荐 { background: #fee2e2; color: #b91c1c; }

.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 14px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; white-space: pre-wrap; }

dialog {
  border: none; border-radius: var(--radius);
  max-width: 560px; width: calc(100vw - 40px);
  padding: 20px;
}
dialog::backdrop { background: rgba(0,0,0,0.35); }

/* ── 管理页视图切换 ── */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.tab.on { background: var(--text); border-color: var(--text); color: #fff; font-weight: 600; }

/* ── 候选人总览卡片 ── */
.cand-card { padding: 0; overflow: hidden; }
.cand-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 14px 16px; cursor: pointer;
}
.cand-head:hover { background: var(--brand-soft); }
.cand-name { font-size: 16px; margin-right: 8px; }
.cand-side { display: flex; align-items: center; gap: 12px; font-size: 14px; white-space: nowrap; }
.cand-arrow { color: var(--muted); }
.cand-round {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; font-size: 14px;
  border-top: 1px dashed var(--line);
  cursor: pointer;
}
.cand-round:hover { background: var(--brand-soft); }
.badge-round {
  display: inline-block; min-width: 44px; text-align: center;
  padding: 3px 10px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 600;
}
@media (max-width: 560px) {
  .cand-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ── 面试链接与附件 ── */
.file-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 4px 10px 0 0; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text);
  font-size: 13px; text-decoration: none;
}
.file-link:hover { border-color: var(--brand); color: var(--brand); }

.cand-info-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.iv-result {
  margin-top: 14px; padding: 12px;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
  font-size: 14px;
}
.iv-link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.iv-link-row code {
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; word-break: break-all;
}
.iv-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.iv-actions { display: flex; gap: 8px; flex-shrink: 0; }

input[type="file"] {
  width: 100%; font-size: 14px; padding: 8px;
  border: 1px dashed var(--line); border-radius: 8px; background: #fff;
}

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

/* ── 图片灯箱预览 ── */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 20px;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%; max-height: 82vh;
  border-radius: 8px; object-fit: contain;
}
.lightbox-name { color: #fff; font-size: 14px; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-hint { color: rgba(255,255,255,0.6); font-size: 13px; }

/* ── 移动端深度优化：大触控目标、吸底提交 ── */
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .wrap { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .card { padding: 16px 14px; border-radius: 14px; }

  /* 触控目标 ≥ 44px */
  .chip { padding: 11px 16px; font-size: 15px; }
  input[type="text"], input[type="password"], select { padding: 12px; }
  textarea { min-height: 64px; }

  /* 评分：维度名在上，5 个大按钮铺满一行 */
  .dim-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 0; }
  .dim-name { font-size: 15px; font-weight: 600; }
  .score-btns { width: 100%; gap: 8px; }
  .score-btns button { flex: 1; width: auto; height: 46px; font-size: 17px; border-radius: 10px; }

  .reco-btns { grid-template-columns: repeat(2, 1fr); }
  .reco-btns .chip { padding: 12px 8px; font-size: 15px; }

  /* 提交按钮吸底，始终一拇指可达 */
  #submit {
    position: fixed; left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto; z-index: 50;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  }

  .cand-info .file-link { padding: 9px 14px; font-size: 14px; }
}
