* { box-sizing: border-box; }

:root {
  --bg-page: #eef1f6;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f3f4f6;
  --bg-table-head: #f8fafc;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --btn-action-bg: #eef2ff;
  --btn-action-text: #1e293b;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
  --nav-hover: #f3f4f6;
  --switch-track: #dbeafe;
  --switch-knob: #ffffff;
  --chart-grid: rgba(148, 163, 184, 0.25);
}

html.theme-dark {
  --bg-page: #181b24;
  --bg-sidebar: #151820;
  --bg-card: #242832;
  --bg-input: #1f2430;
  --bg-table-head: #1b202a;
  --border: #2f3542;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --text-soft: #6b7280;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.18);
  --btn-action-bg: rgba(255, 255, 255, 0.1);
  --btn-action-text: #f8fafc;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.22);
  --nav-hover: rgba(255, 255, 255, 0.04);
  --switch-track: #2a3140;
  --switch-knob: #ffffff;
  --chart-grid: rgba(148, 163, 184, 0.12);
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text);
}

html.admin-app,
html.admin-app body {
  height: 100%;
  overflow: hidden;
}

html.admin-booting #login-view {
  display: none !important;
}

html.admin-booting #admin-view.hidden {
  display: grid !important;
}

html.admin-booting::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-page);
}

html.admin-ready::before {
  display: none;
}

.hidden { display: none !important; }

button, input {
  font: inherit;
}

.btn-primary {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.92; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 40%),
    var(--bg-page);
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  flex-shrink: 0;
}

.brand-icon svg { width: 22px; height: 22px; }

.brand-icon.brand-icon-image {
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.login-card input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

.error { color: #ef4444; min-height: 18px; font-size: 14px; margin: 0; }
.link { color: var(--accent); font-size: 14px; text-align: center; text-decoration: none; }

/* Shell */
.admin-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  padding: 8px 4px 24px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.55) rgba(148, 163, 184, 0.12);
}

.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.65);
  border: 2px solid transparent;
  background-clip: padding-box;
}

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

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}

.nav-item:hover { background: var(--nav-hover); color: var(--text); }

.nav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.28);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.nav-icon svg { width: 18px; height: 18px; }

.nav-parent { justify-content: flex-start; }
.nav-parent span:nth-child(2) { flex: 1; }

.nav-chevron {
  width: 16px;
  height: 16px;
  opacity: 0.55;
  transition: transform 0.2s;
}

.nav-chevron svg { width: 16px; height: 16px; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }

.nav-sub {
  display: grid;
  gap: 4px;
  padding: 2px 0 4px 44px;
}

.nav-sub-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.nav-sub-item:hover,
.nav-sub-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.main-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 58px;
  flex-shrink: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}

.topbar-search {
  flex: 1;
  max-width: 720px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  padding: 0 18px 0 44px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-soft);
}

.search-icon svg { width: 18px; height: 18px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}

.theme-switch-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-label {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
}

.theme-switch {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-switch-track {
  display: block;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: var(--switch-track);
  position: relative;
  transition: background 0.25s;
}

.theme-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--switch-knob);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html.theme-dark .theme-switch-knob { transform: translateX(26px); }

.theme-icon {
  width: 14px;
  height: 14px;
  color: #64748b;
}

.theme-icon svg { width: 14px; height: 14px; }

.theme-icon-sun { display: none; }
html:not(.theme-dark) .theme-icon-moon { display: none; }
html:not(.theme-dark) .theme-icon-sun { display: block; color: #f59e0b; }

.admin-profile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.admin-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.profile-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-soft);
}

.profile-chevron svg { width: 16px; height: 16px; }

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 10px;
  z-index: 30;
}

.profile-menu-meta {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.profile-menu button {
  width: 100%;
  border: none;
  background: transparent;
  color: #ef4444;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.profile-menu button:hover { background: rgba(239, 68, 68, 0.08); }

.content {
  flex: 1;
  min-height: 0;
  padding: 14px 18px 16px;
  overflow: auto;
  position: relative;
}

.content.is-loading {
  pointer-events: none;
}

.content-loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg-page) 72%, transparent);
  backdrop-filter: blur(1px);
  display: none;
  place-items: center;
}

