:root {
  --bg-deep: #080d14;
  --bg: #080d14;
  --surface: #0f1621;
  --surface-2: #0f1621;
  --surface-3: #131b28;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.2);
  --violet: #7c3aed;
  --cyan: #22d3ee;
  --success: #10b981;
  --warning: #fbbf24;
  --danger: #f87171;
  --gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --gradient-soft: linear-gradient(145deg, rgba(37, 99, 235, 0.35), rgba(124, 58, 237, 0.15));
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 60px rgba(59, 130, 246, 0.12);
  --radius: 12px;
  --radius-sm: 10px;
  --sidebar-w: 200px;
  --sidebar-bg: #0a1018;
  --content-padding: 32px;
  --admin-card-gap: 16px;
  --content-view-min-h: calc(100vh - 5.5rem);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.12em 0.4em;
  background: var(--surface-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* —— 屏幕切换 —— */
.screen {
  display: none;
  min-height: 100%;
}
.screen.is-visible {
  display: block;
}

#screen-app.screen.is-visible {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#screen-app.screen.is-visible .app-shell {
  flex: 1;
  min-height: 0;
}

/* —— 登录页：双栏各 100vh + flex 正中，整页无滚动 —— */
html:has(#screen-auth.is-visible),
body:has(#screen-auth.is-visible) {
  height: 100%;
  overflow: hidden;
}

#screen-auth.screen.is-visible {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-deep);
}

.auth-hero {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(
      90deg,
      #030711 0%,
      #061022 22%,
      #0c1a30 52%,
      #132238 78%,
      #161e30 100%
    ),
    radial-gradient(ellipse 70% 55% at 15% 45%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 60%, rgba(124, 58, 237, 0.08), transparent 55%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.auth-hero__glow {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 180deg at 50% 50%, rgba(59, 130, 246, 0.08), transparent, rgba(139, 92, 246, 0.06), transparent);
  animation: slow-rotate 32s linear infinite;
  pointer-events: none;
  opacity: 0.85;
}

@keyframes slow-rotate {
  to {
    transform: rotate(360deg);
  }
}

.auth-hero__content {
  --auth-stack-gap: 1.5rem;
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  width: min(100%, 520px);
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--auth-stack-gap);
  text-align: left;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md), 0 0 40px rgba(59, 130, 246, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-logo__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-hero__title {
  margin: 0;
  width: 100%;
  font-size: clamp(1.75rem, 4.2vw, 56px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
}

.auth-hero__desc {
  margin: 0;
  width: 100%;
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  flex-shrink: 0;
}

.auth-hero__bullets {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #a8b8d0;
  font-size: 1.0625rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--auth-stack-gap);
  width: 100%;
  flex-shrink: 1;
  min-height: 0;
}
.auth-hero__bullets li {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  line-height: 1.45;
  text-align: left;
  flex-shrink: 0;
}
.auth-hero__bullets li::before {
  content: "✓";
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #e0e7ff;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.45), rgba(124, 58, 237, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-panel {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #06080f;
  background-image: radial-gradient(ellipse 120% 80% at 20% 0%, rgba(59, 130, 246, 0.14), transparent 50%),
    radial-gradient(ellipse 90% 70% at 100% 30%, rgba(124, 58, 246, 0.1), transparent 45%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(34, 211, 238, 0.06), transparent 55%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 42%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 31px,
      rgba(255, 255, 255, 0.018) 31px,
      rgba(255, 255, 255, 0.018) 32px
    );
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
}

.auth-panel::after {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(59, 130, 246, 0.25), rgba(139, 92, 246, 0.2), transparent);
  pointer-events: none;
}

.auth-panel > .auth-card {
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  max-height: min(100vh - 2rem, 100%);
  overflow: hidden;
}

@media (max-width: 960px) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: 100vh;
    max-height: 100vh;
  }

  .auth-hero,
  .auth-panel {
    height: 100%;
    max-height: none;
  }

  .auth-hero__content {
    max-height: 100%;
  }

  .auth-panel > .auth-card {
    max-height: calc(50vh - 1rem);
  }

  .auth-card {
    padding: 1.25rem 1.35rem;
  }
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.auth-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.auth-card__subtitle {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 1.25rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.tab:hover {
  color: var(--text);
}
.tab.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: none;
}
.auth-form.is-active {
  display: block;
}

