﻿: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;
  --control-h: 2.375rem;
}

*,
*::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 styles live in backstage.css */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1 1 0%;
  min-width: 0;
  width: auto;
  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: 1rem;
  padding: 0 var(--page-gutter, 1.25rem);
  height: var(--bk-topbar-height, 60px);
  min-height: var(--bk-topbar-height, 60px);
  max-height: var(--bk-topbar-height, 60px);
  box-sizing: border-box;
  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;
  min-width: 0;
  width: 100%;
  overflow-y: auto;
  padding: 0 var(--page-gutter) 1.5rem;
  box-sizing: border-box;
}

@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: 0.75rem;
    padding-right: 0.75rem;
  }

  .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 pages */
.scrape-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
  width: 100%;
}

.scrape-page > .scrape-form-panel,
.scrape-page > .scrape-aside {
  margin: 0;
  align-self: start;
}

@media (max-width: 1080px) {
  .scrape-page {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .scrape-aside {
    order: -1;
  }
}

.scrape-form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.scrape-step {
  padding: 1.35rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.scrape-step:last-of-type {
  border-bottom: none;
}

.scrape-step__head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.scrape-step__num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.scrape-step__titles {
  flex: 1;
  min-width: 0;
}

.scrape-step__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

.scrape-step__desc {
  margin: 0.3rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.scrape-step__action {
  margin-left: auto;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.scrape-step__body {
  padding-left: 2.85rem;
}

@media (max-width: 640px) {
  .scrape-step {
    padding: 1.15rem 1rem;
  }

  .scrape-step__body {
    padding-left: 0;
  }

  .scrape-step__head {
    flex-wrap: wrap;
  }

  .scrape-step__action {
    margin-left: 2.85rem;
  }
}

.scrape-input-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

@media (max-width: 640px) {
  .scrape-input-bar {
    grid-template-columns: 1fr;
  }
}

.scrape-input-bar__field {
  min-width: 0;
}

.scrape-input-bar__field .field-inline input[type="url"],
.scrape-input-bar__field .field-inline select,
.scrape-input-bar__actions .btn {
  height: var(--control-h);
  min-height: var(--control-h);
  box-sizing: border-box;
}

.scrape-input-bar__field .field-inline input[type="url"] {
  padding-top: 0;
  padding-bottom: 0;
  line-height: var(--control-h);
}

.scrape-form-panel select {
  height: var(--control-h);
  min-height: var(--control-h);
  box-sizing: border-box;
  padding: 0 1.75rem 0 0.65rem;
  line-height: var(--control-h);
  font-size: 0.875rem;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 12px 12px;
}

.scrape-input-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.scrape-input-bar__actions .btn {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.directory-url-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.directory-url-row .scrape-input-bar__actions {
  flex-wrap: nowrap;
}

.directory-url-row .btn-icon {
  width: var(--control-h);
  min-width: var(--control-h);
  padding-left: 0;
  padding-right: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}

.directory-url-sync.hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 640px) {
  .scrape-limits-grid {
    grid-template-columns: 1fr;
  }
}

.scrape-option-row {
  margin-top: 1rem;
}

.scrape-option-row .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.scrape-option-row .field-hint {
  margin-top: 0.35rem;
}

.field-group-flush {
  margin-bottom: 0;
}

.scrape-form-footer {
  padding: 1.15rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

.scrape-form-footer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.scrape-form-footer__hint {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.scrape-aside {
  position: sticky;
  top: 0;
  align-self: start;
  margin: 0;
}

.scrape-help-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.scrape-help-panel__head {
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.scrape-help-panel__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.scrape-help-panel__lead {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.scrape-help-section {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}

.scrape-help-section:last-child {
  border-bottom: none;
}

.scrape-help-section--cta {
  background: #f8fafc;
}

.scrape-help-section__title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scrape-help-section__text {
  margin: 0;
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.55;
}

.scrape-help-section__text a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.scrape-help-section__text a:hover {
  text-decoration: underline;
}

.scrape-help-list,
.scrape-help-steps {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.65;
}

.scrape-help-list li + li,
.scrape-help-steps li + li {
  margin-top: 0.3rem;
}

.scrape-help-steps {
  padding-left: 1.2rem;
}

.scrape-advanced {
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}

.scrape-advanced__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.95rem 1.5rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.scrape-advanced__summary::-webkit-details-marker {
  display: none;
}

.scrape-advanced__summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-right: 0.15rem;
}

.scrape-advanced[open] .scrape-advanced__summary::before {
  transform: rotate(45deg);
}

.scrape-advanced__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
}

.scrape-advanced__badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.scrape-advanced__hint {
  flex: 1 1 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 1.35rem;
}

@media (min-width: 641px) {
  .scrape-advanced__hint {
    flex: 1 1 auto;
    padding-left: 0;
  }
}

.scrape-advanced__body {
  padding: 0 1.5rem 1.25rem 2.85rem;
}

@media (max-width: 640px) {
  .scrape-advanced__body {
    padding-left: 1.5rem;
  }
}

.option-picker {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafbfc;
}

.option-picker__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  min-height: calc(var(--control-h) + 0.5rem);
}

.option-picker__row + .option-picker__row {
  border-top: 1px solid #f1f5f9;
}

.option-picker__row--field {
  gap: 0.75rem;
}

.option-picker__row--field select {
  flex: 0 0 auto;
  width: auto;
  min-width: 11.5rem;
  max-width: none;
}

.option-picker__group {
  flex: 0 0 3.5rem;
  display: flex;
  align-items: center;
  align-self: center;
  min-height: var(--control-h);
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1;
}

.option-picker__chips {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  overflow: visible;
}

.option-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 0.3rem;
  min-height: var(--control-h);
  padding: 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  max-width: 100%;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  user-select: none;
}

.option-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.option-chip__badge {
  font-size: 0.65rem;
  font-weight: 500;
  color: #94a3b8;
}

.option-chip:hover:not(.is-disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.option-chip:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.1);
}

.option-chip.is-disabled {
  opacity: 0.75;
  cursor: not-allowed;
  background: #f8fafc;
  border-style: dashed;
  color: #94a3b8;
}

.option-picker__error {
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-top: 1px solid #fecaca;
  background: #fef2f2;
  font-size: 0.82rem;
}

.option-picker__error-inline {
  margin: 0;
  font-size: 0.82rem;
}

@media (max-width: 480px) {
  .option-picker__row {
    flex-wrap: wrap;
    align-items: flex-start;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .option-picker__group {
    flex: 0 0 100%;
    margin-bottom: 0.15rem;
  }
}

.collections-picker--panel {
  margin-top: 0.5rem;
  max-height: 320px;
  border-radius: 8px;
  border-color: #e2e8f0;
  background: #fff;
  padding: 0.5rem;
}

.collections-search-wrap {
  margin-top: 0.75rem;
}

.collections-search-input {
  width: 100%;
}

.collections-search-empty {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: #64748b;
  text-align: center;
}

.collection-tree-node.is-search-hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Legacy scrape form (fallback) */
.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);
}

.radio-chip-disabled {
  opacity: 0.72;
  cursor: not-allowed;
  background: #f8fafc;
  border-style: dashed;
  color: #94a3b8;
}

.radio-chip-disabled:has(input:checked) {
  border-color: var(--border);
  background: #f8fafc;
  color: #94a3b8;
}

.platform-lock-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: #f1f5f9;
}

.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-secondary {
  background: #fff;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.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.82rem;
  padding: 0.32rem 0.8rem;
  text-transform: none;
  letter-spacing: 0;
}

.status-pending { background: #f1f5f9; color: #475569; }
.status-running { background: #dbeafe; color: #1d4ed8; }
.status-exporting { background: #e0e7ff; color: #4338ca; }
.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;
}

.data-table--jobs,
.data-table--tasks {
  table-layout: fixed;
  width: 100%;
}

.data-table--jobs col.col-w-scope { width: 7%; }
.data-table--jobs col.col-w-platform { width: 8%; }
.data-table--jobs col.col-w-name { width: 20%; }
.data-table--jobs col.col-w-num { width: 6%; }
.data-table--jobs col.col-w-status { width: 8%; }
.data-table--jobs col.col-w-duration { width: 10%; }
.data-table--jobs col.col-w-created { width: 11%; }
.data-table--jobs col.col-w-actions { width: 16%; }

.data-table--jobs th,
.data-table--jobs td {
  padding: 0.65rem 0.55rem;
}

.data-table--jobs .cell-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.card--job-list .table-wrap--jobs {
  overflow-x: auto;
}

.data-table--jobs .col-status,
.data-table--tasks .col-status {
  width: 88px;
  text-align: center;
}

.data-table--tasks td:first-child,
.data-table--tasks th.col-status {
  text-align: center;
}

.data-table--tasks td:first-child .status-badge {
  margin-left: auto;
  margin-right: auto;
}

.data-table--jobs .col-type {
  width: 72px;
}

.data-table--jobs .col-target,
.data-table--tasks .col-store {
  width: 30%;
}

.data-table--jobs .col-platform,
.data-table--tasks .col-platform {
  width: 96px;
}

.data-table--jobs .col-count,
.data-table--tasks .col-count {
  width: 72px;
}

.data-table--jobs .col-time,
.data-table--tasks .col-time {
  width: 132px;
}

.data-table--tasks .col-user {
  width: 96px;
}

.data-table--tasks .col-error {
  width: 18%;
}

.data-table--jobs .col-actions,
.data-table--tasks .col-actions {
  width: 112px;
}

.data-table--jobs td,
.data-table--tasks td {
  vertical-align: middle;
}

.cell-actions {
  white-space: nowrap;
}

.detail-item--collections dd {
  min-width: 0;
}

.detail-item--collections .job-collection-tags {
  max-height: 180px;
  overflow-y: auto;
  padding-top: 0.15rem;
}

.detail-collection-summary {
  color: #64748b;
  font-size: 0.88rem;
}

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

.cell-url-full {
  max-width: 420px;
  word-break: break-all;
  white-space: normal;
  line-height: 1.35;
  font-size: 0.82rem;
}

.cell-job-name {
  max-width: 280px;
  line-height: 1.35;
}

.job-list-name {
  color: #0f172a;
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
}

.job-list-name:hover {
  color: #2563eb;
  text-decoration: underline;
}

.job-list-url {
  color: #2563eb;
  text-decoration: none;
}

.job-list-url:hover {
  text-decoration: underline;
}

/* Detail page */
.job-detail-page {
  width: 100%;
}

.job-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}

.job-detail-main,
.job-detail-summary,
.job-detail-timeline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.job-detail-main {
  padding: 0;
  overflow: hidden;
}

.job-detail-hero {
  padding: 1.35rem 1.5rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #eef2f7;
}

.job-detail-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.job-detail-hero .detail-status {
  margin-bottom: 0;
}

.job-detail-mode {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.job-detail-target {
  margin: 0;
}

.job-target-display {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.job-target-store {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
  word-break: break-all;
}

.job-target-store:hover {
  color: #2563eb;
  text-decoration: underline;
}

.job-collection-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.job-collection-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.35;
  text-decoration: none;
  word-break: break-word;
}

.job-collection-tag:hover {
  background: #e2e8f0;
  color: #1d4ed8;
  border-color: #cbd5e1;
}

.job-detail-url {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #334155;
  word-break: break-all;
}

.job-detail-url-item {
  display: block;
  margin-bottom: 0.35rem;
}

.job-detail-section {
  padding: 1.25rem 1.5rem 1.5rem;
}

.job-detail-section--progress {
  padding-top: 1rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
}

.job-detail-section--progress .job-progress-header {
  margin-bottom: 0.5rem;
}

.job-detail-section--progress .job-progress-bar {
  width: 100%;
  margin-bottom: 0.55rem;
}

.job-detail-section--progress .job-status-hint {
  margin-top: 0.65rem;
}

.job-detail-section-title,
.job-detail-aside-title {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
}

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

.job-meta-cell {
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 10px;
}

.job-meta-cell--wide {
  grid-column: 1 / -1;
}

.job-meta-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.job-meta-value {
  display: block;
  font-size: 0.92rem;
  color: #0f172a;
  line-height: 1.45;
}

.job-meta-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.4;
}

.job-detail-main .report-box {
  margin: 0 1.5rem 1.5rem;
}

.job-detail-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.job-detail-summary,
.job-detail-timeline {
  padding: 1.15rem 1.2rem;
}

.job-summary-stats,
.job-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.job-summary-stats li,
.job-timeline-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.job-summary-stats li:last-child,
.job-timeline-list li:last-child {
  border-bottom: none;
}

.job-summary-label,
.job-timeline-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.job-summary-value {
  font-size: 0.92rem;
  color: #0f172a;
  text-align: right;
}

.job-timeline-list time {
  font-size: 0.82rem;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.job-detail-aside-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.btn-block {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: none;
}

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

  .job-detail-aside {
    order: -1;
  }

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

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

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

.job-progress-panel {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.job-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.job-progress-count strong {
  font-size: 1.1rem;
  color: var(--text-primary, #0f172a);
}

.job-progress-pct {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.job-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.job-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.job-progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.job-progress-stats span:empty {
  display: none;
}

.job-status-hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.job-status-hint.is-warning {
  color: #b45309;
}

.job-preview-section {
  margin-top: 0.5rem;
}

.job-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.job-preview-targets {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  background: #f1f5f9;
  border-radius: 999px;
}

.job-preview-target {
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 0.86rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
}

.job-preview-target.is-active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.job-preview-note,
.job-preview-meta {
  color: #64748b;
  font-size: 0.86rem;
}

.job-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.job-preview-pager {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.job-preview-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  max-height: 520px;
}

.job-preview-table {
  min-width: 960px;
  margin: 0;
}

.job-preview-table th,
.job-preview-table td {
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-preview-empty {
  color: #64748b;
  font-size: 0.9rem;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.field-hint-inline {
  font-size: 0.78rem;
  font-weight: normal;
  color: var(--text-muted);
}

.form-section-advanced h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.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: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem;
  background: #f8fafc;
}

.collection-tree {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.collection-tree-node {
  display: block;
}

.collection-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  min-height: 1.9rem;
}

.collection-toggle,
.collection-toggle-spacer {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
}

.collection-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.collection-toggle:hover {
  background: #e2e8f0;
  color: #334155;
}

.collection-toggle svg {
  transition: transform 0.15s ease;
}

.collection-toggle.is-expanded svg {
  transform: rotate(90deg);
}

.collection-children {
  display: block;
}

.collection-children.is-collapsed {
  display: none;
}

.collection-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.12rem;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 4px;
  color: #64748b;
  text-decoration: none;
}

.collection-open-link:hover {
  background: #dbeafe;
  color: #2563eb;
}

.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: flex-start;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
}

.collection-item-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.35;
  min-width: 0;
}

.collection-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}

.collection-parent {
  color: #64748b;
  font-size: 0.8rem;
}

.collection-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.12rem;
  cursor: pointer;
  accent-color: #2563eb;
}

.collection-folder input[type="checkbox"] {
  display: inline-block;
}

.collection-folder .collection-title {
  font-weight: 600;
  color: #334155;
}

.collection-tree-node.is-folder > .collection-row {
  background: rgba(148, 163, 184, 0.08);
}

.collection-select-below {
  flex-shrink: 0;
  margin-left: 0.35rem;
  margin-top: 0.15rem;
  padding: 0.12rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.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-footnote {
  margin: 0.85rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: left;
}

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

.app-modal-footnote a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.app-modal-footnote a:hover {
  text-decoration: underline;
}

.app-modal-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.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);
}

.app-modal-eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

/* Announcement modal — dedicated layout */
.app-modal-announcement .app-modal-backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.app-modal-announcement .app-modal-panel {
  width: min(520px, 100%);
  padding: 0;
  text-align: left;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 24px 64px rgba(15, 23, 42, 0.22);
  animation: ann-modal-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ann-modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-modal-announcement .app-modal-panel::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #1d4ed8 0%, #38bdf8 55%, #67e8f9 100%);
}

.app-modal-announcement .app-modal-icon {
  display: none;
}

.app-modal-announcement .app-modal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 1.35rem 1.5rem 0.55rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
}

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