.content-loader::after {
  content: '';
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: admin-spin 0.7s linear infinite;
}

.content.is-loading .content-loader {
  display: grid;
}

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

.content:has(#page-dashboard:not(.hidden)),
.content:has(#page-settings-access-list:not(.hidden)),
.content:has(#page-vip-level:not(.hidden)) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#page-dashboard,
#page-settings-access-list,
#page-vip-level {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

#page-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: min-content;
}

#page-dashboard {
  gap: 12px;
}

.page h2 {
  margin: 0;
  font-size: 22px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

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

.page-toolbar input {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

/* Dashboard */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  flex-shrink: 0;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.summary-icon svg { width: 18px; height: 18px; }
.summary-icon-blue { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.summary-icon-green { background: rgba(34, 197, 94, 0.14); color: #22c55e; }
.summary-icon-purple { background: rgba(168, 85, 247, 0.14); color: #a855f7; }
.summary-icon-orange { background: rgba(249, 115, 22, 0.14); color: #f97316; }

.summary-body { flex: 1; min-width: 0; }
.summary-label { font-size: 12px; color: var(--text-muted); }
.summary-value { margin-top: 4px; font-size: 22px; font-weight: 700; line-height: 1; }
.summary-arrow { color: var(--text-soft); font-size: 18px; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 0;
  flex-shrink: 0;
}

.panel-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.chart-panel {
  flex: 1.15;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-a { background: #3b82f6; }
.dot-b { background: #60a5fa; }
.dot-c { background: #93c5fd; }

.chart-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px 0;
  flex-shrink: 0;
}

.chart-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.chart-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.chart-wrap {
  flex: 1;
  min-height: 0;
  padding: 4px 10px 8px;
  position: relative;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.bottom-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 12px;
}

.donut-panel,
.activity-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.donut-wrap {
  flex: 1;
  min-height: 0;
  padding: 0 8px 8px;
  position: relative;
}

.donut-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.activity-list {
  flex: 1;
  min-height: 0;
  padding: 4px 8px 8px;
  overflow: hidden;
}

.activity-item {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.activity-item:last-child { border-bottom: none; }

.activity-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.activity-text {
  color: var(--text);
  line-height: 1.5;
}

.activity-meta,
.activity-time {
  color: var(--text-muted);
  white-space: nowrap;
}

.page-head.compact {
  margin-bottom: 12px;
}

.page-head.compact h2 {
  font-size: 18px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

.filter-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.filter-item {
  display: grid;
  gap: 6px;
  min-width: 108px;
}

.filter-item-wide { min-width: 132px; }

.filter-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.filter-item input,
.filter-item select {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  min-width: 0;
}

.filter-btns {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 1px;
}

.filter-btns .btn-primary,
.filter-btns .btn-outline {
  height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}

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

.content-batch-actions {
  align-items: center;
}

.content-selection-info {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-actions .btn-outline.btn-danger {
  height: 36px;
  padding: 0 14px;
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.filter-actions .btn-outline.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.5);
}

.filter-actions .btn-outline.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

html.theme-dark .filter-actions .btn-outline.btn-danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

html.theme-dark .filter-actions .btn-outline.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.btn-outline svg {
  width: 14px;
  height: 14px;
}

.btn-outline:hover {
  background: var(--nav-hover);
}

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

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

.users-table .status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.user-presence-cell {
  min-width: 52px;
  white-space: nowrap;
}

.user-presence {
  font-size: 12px;
  line-height: 1.2;
}

.user-presence-online {
  color: #22c55e;
  font-weight: 600;
}

.user-presence-offline {
  color: var(--text-muted);
}

.user-vip-level {
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-invite-code {
  max-width: 100px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.users-table .status-active {
  background: rgba(34, 197, 94, 0.14);
  color: #22c55e;
}

.users-table .status-disabled {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.user-list-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 36px;
  text-align: center;
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  flex-shrink: 0;
  isolation: isolate;
}

.user-list-avatar.has-image {
  background: #1f2430;
  font-size: 0;
  line-height: 0;
}

.user-list-avatar-lg.has-image {
  line-height: 0;
}

.user-list-avatar img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 50%;
}

.user-list-avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 28px;
  line-height: 72px;
}

.user-nickname-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-nickname-text {
  min-width: 0;
  flex: 1;
}

.admin-modal-card.user-edit-card {
  width: min(480px, 100%);
}

.edit-avatar-block {
  margin-bottom: 14px;
}

.edit-avatar-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.edit-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.edit-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-btn-danger:hover {
  opacity: 0.92;
}

.user-chat-card {
  width: min(1400px, calc(100vw - 32px));
  max-height: min(92vh, 860px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 24px 22px 20px;
}

.user-chat-card h3 {
  font-size: 20px;
}

.user-chat-tip {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.user-chat-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 0;
}

.user-chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.user-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.user-chat-selection {
  font-size: 13px;
  color: var(--muted);
}

.user-chat-actions .btn-danger {
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.user-chat-actions .btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
}

.user-chat-actions .btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

html.theme-dark .user-chat-actions .btn-danger {
  color: #fca5a5;
}

.user-chat-toolbar input {
  flex: 1;
  min-width: 180px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

.user-chat-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 420px;
  max-height: 65vh;
}

.user-chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

.user-chat-table col.col-check { width: 4%; }
.user-chat-table col.col-time { width: 10%; }
.user-chat-table col.col-conv { width: 13%; }
.user-chat-table col.col-sender { width: 11%; }
.user-chat-table col.col-recipient { width: 11%; }
.user-chat-table col.col-content { width: 51%; }

.user-chat-check-cell {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}

.user-chat-check-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.user-chat-table th,
.user-chat-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

.user-chat-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  font-size: 13px;
  white-space: nowrap;
}

.user-chat-table .user-chat-time {
  white-space: nowrap;
}

.user-chat-table td:nth-child(2),
.user-chat-table td:nth-child(3),
.user-chat-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chat-table .user-chat-content {
  word-break: break-word;
  white-space: pre-wrap;
}

.user-chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-chat-pager {
  display: flex;
  gap: 8px;
}

.users-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.users-table .user-check-col,
.users-table .user-check-cell {
  width: 42px;
  text-align: center;
  vertical-align: middle;
}

.users-table .user-check-cell input,
.users-table .user-check-col input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

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

.table-selection.hidden {
  display: none;
}

.user-batch-card {
  width: min(460px, 100%);
}

.user-batch-summary {
  margin: 0 0 16px;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-line;
}

.user-batch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.user-batch-actions button {
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.user-batch-actions .btn-warn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.28);
}

.user-batch-actions .btn-warn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.38);
}

.user-batch-actions .btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.28);
}

.user-batch-actions .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.38);
}

.user-batch-actions button:active {
  transform: translateY(0);
  opacity: 0.95;
}

.group-members-table-wrap {
  max-height: min(60vh, 520px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.group-members-table {
  width: 100%;
  border-collapse: collapse;
}

.group-members-table th,
.group-members-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.group-members-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-muted);
}

.modal-field textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input, var(--bg-page));
  color: var(--text);
  resize: vertical;
}

.group-chat-table col.col-check { width: 4%; }
.group-chat-table col.col-time { width: 16%; }
.group-chat-table col.col-sender { width: 16%; }
.group-chat-table col.col-content { width: 64%; }

.groups-table .row-actions {
  min-width: 220px;
}

.users-table .row-actions button {
  margin: 0;
}

.users-table .btn-edit {
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
}

.users-table .row-actions button:not(.btn-danger):not(.btn-warn):hover {
  filter: brightness(1.06);
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
}

#group-auth-modal {
  z-index: 100010;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.admin-modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.admin-modal-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.admin-modal-card.user-chat-card {
  width: min(1400px, calc(100vw - 32px));
  max-width: none;
  padding: 24px 22px 20px;
}

.admin-modal-card.user-chat-card h3 {
  margin: 0;
  font-size: 20px;
}

.admin-modal-card.user-chat-card:has(.user-chat-body.hidden) {
  width: min(470px, calc(100vw - 32px));
  max-height: none;
  grid-template-rows: auto;
}

.admin-modal-card.group-members-card {
  width: min(1200px, calc(100vw - 32px));
  max-width: none;
  padding: 24px 22px 20px;
}

.admin-modal-card.group-members-card h3 {
  margin: 0 0 14px;
  font-size: 20px;
}

.group-members-table .row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.group-members-table .row-actions button {
  flex-shrink: 0;
  white-space: nowrap;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.group-members-table th:last-child,
.group-members-table td:last-child {
  min-width: 460px;
}

.group-members-table th:nth-child(1),
.group-members-table td:nth-child(1) {
  min-width: 180px;
}

.group-members-table th:nth-child(3),
.group-members-table td:nth-child(3) {
  min-width: 120px;
  white-space: nowrap;
}

.modal-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-field span {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-field input,
.modal-field select {
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
}

.modal-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.modal-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

html.theme-dark .modal-field select {
  color-scheme: dark;
}

html.theme-dark .modal-field select option {
  background: var(--bg-card);
  color: var(--text);
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.admin-dialog-card {
  width: min(440px, 100%);
}

.admin-dialog-body {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 4px;
}

.admin-dialog-input-wrap {
  margin: 12px 0 4px;
}

.admin-dialog-form {
  display: grid;
  gap: 12px;
  margin: 12px 0 4px;
}

.admin-dialog-field {
  display: grid;
  gap: 6px;
}

.admin-dialog-field > span {
  font-size: 13px;
  color: var(--text-muted);
}

.admin-dialog-error {
  font-size: 13px;
  color: #ef4444;
  line-height: 1.5;
}

.admin-dialog-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
}

.admin-dialog-input::placeholder {
  color: var(--text-soft);
}

.admin-dialog-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-dialog-input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.admin-dialog-input[type='number']::-webkit-outer-spin-button,
.admin-dialog-input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modal-btn-danger {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
}

.modal-btn-danger:hover {
  opacity: 0.92;
}

.cell-stack {
  min-width: 148px;
}

.cell-main {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.cell-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.placeholder-panel {
  padding: 28px;
  color: var(--text-muted);
}

.access-page-head {
  margin-bottom: 0;
  flex-shrink: 0;
}

.access-save-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.access-save-actions .error,
.access-save-actions .access-success {
  margin: 0;
}

.access-list-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
  overflow: hidden;
}

.access-panel {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.access-panel .panel-head {
  margin-bottom: 0;
  padding-bottom: 8px;
}

.access-panel-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
  overflow: hidden;
}

.access-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 0;
}

.access-field-compact {
  flex-shrink: 0;
  margin-bottom: 8px;
}

.access-field-grow {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}

.access-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  flex-shrink: 0;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.radio-chip input {
  accent-color: var(--accent);
}

.access-multiselect,
.access-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  flex: 1;
  min-height: 0;
  resize: none;
  overflow: auto;
}

.access-multiselect:focus,
.access-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.access-grid-grow {
  flex: 1;
  min-height: 0;
  margin-bottom: 8px;
}

.access-success {
  color: #22c55e;
  font-size: 13px;
}

.row-actions-text {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  font-size: 14px;
}

.btn-link-danger {
  color: #ef4444;
}

.btn-link:hover {
  opacity: 0.85;
}

.sys-admin-filter .filter-item input,
.sys-admin-filter .filter-item select {
  height: 38px;
}

.security-words-panel {
  margin-bottom: 16px;
}

.security-words-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 0 16px 12px;
}

.security-words-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.security-word-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 13px;
}

.security-word-type {
  color: var(--text-muted);
  font-size: 12px;
}

.security-word-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.security-word-del:hover {
  color: #ef4444;
}

.security-filter .filter-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.security-filter .filter-item input,
.security-filter .filter-item select {
  height: 38px;
  width: 100%;
}

.security-content-cell .cell-main {
  max-width: 360px;
  word-break: break-word;
}

.security-type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 12px;
}

