/* ========== 员工信息登记系统 全局样式 ========== */
:root {
  --primary: #2f6fed;
  --primary-dark: #1f56c8;
  --primary-light: #eaf1fe;
  --danger: #e5484d;
  --danger-light: #fdecec;
  --success: #30a46c;
  --success-light: #e7f6ee;
  --warn: #d97706;
  --text: #1f2329;
  --text-2: #5c636e;
  --text-3: #8a919c;
  --border: #e3e6eb;
  --bg: #f4f6fa;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.04);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #2f6fed, #6ea8ff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.nav-tabs { display: flex; gap: 4px; }
.nav-tabs a {
  padding: 8px 18px; border-radius: 8px; text-decoration: none;
  color: var(--text-2); font-weight: 500; transition: all .15s;
}
.nav-tabs a:hover { background: var(--bg); color: var(--text); }
.nav-tabs a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ---------- 布局容器 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.page-desc { color: var(--text-2); margin-bottom: 20px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card + .card { margin-top: 0; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.card-title .badge {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0;
}
.card-title .optional { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 20px;
}
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 500; color: var(--text); }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
textarea.form-control { height: auto; padding: 8px 12px; resize: vertical; min-height: 70px; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12); }
.form-control.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.10); }
.form-control.invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.14); }
.form-control:disabled { background: var(--bg); color: var(--text-3); }
select.form-control { cursor: pointer; appearance: auto; }
.error-msg { color: var(--danger); font-size: 12px; min-height: 0; display: none; }
.error-msg.show { display: block; }
.hint { color: var(--text-3); font-size: 12px; }

/* 性别单选 */
.radio-group { display: flex; gap: 8px; }
.radio-item {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 16px; cursor: pointer; user-select: none;
  transition: all .15s; background: #fff;
}
.radio-item.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.radio-item input { display: none; }