.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input,
input[type="email"],
input[type="password"],
input[type="number"],
input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-select {
  cursor: pointer;
}

.input--sm {
  padding: 0.45rem 0.6rem;
  font-size: 0.8125rem;
}

.input-grow {
  flex: 1;
  min-width: 0;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s, opacity 0.15s, box-shadow 0.15s;
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-gradient {
  padding: 0.7rem 1.25rem;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
}
.btn-gradient:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.45);
}

.btn-block {
  width: 100%;
}

.btn-secondary {
  padding: 0.55rem 1rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.4rem 0.75rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.2);
}

.btn-sidebar-ghost {
  width: 100%;
  padding: 0.72rem 1rem;
  background: linear-gradient(145deg, rgba(248, 113, 113, 0.14), rgba(239, 68, 68, 0.06));
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-sidebar-ghost:hover {
  color: #fff;
  border-color: rgba(248, 113, 113, 0.55);
  background: linear-gradient(145deg, rgba(248, 113, 113, 0.2), rgba(239, 68, 68, 0.1));
}

.btn-topbar {
  margin-top: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-topbar:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* —— 应用壳 —— */
.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--bg-deep);
}

body.admin-standalone .sidebar {
  width: 220px;
}

body.admin-standalone .content-scroll {
  font-size: 14px;
}

body.admin-standalone .data-table th,
body.admin-standalone .data-table td {
  padding: 0.45rem 0.65rem;
}

html:has(body.admin-standalone),
body.admin-standalone {
  height: 100%;
}

body.admin-standalone {
  background: var(--bg);
}

body.admin-standalone .screen.is-visible {
  min-height: 100vh;
  display: flex;
}

body.admin-standalone .app-shell {
  min-height: 100vh;
  width: 100%;
}

body.admin-standalone .app-main,
body.admin-standalone .content-scroll {
  background: var(--bg);
}

body.admin-standalone .sidebar {
  padding: 1rem 0.7rem;
}

body.admin-standalone .sidebar__nav .nav-item {
  min-height: 44px;
  font-size: 14px;
  padding: 0.5rem 0.7rem 0.5rem 16px;
}

body.admin-standalone .sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

body.admin-standalone .admin-sidebar-link {
  width: 100%;
  justify-content: center;
  border-color: rgba(59, 130, 246, 0.28);
  background: var(--surface-2);
  color: var(--text);
}

body.admin-standalone .admin-sidebar-link:hover {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}

body.admin-standalone #view-admin.is-visible {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body.admin-standalone .admin-pane--overview {
  gap: 16px;
}

body.admin-standalone .stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

body.admin-standalone .stat-card {
  min-height: 120px;
  height: 120px;
  padding: 16px 18px;
  align-items: center;
}

body.admin-standalone .overview-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

body.admin-standalone .overview-metric-card {
  min-height: 80px;
  height: 80px;
  padding: 14px 16px;
  justify-content: center;
}

body.admin-standalone .overview-recent-card .data-table th,
body.admin-standalone .overview-recent-card .data-table td {
  min-height: 48px;
  height: 48px;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

body.admin-standalone .overview-recent-card .data-table th {
  background: #121f36;
}

body.admin-standalone .overview-bottom-row {
  gap: 16px;
}

body.admin-standalone .overview-bottom-card {
  min-height: 160px;
}

#screen-app:not(.is-visible) .app-shell {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1rem 0.65rem;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.65rem 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.sidebar__name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 44px;
  padding: 0 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
  border-left: 2px solid transparent;
}
.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), transparent);
  border-left-color: #7c3aed;
}

.nav-item__icon {
  opacity: 0.7;
  font-size: 0.75rem;
}

.nav-item__label {
  flex: 1;
  min-width: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  max-height: 320px;
  opacity: 1;
  transition: max-height 0.24s ease, opacity 0.2s ease;
}

.nav-submenu--always-open {
  padding-left: 16px;
}

.nav-group.is-collapsed .nav-submenu {
  max-height: 0;
  opacity: 0;
}

.nav-submenu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
  transition: background 0.15s, color 0.15s;
  position: relative;
  border-left: 2px solid transparent;
}

.nav-submenu__item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-submenu__item.is-active {
  color: #fff;
  font-weight: 600;
  background: rgba(124, 58, 237, 0.2);
  border-left-color: #7c3aed;
}