html.theme-dark .security-type-tag {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 14px !important;
}

.user-logs-filter .filter-item input {
  height: 38px;
  width: 100%;
}

.user-log-device-cell {
  max-width: 220px;
  word-break: break-word;
}

.user-logs-table td {
  white-space: nowrap;
}

.user-logs-table .user-log-device-cell {
  white-space: normal;
}

.operation-logs-table td {
  white-space: nowrap;
  vertical-align: top;
}

.operation-logs-table .op-log-content-cell {
  white-space: normal;
  max-width: 360px;
  word-break: break-word;
}

.op-log-admin-id,
.op-log-loc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted, #888);
}

.fake-users-hint {
  margin: 0 0 14px;
  padding: 0 4px;
}

.cs-list-hint {
  margin: 0 0 14px;
  padding: 0 4px;
}

.cs-list-table .row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.basic-config-head {
  align-items: flex-start;
  flex-shrink: 0;
  margin-bottom: 0;
}

.basic-config-body {
  flex: none;
  min-height: auto;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
  padding-bottom: 32px;
}

.basic-config-body .access-panel {
  margin-bottom: 0;
  min-height: auto;
  height: auto;
  overflow: visible;
}

.basic-config-grid {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.config-switch-row input[type='checkbox'] {
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.config-input-row,
.config-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft, rgba(255, 255, 255, 0.02));
}

