:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #111722;
  --panel-2: #161e2b;
  --line: #263246;
  --text: #e8eef7;
  --muted: #94a3b8;
  --primary: #e8b34b;
  --primary-dark: #b88221;
  --danger: #ef6a6a;
  --ok: #54c088;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(232, 179, 75, 0.15), transparent 32rem),
    linear-gradient(180deg, #0b0e13 0%, #0d121a 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: #455773;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #1b1405;
  font-weight: 700;
}

.primary:hover {
  background: #f1c76f;
}

.ghost {
  background: transparent;
}

.danger {
  color: var(--danger);
  border-color: rgba(239, 106, 106, 0.45);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(17, 23, 34, 0.94);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #f4cd79, #c1841b);
  color: #1b1405;
  font-size: 26px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 26px;
}

h2 {
  margin-bottom: 6px;
  font-size: 21px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

label input,
label select,
label textarea,
.filter-line input,
.filter-line select,
.bulk-box textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: #0b111a;
  outline: none;
}

label input:focus,
label select:focus,
label textarea:focus,
.filter-line input:focus,
.filter-line select:focus,
.bulk-box textarea:focus {
  border-color: var(--primary);
}

.login-card label {
  margin-top: 16px;
}

.login-card .primary {
  width: 100%;
  margin-top: 22px;
}

.message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 19, 0.88);
}

.topbar strong {
  margin-right: 10px;
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.identity {
  margin-right: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 26px 0;
  overflow-x: auto;
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.tab.active {
  border-bottom-color: var(--primary);
  color: var(--text);
}

.content {
  padding: 22px 26px 48px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.heading-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  min-width: 170px;
  flex: 1 1 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.notice,
.form-card,
.bulk-box {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}

.notice {
  border-color: rgba(232, 179, 75, 0.3);
}

.notice p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.form-grid label {
  flex: 1 1 210px;
}

.form-grid label.wide {
  flex-basis: 100%;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
}

.check-line input {
  width: auto;
  margin: 0;
}

.form-actions {
  margin-top: 16px;
}

.activation-result {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid rgba(84, 192, 136, 0.55);
  border-radius: 15px;
  background: rgba(84, 192, 136, 0.08);
}

.activation-result code {
  padding: 16px 18px;
  border: 1px dashed rgba(232, 179, 75, 0.7);
  border-radius: 12px;
  background: #0b111a;
  color: var(--primary);
  font-family: Consolas, "Courier New", monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
}

.activation-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.activation-result p {
  margin-bottom: 0;
  line-height: 1.7;
}

.bulk-box summary {
  cursor: pointer;
  font-weight: 700;
}

.bulk-box button {
  margin-top: 10px;
}

.filter-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.filter-line input {
  flex: 1 1 240px;
  margin: 0;
}

.filter-line select {
  width: 150px;
  margin: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #0f1520;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #1e293b;
}

.badge.ok {
  color: var(--ok);
  background: rgba(84, 192, 136, 0.12);
}

.badge.off {
  color: var(--danger);
  background: rgba(239, 106, 106, 0.12);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.empty-row td {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(440px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid #3d4a5e;
  border-radius: 12px;
  background: #182130;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: rgba(239, 106, 106, 0.5);
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .content,
  .tabs {
    padding-left: 14px;
    padding-right: 14px;
  }

  .section-heading {
    flex-direction: column;
  }

  .login-card {
    padding: 24px;
  }
}