.app-modal-announcement .app-modal-eyebrow::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  flex-shrink: 0;
}

.app-modal-announcement .app-modal-title {
  margin: 0 1.5rem 0.85rem;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.app-modal-announcement.app-modal-info .app-modal-title,
.app-modal-announcement.app-modal-warning .app-modal-title {
  color: #0f172a;
}

.app-modal-announcement .app-modal-body {
  margin: 0 1.5rem;
  padding: 0.95rem 1.05rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.72;
  max-height: min(42vh, 320px);
  overflow-y: auto;
}

.app-modal-announcement .app-modal-footnote {
  margin: 0.75rem 1.5rem 0;
  padding-top: 0.75rem;
}

.app-modal-announcement .app-modal-actions {
  margin: 0;
  padding: 1.15rem 1.5rem 1.35rem;
  justify-content: flex-end;
  gap: 0.65rem;
  background: linear-gradient(180deg, transparent 0%, #fafbfc 100%);
}

.app-modal-announcement .app-modal-actions .btn {
  min-width: 6.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.app-modal-announcement .app-modal-actions .btn-ghost {
  color: #64748b;
  border: 1px solid transparent;
}

.app-modal-announcement .app-modal-actions .btn-ghost:hover {
  color: #334155;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.app-modal-announcement .app-modal-actions .btn-primary {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.app-modal-announcement .app-modal-actions .btn-primary:hover {
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

@media (max-width: 560px) {
  .app-modal-announcement .app-modal-panel {
    width: 100%;
    border-radius: 14px;
  }

  .app-modal-announcement .app-modal-eyebrow,
  .app-modal-announcement .app-modal-title {
    margin-left: 1.15rem;
    margin-right: 1.15rem;
  }

  .app-modal-announcement .app-modal-body {
    margin-left: 1.15rem;
    margin-right: 1.15rem;
    max-height: min(48vh, 280px);
  }

  .app-modal-announcement .app-modal-actions {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    flex-direction: column-reverse;
  }

  .app-modal-announcement .app-modal-actions .btn {
    width: 100%;
  }
}

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

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

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

.app-loading-panel {
  position: relative;
  z-index: 1;
  min-width: 220px;
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.app-loading-panel p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.app-loading-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.field-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.field-inline .input {
  flex: 1 1 12rem;
  min-width: 0;
}


/* 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 — split card */
/* ========== Auth pages (login / register) ========== */
.auth-page {
  min-height: 100vh;
  margin: 0;
  background: #f8fafc;
  color: #0f172a;
}

.auth-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* —— Left blue panel —— */
.auth-aside {
  position: relative;
  flex: 0 0 46%;
  max-width: 580px;
  display: none;
  color: #fff;
  overflow: hidden;
}

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

.auth-aside__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 80% 55% at -10% 90%, rgba(56, 189, 248, 0.4), transparent 52%),
    radial-gradient(ellipse 50% 40% at 60% 70%, rgba(37, 99, 235, 0.35), transparent 60%),
    linear-gradient(155deg, #1e3a8a 0%, #1d4ed8 38%, #2563eb 68%, #1e40af 100%);
}

.auth-aside__bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent 28%),
    linear-gradient(90deg, transparent 60%, rgba(255,255,255,0.04));
  pointer-events: none;
}

.auth-aside__bg::after {
  content: "";
  position: absolute;
  right: -18%;
  top: -12%;
  width: 78%;
  height: 62%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  transform: rotate(-14deg);
}

.auth-aside__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  padding: 2.6rem 2.8rem 2.8rem;
  min-height: 100%;
  justify-content: space-between;
}

.auth-aside__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.12rem;
  width: fit-content;
}