.config-input-row > span,
.config-switch-row span {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.config-input-row input[type='text'],
.config-input-row input[type='number'],
.config-input-row select,
.config-input-row .config-select {
  flex: 0 0 132px;
  width: 132px;
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
}

.config-input-row select,
.config-input-row .config-select {
  flex: 0 0 188px;
  width: 188px;
  padding-right: 30px;
}

.config-input-row input[type='text']:focus,
.config-input-row input[type='number']:focus,
.config-input-row select:focus,
.config-input-row .config-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.config-input-row input[type='number']::-webkit-outer-spin-button,
.config-input-row input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.config-input-row input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.config-input-row-multi {
  align-items: flex-start;
}

.config-input-row-multi > span {
  flex: 0 0 132px;
  padding-top: 10px;
}

.config-input-control {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.config-input-control .access-textarea,
.config-input-control textarea {
  width: 100%;
  min-height: 84px;
}

.config-field {
  display: grid;
  gap: 6px;
}

.config-field-wide {
  grid-column: 1 / -1;
}

.config-field input[type='text'],
.config-field input[type='number'],
.basic-config-grid input[type='text'],
.basic-config-grid input[type='number'] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 38px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
}

.config-field input[type='text']:focus,
.config-field input[type='number']:focus,
.basic-config-grid input[type='text']:focus,
.basic-config-grid input[type='number']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.config-field input[type='number']::-webkit-outer-spin-button,
.config-field input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.config-field input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.config-field input::placeholder,
.basic-config-grid input::placeholder,
.basic-config-grid textarea::placeholder {
  color: var(--text-muted);
}

.logo-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.site-logo-preview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.site-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-upload-row input[type='text'] {
  flex: 1 1 180px;
  min-width: 0;
}

.basic-config-grid select,
.config-field select,
.config-select {
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-input-row select,
.config-input-row .config-select {
  width: 188px;
  min-height: 38px;
  padding: 0 30px 0 10px;
  border-radius: 8px;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.basic-config-grid select:hover,
.config-field select:hover,
.config-select:hover {
  border-color: color-mix(in srgb, var(--border) 55%, var(--accent));
}

.basic-config-grid select:focus,
.config-field select:focus,
.config-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.basic-config-grid select option,
.config-field select option,
.config-select option {
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 12px;
}

html.theme-dark .basic-config-grid select,
html.theme-dark .config-field select,
html.theme-dark .config-select {
  color-scheme: dark;
}

html.theme-dark .basic-config-grid select option,
html.theme-dark .config-field select option,
html.theme-dark .config-select option {
  background: #1f2430;
  color: #f3f4f6;
}

html.theme-dark .basic-config-grid select option:checked,
html.theme-dark .config-field select option:checked,
html.theme-dark .config-select option:checked {
  background: #2563eb;
  color: #ffffff;
}

.totp-bind-panel .totp-bind-actions {
  display: flex;
  gap: 10px;
  margin: 8px 0;
}

#cfg-admin-totp-setup-box {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 1400px) {
  .basic-config-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

#page-settings-admins .page-head.compact {
  align-items: center;
}

#page-settings-admins .filter-actions {
  margin-left: auto;
}

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

  .access-grid {
    grid-template-columns: 1fr;
  }
}

