:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #111832;
  --card: rgba(22, 30, 55, 0.82);
  --card-solid: #161e37;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e8edf9;
  --muted: #97a3bd;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(2, 8, 23, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(56, 189, 248, 0.16), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(129, 140, 248, 0.18), transparent 55%),
    var(--bg);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  color: #04121f;
  background: linear-gradient(135deg, var(--accent), #a5f3fc);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.35);
}

.nav {
  display: flex;
  gap: 6px;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.15s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.1);
}

.nav-btn.active {
  color: var(--text);
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) clamp(14px, 4vw, 28px) 80px;
}

.auth-wrap {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(420px, 100%);
}

.auth-head {
  text-align: center;
  margin-bottom: 18px;
}

.auth-head h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.auth-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.4vw, 26px);
  backdrop-filter: blur(16px);
}

.card + .card {
  margin-top: 18px;
}

.card-head {
  margin-bottom: 16px;
}

.card-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  background: rgba(2, 8, 23, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active {
  background: rgba(56, 189, 248, 0.16);
  color: var(--text);
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(2, 8, 23, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(148, 163, 184, 0.16);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06101f;
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn.danger {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid.two.tight {
  gap: 12px;
}

.grid.two > .card + .card {
  margin-top: 0;
}

.profile {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.9), rgba(129, 140, 248, 0.9));
  color: #06101f;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-main h1 {
  margin: 0;
  font-size: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-main p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.14);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge.off {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.3);
}

.badge.admin {
  background: rgba(129, 140, 248, 0.15);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.35);
}

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

.check {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.check input {
  width: auto;
  accent-color: var(--accent);
}

.result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.06);
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  font-size: 13px;
}

.result-row span {
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #bae6fd;
  word-break: break-all;
}

.token-box {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
}

.stat .value {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.5px;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar input {
  width: 180px;
  padding: 7px 10px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: middle;
}

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

.table .right {
  text-align: right;
}

.table .cell-user {
  display: grid;
}

.table .cell-user small {
  color: var(--muted);
}

.table select {
  width: auto;
  padding: 5px 8px;
  font-size: 12px;
}

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

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(2, 8, 23, 0.3);
  font-size: 13px;
}

.mini-item .grow {
  min-width: 0;
}

.mini-item strong {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-item small {
  color: var(--muted);
}

.mini-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 11px 18px;
  border-radius: 10px;
  background: #1b2544;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 100;
  max-width: min(90vw, 520px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.45);
  color: #bbf7d0;
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px 16px;
  }

  .brand span:not(.brand-logo) {
    display: none;
  }

  .nav-btn {
    padding: 8px 10px;
    font-size: 13px;
  }

  .profile {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .profile-meta {
    justify-items: start;
    width: 100%;
    padding-left: 76px;
  }

  .result-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