.nav-section-toggle {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 0.7rem;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-section-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.nav-section-toggle__arrow {
  width: 16px;
  margin-right: 4px;
  font-size: 12px;
  color: #94a3b8;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

/* —— 顶栏 —— */
.topbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-bottom: none;
  background: rgba(12, 18, 34, 0.88);
  backdrop-filter: blur(12px);
}

.topbar__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem var(--content-padding) 0.5rem;
}

.topbar__crumb {
  padding-bottom: 0;
}

.topbar__divider {
  height: 1px;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  border: 0;
}

.topbar__page-title {
  margin: 0 0 0.12rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.topbar__page-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.topbar__right {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.7rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.topbar-user__avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--cyan);
}

.topbar-user__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.topbar-user__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.topbar-user__email {
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-balance {
  min-width: 260px;
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), 0 0 40px rgba(59, 130, 246, 0.08);
  position: relative;
  overflow: hidden;
}

.topbar-balance::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
  pointer-events: none;
}

.topbar-balance__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.topbar-balance__row {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.topbar-balance__currency {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--success);
  opacity: 0.9;
}

.topbar-balance__amount {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #6ee7b7, #34d399, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.topbar-recharge-btn {
  margin-top: 0.32rem;
  width: 100%;
}

/* —— 内容区 —— */
.content-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px var(--content-padding) var(--content-padding);
}

.view {
  display: none;
  animation: fade-in 0.2s ease;
}
.view.is-visible {
  display: block;
}

.workspace-view.is-visible {
  display: flex;
  flex-direction: column;
  min-height: var(--content-view-min-h);
  gap: var(--admin-card-gap);
}

.workspace-announcement {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.14);
  color: #dbeafe;
}

.workspace-announcement__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.workspace-announcement__content {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.workspace-announcement__marquee-wrap {
  width: 100%;
  overflow: hidden;
}

.workspace-announcement__marquee-text {
  margin: 0;
  font-size: 13px;
  color: #dbeafe;
  white-space: nowrap;
  display: inline-block;
  padding-left: 100%;
  animation: workspace-marquee 22s linear infinite;
}

.workspace-announcement__close {
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #dbeafe;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

@keyframes workspace-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

.workspace-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--admin-card-gap);
}

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

@media (max-width: 640px) {
  .workspace-stats-row {
    grid-template-columns: 1fr;
  }
}

.workspace-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--shadow-sm);
}

.workspace-stat-card__label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.workspace-stat-card__value {
  font-size: 1.45rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--admin-card-gap);
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.card--accent {
  background: linear-gradient(165deg, var(--surface) 0%, rgba(22, 32, 54, 0.95) 100%);
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(59, 130, 246, 0.06);
}

.card--table {
  padding-bottom: 0;
  overflow: hidden;
}

.workspace-view .workspace-orders {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-height: 360px;
}

.workspace-orders__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.workspace-view .workspace-orders .table-shell {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.workspace-view .workspace-orders__table {
  flex: 1;
  min-height: 0;
}

.order-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.order-account-row:last-child {
  margin-bottom: 0;
}

.order-account-code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-polling {
  color: #93c5fd;
  animation: code-blink 1.1s ease-in-out infinite;
}

.code-timeout {
  color: #fca5a5;
}

@keyframes code-blink {
  0% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.45;
  }
}

.workspace-orders__table .data-table th:last-child,
.workspace-orders__table .data-table td:last-child {
  white-space: nowrap;
}

.order-status-note {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state--fill {
  flex: 1;
  min-height: 11rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
}

.empty-state__icon {
  font-size: 2.25rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.admin-sections-nav {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.admin-sections-nav .btn.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(124, 58, 237, 0.18));
  border-color: rgba(99, 102, 241, 0.45);
  color: #fff;
}

.stock-low-alert {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.stock-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.stock-stat-pill {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.stock-stat-pill--alt {
  border-color: rgba(139, 92, 246, 0.35);
}

.stock-stat-pill__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stock-stat-pill__value {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stock-import-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
}

#view-admin-audit .card {
  margin-top: 0;
}

.card__head {
  margin-bottom: 0.7rem;
}
.card__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.1rem 0;
  margin-bottom: 0;
}

.card--table .card__head--row {
  margin-bottom: 0.55rem;
}

.card__title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card__sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.card__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: #93c5fd;
  vertical-align: middle;
}

