/* 参考实现的样式表：无构建、无框架，只为让"逻辑跑得动"看得见。
   生产前端是 React 18 + Ant Design Pro 5（架构 §2.6），组件并不复用这里。 */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e4e6eb;
  --text: #1f2329;
  --muted: #6b7280;
  --brand: #1f6feb;
  --brand-weak: #e8f0fe;
  --danger: #d92d20;
  --danger-weak: #fdecea;
  --warn: #b45309;
  --warn-weak: #fff5e6;
  --ok: #12805c;
  --ok-weak: #e7f6ef;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

a { color: var(--brand); text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.topbar .brand small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel > h2 {
  margin: 0;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel > h2 .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.panel > .body { padding: 16px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }
.spacer { flex: 1; }

label.field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

input[type=text], input[type=month], input[type=date], input[type=password], input[type=number], select, textarea {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  min-height: 32px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
textarea { min-height: 72px; resize: vertical; width: 100%; }

.btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #c9ced6; background: #fafbfc; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1a5fd0; border-color: #1a5fd0; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b42318; border-color: #b42318; }
.btn-sm { min-height: 26px; padding: 2px 8px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--brand); padding: 0 4px; min-height: auto; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-blue { background: var(--brand-weak); color: #14508f; }
.tag-red { background: var(--danger-weak); color: #a3180d; }
.tag-amber { background: var(--warn-weak); color: var(--warn); }
.tag-ok { background: var(--ok-weak); color: var(--ok); }
.tag-gray { background: #f2f3f5; color: var(--muted); }

table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { background: #fbfbfc; color: var(--muted); font-weight: 500; white-space: nowrap; }
table.list tr:hover td { background: #fafbfc; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list .empty { padding: 24px; text-align: center; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.kpi {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
}
.kpi .label { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.kpi .value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi.alert { border-color: #f3c9c4; background: var(--danger-weak); }
.kpi.warn { border-color: #f5dcb3; background: var(--warn-weak); }

.batches { display: flex; flex-direction: column; gap: 8px; }
.batch-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  background: #fff;
}
.batch-item:hover { border-color: #c9ced6; }
.batch-item.active { border-color: var(--brand); background: var(--brand-weak); }
.batch-item .no { font-weight: 600; font-variant-numeric: tabular-nums; }
.batch-item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

.notice { border-left: 3px solid var(--brand); background: var(--brand-weak); padding: 8px 12px; border-radius: 4px; font-size: 13px; }
.notice.red { border-color: var(--danger); background: var(--danger-weak); }
.notice.amber { border-color: var(--warn); background: var(--warn-weak); }
.notice.ok { border-color: var(--ok); background: var(--ok-weak); }
.notice + .notice { margin-top: 8px; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .2);
}
.modal h3 { margin: 0; padding: 14px 18px; font-size: 15px; border-bottom: 1px solid var(--line); }
.modal .content { padding: 16px 18px; overflow: auto; }
.modal .foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1f2329;
  color: #fff;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 80;
  max-width: 80vw;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
.split { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .wrap { padding: 12px; }
}