/* ---------- 照片上传 ---------- */
.photo-upload {
  display: flex; align-items: center; gap: 16px;
}
.photo-box {
  width: 92px; height: 120px; border-radius: 8px; overflow: hidden;
  border: 1px dashed var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; flex-shrink: 0;
  transition: all .15s;
}
.photo-box:hover { border-color: var(--primary); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-box.has-photo img { display: block; }
.photo-box.has-photo .photo-placeholder { display: none; }
.photo-placeholder { text-align: center; color: var(--text-3); font-size: 12px; }
.photo-placeholder svg { width: 28px; height: 28px; margin-bottom: 4px; opacity: .6; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 14px; font-weight: 500; transition: all .15s; text-decoration: none;
  user-select: none;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f3c1c3; }
.btn.danger:hover { background: var(--danger-light); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 多条记录（教育/工作经历） ---------- */
.sub-record {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 12px; background: #fafbfd;
  position: relative;
}
.sub-record .record-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-weight: 600; font-size: 13px; color: var(--text-2);
}
.sub-record .record-head .num { color: var(--primary); margin-right: 4px; }
.remove-btn {
  border: none; background: none; color: var(--text-3); cursor: pointer;
  font-size: 13px; padding: 4px 8px; border-radius: 6px;
}
.remove-btn:hover { background: var(--danger-light); color: var(--danger); }
.add-record-btn {
  border: 1px dashed #b8c6e8; background: var(--primary-light);
  color: var(--primary); width: 100%; height: 38px; border-radius: 8px;
  cursor: pointer; font-size: 14px; transition: all .15s;
}
.add-record-btn:hover { border-color: var(--primary); background: #dde9fd; }

/* ---------- 提交区 ---------- */
.submit-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px; margin-top: 4px;
}
.submit-bar .btn { height: 42px; padding: 0 34px; font-size: 15px; border-radius: 10px; }
.submit-hint { color: var(--text-3); font-size: 13px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.toast {
  background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(16,24,40,.16);
  padding: 12px 20px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; animation: toastIn .25s ease; max-width: 480px;
  border: 1px solid var(--border);
}
.toast.success { border-color: #b7e4cb; }
.toast.success .icon { color: var(--success); }
.toast.error { border-color: #f3c1c3; }
.toast.error .icon { color: var(--danger); }
.toast .icon { font-size: 17px; font-weight: 700; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- 数据管理页 ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 18px 24px; margin-bottom: 20px;
}
.filter-item { display: flex; flex-direction: column; gap: 5px; }
.filter-item label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.filter-item .form-control { width: 160px; height: 34px; }
.filter-item.search .form-control { width: 220px; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

.table-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.table-toolbar .count { color: var(--text-2); font-size: 13px; }
.table-toolbar .count b { color: var(--primary); font-size: 15px; }

table.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 11px 12px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table th {
  background: #f7f9fc; color: var(--text-2); font-weight: 600;
  position: sticky; top: 0;
}
.data-table tbody tr:hover { background: #f7f9fd; }
.data-table .avatar {
  width: 30px; height: 38px; border-radius: 4px; object-fit: cover;
  border: 1px solid var(--border); background: var(--bg); display: block;
}
.data-table .avatar.empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11px; background: var(--bg);
}
.dept-tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; background: var(--primary-light); color: var(--primary);
}
.row-actions { display: flex; gap: 6px; }
.link-btn {
  border: none; background: none; color: var(--primary); cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: 4px;
}
.link-btn:hover { background: var(--primary-light); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-light); }
.empty-tip {
  text-align: center; padding: 60px 20px; color: var(--text-3);
}
.empty-tip .big { font-size: 34px; margin-bottom: 8px; }

/* ---------- 详情弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 640px;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(16,24,40,.25);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
.detail-item { display: flex; gap: 8px; font-size: 13px; }
.detail-item .k { color: var(--text-3); flex-shrink: 0; min-width: 70px; }
.detail-item .v { color: var(--text); word-break: break-all; }
.detail-section { margin-top: 18px; }
.detail-section h4 {
  font-size: 13px; color: var(--text-2); font-weight: 600;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.detail-section .sub {
  background: #f7f9fc; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  font-size: 13px;
}
.detail-section .sub .line { color: var(--text); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.cols-2 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-item .form-control { width: 100%; }
  .filter-actions { margin-left: 0; }
  .topbar-inner { padding: 0 12px; }
  .nav-tabs a { padding: 8px 10px; font-size: 13px; }
}

/* ---------- 用户信息条（鉴权版新增） ---------- */
.userbar { display: flex; align-items: center; gap: 10px; }
.userbar .user-name { color: var(--text-2); font-size: 13px; }
.topbar-inner .nav-tabs { margin-right: 14px; }
.topbar-right { display: flex; align-items: center; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef3fc 0%, #f4f6fa 60%, #e9f0fb 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(16, 24, 40, 0.10);
  padding: 32px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .logo {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #2f6fed, #6ea8ff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
}
.login-title { font-size: 18px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--text-3); }
.login-card .form-group { margin-bottom: 16px; }
.login-card label { font-weight: 500; margin-bottom: 6px; display: block; }
.login-card .form-control { width: 100%; }
.login-card .btn-block { width: 100%; padding: 11px 0; font-size: 15px; margin-top: 4px; }
.login-tip {
  margin-top: 14px; font-size: 12px; color: var(--text-3);
  background: #f7f9fc; border-radius: 8px; padding: 10px 12px; line-height: 1.7;
}

/* ---------- 无权限提示 ---------- */
.no-permission {
  max-width: 480px; margin: 60px auto; text-align: center;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 40px 30px;
}
.no-permission .big { font-size: 40px; margin-bottom: 12px; }
.no-permission h3 { font-size: 17px; margin-bottom: 8px; }
.no-permission p { color: var(--text-2); margin-bottom: 18px; font-size: 13px; }