.card__hint {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card__actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.order-flow {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.order-flow__step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.order-flow__step--wide .order-flow__body {
  flex: 1;
  min-width: 0;
}

.order-flow__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.order-flow__body {
  flex: 1;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: stretch;
}

.inline-actions .btn-secondary {
  flex-shrink: 0;
}

.tips-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.tips-list li {
  margin-bottom: 0.5rem;
}

.api-docs-card {
  padding: 18px;
}

.api-docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.api-docs-nav {
  position: sticky;
  top: 12px;
  align-self: start;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  padding: 12px;
}

.api-docs-nav h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.api-docs-nav a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 8px;
}

.api-docs-nav a:hover {
  background: rgba(37, 99, 235, 0.16);
  color: #dbeafe;
}

.api-docs-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.api-docs-block {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.api-docs-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.api-docs-block p {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.api-endpoint {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 12px;
  background: rgba(2, 6, 23, 0.38);
}

.api-endpoint + .api-endpoint {
  margin-top: 10px;
}

.api-endpoint__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.api-endpoint__meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.api-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}

.api-method--get {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #bfdbfe;
}

.api-method--post {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.api-param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0 10px;
}

.api-param-table th,
.api-param-table td {
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 8px 10px;
  text-align: left;
}

.api-param-table thead th {
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-muted);
  font-weight: 700;
}

.api-quickstart-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 12px;
}

.api-quickstart-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 10px;
  background: rgba(2, 6, 23, 0.35);
}

.api-quickstart-item > span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.api-quickstart-item strong {
  font-size: 20px;
  color: #6ee7b7;
}

.api-quickstart-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.api-sample-tabs {
  display: inline-flex;
  gap: 8px;
}

.api-sample-tabs .btn.is-active {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(37, 99, 235, 0.5);
  color: #dbeafe;
}

.api-sample-pane {
  display: none;
}

.api-sample-pane.is-active {
  display: block;
}

#view-api-docs {
  scroll-behavior: smooth;
}

@media (max-width: 980px) {
  .api-docs-layout {
    grid-template-columns: 1fr;
  }

  .api-docs-nav {
    position: static;
  }

  .api-quickstart-grid {
    grid-template-columns: 1fr;
  }
}

.api-code-block {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #0b1220;
  color: #e2e8f0;
  font: 13px/1.65 SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.workspace-side-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.workspace-side-block {
  padding: 0.85rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workspace-side-block__title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.workspace-price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.workspace-price-item {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.workspace-price-item__name {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.workspace-price-item__value {
  display: block;
  margin-top: 0.22rem;
  font-size: 1rem;
  font-weight: 700;
}

.workspace-api-key-row {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.workspace-api-key-row .mono-input {
  min-width: 0;
  font-size: 0.75rem;
}

.workspace-guide {
  padding: 0;
  overflow: hidden;
}

.workspace-guide__summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-bottom: 1px solid transparent;
}

.workspace-guide__summary::-webkit-details-marker {
  display: none;
}

.workspace-guide[open] .workspace-guide__summary {
  border-bottom-color: var(--border);
}

.workspace-guide__content {
  padding: 0.85rem 1.1rem 1rem;
  display: grid;
  gap: 0.75rem;
}

.workspace-guide__item h3 {
  margin: 0 0 0.3rem;
  font-size: 0.86rem;
}

.workspace-guide__item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* —— 统计卡片 —— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.admin-pane--overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 32px;
}

.admin-pane--overview .stats-grid {
  gap: 16px;
  margin: 0;
}

.admin-pane--overview .stats-grid .stat-card {
  min-height: 110px;
  height: 110px;
}

#view-admin.view.is-visible {
  display: flex;
  flex-direction: column;
}

.overview-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .overview-metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .overview-metrics-row {
    grid-template-columns: 1fr;
  }
}

.overview-metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  min-height: 80px;
  height: 80px;
  justify-content: center;
}

.overview-metric-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.overview-metric-card__value {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.overview-recent-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 12px;
  margin-top: 20px;
}

.overview-recent-card .table-shell {
  margin: 0;
  width: 100%;
  padding: 12px 0;
}

.overview-recent-card .card__head--row {
  padding: 0;
  margin-bottom: 0;
}

.overview-recent-card .data-table th,
.overview-recent-card .data-table td {
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
  min-height: 48px;
}