.auth-aside__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 1.2rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.auth-aside__name {
  letter-spacing: -0.01em;
}

.auth-aside__hero {
  margin: auto 0;
  max-width: 26rem;
  padding: 1rem 0 2rem;
}

.auth-aside__title {
  margin: 0 0 1rem;
  font-size: clamp(1.95rem, 3.2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.03em;
  text-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.auth-aside__desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
  line-height: 1.75;
}

.auth-aside__gift {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
}

/* —— Right form panel —— */
.auth-main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  background: #f8fafc;
}

.auth-main__pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    radial-gradient(circle at 1px 1px, #cbd5e1 1px, transparent 0);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

.auth-main__wrap {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  min-height: 100vh;
}

.auth-brand-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-brand-head--mobile-only {
  display: none;
}

@media (max-width: 959px) {
  .auth-brand-head--mobile-only {
    display: flex;
  }
}

.auth-brand-head__mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  color: #78350f;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.auth-brand-head__title {
  font-size: 1.15rem;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.auth-brand-head__tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}

.auth-card {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.06);
}

.auth-card-inner {
  padding: 1.5rem 1.4rem 1.35rem;
}

.auth-card-header {
  margin-bottom: 1.1rem;
}

.auth-card-header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  font-weight: 750;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.auth-card-header .subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
}

.auth-page-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.75rem;
  color: #94a3b8;
  padding-top: 0.25rem;
}

.auth-page-foot a {
  color: #64748b;
  text-decoration: none;
}

.auth-page-foot a:hover {
  color: #2563eb;
}

/* Forms */
.auth-login {
  width: 100%;
}

.auth-panel[hidden] {
  display: none !important;
}

.auth-panel--wx {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: auth-panel-in 0.25s ease both;
}

.auth-panel--form.is-active {
  animation: auth-panel-in 0.25s ease both;
}

@keyframes auth-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-wx-body {
  width: 100%;
  display: flex;
  justify-content: center;
}

