/* 公共样式：变量、重置、按钮、表单、工具 */
:root {
  --primary: #1e5aa8;
  --primary-dark: #164784;
  --primary-light: #e8f0fa;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --text: #1f2937;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f5f9;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(30, 90, 168, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid transparent; border-radius: 6px;
  font-size: 14px; cursor: pointer; background: var(--primary); color: #fff;
  transition: .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #f9fafb; border-color: #cbd5e1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-link { background: none; color: var(--primary); padding: 4px 6px; }
.btn-link:hover { background: var(--primary-light); text-decoration: none; }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: #374151; }
.field .hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 90, 168, .12);
}
.textarea { resize: vertical; min-height: 90px; }
.row { display: flex; gap: 14px; }
.row > .field { flex: 1; }
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.checkbox-line input { width: 16px; height: 16px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #f8fafc; font-weight: 600; color: #475569; white-space: nowrap; }
.table tr:hover td { background: #fafbfe; }
.table td.actions { white-space: nowrap; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #fef3c7; color: #92400e; }

/* 提示条 */
.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.hidden { display: none !important; }

/* 遮罩与模态框 */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { max-width: 900px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-sub); line-height: 1; }

/* 分页 */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* 空状态 / 加载 */
.empty { text-align: center; padding: 50px 20px; color: var(--text-sub); }
.loading { text-align: center; padding: 40px; color: var(--text-sub); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid #cbd5e1; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 8px; color: #fff; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.15); animation: fadein .2s; }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }
