:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e6e8ec;
  --text: #1f2329;
  --muted: #7a808a;
  --accent: #ff7a00;
  --accent-weak: #fff3e6;
  --green: #1a7f4b;
  --red: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.ghost { background: #fff; }

button:disabled { opacity: .5; cursor: not-allowed; }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

textarea { resize: vertical; min-height: 72px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
}

.login-card h1 { font-size: 18px; margin: 0 0 4px; }

.hint { color: var(--muted); font-size: 12px; }

.field { margin-bottom: 14px; }

.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header .brand { font-weight: 600; }

header .who { color: var(--muted); font-size: 12px; }

main { padding: 24px; max-width: 1240px; margin: 0 auto; overflow-x: auto; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }

main > table { min-width: 980px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}

th { background: #fafbfc; color: var(--muted); font-weight: 500; }

tr:last-child td { border-bottom: none; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f2f3f5;
  color: #5c6370;
}

.badge.running { background: #e8f7ee; color: var(--green); }
.badge.pending { background: var(--accent-weak); color: #b35c00; }
.badge.stopped, .badge.ended { background: #f2f3f5; color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 28, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow: auto;
  z-index: 20;
}

.modal[hidden] { display: none; }

.modal-card {
  background: #fff;
  border-radius: 10px;
  width: 760px;
  max-width: 100%;
  padding: 24px;
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.modal-card table { min-width: 0; table-layout: fixed; }
.modal-card th, .modal-card td { padding: 8px 10px; }

.uuid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #5c6370;
  word-break: break-all;
}

.time { white-space: nowrap; font-variant-numeric: tabular-nums; }

.modal-card h3 { margin: 0 0 16px; font-size: 16px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.prize-row {
  display: grid;
  grid-template-columns: 1.3fr 1.1fr .8fr .7fr .7fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

h4 { margin: 18px 0 8px; font-size: 14px; }

.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  word-break: break-all;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: #1f2329;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 50;
}

.error { color: var(--red); font-size: 13px; margin-top: 8px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

[hidden] { display: none !important; }
