* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 10px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  padding: 6px 12px;
}
.btn-ghost:hover { background: var(--border); }

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input[readonly], input[disabled] {
  background: #f1f5f9;
  color: var(--text-light);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
}

.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* 顶部导航 */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  gap: 8px;
}
.topbar .brand {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  flex-shrink: 0;
}
.topbar .brand .logo {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.topbar .nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.topbar-tabs {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}
.topbar-tab {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.topbar-tab:hover { background: var(--primary-light); color: var(--primary); }
.topbar-tab.active { background: var(--primary); color: #fff; }
.topbar .user-info {
  font-size: 13px;
  color: var(--text-light);
}
.topbar .user-info .badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.topbar .user-info .badge.hr {
  background: var(--success-light);
  color: var(--success);
}

/* 容器 */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.container.narrow { max-width: 560px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
}

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card .logo {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; font-weight: 800;
  margin: 0 auto 16px;
}
.login-card h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
}
.login-card .sub {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 24px;
}
.login-card .demo-accounts {
  margin-top: 20px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-light);
}
.login-card .demo-accounts p { margin-bottom: 4px; }
.login-card .demo-accounts .acc {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.login-card .demo-accounts .acc:last-child { border: none; }
.login-card .demo-accounts code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--primary);
}

/* 表单 */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row .field-full { grid-column: 1 / -1; }

/* 工号自动补全 */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  margin-top: 2px;
}
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--primary-light); }
.autocomplete-item .emp-id {
  font-weight: 700;
  color: var(--primary);
  min-width: 80px;
}
.autocomplete-item .emp-name {
  flex: 1;
  color: var(--text);
}
.autocomplete-item .emp-dept {
  color: var(--text-light);
  font-size: 12px;
}
#f-emp-input {
  font-size: 15px;
  letter-spacing: 0.5px;
}
/* 图片上传 */
.image-uploader {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.image-uploader:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.image-uploader .hint-text {
  color: var(--text-light);
  font-size: 13px;
}
.image-uploader .hint-text .icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}
.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.image-preview {
  position: relative;
  width: 80px; height: 80px;
}
.image-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.image-preview .remove-btn {
  position: absolute;
  top: -6px; right: -6px;
  width: 22px; height: 22px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: 2px solid #fff;
}

/* 扣分徽章 */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--danger-light);
  color: var(--danger);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
}
.points-badge.bonus {
  background: var(--success-light);
  color: var(--success);
}

/* Toast */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  z-index: 9999;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Tab */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  padding: 6px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
}
.tab.active {
  background: var(--primary);
  color: #fff;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:hover td { background: #fafbfc; }

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.stat-card.danger .num { color: var(--danger); }

/* 柱状图（纯CSS） */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bar-row .bar-label {
  width: 120px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-row .bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.bar-row .bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.3s;
  min-width: 2px;
}
.bar-row .bar-value {
  font-size: 13px;
  font-weight: 600;
  width: 40px;
  text-align: right;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
/* 嵌套弹窗（弹窗中再开弹窗）需要更高层级 */
.modal-overlay .modal-overlay,
.modal-overlay[style*="z-index"] {
  z-index: 300;
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal h3 {
  margin-bottom: 16px;
  font-size: 18px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* 筛选条 */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.filter-bar .field { margin-bottom: 0; }
.filter-bar label { font-size: 12px; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}
.empty .icon { font-size: 40px; margin-bottom: 8px; }

/* 记录卡片（移动端） */
.record-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.record-card .top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.record-card .name {
  font-weight: 700;
  font-size: 15px;
}
.record-card .meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.record-card .desc {
  font-size: 13px;
  color: var(--text);
  margin: 8px 0;
}
.record-card .thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.record-card .thumbs img {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 6px;
}

/* 移动端响应式 */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .topbar .user-info .name-text { display: none; }
  .container { padding: 14px 12px 60px; }
  .card { padding: 16px; }
  .modal { padding: 18px; }
  .topbar { padding: 8px 12px; }
  .topbar-tabs { order: 3; width: 100%; justify-content: flex-start; border-top: 1px solid var(--border); margin-top: 4px; }
}

/* 列表项 */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border: none; }
.list-item .info { flex: 1; }
.list-item .info .title { font-weight: 600; }
.list-item .info .sub { font-size: 12px; color: var(--text-light); }
.list-item .actions { display: flex; gap: 6px; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-header h2 { font-size: 17px; }

/* loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 提交成功页 */
.success-icon {
  width: 64px; height: 64px;
  background: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  color: #fff;
}

/* 自定义圆形勾选框 */
.custom-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  margin-top: 2px;
}
.custom-check:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.custom-check.checked {
  background: var(--primary);
  border-color: var(--primary);
}
.custom-check.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.custom-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 部门选择按钮组 */
.dept-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}
.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.dept-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}
.dept-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 员工勾选行 */
.emp-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
  border-radius: 7px;
}
.emp-check-row.selected {
  background: #eef6ff;
  border-color: #93c5fd;
  box-shadow: inset 3px 0 0 var(--primary);
}
.eval-selected-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.eval-selected-badge[hidden] {
  display: none;
}
.emp-check-row:hover {
  background: var(--bg);
  border-radius: 6px;
}
.emp-check-row:last-child {
  border-bottom: none;
}
