:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --border-2: #d1d5db;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

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

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

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f0f7ff 45%, #f8fafc 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 24px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28);
}
.login-brand h1 { font-size: 19px; font-weight: 650; letter-spacing: .5px; }
.login-brand p { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.login-tip {
  margin-top: 18px; text-align: center;
  font-size: 12px; color: var(--text-3);
  padding-top: 16px; border-top: 1px solid var(--border);
}
.login-err {
  color: var(--danger); font-size: 13px;
  min-height: 20px; margin-bottom: 6px;
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-2); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 72px; }
input[readonly] { background: #f9fafb; color: var(--text-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: 8px;
  font-size: 14px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-light); }
.btn-outline { background: #fff; color: var(--text-2); border-color: var(--border-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f3f4f6; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
}
.brand-text strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.2; }
.brand-text span { font-size: 11px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.role-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #f3f4f6; color: var(--text-2);
}
.role-tag.admin { background: var(--primary-light); color: var(--primary); }

/* ---------- 导航 ---------- */
.tabs {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; display: flex; gap: 4px; overflow-x: auto;
  position: sticky; top: 60px; z-index: 40;
}
.tab {
  padding: 13px 16px; font-size: 14px; color: var(--text-2);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  font-family: inherit; transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px;
  background: var(--danger); color: #fff; border-radius: 9px;
  font-size: 11px; line-height: 18px; text-align: center;
}

/* ---------- 容器 ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 12px;
}
.page-head h2 { font-size: 19px; font-weight: 650; }
.page-head .desc { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-card .label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 650; line-height: 1.2; }
.stat-card .unit { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat-card .foot { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat-card.blue .value { color: var(--primary); }
.stat-card.green .value { color: var(--success); }
.stat-card.orange .value { color: var(--warning); }
.stat-card.red .value { color: var(--danger); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: #f9fafb; color: var(--text-2); font-weight: 500;
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 13px;
}
tbody td {
  padding: 11px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
.strong { font-weight: 600; }
.muted { color: var(--text-3); }
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); font-size: 14px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500; line-height: 19px;
}
.tag.pending { background: var(--warning-light); color: var(--warning); }
.tag.approved { background: var(--success-light); color: var(--success); }
.tag.rejected { background: var(--danger-light); color: var(--danger); }

/* ---------- 筛选栏 ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; background: #fafbfc; border-bottom: 1px solid var(--border);
}
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 130px; padding: 7px 10px; font-size: 13px; }
.filters label { font-size: 12px; margin-bottom: 4px; }

/* ---------- 表单网格 ---------- */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
}
.form-full { grid-column: 1 / -1; }

/* ---------- 提示条 ---------- */
.alert {
  padding: 11px 14px; border-radius: 8px; font-size: 13.5px;
  margin-bottom: 16px; border: 1px solid transparent;
}
.alert-info { background: var(--primary-light); color: var(--primary-dark); border-color: #dbeafe; }
.alert-warn { background: var(--warning-light); color: #92400e; border-color: #fde68a; }

/* ---------- 待办项 ---------- */
.todo-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 18px; border-bottom: 1px solid #f3f4f6;
}
.todo-item:last-child { border-bottom: none; }
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.todo-meta { font-size: 12.5px; color: var(--text-3); }
.todo-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 30px; transform: translateX(-50%) translateY(-20px);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 900; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; z-index: 800; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 24px; color: var(--text-3);
  cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; font-size: 14px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; background: #fafbfc;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .tabs { padding: 0 10px; }
  .container { padding: 16px 12px; }
  .stat-card .value { font-size: 22px; }
  .todo-item { flex-direction: column; align-items: stretch; }
  .todo-actions { justify-content: flex-end; }
}