.overview-bottom-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .overview-bottom-row {
    grid-template-columns: 1fr;
  }
}

.overview-bottom-card .card__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.overview-bottom-card {
  min-height: 140px;
  padding: 24px;
}

.overview-bottom-card .card__head {
  margin-bottom: 1rem;
}

.overview-announcements {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.15rem 0 0.35rem;
}

.overview-announcements__empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.overview-announcement-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.overview-announcement-item__title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.overview-announcement-item__meta {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.overview-announcement-item__body {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.overview-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.15rem 0 0.35rem;
}

.overview-quick-actions .btn {
  min-height: 44px;
  padding: 0.62rem 1rem;
  font-size: 0.9rem;
  gap: 0.5rem;
}

.quick-action-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  gap: 0.72rem;
  align-items: flex-start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.admin-pane--overview .stat-card,
.admin-pane--overview .overview-metric-card,
.admin-pane--overview .overview-recent-card,
.admin-pane--overview .overview-bottom-card {
  border-radius: 12px;
}

.admin-pane--overview .stat-card__value,
.admin-pane--overview .overview-metric-card__value {
  font-size: 32px;
  line-height: 1;
}

.admin-pane--overview .stat-card__label,
.admin-pane--overview .stat-card__note,
.admin-pane--overview .overview-metric-card__label {
  font-size: 13px;
  color: #6b7280;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent);
  pointer-events: none;
}

.stat-card__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.stat-card__icon--blue {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.stat-card__icon--violet {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}
.stat-card__icon--green {
  background: linear-gradient(135deg, #10b981, #059669);
}

.stat-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  position: relative;
  z-index: 1;
}

.stat-card__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-card__value--money {
  font-size: 1.9rem;
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
}
.stat-card__value--money .rmb {
  font-size: 1rem;
  color: var(--success);
  font-weight: 700;
}

.stat-card__note {
  font-size: 0.66rem;
  color: var(--text-muted);
  opacity: 0.85;
}

/* —— 表格 —— */
.table-shell {
  overflow-x: auto;
  border-top: 1px solid var(--border);
}

.card--table .table-shell {
  margin: 0 -1.1rem;
  width: calc(100% + 2.2rem);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table th,
.data-table td {
  padding: 0.52rem 0.78rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  height: 48px;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
}

.data-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(7, 11, 20, 0.32);
}

.data-table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.08);
}

.data-table .table-empty-cell {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 2.5rem 1rem !important;
  background: rgba(7, 11, 20, 0.28) !important;
}

.data-table tbody tr:only-child .table-empty-cell {
  border-bottom: none;
}

.data-table tbody tr:only-child:hover td {
  background: rgba(7, 11, 20, 0.28) !important;
}

.th-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.th-check {
  width: 38px;
  text-align: center;
}

.data-table td .btn-sm + .btn-sm {
  margin-left: 0.24rem;
}

.data-table .btn-sm {
  padding: 0.22rem 0.5rem;
  font-size: 0.68rem;
  line-height: 1.25;
  border-radius: 7px;
}

.table-action-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-action-row .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.role-badge--admin {
  color: #ddd6fe;
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.45);
}

.role-badge--user {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.18);
  border-color: rgba(148, 163, 184, 0.35);
}

.admin-users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.admin-users-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-users-filter-row__search {
  width: 260px;
}

.admin-users-filter-row__status {
  width: 130px;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 2px;
}

.table-pagination__meta {
  color: var(--text-muted);
  font-size: 12px;
}

.table-pagination__controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-pagination__controls label,
.table-pagination__controls span {
  color: var(--text-muted);
  font-size: 12px;
}

#admin-users-page-size {
  width: 78px;
}

.data-table input[type="number"],
.data-table input[type="text"] {
  max-width: 110px;
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
}

