:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --border: #e3e8f0;
  --text: #1f2937;
  --text-soft: #6b7280;
  --sidebar: #1e293b;
  --sidebar-soft: #334155;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
}
.login-card {
  width: 360px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--text-soft); margin: 0 0 24px; font-size: 13px; }
.login-card label { display: block; font-size: 13px; margin: 14px 0 6px; color: var(--text-soft); }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--brand); }
.login-btn {
  width: 100%; margin-top: 22px; padding: 11px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 15px; cursor: pointer;
}
.login-btn:hover { background: var(--brand-dark); }
.login-err { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar .brand {
  padding: 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
  border-bottom: 1px solid var(--sidebar-soft);
  line-height: 1.45; word-break: break-all;
}
.sidebar .brand small { display:block; font-size: 12px; font-weight: 400; color:#94a3b8; margin-top:2px;}
.sidebar nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px;
  cursor: pointer; color: #cbd5e1; margin-bottom: 4px; font-size: 14px; user-select: none;
}
.nav-item:hover { background: var(--sidebar-soft); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid var(--sidebar-soft); font-size: 12px; color:#94a3b8;}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .user { color: var(--text-soft); font-size: 13px; display:flex; align-items:center; gap:12px;}
.topbar .user button {
  border: 1px solid var(--border); background:#fff; border-radius: 6px; padding: 5px 12px;
  cursor: pointer; color: var(--text); font-size: 13px;
}
.topbar .user button:hover { border-color: var(--brand); color: var(--brand); }
.content { padding: 22px; flex: 1; overflow: auto; }
.view { display: none; }
.view.active { display: block; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow);
}
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.muted { color: var(--text-soft); }

.btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: var(--text);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); color:#fff; }
.btn-danger { color: var(--red); border-color: #f1c4c4; }
.btn-danger:hover { background: #fef2f2; color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------------- 看板 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.stat-card .label { color: var(--text-soft); font-size: 13px; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.stat-card .value.blue { color: var(--brand); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.amber { color: var(--amber); }
.stat-card .value.red { color: var(--red); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut {
  width: 140px; height: 140px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.donut .center { font-size: 22px; font-weight: 700; }
.legend { flex: 1; }
.legend .item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend .cnt { margin-left: auto; font-weight: 600; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-item .name { width: 90px; flex-shrink: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-item .track { flex: 1; background: #eef2f7; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-item .fill { height: 100%; background: var(--brand); border-radius: 6px; }
.bar-item .cnt { width: 38px; text-align: right; font-weight: 600; flex-shrink: 0; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: #eef2ff; color: var(--brand-dark); border-radius: 20px;
  padding: 5px 12px; font-size: 13px; border: 1px solid #dbe3ff;
}
.tag b { color: var(--brand); }

/* ---------------- 列表 ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); }
.toolbar .spacer { flex: 1; }

#listTableWrap { overflow-x: auto; }
table.tbl { width: 100%; min-width: 860px; border-collapse: collapse; background: var(--panel); }
table.tbl th, table.tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
table.tbl th { background: #f8fafc; color: var(--text-soft); font-weight: 600; }
table.tbl tr:hover td { background: #f9fbff; }
table.tbl tbody tr.row-clickable { cursor: pointer; }
.tag-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.mini-tag { background: #eef2f7; border-radius: 5px; padding: 2px 7px; font-size: 12px; color:#475569;}

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.b1 { background: #fef3c7; color: #92400e; }
.badge.b2 { background: #dbeafe; color: #1e40af; }
.badge.b3 { background: #e2e8f0; color: #475569; }
.badge.b4 { background: #dcfce7; color: #166534; }
.badge.b5 { background: #ede9fe; color: #5b21b6; }
/* 分类：A绿 / B黄 / C暗红 */
.badge.cat-a { background: #dcfce7; color: #166534; }
.badge.cat-b { background: #fef9c3; color: #a16207; }
.badge.cat-c { background: #fee2e2; color: #991b1b; }
/* 状态：淘汰灰 / 待初试浅黄 / 待复试橙 / 待董事长面试蓝 / 拟录用绿 */
.badge.st-out     { background: #f1f5f9; color: #64748b; }
.badge.st-first   { background: #fef9c3; color: #a16207; }
.badge.st-second  { background: #ffedd5; color: #c2410c; }
.badge.st-chairman{ background: #dbeafe; color: #1e40af; }
.badge.st-hired   { background: #dcfce7; color: #166534; }
.arrival-hint { margin-left: 6px; font-size: 12px; color: var(--text-soft); white-space: nowrap; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 16px; font-size: 13px; color: var(--text-soft); }
.pager button { border: 1px solid var(--border); background:#fff; border-radius:6px; padding:6px 12px; cursor:pointer; }
.pager button:disabled { color:#cbd5e1; cursor:not-allowed; }
.page-size-ctrl { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pager select { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 8px; font-size: 13px; color: var(--text); cursor: pointer; }

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

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50;
}
.modal-mask.active { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 720px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display:flex; justify-content: space-between; align-items:center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { cursor: pointer; color: var(--text-soft); font-size: 22px; line-height: 1; }
.modal-body { padding: 20px; max-height: 70vh; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Excel 导入弹窗 */
.modal-wide { width: 1040px; }
.import-steps { display: flex; flex-direction: column; gap: 18px; }
.import-steps .step { display: flex; gap: 12px; align-items: flex-start; }
.import-steps .step-no {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--brand); color:#fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.import-steps .step-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.import-steps .step-desc { color: var(--text-soft); font-size: 12px; margin-bottom: 8px; line-height: 1.6; }
.import-steps .step-grow { flex: 1; }
.import-summary { display:flex; gap:16px; flex-wrap:wrap; margin: 4px 0 12px; font-size:13px; }
.import-summary .ok-count { color:#16a34a; font-weight:600; }
.import-summary .err-count { color:#dc2626; font-weight:600; }
.import-preview-wrap { overflow:auto; max-height: 46vh; border:1px solid var(--border); border-radius:8px; }
.tbl-import { width:100%; border-collapse:collapse; font-size:12px; white-space:nowrap; }
.tbl-import th, .tbl-import td { padding:7px 10px; border-bottom:1px solid var(--border); text-align:left; }
.tbl-import th { background:#f8fafc; position:sticky; top:0; font-weight:600; }
.tbl-import tr.row-invalid { background:#fef2f2; }
.tbl-import .err-text { color:#dc2626; font-size:11px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 5px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; font-family: inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--brand); }
.form-grid textarea { resize: vertical; min-height: 60px; }
.form-grid input.readonly-input { background: #f1f5f9; color: #475569; cursor: not-allowed; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.detail-grid .k { color: var(--text-soft); font-size: 12px; }
.detail-grid .v { font-size: 14px; margin-bottom: 6px; }
.detail-block { margin-top: 14px; }
.detail-block.detail-resume-first { margin-top: 0; }
.detail-block h4 { margin: 0 0 8px; font-size: 14px; }
.resume-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.resume-heading h4 { margin: 0; }
.timeline { border-left: 2px solid var(--border); padding-left: 14px; margin-left: 4px; }
.timeline .item { margin-bottom: 12px; }
.timeline .item .t { font-weight: 600; }
.timeline .item .d { color: var(--text-soft); font-size: 12px; }

.resume-box { margin-top: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: 8px; display:flex; align-items:center; gap:12px; }
.resume-box .fname { flex:1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-hint { font-size: 12px; color: var(--text-soft); margin-top: 6px; }

.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid, .chart-row-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
