/**
 * 公共样式
 */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
  background: #f5f7fb;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

/* ===== 容器 ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}
.container-narrow { max-width: 640px; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px 0;
  color: #111827;
}

/* ===== 表单 ===== */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}
.form-row label .req { color: #ef4444; margin-left: 2px; }

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="tel"],
.form-row input[type="email"],
.form-row input[type="date"],
.form-row input[type="password"],
.form-row input[type="datetime-local"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row .hint { font-size: 12px; color: #6b7280; margin-top: 4px; }
.form-row .err { font-size: 12px; color: #ef4444; margin-top: 4px; display: none; }
.form-row.invalid input, .form-row.invalid select, .form-row.invalid textarea { border-color: #ef4444; }
.form-row.invalid .err { display: block; }

.form-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
}
@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: #2563eb;
  color: #fff;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }

.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f3f4f6; }

.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: #10b981; }
.btn-success:hover { background: #059669; }

.btn-warn { background: #f59e0b; }
.btn-warn:hover { background: #d97706; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 表格 ===== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
.tbl th, .tbl td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}
.tbl th {
  background: #f9fafb;
  color: #374151;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.tbl tbody tr:hover { background: #f9fafb; }

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}
.badge-gray   { background: #e5e7eb; color: #374151; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #047857; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ===== 顶部导航 ===== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-size: 18px; font-weight: 600; color: #111827;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand-mark {
  display: inline-block; width: 28px; height: 28px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 6px; color: #fff; text-align: center; line-height: 28px;
  font-size: 14px; font-weight: 700;
}
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: #4b5563; font-size: 14px; }
.topbar nav a.active { color: #2563eb; font-weight: 600; }

/* ===== 标签页 ===== */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px;
  flex-wrap: wrap;
}
.tabs .tab {
  padding: 10px 16px; cursor: pointer;
  color: #6b7280; font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: #2563eb; }
.tabs .tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 500; }

/* ===== 统计卡片 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #e5e7eb;
}
.stat-card .label { color: #6b7280; font-size: 13px; }
.stat-card .value { font-size: 24px; font-weight: 600; color: #111827; margin-top: 4px; }
.stat-card.green .value { color: #047857; }
.stat-card.blue .value { color: #1d4ed8; }
.stat-card.orange .value { color: #c2410c; }
.stat-card.red .value { color: #b91c1c; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.modal h3 { margin: 0 0 16px 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ===== 提示文本 ===== */
.muted { color: #6b7280; }
.center { text-align: center; }
.divider { height: 1px; background: #e5e7eb; margin: 16px 0; }
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ===== 移动端适配 ===== */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .topbar nav { gap: 12px; }
  .topbar nav a { font-size: 13px; }
  .container { padding: 16px 12px; }
  .card { padding: 16px; }
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 6px; }
}
