:root {
  color-scheme: dark;
  --auth-canvas: #050b13;
  --auth-header: #08111d;
  --auth-panel: #0b1624;
  --auth-panel-raised: #101e2f;
  --auth-control: #0d1a2a;
  --auth-hover: #13263a;
  --auth-selected: #10324a;
  --auth-line: #263b50;
  --auth-line-strong: #38536c;
  --auth-text: #edf5fb;
  --auth-muted: #a8bac9;
  --auth-dim: #71879a;
  --auth-accent: #27c2d1;
  --auth-accent-strong: #1498ad;
  --auth-accent-soft: rgba(39, 194, 209, .12);
  --auth-green: #42cf8b;
  --auth-yellow: #e9b949;
  --auth-red: #f06470;
  --auth-red-soft: rgba(240, 100, 112, .12);
  --auth-radius-sm: 6px;
  --auth-radius-md: 9px;
  --auth-radius-lg: 12px;
  --auth-shadow: 0 18px 46px rgba(0, 0, 0, .38);
  --auth-font: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --auth-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--auth-canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--auth-canvas);
  color: var(--auth-text);
  font-family: var(--auth-font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
.auth-button {
  min-height: 42px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  padding: 9px 14px;
  background: var(--auth-control);
  color: var(--auth-text);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

button:hover,
.auth-button:hover {
  border-color: var(--auth-line-strong);
  background: var(--auth-hover);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--auth-accent);
  outline-offset: 2px;
}

.primary-button {
  border-color: #2ecbd8;
  background: var(--auth-accent);
  color: #021116;
  font-weight: 750;
}

.primary-button:hover {
  border-color: #5bddE7;
  background: #4dd4df;
}

.danger-button {
  border-color: rgba(240, 100, 112, .45);
  background: var(--auth-red-soft);
  color: #ff9ba5;
}

.danger-button:hover {
  border-color: var(--auth-red);
  background: rgba(240, 100, 112, .2);
}

.success-button {
  border-color: rgba(66, 207, 139, .42);
  background: rgba(66, 207, 139, .11);
  color: #71e4aa;
}

.auth-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--auth-text);
  text-decoration: none;
}

.auth-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(39, 194, 209, .3);
  border-radius: 10px;
  background: var(--auth-accent-soft);
  color: var(--auth-accent);
}

.auth-brand-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  font-size: 16px;
  letter-spacing: .025em;
}

.auth-brand small {
  color: var(--auth-dim);
  font-size: 10px;
  letter-spacing: .08em;
}

/* Login and registration */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--auth-line);
  padding: 46px 52px;
  background:
    linear-gradient(rgba(39, 194, 209, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 194, 209, .055) 1px, transparent 1px),
    radial-gradient(circle at 75% 20%, rgba(39, 194, 209, .14), transparent 32%),
    #07111d;
  background-size: 50px 50px, 50px 50px, auto, auto;
}

.auth-visual::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -160px;
  top: -150px;
  border-radius: 50%;
  background: rgba(39, 194, 209, .12);
  filter: blur(90px);
  pointer-events: none;
}

.auth-hero {
  position: relative;
  max-width: 680px;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--auth-accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .13em;
}

.auth-kicker::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--auth-accent);
  box-shadow: 0 0 10px rgba(39, 194, 209, .75);
}

.auth-hero h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(36px, 4.2vw, 64px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.auth-hero > p {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--auth-muted);
  font-size: 16px;
}

.auth-feature-list {
  display: grid;
  gap: 14px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.auth-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--auth-muted);
}

.auth-feature-list svg {
  flex: 0 0 auto;
  color: var(--auth-accent);
}

.auth-copyright {
  position: relative;
  margin: 0;
  color: var(--auth-dim);
  font-size: 12px;
}

.auth-form-side {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 46px;
  background: var(--auth-canvas);
}

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

.auth-mobile-brand {
  display: none;
  margin-bottom: 36px;
}

.auth-form-heading {
  margin-bottom: 30px;
}