.auth-wx-oauth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.auth-wx-oauth__icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-link-btn {
  border: 0;
  background: none;
  color: #2563eb;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.auth-link-btn:hover {
  text-decoration: underline;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .auth-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  z-index: 1;
}

.auth-input-wrap .auth-input-icon svg {
  display: block;
}

.auth-input-wrap .auth-input-icon .auth-contact-icon {
  display: none;
}

.auth-input-wrap .auth-input-icon .auth-contact-icon.is-active {
  display: block;
}

.auth-input-wrap .input {
  width: 100%;
}

.auth-input-wrap--pwd .input {
  padding-right: 2.75rem;
}

.auth-input-wrap .input:focus {
  outline: none;
}

.auth-pwd-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  line-height: 0;
}

.auth-pwd-toggle:focus {
  outline: none;
}

.auth-pwd-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.auth-pwd-toggle:hover {
  color: #475569;
  background: #f1f5f9;
}

.auth-pwd-toggle__icon {
  display: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.auth-pwd-toggle:not(.is-revealed) .auth-pwd-toggle__icon--hidden {
  display: block;
}

.auth-pwd-toggle.is-revealed .auth-pwd-toggle__icon--visible {
  display: block;
}

.auth-form .field-group {
  margin-bottom: 0.85rem;
}

.auth-form .field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.auth-wechat__qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.auth-wechat__qr-frame {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-wechat__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-wechat__placeholder {
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 1rem;
  text-align: center;
}

.auth-wechat__tip {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}

.auth-wechat__oauth {
  min-width: 180px;
}

.auth-form--compact .field-group {
  margin-bottom: 0.8rem;
}

.auth-form--compact .field-label {
  display: none;
}

.auth-form--compact .input {
  min-height: 2.65rem;
  font-size: 0.92rem;
}

.auth-code-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.auth-mode-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: #f1f5f9;
}

.auth-mode-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.55rem 0.5rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
}

.auth-mode-tab.is-active {
  background: #fff;
  color: #2563eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-agree {
  margin-top: 0.15rem;
}

.auth-agree__label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #64748b;
  cursor: pointer;
}

.auth-agree__label input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.auth-agree__link {
  color: #2563eb;
  text-decoration: none;
  margin-left: 0.1rem;
}

.auth-agree__link:hover {
  text-decoration: underline;
}

.auth-inline-msg.is-error {
  color: #dc2626;
}

.auth-inline-msg.is-ok {
  color: #15803d;
}

.auth-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.auth-footer-links a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

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

.auth-footer-links__muted {
  color: #94a3b8;
  font-size: 0.78rem;
}

.auth-input-wrap--bare .input {
  padding-right: 2.75rem;
}

.auth-form--compact.hidden,
.auth-panel .auth-form.hidden {
  display: none !important;
}

.auth-form {
  width: 100%;
}

.auth-code-row {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}

.auth-code-row .input {
  flex: 1;
  min-width: 0;
}

.auth-code-row .btn {
  flex: 0 0 auto;
}

.auth-verify-box {
  margin-top: 0.5rem;
}

.auth-req {
  color: #dc2626;
}

.auth-submit {
  width: 100%;
  margin-top: 0.35rem;
  min-height: 2.75rem;
  font-weight: 700;
  border-radius: 10px;
}

.auth-submit:hover {
  filter: brightness(1.03);
}

.auth-switch {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: #64748b;
}

.auth-switch a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

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

/* Third-party social row */

.auth-input-wrap--lead .input,
.auth-input-wrap--lead .auth-input--icon {
  padding-left: 2.55rem;
}

.auth-input-wrap--pwd .input,
.auth-input-wrap--pwd .auth-input--pwd {
  padding-right: 2.75rem;
}

.auth-input-wrap--code {
  flex: 1;
  min-width: 0;
}

.auth-input-wrap--code .input {
  width: 100%;
}

.auth-contact-alt {
  margin: 0.15rem 0 0.95rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #64748b;
}

.auth-contact-alt__link {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  color: #2563eb;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}

.auth-contact-alt__link:hover {
  text-decoration: underline;
}

.auth-social {
  margin-top: 1.15rem;
}

.auth-social__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  color: #94a3b8;
  font-size: 0.78rem;
}

.auth-social__divider::before,
.auth-social__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

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

.auth-social__row[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.auth-social__btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-social__btn:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  background: #f8fafc;
}

.auth-social__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
  flex-shrink: 0;
}

.auth-social__icon svg {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.auth-social__btn--google .auth-social__icon svg {
  width: 20px;
  height: 20px;
}

.auth-social__btn--wechat {
  color: #0f172a;
}

.auth-social__btn--wechat .auth-social__icon {
  color: #07c160;
}

.auth-social__btn--qq .auth-social__icon {
  color: #12b7f5;
}

.auth-social__tip {
  margin: 0.55rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: #b45309;
}

@media (max-width: 959px) {
  .auth-main__wrap {
    padding: 1.5rem 1.15rem 1.25rem;
    min-height: 100vh;
  }

  .auth-card-inner {
    padding: 1.25rem 1.1rem 1.15rem;
  }
}

/* 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;
}

.report-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.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);
}

.cell-actions {
  white-space: nowrap;
}

.cell-actions .inline-form {
  margin-left: 0.25rem;
}

.btn-cancel-task {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

.btn-cancel-task:hover {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.5);
}

.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(280px, 1fr));
  gap: 1.35rem;
  align-items: stretch;
}

/* Membership plan cards — refreshed layout */
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

.plan-card.is-current {
  border-color: #93c5fd;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.14);
}

.plan-card__accent {
  height: 4px;
  background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%);
}

.plan-card--paid .plan-card__accent {
  background: linear-gradient(90deg, #1677ff 0%, #4096ff 55%, #6366f1 100%);
}

.plan-card--free .plan-card__accent {
  background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%);
}

.plan-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.15rem 0.5rem;
}

.plan-card__header {
  padding-bottom: 0.85rem;
  border-bottom: 1px dashed #e8edf3;
}

.plan-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.plan-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.01em;
}

