:root {
  color-scheme: dark light;
  --bg: #09090b;
  --bg-elev: #111113;
  --bg-soft: #18181b;
  --bg-hover: #1c1c1f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-ring: rgba(56, 189, 248, 0.28);
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 1px 0 rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.35);
  --radius: 10px;
  --radius-sm: 6px;
  --space: 8px;
  --row-font: 12.5px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  font-family: var(--sans);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa;
    --bg-elev: #ffffff;
    --bg-soft: #f4f4f5;
    --bg-hover: #f4f4f5;
    --line: rgba(24, 24, 27, 0.08);
    --line-strong: rgba(24, 24, 27, 0.12);
    --text: #09090b;
    --muted: #52525b;
    --faint: #71717a;
    --accent: #0284c7;
    --accent-soft: rgba(2, 132, 199, 0.08);
    --accent-ring: rgba(2, 132, 199, 0.22);
    --shadow: 0 1px 0 rgba(24,24,27,0.04), 0 8px 24px rgba(24,24,27,0.06);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  width: min(1560px, calc(100% - 2rem));
  margin: 0 auto;
  padding: calc(var(--space) * 3) 0 calc(var(--space) * 4);
}

/* —— Hero —— */
.hero {
  margin-bottom: calc(var(--space) * 2);
  padding-bottom: calc(var(--space) * 2);
  border-bottom: 1px solid var(--line);
}
.hero-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space);
  flex-wrap: wrap;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}
h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.as-of {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.disclaimer {
  margin: calc(var(--space) * 1.5) 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
  max-width: 72ch;
}

/* —— Metrics strip —— */
.metrics {
  display: flex;
  flex-direction: column;
  gap: var(--space);
  margin-bottom: calc(var(--space) * 2);
}
.metric-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}
.metric {
  flex: 1 1 0;
  min-width: 100px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--line);
}
.metric:last-child { border-right: none; }
.metric .label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.metric .value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.metric.total .value { color: var(--accent); }
.metric-strip.billing .metric .value { font-size: 16px; }

/* —— Toolbar —— */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space);
}
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); background: var(--bg-hover); }
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent);
}
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.clear-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.clear-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--bg-hover); }
.clear-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search input {
  width: min(220px, 100vw - 2rem);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  outline: none;
  font-size: 12.5px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 360px;
}
.active-pills[hidden] { display: none !important; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--accent-ring);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill-count {
  color: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* —— Table —— */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1280px;
  table-layout: fixed;
}
th, td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: var(--row-font);
  line-height: 1.3;
}
thead tr.header-row th {
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  color: var(--faint);
  font-weight: 550;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: none;
  z-index: 4;
  white-space: nowrap;
  user-select: none;
  border-bottom: 1px solid var(--line-strong);
  height: 32px;
}
thead tr.filter-row th {
  position: sticky;
  top: 32px;
  background: var(--bg-elev);
  z-index: 3;
  padding: 4px 6px 6px;
  border-bottom: 1px solid var(--line-strong);
  font-weight: 400;
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  width: 100%;
  text-align: left;
}
.th-sort:hover { color: var(--text); }
.th-sort .arrow {
  opacity: 0.3;
  font-size: 10px;
  font-weight: 600;
}
.th-sort.active { color: var(--text); }
.th-sort.active .arrow { opacity: 1; color: var(--accent); }

/* Text filter inputs */
.col-filter {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11.5px;
  outline: none;
  height: 26px;
}
.col-filter:focus {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.col-filter::placeholder { color: var(--faint); }

/* Multi-select dropdown */
.ms {
  position: relative;
  width: 100%;
}
.ms-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11.5px;
  height: 26px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.ms-btn:hover { border-color: var(--line-strong); }
.ms-btn.open,
.ms-btn:focus-visible {
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}
.ms-btn.has-value {
  border-color: var(--accent-ring);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
}
.ms-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ms-chevron {
  flex-shrink: 0;
  opacity: 0.45;
  font-size: 9px;
}
.ms-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max(100%, 160px);
  max-height: 240px;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
  padding: 4px;
}
.ms-panel[hidden] { display: none !important; }
.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  user-select: none;
}
.ms-option:hover { background: var(--bg-hover); }
.ms-option input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  margin: 0;
  flex-shrink: 0;
}
.ms-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-actions {
  display: flex;
  gap: 4px;
  padding: 4px 4px 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.ms-actions button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.ms-actions button:hover { color: var(--accent); background: var(--accent-soft); }

tbody tr:nth-child(even) { background: rgba(127, 127, 127, 0.03); }
tbody tr:hover { background: var(--accent-soft); }
.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem !important;
  font-size: 13px;
}

.email {
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.via {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.22);
  font-size: 11px;
  color: var(--violet);
  white-space: nowrap;
  font-weight: 500;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge.pending { color: #c4b5fd; background: rgba(196,181,253,0.1); border-color: rgba(196,181,253,0.22); }
.badge.draft { color: #93c5fd; background: rgba(96,165,250,0.1); border-color: rgba(96,165,250,0.22); }
.badge.submitted { color: #5eead4; background: rgba(45,212,191,0.1); border-color: rgba(45,212,191,0.22); }
.badge.rejected { color: #fca5a5; background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.22); }
.badge.unbanned { color: #6ee7b7; background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.22); }

@media (prefers-color-scheme: light) {
  .badge.pending { color: #6d28d9; background: rgba(109,40,217,0.08); border-color: rgba(109,40,217,0.18); }
  .badge.draft { color: #1d4ed8; background: rgba(29,78,216,0.08); border-color: rgba(29,78,216,0.18); }
  .badge.submitted { color: #0f766e; background: rgba(15,118,110,0.08); border-color: rgba(15,118,110,0.18); }
  .badge.rejected { color: #b91c1c; background: rgba(185,28,28,0.08); border-color: rgba(185,28,28,0.18); }
  .badge.unbanned { color: #047857; background: rgba(4,120,87,0.08); border-color: rgba(4,120,87,0.18); }
  .via { color: #6d28d9; background: rgba(109,40,217,0.08); border-color: rgba(109,40,217,0.16); }
}

.muted { color: var(--muted); }
.cell-trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  max-width: 100%;
}

.col-email { width: 11%; }
.col-suspendedAt { width: 7%; }
.col-via { width: 8%; }
.col-status { width: 9%; }
.col-plan { width: 6%; }
.col-aliveDays { width: 6%; }
.col-refunded { width: 5.5%; }
.col-lastAppeal { width: 7.5%; }
.col-angle { width: 14%; }
.col-note { width: 26%; }
td.num { font-variant-numeric: tabular-nums; text-align: right; padding-right: 12px; font-family: var(--mono); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space);
  margin-top: calc(var(--space) * 1.5);
  color: var(--faint);
  font-size: 12px;
}
.foot p { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 980px) {
  .metric { min-width: 80px; }
  .table-wrap { max-height: none; }
}
@media (max-width: 640px) {
  .page { width: min(100% - 1rem, 1560px); padding-top: calc(var(--space) * 2); }
  .search input { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar-right { width: 100%; }
  .search { flex: 1; }
  .metric { min-width: calc(50% - 1px); border-bottom: 1px solid var(--line); }
}