.auth-form-heading h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.auth-form-heading p {
  margin: 8px 0 0;
  color: var(--auth-muted);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #dce8f1;
  font-size: 13px;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  padding: 0 12px;
  outline: 0;
  background: var(--auth-control);
  color: var(--auth-text);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.field input:hover {
  border-color: var(--auth-line-strong);
}

.field input:focus {
  border-color: var(--auth-accent-strong);
  background: #0f1e2f;
  box-shadow: 0 0 0 3px rgba(39, 194, 209, .1);
}

.field input::placeholder {
  color: #617688;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--auth-dim);
}

.password-toggle:hover {
  border: 0;
  background: var(--auth-hover);
  color: var(--auth-text);
}

.auth-error,
.auth-notice {
  display: none;
  border-radius: var(--auth-radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

.auth-error.visible {
  display: block;
  border: 1px solid rgba(240, 100, 112, .38);
  background: var(--auth-red-soft);
  color: #ffadb5;
}

.auth-notice.visible {
  display: block;
  border: 1px solid rgba(66, 207, 139, .35);
  background: rgba(66, 207, 139, .1);
  color: #8de9ba;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-switch {
  margin: 26px 0 0;
  color: var(--auth-muted);
  text-align: center;
}

.auth-switch a {
  color: var(--auth-accent);
  font-weight: 700;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-footnote {
  margin: 18px 0 0;
  color: var(--auth-dim);
  font-size: 12px;
  text-align: center;
}

/* Admin */
.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% -10%, rgba(39, 194, 209, .08), transparent 28%),
    var(--auth-canvas);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--auth-line);
  padding: 0 clamp(18px, 3vw, 42px);
  background: rgba(8, 17, 29, .96);
  backdrop-filter: blur(16px);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-role {
  border: 1px solid rgba(233, 185, 73, .4);
  border-radius: 999px;
  padding: 3px 9px;
  color: #f3cd72;
  font-size: 11px;
}

.admin-current-user {
  color: var(--auth-muted);
  font-size: 13px;
}

.admin-main {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 30px clamp(16px, 3vw, 42px) 46px;
}

.admin-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.admin-title-row h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.02em;
}

.admin-title-row p {
  margin: 7px 0 0;
  color: var(--auth-muted);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.admin-stat {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-lg);
  padding: 18px 20px;
  background: var(--auth-panel);
}

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

.admin-stat strong {
  margin-top: 2px;
  font-family: var(--auth-mono);
  font-size: 28px;
  line-height: 1.2;
}

.admin-stat.active strong {
  color: var(--auth-accent);
}

.admin-stat.banned strong {
  color: var(--auth-red);
}

.admin-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.admin-panel {
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-lg);
  background: var(--auth-panel);
  box-shadow: var(--auth-shadow);
}

.user-list-panel {
  align-self: start;
  overflow: hidden;
}

.admin-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--auth-line);
  padding: 16px;
}

.admin-panel-heading strong {
  font-size: 15px;
}

.admin-panel-heading span {
  color: var(--auth-dim);
  font-size: 12px;
}

.admin-search {
  padding: 12px 14px;
}

.admin-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-sm);
  padding: 0 12px;
  outline: 0;
  background: var(--auth-control);
  color: var(--auth-text);
}

.admin-search input:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(39, 194, 209, .1);
}

.admin-user-list {
  max-height: calc(100vh - 318px);
  min-height: 360px;
  overflow: auto;
  padding: 0 10px 12px;
}

.admin-user-item {
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--auth-radius-md);
  padding: 10px;
  background: transparent;
  text-align: left;
}

.admin-user-item:hover {
  border-color: var(--auth-line);
  background: var(--auth-hover);
}

.admin-user-item.selected {
  border-color: var(--auth-accent-strong);
  background: var(--auth-selected);
  box-shadow: inset 3px 0 0 var(--auth-accent);
}

.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--auth-line);
  border-radius: 50%;
  background: #081420;
  color: var(--auth-muted);
  font-family: var(--auth-mono);
  font-size: 12px;
}

.user-copy {
  min-width: 0;
}

.user-copy strong,
.user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 14px;
}

