:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #1f4e79;
  --accent-2: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; background: #0f172a; color: #e2e8f0;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.topbar .brand span { color: #93c5fd; font-weight: 400; }
.topbar nav a { color: #cbd5e1; margin-left: 20px; font-size: 14px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; text-decoration: none; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; margin: 0; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.card .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; }
tbody tr:hover { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.queued { background: #fef3c7; color: #92400e; }
.badge.running { background: #dbeafe; color: #1e40af; }
.badge.succeeded { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.cancelled { background: #e5e7eb; color: #374151; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.filled { background: #dcfce7; color: #166534; }
.badge.rejected, .badge.expired { background: #fee2e2; color: #991b1b; }
form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px; color: var(--ink);
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
button, .btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 13px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
button:disabled { opacity: .55; cursor: not-allowed; }
.chart { width: 100%; height: 340px; }
.chart.small { height: 260px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.kv { display: flex; gap: 8px; color: var(--muted); font-size: 12px; }
.notice { padding: 12px 14px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; margin-bottom: 16px; }
.notice.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.scroll { max-height: 420px; overflow: auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pos { color: var(--green); }
.neg { color: var(--red); }
@media (max-width: 900px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
}