/* Tables */
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: var(--bg-table-head);
  color: var(--text-muted);
  font-weight: 600;
}

table button {
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  margin-right: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  font-weight: 500;
}

table button.btn-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
table button.btn-warn { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

html.theme-dark table button.btn-danger { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
html.theme-dark table button.btn-warn { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }

.status-active { color: #22c55e; }
.status-disabled { color: #ef4444; }
.status-warn {
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
}

html.theme-dark .status-warn {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 12px !important;
}

.page-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.moments-table .moment-content-cell {
  max-width: 280px;
  word-break: break-word;
}

.moment-images {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.moment-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

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

.moments-empty {
  padding: 48px 12px !important;
}

.moments-empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.moments-empty-inner svg {
  width: 56px;
  height: 56px;
  opacity: 0.35;
}

.moment-comments-card {
  width: min(760px, calc(100vw - 32px));
}

.btn-link-warn {
  color: #f59e0b;
}

.reports-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 4px 0;
}

.reports-pager {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.reports-pager .btn-outline {
  height: 32px;
  min-width: 72px;
  padding: 0 12px;
  justify-content: center;
  font-size: 13px;
  background: var(--bg-input);
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.reports-pager .btn-outline:hover:not(:disabled) {
  background: var(--nav-hover);
  border-color: color-mix(in srgb, var(--border) 70%, var(--accent));
}

.reports-pager .btn-outline:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  background: transparent;
}

.reports-page-label {
  min-width: 64px;
  padding: 0 4px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.reports-page-size {
  display: inline-flex;
  align-items: center;
}

.reports-page-size select {
  height: 32px;
  min-width: 108px;
  padding: 0 32px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.reports-page-size select:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent));
}

.reports-page-size select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

html.theme-dark .reports-page-size select {
  color-scheme: dark;
}

html.theme-dark .reports-page-size select option {
  background: var(--bg-card);
  color: var(--text);
}

.reports-goto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.reports-goto input {
  width: 56px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.reports-goto input:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent));
}

.reports-goto input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.reports-goto input::-webkit-outer-spin-button,
.reports-goto input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.reports-goto input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.discover-link-cell {
  max-width: 260px;
  word-break: break-all;
}

.discover-link-cell a {
  color: #2563eb;
  text-decoration: none;
}

.discover-link-cell a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

html.theme-dark .discover-link-cell a {
  color: #93c5fd;
}

html.theme-dark .discover-link-cell a:hover {
  color: #bfdbfe;
}

.discover-table .discover-link-cell {
  max-width: 260px;
}

.discover-icon-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.discover-icon-fallback {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.reports-table .report-details-cell {
  max-width: 220px;
  word-break: break-word;
}

.type-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid transparent;
}

.tag-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.25);
}

