:root {
  color-scheme: dark;
  --bg: #090416;
  --panel: rgba(36, 18, 76, .66);
  --panel-strong: rgba(61, 26, 110, .72);
  --text: #fbf7ff;
  --muted: #c8b8f7;
  --soft: #9277d2;
  --line: rgba(216, 180, 254, .26);
  --pink: #ff4fd8;
  --violet: #a855f7;
  --cyan: #35e8ff;
  --green: #63f7b4;
  --amber: #facc15;
  --red: #fb7185;
  --shadow: 0 24px 72px rgba(9, 4, 22, .55), 0 0 34px rgba(168, 85, 247, .16);
}
* { box-sizing: border-box; }
html { min-height: 100%; overflow-x: hidden; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 79, 216, .28), transparent 28vw),
    radial-gradient(circle at 88% 0%, rgba(53, 232, 255, .22), transparent 30vw),
    radial-gradient(circle at 50% 100%, rgba(168, 85, 247, .34), transparent 34vw),
    linear-gradient(135deg, #13071f 0%, #220759 42%, #071528 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}
body::after {
  content: "";
  position: fixed;
  inset: -18%;
  pointer-events: none;
  z-index: -1;
  background: conic-gradient(from 230deg at 50% 45%, transparent, rgba(255,79,216,.12), transparent, rgba(53,232,255,.10), transparent);
  filter: blur(42px);
  animation: drift 22s linear infinite;
}
@keyframes drift { to { transform: rotate(1turn); } }

button, input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
}
input {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(216, 180, 254, .28);
  padding: 11px 13px;
  color: var(--text);
  background: rgba(10, 4, 24, .55);
  box-shadow: inset 0 0 28px rgba(0,0,0,.18);
  outline: none;
}
input::placeholder { color: rgba(231, 216, 255, .55); }
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
code {
  color: #a5f3fc;
  word-break: break-all;
  white-space: normal;
}
.glass-panel {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.045));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(160%);
  overflow: hidden;
}
.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255,255,255,.20), transparent 18%, transparent 72%, rgba(53,232,255,.11));
  opacity: .76;
}
.glass-panel > * { position: relative; z-index: 1; }

