:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background: #0b0d10;
  color: #e8ebef;
  letter-spacing: 0;
  --line: #292e35;
  --muted: #8e98a5;
  --surface: #12161b;
  --surface-2: #171c22;
  --accent: #b8ed37;
  --accent-ink: #11150a;
  --danger: #ff626d;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 960px; min-height: 100vh; background: #0b0d10; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.eyebrow { margin: 0 0 5px; color: var(--accent); font: 700 11px/1.2 Consolas, monospace; }
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
.timezone-clock { margin: 4px 0 0; color: var(--muted); font: 11px/1.2 Consolas, monospace; }

.topbar {
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #0e1115;
}

.workspace { width: 100%; }
.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  border-bottom: 1px solid var(--line);
  background: #101419;
}
.stats-strip div { padding: 16px 24px; border-right: 1px solid var(--line); }
.stats-strip div:last-child { border-right: 0; }
.stats-strip span { display: block; color: var(--muted); font-size: 12px; }
.stats-strip strong { display: block; margin-top: 5px; font: 650 24px/1 Consolas, monospace; }

.control-band, .filter-band { padding: 14px 24px; border-bottom: 1px solid var(--line); }
.control-band { background: var(--surface); }
.filter-band { background: #0e1115; }
.generate-form { display: flex; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 11px; }
.field.compact { width: 130px; }
.field.grow { min-width: 220px; flex: 1; }

input, select, textarea {
  min-height: 34px;
  border: 1px solid #343b44;
  border-radius: 4px;
  background: #0b0e12;
  color: #f1f3f5;
  padding: 7px 10px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #789d28; box-shadow: 0 0 0 2px rgba(184, 237, 55, .1); }

button {
  min-height: 34px;
  border: 1px solid #39414a;
  border-radius: 4px;
  padding: 7px 12px;
  background: #181d23;
  color: #e8ebef;
}
button:hover { border-color: #5a6571; background: #20262e; }
button:disabled { opacity: .45; cursor: default; }
button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.primary:hover { background: #c9f667; }
button.quiet { background: transparent; }
button.danger { border-color: #744047; background: #371d22; color: #ffb5ba; }
button.danger:hover { border-color: var(--danger); }
button.danger.subtle { background: transparent; }
button.icon { width: 34px; padding: 0; }
.align-end { align-self: flex-end; }

.filter-row, .action-row { display: flex; align-items: center; gap: 8px; }
.filter-row input { width: min(420px, 40vw); }
.filter-row select { width: 140px; }
.action-row { margin-top: 10px; }
.action-divider { width: 1px; height: 24px; margin: 0 3px; background: var(--line); }

.table-section { background: #0b0d10; }
.table-scroll { min-height: 420px; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
th, td { height: 42px; padding: 8px 12px; text-align: left; border-bottom: 1px solid #22272e; }
th { position: sticky; top: 0; z-index: 1; height: 38px; background: #15191f; color: #99a3ae; font-weight: 600; }
th.check, td.check { width: 42px; text-align: center; }
td.code { color: #edf7d3; font: 600 12px Consolas, monospace; }
td.mono { max-width: 180px; overflow: hidden; text-overflow: ellipsis; font-family: Consolas, monospace; color: #aeb7c1; }
td.notes { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: #aeb7c1; }
tbody tr:hover { background: #11161b; }
.empty-row td { height: 260px; text-align: center; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #77808a; }
.status.active::before { background: #72d68b; }
.status.unactivated::before { background: #e6b84a; }
.status.expired::before, .status.disabled::before { background: #ef6872; }

.pagination { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-top: 1px solid var(--line); color: var(--muted); }
.pagination div { display: flex; align-items: center; gap: 10px; }
.pagination button { width: 34px; padding: 0; font-size: 18px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; background: #0b0d10; }
.login-panel { width: 380px; padding: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.login-panel h1 { margin-bottom: 24px; }
.login-panel label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.login-panel input, .login-panel button { width: 100%; }
.login-panel button { margin-top: 14px; }
.form-error { margin: 10px 0 0; color: #ff8c94; font-size: 12px; }

dialog { width: 620px; max-width: 80vw; padding: 0; border: 1px solid #3b434d; border-radius: 6px; background: #11151a; color: #eef1f4; }
dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
#generated-codes { width: calc(100% - 36px); height: 280px; margin: 18px; resize: vertical; font: 13px/1.7 Consolas, monospace; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }

#toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; min-width: 240px; max-width: 420px; padding: 11px 14px; border: 1px solid #46515c; border-radius: 4px; background: #1a2026; color: #edf0f3; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .16s ease; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { border-color: #8d424b; color: #ffb7bc; }

@media (max-width: 1100px) {
  .generate-form { flex-wrap: wrap; }
  .field.grow { min-width: 360px; }
}