.tag-green {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.25);
}

.tag-purple {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border-color: rgba(168, 85, 247, 0.25);
}

.tag-orange {
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.25);
}

.tag-gray {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.25);
}

.wallet-settings-body {
  padding: 0;
}

.wallet-scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 20px;
}

.wallet-scenario-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.wallet-scenario-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.wallet-scenario-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.wallet-scenario-icon svg {
  width: 20px;
  height: 20px;
}

.wallet-scenario-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.wallet-scenario-list,
.wallet-toggle-list {
  padding: 8px 0;
}

.wallet-setting-row,
.wallet-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.wallet-setting-row:last-child,
.wallet-toggle-row:last-child {
  border-bottom: none;
}

.wallet-setting-info,
.wallet-toggle-meta {
  flex: 1;
  min-width: 0;
}

.wallet-setting-title,
.wallet-toggle-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.wallet-setting-desc,
.wallet-toggle-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.wallet-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.wallet-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.wallet-toggle-ui {
  position: relative;
  width: 72px;
  height: 32px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  transition: background 0.2s;
}

.wallet-toggle-knob {
  position: absolute;
  width: 26px;
  height: 26px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wallet-toggle input:checked + .wallet-toggle-ui {
  background: #3b82f6;
}

.wallet-toggle input:checked + .wallet-toggle-ui .wallet-toggle-knob {
  transform: translateX(40px);
}

.wallet-toggle-state {
  font-size: 12px;
  font-weight: 600;
  color: #93c5fd;
  min-width: 28px;
}

.wallet-toggle input:not(:checked) ~ .wallet-toggle-state {
  color: var(--muted);
}

.wallet-settings-note {
  margin: 0 20px 20px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.08);
  color: #93c5fd;
  font-size: 13px;
  line-height: 1.6;
}

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