.admin-shell {
  width: min(100%, 1220px);
  margin: 0 auto;
  padding: 28px;
}
.admin-hero {
  border-radius: 28px;
  padding: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 86% 2%, rgba(255,79,216,.38), transparent 24%),
    linear-gradient(135deg, rgba(255,255,255,.15), rgba(20, 12, 47, .68));
}
.hero-kicker, .eyebrow, .login-kicker {
  color: #bdefff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.admin-hero h1, .login-card h1 {
  margin: 6px 0 0;
  font-family: 'DIN Alternate', 'PingFang SC', ui-sans-serif, sans-serif;
  font-size: clamp(42px, 8vw, 82px);
  line-height: .96;
  letter-spacing: -.06em;
  background: linear-gradient(90deg, #fff, #e9d5ff 38%, #67e8f9 74%, #ff8be7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(168, 85, 247, .28);
}
.admin-hero p, .login-subtitle {
  margin: 12px 0 0;
  color: #decfff;
  font-weight: 700;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.hero-chip {
  min-width: 108px;
  border: 1px solid rgba(216,180,254,.28);
  border-radius: 18px;
  padding: 9px 12px;
  background: rgba(255,255,255,.08);
}
.hero-chip span { display:block; color: var(--muted); font-size: 12px; }
.hero-chip b { display:block; margin-top: 2px; }
.primary-btn, .ghost-btn, .actions button, .filter-tab {
  min-height: 42px;
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  font-weight: 900;
  border: 1px solid rgba(216,180,254,.42);
  box-shadow: 0 0 18px rgba(168,85,247,.22), inset 0 1px 0 rgba(255,255,255,.22);
  transition: transform .18s ease, filter .18s ease, border-color .18s ease;
}
.primary-btn {
  background: linear-gradient(135deg, rgba(168,85,247,.98), rgba(236,72,153,.88));
}
.ghost-btn, .filter-tab, .actions button {
  background: rgba(255,255,255,.07);
  color: #efe7ff;
}
button:hover { filter: brightness(1.08) saturate(1.1); transform: translateY(-1px); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 140px;
  background:
    radial-gradient(circle at 100% 0%, rgba(53,232,255,.13), transparent 36%),
    linear-gradient(145deg, rgba(36,18,76,.70), rgba(14,8,34,.56));
}
.stat-primary {
  border-color: rgba(255,79,216,.34);
  background:
    radial-gradient(circle at 88% 6%, rgba(255,79,216,.26), transparent 34%),
    linear-gradient(135deg, rgba(89, 28, 135, .86), rgba(14,165,233,.30));
}
.stat-card span, .muted, .hint-line, .section-desc { color: var(--muted); }
.stat-card strong {
  display: block;
  margin-top: 10px;
  font-family: 'DIN Alternate', ui-monospace, monospace;
  font-size: 46px;
  line-height: .9;
  text-shadow: 0 0 24px rgba(255,255,255,.18);
}
.stat-card small { display:block; margin-top: 12px; color: #9eefff; font-weight: 800; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}
.admin-card {
  border-radius: 26px;
  padding: 20px;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.1;
}
.eyebrow { margin: 0; }
.neon-badge, .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(99,247,180,.38);
  color: #9ef7d0;
  background: rgba(99,247,180,.14);
}
.create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr 120px auto;
  gap: 10px;
  align-items: end;
}
.create-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.create-submit { min-width: 128px; }
.hint-line { margin-top: 12px; font-size: 13px; }
.route-card code {
  display: block;
  margin: 14px 0;
  border: 1px solid rgba(53,232,255,.26);
  border-radius: 16px;
  padding: 14px;
  background: rgba(5, 9, 26, .44);
}
.route-card p:last-child { color: var(--muted); line-height: 1.65; }

.users-card { margin-bottom: 18px; }
.users-head { align-items: flex-end; }
.filter-panel {
  width: min(100%, 540px);
  display: grid;
  gap: 10px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.filter-tab {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.filter-tab.active {
  border-color: rgba(53,232,255,.48);
  color: #cdf7ff;
  background: linear-gradient(135deg, rgba(53,232,255,.18), rgba(168,85,247,.20));
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.admin-table th {
  padding: 0 12px 6px;
  color: #d8b4fe;
  text-align: left;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.admin-table td {
  padding: 14px 12px;
  vertical-align: top;
  border-top: 1px solid rgba(216,180,254,.18);
  border-bottom: 1px solid rgba(216,180,254,.18);
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.032));
}
.admin-table td:first-child { border-left: 1px solid rgba(216,180,254,.18); border-radius: 18px 0 0 18px; }
.admin-table td:last-child { border-right: 1px solid rgba(216,180,254,.18); border-radius: 0 18px 18px 0; }
.id-token {
  color: #67e8f9;
  font-family: 'DIN Alternate', ui-monospace, monospace;
  font-size: 18px;
  font-weight: 900;
}
.user-name { font-size: 17px; font-weight: 900; margin-bottom: 4px; }
.pill.ok { color: #9ef7d0; background: rgba(99,247,180,.13); border-color: rgba(99,247,180,.36); }
.pill.warn { color: #fde68a; background: rgba(250,204,21,.13); border-color: rgba(250,204,21,.36); }
.pill.bad { color: #fecdd3; background: rgba(251,113,133,.14); border-color: rgba(251,113,133,.36); }
.pill.idle { color: #ddd6fe; background: rgba(168,85,247,.13); border-color: rgba(168,85,247,.34); }
.status-word { margin-left: 6px; color: #fff; font-weight: 800; }
.runtime-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.runtime-metrics span {
  border: 1px solid rgba(216,180,254,.18);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  background: rgba(255,255,255,.055);
  font-size: 12px;
}
.actions {
  min-width: 240px;
}
.actions button {
  min-height: 34px;
  padding: 7px 10px;
  margin: 0 6px 6px 0;
  font-size: 12px;
}
.empty-state {
  border: 1px dashed rgba(216,180,254,.32);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}
.empty-row td { border-radius: 18px !important; }

.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
  border-radius: 14px;
  padding: 12px 14px;
  color: #fff;
  box-shadow: 0 0 24px rgba(168,85,247,.34);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.info { background: linear-gradient(135deg, #7c3aed, #0ea5e9); }
.toast.success { background: linear-gradient(135deg, #059669, #14b8a6); }
.toast.error { background: linear-gradient(135deg, #dc2626, #c026d3); }

.admin-login-page {
  display: grid;
  place-items: center;
  padding: 22px;
}
.login-stage {
  position: relative;
  width: min(100%, 980px);
  min-height: min(720px, calc(100vh - 44px));
  display: grid;
  place-items: center;
}
.login-orbit {
  position: absolute;
  inset: 8%;
  border-radius: 999px;
  border: 1px solid rgba(216,180,254,.18);
  background: radial-gradient(circle at 50% 50%, rgba(168,85,247,.14), transparent 62%);
  filter: blur(.2px);
}
.login-card {
  width: min(94vw, 450px);
  border-radius: 30px;
  padding: 30px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,79,216,.24), transparent 32%),
    linear-gradient(145deg, rgba(36,18,76,.78), rgba(10,4,24,.68));
}
.login-card h1 { font-size: clamp(48px, 14vw, 76px); }
.field-label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.full { width: 100%; margin-top: 18px; }
.form-error {
  margin-top: 14px;
  border: 1px solid rgba(251,113,133,.38);
  border-radius: 14px;
  padding: 10px 12px;
  color: #fecdd3;
  background: rgba(251,113,133,.12);
}
.login-footnote { margin-top: 14px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .admin-shell { padding: 18px; }
  .admin-hero { align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-submit { grid-column: 1 / -1; }
  .users-head { display: grid; }
  .filter-panel { width: 100%; }
  .filter-tabs { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .admin-shell { padding: 12px; }
  .admin-hero { border-radius: 24px; padding: 18px; display: grid; }
  .admin-hero h1 { font-size: 52px; }
  .hero-actions { justify-content: flex-start; }
  .hero-chip { min-width: 0; flex: 1 1 120px; }
  .stats-grid { gap: 10px; }
  .stat-card { border-radius: 22px; padding: 14px; min-height: 116px; }
  .stat-card strong { font-size: 38px; }
  .admin-card { border-radius: 24px; padding: 16px; }
  .section-head { display: grid; }
  .create-grid { grid-template-columns: 1fr; }
  .table-wrap { overflow: visible; }
  .admin-table { min-width: 0; border-spacing: 0; }
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr {
    margin-bottom: 12px;
    border: 1px solid rgba(216,180,254,.24);
    border-radius: 20px;
    padding: 8px;
    background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  }
  .admin-table td {
    border: 0 !important;
    border-radius: 0 !important;
    padding: 8px 6px;
    background: transparent;
  }
  .admin-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--soft);
    font-size: 12px;
    font-weight: 900;
  }
  .actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
  }
  .actions::before { grid-column: 1 / -1; }
  .actions button { width: 100%; margin: 0; }
  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter-tab { white-space: nowrap; }
  .login-card { padding: 24px; border-radius: 26px; }
}
@media (max-width: 420px) {
  .admin-hero h1 { font-size: 46px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card strong { font-size: 34px; }
  .admin-card { padding: 14px; }
}