.plan-card__tag {
  flex-shrink: 0;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.plan-card__tag--hot {
  color: #c2410c;
  background: #fff7ed;
  border-color: #fed7aa;
}

.plan-card__price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.plan-card__price-value {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.plan-card--paid .plan-card__price-value {
  color: #1677ff;
}

.plan-card__price-unit {
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748b;
}

.plan-card__features {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0 0.35rem;
  flex: 1;
}

.plan-card__feature {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0;
  font-size: 0.86rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.plan-card__feature:last-child {
  border-bottom: none;
}

.plan-card__feature.is-disabled {
  color: #94a3b8;
}

.plan-card__check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: #22c55e;
}

.plan-card__feature.is-disabled .plan-card__check {
  background: #cbd5e1;
  color: #64748b;
}

.plan-card__feature-label {
  flex: 1;
  min-width: 0;
}

.plan-card__feature-badge {
  flex-shrink: 0;
  max-width: 52%;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: right;
  line-height: 1.35;
}

.plan-card__feature.is-disabled .plan-card__feature-badge {
  display: none;
}

.plan-card__footer {
  padding: 0.85rem 1rem 1rem;
  background: #f8fafc;
  border-top: 1px solid #eef2f6;
}

.plan-card__cta {
  display: block;
  width: 100%;
  padding: 0.78rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.plan-card__cta--free {
  color: #fff;
  background: linear-gradient(135deg, #475569 0%, #64748b 100%);
}

.plan-card__cta--free:hover {
  filter: brightness(1.06);
}

.plan-card__cta--muted {
  color: #64748b;
  background: #e2e8f0;
  cursor: default;
}

.plan-card__pay-row {
  display: flex;
  gap: 0.55rem;
  width: 100%;
}

.plan-card__pay-row.is-split .pay-channel-btn {
  flex: 1 1 0;
  min-width: 0;
}

.pay-channel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.72rem 0.75rem;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.pay-channel-btn .pay-channel-icon {
  color: #fff;
}

.pay-channel-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.pay-channel-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.15);
  box-shadow: none;
}

.pay-channel-btn--alipay {
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
}

.pay-channel-btn--wechat {
  background: linear-gradient(135deg, #07c160 0%, #06ae56 100%);
}

.pay-channel-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.pay-channel-icon {
  display: block;
  flex-shrink: 0;
}

.pay-channel-icon--alipay {
  width: 1.375rem;
  height: 1.375rem;
}

.pay-channel-icon--wechat {
  width: 1.375rem;
  height: 1.375rem;
}

.pay-channel-btn__label {
  line-height: 1;
  white-space: nowrap;
}

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

.pricing-footnote {
  margin-top: 1rem;
  text-align: center;
}

/* Legacy pricing classes kept for pay modal / other pages */
.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;
}

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

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

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

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

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

.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;
}

.pricing-card-footer {
  padding: 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;
}

.pricing-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.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: var(--bk-sidebar-w, 200px);
  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);
  transition: width 0.2s ease;
}

.backstage-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: var(--bk-topbar-height, 60px);
  min-height: var(--bk-topbar-height, 60px);
  max-height: var(--bk-topbar-height, 60px);
  padding: 0 0.75rem 0 1rem;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.backstage-sidebar-toggle {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.backstage-sidebar-toggle:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #f8fafc;
}

.backstage-sidebar-toggle .toggle-icon {
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s;
}

.backstage-shell.sidebar-collapsed .backstage-sidebar {
  width: 72px;
}

.backstage-shell.sidebar-collapsed .backstage-brand-text,
.backstage-shell.sidebar-collapsed .backstage-nav-text,
.backstage-shell.sidebar-collapsed .backstage-user,
.backstage-shell.sidebar-collapsed .backstage-nav-section-btn span:first-child,
.backstage-shell.sidebar-collapsed .nav-chevron {
  display: none;
}

.backstage-shell.sidebar-collapsed .backstage-brand {
  justify-content: center;
  padding: 0;
}

.backstage-shell.sidebar-collapsed .backstage-nav-link {
  justify-content: center;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.backstage-shell.sidebar-collapsed .backstage-nav-group-items {
  padding-left: 0;
  margin-left: 0;
  border-left: none;
}

.backstage-shell.sidebar-collapsed .backstage-nav-group + .backstage-nav-group {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.backstage-shell.sidebar-collapsed .backstage-sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.backstage-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0;
  text-decoration: none;
  color: #f8fafc;
  font-weight: 700;
  font-size: 1.08rem;
  min-width: 0;
}

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

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

.backstage-nav-section {
  margin: 1rem 0.5rem 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e2e8f0;
}

.backstage-nav-group {
  margin-bottom: 0.15rem;
}

.backstage-nav-group + .backstage-nav-group {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.backstage-nav-section-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 0 0.2rem;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.backstage-nav-section-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #f8fafc;
}

.backstage-nav-group-items {
  padding: 0.1rem 0 0.15rem 0.65rem;
  margin-left: 0.35rem;
  border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.backstage-nav-group.collapsed .backstage-nav-group-items {
  display: none;
}

.backstage-nav-group.collapsed .nav-chevron {
  transform: rotate(-90deg);
}

.nav-chevron {
  font-size: 0.65rem;
  color: #64748b;
  transition: transform 0.15s;
}

.backstage-nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  line-height: 1;
  opacity: 0.9;
}

.backstage-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.55rem;
  margin-bottom: 0.1rem;
  border-radius: 8px;
  text-decoration: none;
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.backstage-nav-link:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
}

.backstage-nav-link.active {
  background: rgba(37, 99, 235, 0.18);
  color: #f1f5f9;
  font-weight: 500;
  box-shadow: none;
}

.backstage-nav-link.active .backstage-nav-icon {
  opacity: 1;
}

.backstage-nav-muted {
  color: #64748b;
  font-size: 0.8125rem;
}

.backstage-nav-muted:hover {
  color: #cbd5e1;
}

.backstage-sidebar-footer {
  padding: 0.65rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.backstage-sidebar-footer .backstage-nav-link {
  padding: 0.4rem 0.55rem;
}

.backstage-user {
  padding: 0.5rem 0.55rem 0.35rem;
  margin-top: 0.15rem;
}

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

.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: 1rem;
  height: var(--bk-topbar-height, 60px);
  min-height: var(--bk-topbar-height, 60px);
  max-height: var(--bk-topbar-height, 60px);
  padding: 0 1.25rem;
  box-sizing: border-box;
  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.25rem var(--page-gutter) 1.75rem;
}

/* 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-meta-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.65;
}

.bk-meta-list li + li {
  margin-top: 0.2rem;
}

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

.bk-table-wrap {
  margin: 0 -1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.bk-table th,
.bk-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.bk-table th {
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.bk-table tbody tr {
  transition: background 0.12s;
}

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

.bk-table tbody tr:last-child td {
  border-bottom: none;
}

.bk-table .col-id,
.bk-table .col-actions {
  width: 1%;
  white-space: nowrap;
}

.bk-table .cell-muted {
  color: #64748b;
  font-size: 0.86rem;
}

/* 用户列表页 */
.bk-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.bk-search-field {
  flex: 1;
  min-width: min(100%, 280px);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.45rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.bk-search-field:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  background: #fff;
}

.bk-search-icon {
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.bk-search-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.35rem 0 !important;
  min-width: 0;
}

.bk-search-input:focus {
  outline: none;
}

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

.bk-users-panel {
  margin-top: 1rem;
  padding-bottom: 1.25rem;
  overflow: visible;
}

.bk-users-panel .bk-panel-header {
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.bk-users-panel .bk-table-wrap {
  margin: 0 -1.25rem;
  border-radius: 0 0 12px 12px;
}

.bk-users-table {
  min-width: 960px;
}

.bk-users-table .bk-code-tag {
  display: inline-block;
  min-width: 5.5rem;
  text-align: center;
}

.bk-panel-meta {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

.bk-panel-meta strong {
  color: #475569;
  font-weight: 600;
}

.bk-user-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.bk-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  color: #3730a3;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bk-user-name {
  font-weight: 600;
  color: #0f172a;
}

.bk-id-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.bk-plan-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.bk-code-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.03em;
}

.bk-text-permanent {
  color: #16a34a;
  font-size: 0.84rem;
  font-weight: 500;
}

.bk-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: #94a3b8;
}

.bk-empty-state p {
  margin: 0;
  font-size: 0.92rem;
}

.bk-empty-icon {
  font-size: 2rem;
  opacity: 0.5;
}

@media (max-width: 900px) {
  .bk-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .bk-search-actions {
    justify-content: flex-start;
  }
}

.bk-form-section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
  color: #1e293b;
}

