/* ===================== 基础重置 ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --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);
}

html, body { height: 100%; }

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

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }
img { max-width: 100%; display: block; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6e0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b6bfcc; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.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: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: #cbd5e1; color: var(--text); }

.btn-light { background: var(--primary-light); color: var(--primary); }
.btn-light:hover { background: #dbeafe; }

.btn-block { width: 100%; height: 42px; font-size: 15px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

/* ===================== 状态标签 ===================== */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}
.tag-green  { background: var(--success-light); color: var(--success); }
.tag-blue   { background: var(--primary-light); color: var(--primary); }
.tag-orange { background: var(--warning-light); color: #b45309; }
.tag-red    { background: var(--danger-light); color: var(--danger); }
.tag-gray   { background: #f3f4f6; color: var(--text-2); }
.tag-cyan   { background: #ecfeff; color: var(--info); }
.tag-purple { background: #f5f3ff; color: #7c3aed; }

/* ===================== 表单 ===================== */
.form-grid { display: flex; flex-wrap: wrap; gap: 14px 16px; }
.form-item { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; }
.form-item.half { flex: 1 1 calc(50% - 8px); }
.form-item label { font-size: 13px; color: var(--text-2); }
.form-item label i { color: var(--danger); font-style: normal; }
.form-item input,
.form-item select,
.form-item textarea {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  transition: .18s;
}
.form-item textarea { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.6; }
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.form-item input[readonly],
.form-item textarea[readonly] { background: #f9fafb; color: var(--text-2); }
.input-error { border-color: var(--danger) !important; }

/* ===================== 弹窗 ===================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-sm { width: 380px; }
.modal-wide { width: 760px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
}
.modal-close:hover { color: var(--danger); }

.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ===================== 轻提示 ===================== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #1f2937; }
.toast-out { opacity: 0; transform: translate(-50%, -10px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===================== 空状态 ===================== */
.empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty-icon { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ===================== 通用卡片 ===================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
