:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
  --font: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1e293b;
  --sidebar-width: 240px;
  --app-header-height: 56px;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* App shell: sidebar + main */
.app-shell {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: var(--app-header-height);
  padding: 0 1.1rem;
  flex-shrink: 0;
  text-decoration: none;
  color: #f8fafc;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  box-sizing: border-box;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
}

.sidebar-section {
  margin: 0.75rem 0.65rem 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.15rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--sidebar-active);
  color: #f8fafc;
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-icon {
  width: 1.1rem;
  text-align: center;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-user {
  padding: 0.5rem 0.75rem 0.75rem;
}

.sidebar-user-name {
  display: block;
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar-user-role {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.sidebar-logout {
  color: #94a3b8;
}

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

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--app-header-height);
  min-height: var(--app-header-height);
  padding: 0 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  flex-shrink: 0;
  box-sizing: border-box;
  z-index: 110;
}

.topbar-nav-slot {
  flex: 1;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-announcement {
  margin: 0;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
  border: 1px solid #fcd34d;
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-menu {
  position: relative;
  flex-shrink: 0;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  background: #fff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.user-menu-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.user-menu.open .user-menu-caret {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 0.35rem;
  z-index: 200;
}

.user-menu-dropdown.hidden {
  display: none;
}

.user-menu-info {
  padding: 0.55rem 0.75rem;
}

.user-menu-info-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.user-menu-info-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.user-menu-item {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.12s;
}

.user-menu-item:hover {
  background: #f1f5f9;
}

.user-menu-logout {
  color: var(--danger);
}

.user-menu-logout:hover {
  background: #fef2f2;
}

.topbar-username {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}

.membership-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #bfdbfe;
}

.membership-badge-admin {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
  color: #b45309;
  border-color: #fde68a;
}

.membership-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem 2rem 1rem;
  background: var(--bg);
  flex-shrink: 0;
  z-index: 100;
}

.content-header-main {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.content-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.content-header-desc {
  flex: 1;
  min-width: min(100%, 12rem);
}

.content-header-desc:empty {
  display: none;
}

.content-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.content-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.content-header-actions:empty {
  display: none;
}

.content-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2rem 2rem;
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .app-main {
    height: auto;
    overflow: visible;
  }

  .content-body {
    overflow: visible;
    min-height: auto;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .sidebar-section,
  .sidebar-footer {
    display: none;
  }

  .sidebar-link {
    margin: 0;
    padding: 0.5rem 0.75rem;
  }

  .content-header,
  .content-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar-announcement {
    display: none;
  }
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

.break-all {
  word-break: break-all;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-icon {
  color: var(--primary);
  font-size: 1.2rem;
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: #eff6ff;
  color: var(--primary);
}

/* Main */
.main-content {
  flex: 1;
  padding: 2rem 0 3rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
}

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

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* Form */
.scrape-form .form-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.scrape-form .form-section-last,
.scrape-form .form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-group {
  margin-bottom: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.field-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.field-hint {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.field-error {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.field-error-block {
  white-space: pre-wrap;
  line-height: 1.5;
}

.field-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

input[type="url"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select,
.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.5;
}

input[type="url"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus,
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.radio-row,
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-chip,
.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.radio-chip input[type="radio"],
.checkbox-chip input[type="checkbox"] {
  margin: 0;
  outline: none;
  box-shadow: none;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.radio-chip input[type="radio"]:focus,
.radio-chip input[type="radio"]:focus-visible,
.checkbox-chip input[type="checkbox"]:focus,
.checkbox-chip input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: none;
}

.radio-chip:has(input:checked),
.checkbox-chip:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.platform-group {
  margin-bottom: 0.85rem;
}

.platform-group:last-child {
  margin-bottom: 0;
}

.platform-group-label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: #f8fafc;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.status-lg {
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
}

.status-pending { background: #f1f5f9; color: #475569; }
.status-running { background: #dbeafe; color: #1d4ed8; }
.status-completed { background: #dcfce7; color: #15803d; }
.status-failed { background: #fee2e2; color: #b91c1c; }

/* Table */
.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.cell-ellipsis {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Detail page */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.detail-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-list {
  margin: 0;
}

.detail-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.detail-item dt {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-item dd {
  margin: 0;
  font-size: 0.92rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.log-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.log-panel {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  min-height: 200px;
  max-height: 360px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
}

.log-line {
  margin: 0 0 0.35rem;
}

.log-line.muted {
  color: #94a3b8;
}

.log-line.error {
  color: #fca5a5;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Collections picker */
.collections-picker {
  margin-top: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  background: #f8fafc;
}

.collections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.collections-header .field-label {
  margin-bottom: 0;
}

.collection-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
}

.collection-item:hover {
  background: #f1f5f9;
}

/* Toast (legacy, collection quick feedback uses modal via showToast) */
.toast {
  display: none;
}

/* App modal */
body.modal-open {
  overflow: hidden;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.app-modal.hidden {
  display: none;
}

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

.app-modal-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 1.5rem 1.5rem 1.25rem;
  text-align: center;
  animation: app-modal-in 0.18s ease-out;
}

@keyframes app-modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-modal-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.85rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
}

.app-modal-error .app-modal-icon {
  background: #fee2e2;
  color: var(--danger);
}

.app-modal-warning .app-modal-icon {
  background: #fef3c7;
  color: var(--warning);
}

.app-modal-success .app-modal-icon {
  background: #dcfce7;
  color: var(--success);
}

.app-modal-info .app-modal-icon {
  background: #dbeafe;
  color: var(--primary);
}

.app-modal-title {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
}

.app-modal-body {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  text-align: left;
}

.app-modal-actions {
  margin-top: 1.25rem;
}

.app-modal-actions .btn {
  min-width: 7rem;
}

.app-modal-error .app-modal-title {
  color: var(--danger);
}

.app-modal-warning .app-modal-title {
  color: var(--warning);
}

.app-modal-success .app-modal-title {
  color: var(--success);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0 0 1rem;
}

.empty-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-footer p {
  margin: 0;
}

/* Utilities */
.hidden {
  display: none !important;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

/* Login & Register */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #eff6ff 0%, #f4f6f9 50%, #f0fdf4 100%);
}

.auth-layout {
  display: flex;
  min-height: 100vh;
}

.auth-showcase {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #1e40af 100%);
  color: #e2e8f0;
}

@media (min-width: 900px) {
  .auth-showcase {
    display: flex;
  }
}

.auth-showcase-inner {
  max-width: 420px;
}

.auth-showcase-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  text-decoration: none;
  color: #f8fafc;
  font-weight: 700;
  font-size: 1.15rem;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.1rem;
}

.auth-showcase-title {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.auth-showcase-desc {
  margin: 0 0 1.75rem;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.6;
}

.auth-feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-feature-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  color: #cbd5e1;
}

.auth-feature-icon {
  flex-shrink: 0;
  width: 1.75rem;
  text-align: center;
}

.auth-trial-badge {
  display: inline-block;
  margin: 1.75rem 0 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
  font-size: 0.85rem;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

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

.auth-card-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 1.5rem 0 1.25rem;
  padding: 0.25rem;
  background: var(--bg);
  border-radius: 8px;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  text-align: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-switch {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

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

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

/* Legacy login class aliases */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #eff6ff 0%, #f4f6f9 50%, #f0fdf4 100%);
}

.login-card {
  width: min(400px, 90vw);
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.login-form {
  margin-top: 1.5rem;
}

/* Nav user */
.nav-user {
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

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

.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-failed .stat-value { color: var(--danger); }
.stat-card.stat-running .stat-value { color: var(--primary); }

/* Backstage */
.backstage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header-row h2 {
  margin: 0;
  font-size: 1rem;
}

.muted-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-bar {
  padding: 1rem 1.25rem;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filter-form .field-group {
  margin: 0;
  min-width: 160px;
}

/* Reports */
.report-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
}

.report-box h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.report-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.report-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.traceback-box {
  margin-top: 1rem;
  background: #1e293b;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

.traceback-box h3 {
  margin: 0 0 0.5rem;
  color: #fca5a5;
  font-size: 0.9rem;
}

.traceback-box pre {
  margin: 0;
  color: #e2e8f0;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-panel-tall {
  max-height: 500px;
}

.log-line.log-error { color: #fca5a5; }
.log-line.log-warning { color: #fcd34d; }
.log-line.log-success { color: #86efac; }
.log-line.log-info { color: #e2e8f0; }

.log-time {
  color: #64748b;
  margin-right: 0.5rem;
}

.log-level {
  color: #94a3b8;
  margin-right: 0.35rem;
}

.error-summary {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--danger);
  font-size: 0.88rem;
}

/* Membership & backstage forms */
.sidebar-membership {
  margin: 0.75rem 1rem 0;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.sidebar-membership-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-membership-meta {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.backstage-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.backstage-subnav .btn.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.form-card {
  padding: 1.25rem;
}

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

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

.checkbox-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.checkbox-inline-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.inline-form {
  display: inline;
}

.btn-danger-text {
  color: var(--danger);
}

.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-info {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
}

.badge-muted {
  background: #f1f5f9;
  color: #64748b;
}

.text-warning {
  color: #b45309;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Membership pricing cards */
.membership-current-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
}

.membership-current-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.membership-current-name {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.membership-current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.pricing-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pricing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.pricing-card.is-current {
  border-color: #93c5fd;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
}

.pricing-card-header {
  position: relative;
  padding: 0.85rem 1rem;
  text-align: center;
  color: #fff;
}

.pricing-card-free .pricing-card-header,
.pricing-card-free .pricing-card-footer {
  background: #6b7280;
}

.pricing-card-paid .pricing-card-header,
.pricing-card-paid .pricing-card-footer {
  background: #38bdf8;
}

.pricing-card-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pricing-current-tag {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
}

.pricing-card-price {
  padding: 1.25rem 1rem 0.5rem;
  text-align: center;
}

.pricing-price-value {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.pricing-price-suffix {
  margin-left: 0.15rem;
  font-size: 1rem;
  font-weight: 500;
  color: #374151;
}

.pricing-card-desc {
  margin: 0;
  padding: 0 1rem 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pricing-feature-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  flex: 1;
}

.pricing-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
  color: #334155;
}

.pricing-feature:last-child {
  border-bottom: none;
}

.pricing-feature.is-disabled {
  color: #94a3b8;
}

.pricing-feature-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.pricing-feature:not(.is-disabled) .pricing-feature-icon {
  background: #22c55e;
}

.pricing-feature.is-disabled .pricing-feature-icon {
  background: #ef4444;
}

.pricing-feature-label {
  flex: 1;
}

.pricing-feature-badge {
  flex-shrink: 0;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.pricing-feature.is-disabled .pricing-feature-badge {
  display: none;
}

.pricing-card-footer {
  padding: 0;
}

.pricing-action-form {
  margin: 0;
}

.pricing-btn {
  display: block;
  width: 100%;
  padding: 0.9rem 1rem;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: filter 0.15s ease;
}

.pricing-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.pricing-btn-free,
.pricing-card-free .pricing-btn-paid {
  background: #6b7280;
}

.pricing-btn-paid {
  background: #38bdf8;
}

.pricing-btn-current {
  background: #cbd5e1;
  color: #475569;
  cursor: default;
}

.pricing-btn-trial {
  background: #6b7280;
  color: #fff;
  cursor: default;
  opacity: 0.92;
}

.settings-summary-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #475569;
  font-size: 0.9rem;
}

.settings-summary-list li {
  margin: 0.35rem 0;
}

.pricing-footnote {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
}

/* Frontend: staff entry to backstage */
.sidebar-admin-entry {
  margin-bottom: 0.35rem;
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd !important;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.sidebar-admin-entry:hover {
  background: rgba(37, 99, 235, 0.28) !important;
  color: #fff !important;
}

/* ===== Backstage (独立管理后台) ===== */
.backstage-body {
  background: #eef2f7;
}

.backstage-shell {
  display: flex;
  min-height: 100vh;
}

.backstage-sidebar {
  width: 252px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0c1222 0%, #111827 100%);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(148, 163, 184, 0.1);
}

.backstage-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.35rem 1.15rem;
  text-decoration: none;
  color: #f8fafc;
  font-weight: 700;
  font-size: 1.08rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.backstage-brand-icon {
  color: #38bdf8;
  font-size: 1.2rem;
}

.backstage-nav {
  flex: 1;
  padding: 1rem 0.8rem;
}

.backstage-nav-section {
  margin: 1rem 0.6rem 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.backstage-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.2rem;
  border-radius: 10px;
  text-decoration: none;
  color: #cbd5e1;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.backstage-nav-link:hover {
  background: rgba(56, 189, 248, 0.1);
  color: #f8fafc;
}

.backstage-nav-link.active {
  background: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.backstage-nav-muted {
  opacity: 0.85;
  font-size: 0.86rem;
}

.backstage-nav-muted:hover {
  opacity: 1;
}

.backstage-sidebar-footer {
  padding: 0.8rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.backstage-user {
  padding: 0.6rem 0.8rem 0.5rem;
}

.backstage-user-name {
  display: block;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.9rem;
}

.backstage-user-role {
  font-size: 0.75rem;
  color: #64748b;
}

.backstage-nav-logout {
  color: #f87171 !important;
}

.backstage-nav-logout:hover {
  background: rgba(248, 113, 113, 0.12) !important;
}

.backstage-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.backstage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.75rem 2rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.backstage-header-main {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.backstage-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.backstage-header-desc {
  flex: 1;
  min-width: min(100%, 12rem);
}

.backstage-header-desc:empty {
  display: none;
}

.backstage-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.backstage-header-actions:empty {
  display: none;
}

.backstage-desc {
  margin: 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.backstage-content {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
}

/* Backstage stats */
.bk-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

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

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

.bk-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}

.bk-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.bk-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.bk-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: #0f172a;
}

.bk-stat-label {
  font-size: 0.82rem;
  color: #64748b;
}

.bk-stat-success .bk-stat-value { color: #16a34a; }
.bk-stat-success .bk-stat-icon { background: #dcfce7; }
.bk-stat-failed .bk-stat-value { color: #dc2626; }
.bk-stat-failed .bk-stat-icon { background: #fee2e2; }
.bk-stat-running .bk-stat-value { color: #2563eb; }
.bk-stat-running .bk-stat-icon { background: #dbeafe; }

.bk-section-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}

/* Backstage action cards */
.bk-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 1000px) {
  .bk-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bk-action-card {
  display: block;
  padding: 1.35rem 1.25rem;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.bk-action-card:hover {
  transform: translateY(-3px);
  border-color: #93c5fd;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.12);
}

.bk-action-icon {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.bk-action-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.bk-action-card p {
  margin: 0;
  font-size: 0.84rem;
  color: #64748b;
  line-height: 1.45;
}

/* Backstage panels */
.bk-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.bk-panel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  padding: 1.25rem;
  overflow: hidden;
}

.bk-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.bk-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.bk-filter-panel {
  padding: 1rem 1.25rem;
}

.bk-form-panel {
  padding: 1.5rem;
}

.bk-info-box {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #dbeafe;
}

.bk-info-box h3 {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  color: #1e40af;
}

.bk-empty {
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

.bk-table th {
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
}

@media (max-width: 768px) {
  .backstage-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .backstage-shell {
    flex-direction: column;
  }

  .backstage-header,
  .backstage-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Referral */
.referral-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.75rem 2rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #1e40af 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.referral-hero-main {
  position: relative;
  z-index: 1;
}

.referral-hero-amount-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.referral-hero-amount {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.referral-withdraw-btn {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 6px;
  background: #22c55e;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.85;
}

.referral-hero-desc {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  opacity: 0.95;
}

.referral-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  opacity: 0.88;
}

.referral-hero-deco {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  line-height: 1;
  opacity: 0.12;
  pointer-events: none;
}

.referral-settings-card {
  margin-bottom: 1.25rem;
}

.referral-section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.referral-rules {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.referral-rules-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.referral-rules-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.referral-rules-list li + li {
  margin-top: 0.15rem;
}

.referral-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.referral-share-line {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  word-break: break-all;
}

.referral-records-card {
  padding-top: 1rem;
}

.referral-records-toolbar {
  margin-bottom: 0.75rem;
}

.btn-dark {
  background: #1e293b;
  color: #fff;
  border: 1px solid #1e293b;
}

.btn-dark:hover {
  background: #0f172a;
  border-color: #0f172a;
}

.referral-records-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.referral-records-table {
  margin: 0;
}

.referral-records-table thead th {
  background: #f1f5f9;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.referral-records-table tbody td {
  font-size: 0.9rem;
}

.referral-records-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem !important;
}

@media (max-width: 768px) {
  .referral-hero {
    padding: 1.25rem 1.25rem;
  }

  .referral-hero-amount {
    font-size: 2rem;
  }

  .referral-hero-deco {
    display: none;
  }
}