.user-copy small {
  margin-top: 3px;
  color: var(--auth-dim);
  font-size: 11px;
}

.status-chip,
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.status-chip.active {
  border-color: rgba(39, 194, 209, .35);
  background: rgba(39, 194, 209, .1);
  color: var(--auth-accent);
}

.status-chip.banned {
  border-color: rgba(240, 100, 112, .38);
  background: var(--auth-red-soft);
  color: #ff8d98;
}

.role-chip.admin {
  border-color: rgba(233, 185, 73, .35);
  color: #f1ca6b;
}

.detail-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 18px;
}

.account-card {
  padding: 20px;
}

.account-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.account-identity .user-avatar {
  width: 50px;
  height: 50px;
  color: var(--auth-text);
}

.account-identity h2 {
  margin: 0;
  font-size: 20px;
}

.account-identity p {
  margin: 3px 0 0;
  color: var(--auth-dim);
  font-family: var(--auth-mono);
  font-size: 11px;
}

.account-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(3, minmax(145px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.account-meta div {
  min-width: 0;
}

.account-meta span,
.account-meta strong {
  display: block;
}

.account-meta span {
  color: var(--auth-dim);
  font-size: 11px;
}

.account-meta strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--auth-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--auth-line);
  padding-top: 16px;
}

.account-action p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 12px;
}

.console-card {
  min-height: 480px;
  overflow: hidden;
}

.console-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 12px;
}

.console-card-header h3 {
  margin: 0;
  font-size: 16px;
}

.console-card-header p {
  margin: 3px 0 0;
  color: var(--auth-dim);
  font-size: 12px;
}

.console-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 0 16px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-md);
  padding: 3px;
  background: #08121e;
}

.console-tab {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--auth-muted);
}

.console-tab:hover {
  border: 0;
}

.console-tab.active {
  background: var(--auth-panel-raised);
  color: var(--auth-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.console-count {
  min-width: 22px;
  border-radius: 999px;
  padding: 1px 6px;
  background: var(--auth-control);
  color: var(--auth-dim);
  font-family: var(--auth-mono);
  font-size: 10px;
  text-align: center;
}

.console-tab.active .console-count {
  color: var(--auth-accent);
}

.console-content {
  height: 390px;
  overflow: auto;
  padding: 12px 16px 18px;
}

.console-records {
  display: grid;
  gap: 8px;
}

.console-record {
  border: 1px solid #1c3044;
  border-radius: var(--auth-radius-sm);
  padding: 10px 12px;
  background: #0a1522;
}

.console-record time {
  display: block;
  margin-bottom: 5px;
  color: var(--auth-dim);
  font-family: var(--auth-mono);
  font-size: 10px;
}

.console-record pre,
.status-help {
  margin: 0;
  color: #d5e2eb;
  font-family: var(--auth-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-empty,
.admin-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--auth-dim);
  text-align: center;
}

.admin-empty-user {
  padding: 70px 24px;
  color: var(--auth-dim);
  text-align: center;
}

@media (max-width: 1100px) {
  .account-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .auth-page {
    display: block;
  }

  .auth-visual {
    display: none;
  }

  .auth-form-side {
    padding: 38px 24px;
  }

  .auth-mobile-brand {
    display: flex;
  }

  .admin-workspace {
    grid-template-columns: 1fr;
  }

  .admin-user-list {
    max-height: 360px;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .auth-form-side {
    align-items: flex-start;
    padding: 24px 18px 36px;
  }

  .auth-form-heading h2 {
    font-size: 26px;
  }

  .admin-header {
    height: auto;
    min-height: 64px;
    padding: 10px 14px;
  }

  .admin-header .auth-brand small,
  .admin-current-user,
  .admin-role {
    display: none;
  }

  .admin-main {
    padding: 22px 12px 32px;
  }

  .admin-title-row,
  .account-top,
  .account-action {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-stat {
    min-height: 82px;
  }

  .account-meta {
    grid-template-columns: 1fr;
  }

  .console-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .console-tabs {
    grid-template-columns: 1fr;
  }

  .console-content {
    height: 430px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