.recharge-table .recharge-order-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.recharge-table .recharge-amount {
  font-weight: 600;
  color: #fbbf24;
  white-space: nowrap;
}

.recharge-table .recharge-remark-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recharge-voucher-btn {
  display: inline-flex;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  overflow: hidden;
}

.recharge-voucher-btn:hover {
  border-color: rgba(59, 130, 246, 0.5);
}

.recharge-voucher-thumb {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.withdraw-table .withdraw-account-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.redpacket-table .redpacket-greeting-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-total-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
  font-size: 12px;
  font-weight: 600;
}

.transfer-table .transfer-desc-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-recharge-body {
  padding: 0 20px 20px;
}

.system-recharge-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.system-recharge-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.system-recharge-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
}

.system-recharge-panel-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.system-recharge-panel-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
}

.system-recharge-panel-icon svg {
  width: 20px;
  height: 20px;
}

.system-recharge-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.system-recharge-empty .table-empty-illus {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.45;
}

.system-recharge-empty p {
  margin: 0 0 16px;
}

.system-recharge-selected {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.wallet-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 16px;
}

.wallet-user-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wallet-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  font-weight: 700;
  flex-shrink: 0;
}

.wallet-user-name {
  font-size: 15px;
  font-weight: 600;
}

.wallet-user-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  word-break: break-all;
}

.wallet-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.wallet-stat-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

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

.wallet-stat-value {
  font-size: 16px;
  font-weight: 700;
}

.wallet-stat-income {
  color: #86efac;
}

.wallet-stat-expense {
  color: #fca5a5;
}

.system-recharge-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.system-recharge-form h4 {
  margin: 0 0 14px;
  font-size: 14px;
}

.system-recharge-form .btn-primary {
  margin-top: auto;
}

.system-recharge-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.system-recharge-field span {
  font-size: 13px;
  color: var(--text-muted);
}

.system-recharge-field span.required::before {
  content: '*';
  color: #f87171;
  margin-right: 4px;
}

.system-recharge-field input,
.system-recharge-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
}

.system-recharge-logs-panel .system-recharge-logs-head {
  justify-content: space-between;
}

.system-recharge-logs-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.system-recharge-logs-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 0 8px;
  min-height: 0;
}

.system-recharge-logs-wrap .table-foot {
  margin-top: auto;
}

.wallet-logs-table .wallet-log-plus {
  color: #86efac;
  font-weight: 600;
}

.wallet-logs-table .wallet-log-minus {
  color: #fca5a5;
  font-weight: 600;
}

.system-recharge-user-card {
  width: min(520px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
}

.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.system-recharge-user-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 12px;
}

.system-recharge-user-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.system-recharge-user-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: inherit;
  padding: 12px 0;
  outline: none;
}

.system-recharge-user-list {
  overflow: auto;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-recharge-user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.system-recharge-user-item:hover {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
}

.system-recharge-user-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.system-recharge-user-item-name {
  font-weight: 600;
}

.system-recharge-user-item-meta {
  font-size: 12px;
  color: var(--muted);
}

.system-recharge-user-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--muted);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.vip-level-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 20px 12px;
  overflow: hidden;
}

#page-vip-level .page-head.compact {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.vip-level-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.vip-level-total {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.vip-level-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 8px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(59, 130, 246, 0.06));
  color: #dbeafe;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.vip-level-add-btn:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(59, 130, 246, 0.12));
  border-color: rgba(147, 197, 253, 0.55);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.vip-level-add-btn:active {
  transform: translateY(0);
}

.vip-level-add-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.vip-level-add-icon svg {
  width: 14px;
  height: 14px;
}

.vip-level-toolbar .btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.vip-level-toolbar input,
.vip-level-toolbar select {
  min-width: 160px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
}

.vip-level-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: hidden;
}