.user-picker {
  position: relative;
}

.user-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 240px;
  overflow-y: auto;
}

.user-picker-option {
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  color: #334155;
  cursor: pointer;
}

.user-picker-option:hover,
.user-picker-option.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.user-picker-empty {
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

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

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

  .backstage-shell.sidebar-collapsed .backstage-sidebar {
    width: 100%;
  }

  .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 {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 6px;
  background: #22c55e;
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 1;
  text-decoration: none;
}

.referral-withdraw-btn:disabled,
.referral-withdraw-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.referral-withdraw-notice {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
  max-width: 36rem;
}

.referral-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.referral-form-grid .field-group--full {
  grid-column: 1 / -1;
}

.referral-payout-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.referral-payout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.referral-payout-qr {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.referral-payout-form .btn,
.referral-withdraw-form .btn {
  margin-top: 0.25rem;
}

.referral-bind-channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.25rem;
}

.referral-bind-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
}

.referral-bind-card.is-active,
.referral-bind-card.is-bound {
  border-color: #86efac;
  background: #f0fdf4;
}

.referral-bind-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.referral-bind-card__meta {
  margin: 0;
  font-size: 0.9rem;
  color: #374151;
}

.referral-payout-form-wrap {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.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;
}

/* —— 收款与提现独立页 —— */
.wallet-back-link {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-weight: 500;
}

.wallet-back-link:hover {
  text-decoration: underline;
}

.wallet-back-sep {
  margin: 0 0.35rem;
  color: var(--text-muted);
}

.wallet-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wallet-top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 0.85rem;
  align-items: stretch;
}

.wallet-balance {
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: #fff;
}