/* —— 状态标签 —— */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tag-wait {
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.tag-active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.tag-done {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.tag-expired {
  background: rgba(251, 146, 60, 0.15);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

.tag-cancel {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.tag-fail {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state p {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: var(--text);
}
.empty-state span {
  font-size: 0.875rem;
}

/* —— 管理：订单筛选横排 —— */
.card__head--stack-sm {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.admin-orders-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.admin-orders-filter__uid {
  width: 150px;
  min-width: 150px;
  flex: 0 0 150px;
}

.admin-orders-filter__status {
  width: 120px;
  min-width: 120px;
  flex: 0 0 120px;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-2);
}

.segmented__btn {
  margin: 0;
  padding: 0.38rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented__btn:last-child {
  border-right: none;
}

.segmented__btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.segmented__btn.is-active {
  color: #fff;
  background: rgba(59, 130, 246, 0.28);
}

#btn-refresh-admin-orders {
  margin-left: auto;
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  #btn-refresh-admin-orders {
    margin-left: 0;
  }
}

/* —— 充值：紧凑手动表单 —— */
.recharge-manual-wrap {
  padding: 0 0 1rem;
  max-width: 600px;
}

.recharge-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, 6.5rem) minmax(0, 1fr) auto;
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.recharge-inline-form .form-group {
  margin-bottom: 0;
}

.recharge-inline-form__field label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.recharge-inline-form__field .input {
  width: 100%;
}

.recharge-inline-form__submit {
  padding-bottom: 0.05rem;
}

@media (max-width: 640px) {
  .recharge-inline-form {
    grid-template-columns: 1fr 1fr;
  }

  .recharge-inline-form__submit {
    grid-column: 1 / -1;
  }

  .recharge-inline-form__field--narrow {
    grid-column: auto;
  }
}

/* —— 次要视图：避免内容过短时整页被无意义拉高 —— */
#view-admin-audit.view.is-visible {
  min-height: 0;
}

.view-admin-audit-view .card {
  min-height: 0;
}

/* —— 弹窗 —— */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal__head h3 {
  margin: 0;
  font-size: 1rem;
}

.modal__body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.modal-meta {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.messages-box {
  max-height: 280px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.recharge-address-box {
  margin-bottom: 0.9rem;
}

.recharge-address-box label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.recharge-address-row {
  display: flex;
  gap: 0.5rem;
}

.recharge-address-row input {
  flex: 1;
}

.recharge-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.recharge-stepper {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.recharge-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.recharge-step.is-active {
  color: var(--text);
}

.recharge-step__num {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.03);
}

.recharge-step.is-active .recharge-step__num {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.2);
  color: #dbeafe;
}

.recharge-stepper__line {
  flex: 1;
  min-width: 1rem;
  height: 1px;
  background: var(--border);
}

.recharge-transfer-amount {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0.3rem 0 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(59, 130, 246, 0.08);
}

.recharge-transfer-amount strong {
  font-size: 1.05rem;
  color: #bfdbfe;
  letter-spacing: 0.01em;
}

.recharge-transfer-amount--danger {
  color: #f87171 !important;
  font-weight: 800;
}

.recharge-transfer-amount__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.recharge-notes {
  margin: 0;
  padding-left: 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.recharge-notes li + li {
  margin-top: 0.3rem;
}

.message-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.message-item:last-child {
  border-bottom: none;
}

.message-item time {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.message-item pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.recharge-foot-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.recharge-view {
  min-height: var(--content-view-min-h);
}

.recharge-page-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recharge-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
}

.recharge-page-form-card,
.recharge-page-records-card {
  background: var(--surface);
  border: 1px solid var(--border);
}

.recharge-page-form-card .card__actions {
  justify-content: flex-start;
}

@media (max-width: 980px) {
  .recharge-page-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Toast —— */
.toast-wrap {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.22s ease;
  border: 1px solid var(--border);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast.ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.35);
}

.toast.err {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}

/* —— 系统配置页 —— */
.config-page-card {
  max-width: none;
  margin: 0;
}

.config-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 0.5rem;
}

.config-group-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.config-page-card .config-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-form-grid .mono-input {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.config-toggle-grid--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.config-toggle-item {
  align-items: center;
}

.config-toggle-item__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.config-toggle-item__meta span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.config-toggle-item__meta small {
  color: var(--text-muted);
  font-size: 12px;
}

.config-toggle-item .switch {
  margin-left: auto;
}

.config-form-actions {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  padding-top: 12px;
  display: flex;
  justify-content: flex-start;
  background: linear-gradient(180deg, rgba(12, 18, 34, 0), rgba(12, 18, 34, 0.94) 35%);
}

#btn-save-system-config {
  width: 120px;
}

@media (max-width: 640px) {
  .form-row-2,
  .config-toggle-grid--two-col {
    grid-template-columns: 1fr;
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: rgba(59, 130, 246, 0.35);
  border-color: rgba(59, 130, 246, 0.45);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
