:root {
  color-scheme: dark;
  --bg: #141417;
  --panel: #202027;
  --panel-2: #282831;
  --line: #3a3945;
  --text: #f5f3ff;
  --muted: #b9b4c9;
  --accent: #8a5cf6;
  --danger: #f87171;
  --ok: #4ade80;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  padding: 10px 14px;
}

button.secondary {
  background: #3a3945;
}

button.danger {
  background: #8f2f3f;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17171d;
  color: var(--text);
  padding: 10px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 60px;
}

.hidden {
  display: none !important;
}

.login-panel,
.create-panel,
.list-panel,
.toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-panel {
  width: min(420px, 100%);
  margin: 120px auto;
  padding: 24px;
}

.login-panel label,
.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.login-panel h1,
.topbar h1,
.create-panel h2,
.list-panel h2 {
  margin: 0;
}

.login-panel button {
  width: 100%;
  margin-top: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.switch-row,
.check-line {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.switch-row input,
.check-line input {
  width: auto;
}

.create-panel,
.list-panel {
  padding: 18px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.message {
  min-height: 22px;
  color: var(--muted);
}

.message[data-status="error"] {
  color: var(--danger);
}

.message[data-status="success"] {
  color: var(--ok);
}

.created-code {
  margin-top: 12px;
  border: 1px solid #6d54d9;
  border-radius: 8px;
  background: #19142c;
  padding: 14px;
  word-break: break-all;
  font-family: Consolas, monospace;
}

.license-list {
  display: grid;
  gap: 12px;
}

.license-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 14px;
}

.license-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.license-title {
  font-family: Consolas, monospace;
  font-weight: 700;
}

.status {
  border-radius: 999px;
  padding: 4px 10px;
  background: #3a3945;
}

.status.active {
  background: #14532d;
}

.status.disabled,
.status.expired {
  background: #7f1d1d;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
  color: var(--muted);
}

.edit-row {
  display: grid;
  grid-template-columns: 120px 160px 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.device-list {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.device-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

@media (max-width: 860px) {
  .form-grid,
  .meta-grid,
  .edit-row {
    grid-template-columns: 1fr;
  }
}