.wallet-balance__main {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.wallet-balance__label {
  font-size: 0.85rem;
  opacity: 0.9;
}

.wallet-balance__amount {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.wallet-balance__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  opacity: 0.9;
}

.wallet-balance__notice {
  margin: 0.55rem 0 0;
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.45;
}

.wallet-withdraw {
  padding: 1rem 1.15rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.wallet-block-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.wallet-block-desc {
  margin: 0.2rem 0 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wallet-withdraw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.wallet-withdraw-form .field-hint {
  margin-top: 0.45rem;
}

.wallet-card {
  padding: 0.9rem 1.05rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.wallet-card__head {
  margin-bottom: 0.65rem;
}

.wallet-card__head .wallet-block-desc {
  margin-bottom: 0;
}

.wallet-balance__methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.4rem 0.45rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
}

.wallet-chip.is-bound {
  background: rgba(255, 255, 255, 0.2);
}

.wallet-chip__icon {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.wallet-chip__icon--wechat {
  background: #07c160;
}

.wallet-chip__icon--alipay {
  background: #1677ff;
}

.wallet-chip__body {
  min-width: 0;
  flex: 1;
}

.wallet-chip__row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.wallet-chip__tag {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.18);
  color: rgba(255, 255, 255, 0.92);
}

.wallet-chip__tag.is-on {
  background: rgba(34, 197, 94, 0.35);
}

.wallet-chip__meta {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-chip__btn {
  flex-shrink: 0;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  padding: 0.18rem 0.45rem !important;
  font-size: 0.75rem !important;
}

.wallet-chip__btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}

.wallet-history-table {
  margin: 0;
}

.wallet-bind-modal-panel {
  max-width: 420px;
}

.wallet-bind-modal-panel .export-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wallet-upload {
  display: block;
  cursor: pointer;
  margin-top: 0.25rem;
}

.wallet-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.wallet-upload__visual {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.wallet-upload:hover .wallet-upload__visual,
.wallet-upload:focus-within .wallet-upload__visual {
  border-color: #38bdf8;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.wallet-upload__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0284c7;
  flex-shrink: 0;
}

.wallet-upload__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.wallet-upload__text strong {
  font-size: 0.9rem;
  font-weight: 650;
  color: #0f172a;
}

.wallet-upload__text small {
  font-size: 0.78rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-upload__preview {
  display: block;
  margin-top: 0.65rem;
}

.wallet-upload__preview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

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

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

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

  .wallet-top {
    grid-template-columns: 1fr;
  }

  .wallet-withdraw-grid {
    grid-template-columns: 1fr;
  }

  .wallet-balance__methods {
    grid-template-columns: 1fr;
  }
}

/* Payment modal */
.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.pay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.pay-modal-panel {
  --pay-accent: #1677ff;
  --pay-accent-soft: rgba(22, 119, 255, 0.08);
  --pay-accent-border: rgba(22, 119, 255, 0.22);
  position: relative;
  width: min(100%, 400px);
  padding: 0 1.35rem 1.35rem;
  text-align: center;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  animation: pay-modal-in 0.22s ease-out;
}

.pay-modal-panel--wechat {
  --pay-accent: #07c160;
  --pay-accent-soft: rgba(7, 193, 96, 0.08);
  --pay-accent-border: rgba(7, 193, 96, 0.24);
}

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

.pay-modal-accent {
  height: 4px;
  margin: 0 -1.35rem 1.15rem;
  background: linear-gradient(90deg, var(--pay-accent), color-mix(in srgb, var(--pay-accent) 55%, #6366f1));
}

.pay-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pay-modal-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.pay-modal-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  margin-bottom: 1rem;
}

.pay-modal-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--pay-accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--pay-accent) 35%, transparent);
}

.pay-modal-brand-icon {
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.pay-modal-brand-icon .pay-channel-icon--alipay,
.pay-modal-brand-icon .pay-channel-icon--wechat {
  width: 1.75rem;
  height: 1.75rem;
}

.pay-modal-panel--alipay .pay-modal-brand-icon--alipay {
  display: inline-flex;
}

.pay-modal-panel--wechat .pay-modal-brand-icon--wechat {
  display: inline-flex;
}

.pay-modal-head-text {
  min-width: 0;
}

.pay-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

.pay-modal-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.pay-modal-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: var(--pay-accent-soft);
  border: 1px solid var(--pay-accent-border);
  text-align: left;
}

.pay-modal-summary-plan {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-modal-summary-amount {
  flex-shrink: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pay-accent);
  font-variant-numeric: tabular-nums;
}

.pay-qr-box {
  padding: 1rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.pay-qr-stage {
  width: 220px;
  margin: 0 auto;
}

.pay-qr-stage.is-loading .pay-qr-ready {
  display: none;
}

.pay-qr-stage.is-ready .pay-qr-loading {
  display: none;
}

.pay-qr-wrap canvas {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.pay-qr-image {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.pay-qr-loading {
  width: 220px;
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px dashed var(--pay-accent-border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 1rem;
  box-sizing: border-box;
  background: #fff;
}

.pay-qr-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--pay-accent-border);
  border-top-color: var(--pay-accent);
  border-radius: 50%;
  animation: pay-qr-spin 0.75s linear infinite;
}

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

.pay-qr-countdown {
  margin: 0.75rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.pay-qr-countdown strong {
  color: var(--pay-accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.pay-modal-foot {
  margin-top: 1rem;
}

.pay-modal-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pay-modal-status-success {
  color: #16a34a;
  font-weight: 600;
}

.pay-modal-status-error {
  color: #dc2626;
  font-weight: 600;
}

.textarea-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.code-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: #f1f5f9;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.bk-info-box-spaced {
  margin-top: 1.25rem;
}

.field-group-full {
  grid-column: 1 / -1;
}

.text-success {
  color: #16a34a;
}

.text-warning {
  color: #d97706;
}

.badge-error {
  background: #fee2e2;
  color: #b91c1c;
}

.job-list-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.job-list-hint {
  color: #64748b;
  font-size: 0.875rem;
}

.data-table--exports .col-target,
.data-table--exports .col-format {
  white-space: nowrap;
}

.data-table--exports .col-format {
  min-width: 7rem;
}

.export-list-alert {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

.export-list-alert .text-danger {
  color: #dc2626;
  background: #fee2e2;
  padding: 0 0.25rem;
  border-radius: 3px;
}

.export-list-alert .text-link {
  color: #2563eb;
  background: #dbeafe;
  padding: 0 0.25rem;
  border-radius: 3px;
}

.export-row-watch {
  background: #eff6ff;
}

.export-row-watch.export-row-done {
  background: #ecfdf5;
  transition: background 0.6s ease;
}

.export-row-flash {
  animation: export-row-flash 0.8s ease;
}

@keyframes export-row-flash {
  0% { background: #dbeafe; }
  100% { background: transparent; }
}

.export-error-msg {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #dc2626;
  max-width: 16rem;
  line-height: 1.35;
  word-break: break-word;
}

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

.job-export-form .form-row--inline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.export-collection-mode {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.export-collection-mode .radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.job-export-form .form-row--stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 100%;
}

.job-product-table-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

/* ── 任务详情：统计卡片（参考图2） ── */
.job-detail-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  background: #fff;
}

.job-detail-stat {
  border-radius: 12px;
  padding: 0.9rem 0.65rem;
  text-align: center;
  border: 1px solid transparent;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.job-detail-stat-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.job-detail-stat-value--text {
  font-size: 1rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail-stat-label {
  font-size: 0.78rem;
  color: #64748b;
}

.job-detail-stat--green {
  background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}

.job-detail-stat--green .job-detail-stat-value { color: #047857; }

.job-detail-stat--blue {
  background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}

.job-detail-stat--blue .job-detail-stat-value { color: #1d4ed8; }

.job-detail-stat--slate {
  background: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
}

.job-detail-stat--slate .job-detail-stat-value { color: #334155; }

.job-detail-stat--amber {
  background: linear-gradient(160deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.job-detail-stat--amber .job-detail-stat-value {
  font-size: 1.05rem;
  color: #c2410c;
}

.job-detail-stat--violet {
  background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 100%);
  border-color: #ddd6fe;
}

.job-detail-stat--violet .job-detail-stat-value { color: #6d28d9; }

/* ── 信息条（参考图2 filter bar） ── */
.job-detail-infobar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: #eceff3;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #dde1e6;
}

.job-detail-infobar-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

.job-detail-infobar-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.35rem 0.65rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.job-detail-infobar-field--grow {
  flex: 1 1 220px;
  max-width: 100%;
}

.job-detail-infobar-field--hint {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

.job-detail-infobar-label {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
}

.job-detail-infobar-value {
  font-size: 0.8rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail-infobar-value--muted {
  color: #64748b;
}

.job-detail-infobar-value.mono {
  color: #2563eb;
  text-decoration: none;
}

.job-detail-infobar-value.mono:hover {
  text-decoration: underline;
}

.job-detail-infobar-field .status-badge {
  text-transform: none;
  letter-spacing: 0;
}

.job-detail-infobar-action {
  margin: 0;
  flex-shrink: 0;
}

.job-status-hint--bar {
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  color: #64748b;
  background: #eceff3;
  border-bottom: 1px solid #dde1e6;
}

.job-product-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 340px);
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eceff3;
  background: #fff;
}

.job-product-table-wrap::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.job-product-table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.job-product-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.job-product-table {
  width: max-content;
  min-width: 100%;
  font-size: 0.8125rem;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.job-product-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #64748b;
  color: #f8fafc;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid #475569;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.job-product-table thead th:first-child {
  padding-left: 1rem;
}

.job-product-table tbody td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid #eef2f6;
  vertical-align: middle;
  line-height: 1.45;
  color: #334155;
  background: #fff;
}

.job-product-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.job-product-table tbody td:first-child {
  padding-left: 1rem;
}

.job-product-table tbody tr:hover td {
  background: #f1f5f9;
}

.job-product-table .cell-data {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-product-table .col-json { max-width: 240px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; }
.job-product-table .col-json-wide { max-width: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; }
.job-product-table .col-url-wide { max-width: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; color: #475569; }
.job-product-table .col-bool,
.job-product-table .col-version,
.job-product-table .col-mode { max-width: 90px; text-align: center; }
.job-product-table .col-task { max-width: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; }
.job-product-table .col-user { max-width: 100px; }
.job-product-table .col-domain,
.job-product-table .col-dedup,
.job-product-table .col-collection,
.job-product-table .col-source,
.job-product-table .col-scraped { max-width: 180px; }
.job-product-table .col-currency { max-width: 70px; text-align: center; }

.job-product-table .col-id { max-width: 110px; }
.job-product-table .col-handle { max-width: 160px; }
.job-product-table .col-title { max-width: 200px; font-weight: 500; color: #0f172a; }
.job-product-table .col-url { max-width: 280px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; color: #475569; }
.job-product-table .col-sku { max-width: 280px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; }
.job-product-table .col-tags,
.job-product-table .col-body,
.job-product-table .col-summary,
.job-product-table .col-seo-desc { max-width: 180px; }
.job-product-table .col-published,
.job-product-table .col-created,
.job-product-table .col-updated { max-width: 130px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.job-product-table .col-status,
.job-product-table .col-variants,
.job-product-table .col-images,
.job-product-table .col-price { max-width: 90px; text-align: center; }

.job-product-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid #eef2f7;
  background: linear-gradient(180deg, #fff 0%, #fafbfd 100%);
}

.job-product-pager-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.job-product-pager .btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.job-product-pager-info {
  font-size: 0.82rem;
  color: #64748b;
  min-width: 7rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Compact job detail */
.job-detail-page--compact {
  display: flex;
  flex-direction: column;
}

.job-detail-panel {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.product-status-chip,
.product-platform-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.product-status-chip--active {
  color: #15803d;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}

.product-status-chip--inactive {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.product-status-chip--draft {
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.product-platform-chip {
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  text-transform: lowercase;
}

.product-title-cell {
  font-weight: 600;
  color: #0f172a;
}

.product-link-chip {
  color: #2563eb;
  text-decoration: none;
}

.product-link-chip:hover {
  text-decoration: underline;
}

.job-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  background: #fff;
}

.job-detail-header-body {
  min-width: 0;
}

.job-detail-progress-ring {
  --pct: 0;
  --ring-color: #3b82f6;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), #e8edf3 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.95), 0 8px 18px rgba(59, 130, 246, 0.12);
}

.job-detail-progress-ring.is-complete {
  --ring-color: #16a34a;
}

.job-detail-progress-ring.is-failed {
  --ring-color: #dc2626;
}

.job-detail-progress-ring-inner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  font-weight: 800;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
}

.job-detail-header-body {
  min-width: 0;
}

.job-detail-header-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.job-detail-header-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.job-detail-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.job-meta-pill,
.job-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 32px;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-size: 0.83rem;
  line-height: 1.2;
  border: 1px solid #dbe4f0;
  background: #f8fafc;
  color: #334155;
}

.job-meta-pill strong,
.job-stat-chip strong {
  font-variant-numeric: tabular-nums;
}

.job-meta-pill--soft {
  background: #eef6ff;
  border-color: #dbeafe;
  color: #1d4ed8;
}

.job-meta-pill--primary {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.job-detail-header-url {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-detail-header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.job-stat-chip--accent {
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
  border-color: #bae6fd;
  color: #0369a1;
}

.job-detail-header-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  min-width: 108px;
}

.job-status-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.report-box--compact {
  padding: 0.75rem 1rem;
  margin: 0;
}

.job-detail-alert {
  border-top: 1px solid #fecaca;
  border-bottom: 1px solid #fecaca;
}

.job-detail-alert.report-box--compact {
  border-radius: 0;
}

.empty-state--compact {
  padding: 1.5rem 1rem;
}

.data-table--jobs .cell-actions {
  white-space: nowrap;
}

.data-table--jobs .cell-actions .btn + .btn {
  margin-left: 0.2rem;
}

.cell-nowrap {
  white-space: nowrap;
}

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

  .job-detail-infobar {
    flex-direction: column;
    align-items: stretch;
  }

  .job-detail-infobar-field,
  .job-detail-infobar-field--grow {
    width: 100%;
  }

  .job-product-table-wrap {
    max-height: calc(100vh - 420px);
  }
}

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

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

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

.export-modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  border: 1px solid #e2e8f0;
}

.export-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #eef2f7;
}

.export-modal-title {
  margin: 0;
  font-size: 1.05rem;
}

.export-modal-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.export-modal-form {
  padding: 0 1.25rem 1.25rem;
}

.export-modal-body .form-row {
  margin-top: 0.9rem;
}

.export-modal-loading {
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.export-modal-actions {
  display: flex;
  gap: 0.65rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid #eef2f7;
}

.export-collection-empty {
  margin: 0;
  font-size: 0.84rem;
  color: #64748b;
}

.export-collection-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.45rem 0.75rem;
  max-height: 180px;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.export-collection-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  cursor: pointer;
}

.export-modal-collections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.btn-xs {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}

/* —— 店铺绑定 / 上架 —— */
.store-binding-card {
  margin-bottom: 1rem;
}

.store-binding-section-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.store-binding-lead {
  margin: 0 0 1.1rem;
}

.store-binding-form .field-group:last-of-type {
  margin-bottom: 0.75rem;
}

.store-binding-meta {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.store-binding-meta p {
  margin: 0.25rem 0;
}

.jd-publish-form {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.jd-publish-store-select {
  width: auto;
  min-width: 11rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.86rem;
}

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

.inline-form {
  display: inline;
  margin: 0;
}

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

.publish-detail-row > td {
  padding-top: 0;
  border-top: none;
  background: #f8fafc;
}

.publish-detail-panel {
  margin: 0.35rem 0 0.85rem;
}

.publish-detail-panel > summary {
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}

.publish-detail-table-wrap {
  margin-top: 0.65rem;
}

.publish-detail-table {
  font-size: 0.86rem;
}

.publish-detail-table .mono {
  font-size: 0.82rem;
}

/* 工单详情（前台 / 后台全宽分栏） */
.ticket-page-wrap {
  width: 100%;
  max-width: none;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0;
  width: 100%;
  min-height: min(70vh, 720px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ticket-aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem 1rem;
  border-right: 1px solid #e8edf3;
  background: #f8fafc;
}

.ticket-aside__status {
  display: flex;
  align-items: center;
}

.ticket-aside__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.4;
  color: #0f172a;
  word-break: break-word;
}

.ticket-aside__meta {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  flex: 1;
}

.ticket-aside__meta > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ticket-aside__meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #94a3b8;
  text-transform: none;
}

.ticket-aside__meta dd {
  margin: 0;
  font-size: 0.84rem;
  color: #334155;
  word-break: break-word;
  line-height: 1.45;
}

.ticket-aside__meta a {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
}

.ticket-aside__meta a:hover {
  text-decoration: underline;
}

.ticket-aside__close,
.ticket-aside__actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.ticket-aside__actions-label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

.ticket-aside__actions .btn {
  width: 100%;
  justify-content: center;
}

.ticket-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.ticket-main__head {
  flex-shrink: 0;
  padding: 0.7rem 1.15rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: #64748b;
  border-bottom: 1px solid #eef2f6;
  background: #fff;
}

.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-y: auto;
  border-top: none;
  background: #fcfcfd;
}

.ticket-msg {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  max-width: 42rem;
}

.ticket-msg--user {
  background: #fff;
  border-color: #e2e8f0;
  align-self: flex-start;
}

.ticket-msg--staff {
  background: #f0f7ff;
  border-color: #cfe0f5;
  align-self: flex-start;
}

.ticket-msg__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.3rem;
  font-size: 0.76rem;
}

.ticket-msg__head strong {
  color: #334155;
  font-weight: 600;
}

.ticket-msg__head time {
  color: #94a3b8;
  font-size: 0.72rem;
  white-space: nowrap;
}

.ticket-msg__body {
  white-space: pre-wrap;
  word-break: break-word;
  color: #1e293b;
  font-size: 0.9rem;
  line-height: 1.55;
}

.ticket-composer {
  flex-shrink: 0;
  margin: 0;
  padding: 0.85rem 1.15rem 1rem;
  border-top: 1px solid #e8edf3;
  background: #fff;
}

.ticket-composer textarea,
.ticket-composer .input {
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.45;
  border-radius: 8px;
  resize: vertical;
}

.ticket-composer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.55rem;
}

.ticket-composer__hint {
  font-size: 0.75rem;
  color: #94a3b8;
}

.ticket-closed-hint a {
  color: #2563eb;
  text-decoration: none;
  margin-left: 0.25rem;
}

.ticket-closed-hint a:hover {
  text-decoration: underline;
}

.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
  color: #991b1b;
}

@media (max-width: 900px) {
  .ticket-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .ticket-aside {
    border-right: none;
    border-bottom: 1px solid #e8edf3;
  }

  .ticket-aside__close,
  .ticket-aside__actions {
    margin-top: 0;
  }

  .ticket-msg {
    max-width: none;
  }
}

/* 兼容旧类名 */
.ticket-panel,
.ticket-detail-card,
.ticket-footer-actions {
  max-width: none;
  width: 100%;
}


/* Legal drawer (terms / privacy) */
body.legal-drawer-open {
  overflow: hidden;
}

.legal-drawer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.legal-drawer.is-open {
  pointer-events: auto;
}

.legal-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 36, 0.48);
  opacity: 0;
  backdrop-filter: blur(2px);
  transition: opacity 0.22s ease;
}

.legal-drawer.is-open .legal-drawer__backdrop {
  opacity: 1;
}

.legal-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(30rem, 100%);
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  box-shadow: -18px 0 50px rgba(10, 22, 36, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.legal-drawer.is-open .legal-drawer__panel {
  transform: translateX(0);
}

.legal-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
}

.legal-drawer__title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.legal-drawer__close {
  width: 2.15rem;
  height: 2.15rem;
  border: 0;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.legal-drawer__close:hover {
  background: #e2e8f0;
  transform: scale(1.04);
}

.legal-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.3rem 1.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.78;
}