.vip-level-empty {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vip-level-admin-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.vip-level-admin-card.is-disabled {
  opacity: 0.72;
}

.vip-level-preview-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.35), rgba(15, 23, 42, 0.9));
  border-bottom: 1px solid var(--border);
}

.vip-level-preview-card.is-disabled {
  filter: grayscale(0.35);
}

.vip-level-preview-body {
  flex: 1;
  min-height: 0;
  padding: 10px 12px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.vip-level-badge {
  width: 52px;
  height: 52px;
  margin: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  flex-shrink: 0;
}

.vip-level-badge img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 8px;
}

.vip-level-badge svg {
  width: 24px;
  height: 24px;
}

.vip-level-preview-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.vip-level-preview-bar {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  line-height: 1.3;
}

.vip-level-preview-btn {
  width: 100%;
  max-width: 160px;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: default;
  flex-shrink: 0;
}

.vip-level-admin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  flex-shrink: 0;
}

.vip-level-admin-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}

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

.vip-level-admin-actions .btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.vip-level-edit-card {
  width: min(720px, calc(100vw - 32px));
}

.vip-level-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.vip-level-icon-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vip-level-icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-roles-panel {
  margin: 0 20px 20px;
}

.admin-roles-table .role-code {
  font-size: 12px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.role-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.role-type-builtin {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.role-type-custom {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}

.role-desc-cell {
  max-width: 360px;
  line-height: 1.5;
}

.btn-link-muted {
  color: var(--muted);
  cursor: default;
  pointer-events: none;
}

.admin-role-permissions-card {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}

.admin-role-permissions-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.admin-role-permissions-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-right: 4px;
}

.admin-role-perm-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
}

.admin-role-perm-group-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.admin-role-perm-group-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-role-perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

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

  .vip-level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .vip-level-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .theme-label { display: none; }
  .admin-role-permissions-list { grid-template-columns: 1fr; }
}

.group-join-qr-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.group-join-qr-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
#group-join-qr {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px;
}
.group-join-qr-meta {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 8px;
}
#group-join-url {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 12px;
}

#group-edit-modal .admin-modal-card.user-edit-card {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

#group-edit-modal .admin-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--bg-card);
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.user-phone-cell {
  min-width: 120px;
  white-space: nowrap;
}

.user-phone-text {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cell-empty {
  color: var(--text-muted);
}

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


.wallet-master-panel { margin-bottom: 16px; border: 1px solid rgba(59,130,246,.35); background: linear-gradient(135deg,rgba(59,130,246,.08),rgba(59,130,246,.02)); }
.wallet-master-panel .wallet-toggle-title { font-size: 16px; font-weight: 700; }

.splash-upload-btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

.payment-channel-panel {
  margin-top: 16px;
}
.payment-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.payment-channel-head h3 {
  margin: 0 0 4px;
}
.payment-channel-wrap {
  overflow: auto;
}
.payment-channel-table td,
.payment-channel-table th {
  white-space: nowrap;
}
.payment-channel-modal-card {
  width: min(720px, calc(100vw - 32px));
  max-height: min(90vh, 820px);
  overflow: auto;
}
.payment-channel-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.payment-channel-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0;
}
@media (max-width: 720px) {
  .payment-channel-form-grid {
    grid-template-columns: 1fr;
  }
}
.theme-switch-badge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.admin-pending-badge {
  position: absolute;
  top: -5px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--panel-bg, #111827);
  pointer-events: none;
  z-index: 2;
}
.admin-pending-badge.hidden {
  display: none;
}
.admin-pending-badge-inline {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  box-shadow: none;
}
.nav-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.nav-pending-badge.hidden,
.admin-pending-badge-inline.hidden {
  display: none;
}
/* Two-step password field */
.two-step-field {
  margin: 4px 0 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-input));
}

.two-step-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.two-step-field-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.two-step-field-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}

.two-step-input-field {
  margin-bottom: 0;
}

.two-step-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.two-step-input-wrap input {
  flex: 1;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.two-step-input-wrap input.two-step-input-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.two-step-toggle {
  flex-shrink: 0;
  height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.two-step-field-hint {
  margin: 8px 0 0;
}


.config-lang-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:6px 12px;}
.config-check-inline{display:flex;align-items:center;gap:6px;font-size:13px;}