:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #d6dbe3;
  --head: #f1f4f8;
  --accent: #2563eb;
  --row-hover: #f7f9fc;
  --error-bg: #fdecec;
  --error-text: #9b1c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1d2025;
    --text: #e6e8eb;
    --muted: #9aa2ad;
    --border: #353a42;
    --head: #24282e;
    --accent: #6ea0ff;
    --row-hover: #23272d;
    --error-bg: #3a1f1f;
    --error-text: #f5b4b4;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.bar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.who { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 14px; }
.who a { color: var(--accent); text-decoration: none; }

main { padding: 20px 24px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.filters select, .filters input, .filters button {
  font: inherit; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
.filters input { min-width: 240px; }
.filters button { background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer; }
.count { color: var(--muted); font-size: 13px; padding-bottom: 8px; }

.message {
  padding: 10px 14px; margin-bottom: 16px; border-radius: 6px;
  background: var(--error-bg); color: var(--error-text);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th + th, td + td { border-left: 1px solid var(--border); }
th {
  background: var(--head); font-weight: 600; white-space: nowrap;
  cursor: pointer; user-select: none;
}
th.sorted[data-dir="asc"]::after { content: " ▲"; font-size: 10px; color: var(--muted); }
th.sorted[data-dir="desc"]::after { content: " ▼"; font-size: 10px; color: var(--muted); }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.time { font-size: 12px; color: var(--muted); }
.muted, .empty { color: var(--muted); }
.empty { text-align: center; padding: 24px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge.ready      { background: #e7f6ec; color: #1a7f37; border-color: #b7e2c3; }
.badge.draft      { background: #eef0f3; color: #4b5563; border-color: #d5d9e0; }
.badge.processing { background: #e8f0fe; color: #1d4ed8; border-color: #bfd3fb; }
.badge.failed     { background: #fdecec; color: #b42318; border-color: #f5c2c0; }
.badge.cancelled  { background: #f3f0ea; color: #7a5b1e; border-color: #e3d8c3; }
@media (prefers-color-scheme: dark) {
  .badge.ready      { background: #133222; color: #7ee2a0; border-color: #24553a; }
  .badge.draft      { background: #2a2e35; color: #c3c9d2; border-color: #3c424b; }
  .badge.processing { background: #182a4d; color: #9dbcff; border-color: #2a4479; }
  .badge.failed     { background: #3a1f1f; color: #f5a8a3; border-color: #5c2c2a; }
  .badge.cancelled  { background: #352c1b; color: #e4c78d; border-color: #574629; }
}
