/* Admin design system - 喵极AI 主色点缀，整体偏中性 */
:root {
  color-scheme: light;
  /* 主色：霓虹粉，仅用于强调 */
  --admin-primary: #FF6AC1;
  --admin-primary-hover: #FF4FB3;
  --admin-primary-soft: #FDF2F8;
  --admin-primary-muted: rgba(255, 106, 193, 0.08);
  /* 背景：中性浅灰 */
  --admin-bg: #F5F5F7;
  --admin-panel: #FFFFFF;
  --admin-panel-hover: #FAFAFA;
  --admin-border: #E8E8ED;
  /* 文字 */
  --admin-text: #1C1C1E;
  --admin-muted: #6B6B70;
  /* 状态色 */
  --admin-ok: #0D9488;
  --admin-warn: #D97706;
  --admin-error: #E11D48;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--admin-text);
  background: var(--admin-bg);
}

a {
  color: inherit;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.admin-auth-page {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(180deg, #fcf6f9 0%, #f9f5ff 100%);
}

.admin-auth-ambient {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(100px);
  opacity: 0.9;
}

.admin-auth-ambient-left {
  top: -280px;
  left: -220px;
  width: 800px;
  height: 800px;
  background: linear-gradient(135deg, rgba(224, 239, 255, 0.82), rgba(224, 239, 255, 0));
}

.admin-auth-ambient-right {
  right: -140px;
  bottom: -220px;
  width: 620px;
  height: 620px;
  background: linear-gradient(135deg, rgba(255, 209, 234, 0), rgba(255, 209, 234, 0.72));
}

.admin-auth-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 4px 0 0;
}

.admin-auth-brandmark {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  color: var(--admin-text);
}

.admin-auth-brandmark img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(28, 28, 30, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.admin-auth-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-auth-brand-line {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.admin-auth-brand-line span {
  color: #f264bb;
}

.admin-auth-brand-copy small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #6d7484;
}

.admin-auth-brand-copy small::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #f264bb;
}

.admin-auth-toplink {
  color: #5f6675;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.admin-auth-toplink:hover {
  color: var(--admin-primary-hover);
}

.admin-auth-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 0 40px;
}

.admin-auth-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  border-radius: 32px;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.08);
  padding: 40px;
}

.admin-auth-panel-accent {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: rgba(255, 110, 199, 0.12);
  filter: blur(42px);
  pointer-events: none;
}

.admin-auth-copy {
  position: relative;
  z-index: 1;
  margin-bottom: 28px;
}

.admin-auth-kicker {
  margin: 0;
  color: var(--admin-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.admin-auth-copy h1 {
  margin: 14px 0 0;
  color: #171717;
  font-size: 40px;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.admin-auth-title-muted {
  color: #a3a3a3;
  font-weight: 500;
}

.admin-auth-title-main {
  color: #171717;
}

.admin-auth-title-mark {
  margin-left: 6px;
  color: #f264bb;
}

.admin-auth-banner {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  background: rgba(28, 28, 30, 0.06);
  color: var(--admin-text);
}

.admin-auth-banner.info {
  background: rgba(28, 28, 30, 0.05);
  color: #4a5260;
}

.admin-auth-banner.error {
  background: rgba(225, 29, 72, 0.1);
  color: var(--admin-error);
}

.admin-auth-banner.warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--admin-warn);
}

.admin-auth-form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-auth-inline-tip {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 240, 247, 0.72);
  border: 1px solid rgba(255, 106, 193, 0.12);
  color: #6e6373;
  font-size: 13px;
  line-height: 1.5;
}

.admin-auth-field {
  display: grid;
  gap: 8px;
}

.admin-auth-field > span,
.admin-auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #737b8c;
  font-size: 13px;
  font-weight: 700;
}

.admin-auth-link-inline {
  color: #f264bb;
  font-size: 12px;
  font-weight: 700;
}

.admin-auth-input-shell {
  position: relative;
}

.admin-auth-input-shell input {
  width: 100%;
  min-height: 58px;
  padding: 16px 58px 16px 18px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: rgba(250, 250, 250, 0.72);
  color: var(--admin-text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.admin-auth-input-shell input::placeholder {
  color: #a3a3a3;
}

.admin-auth-input-shell input:focus {
  outline: none;
  background: #fff;
  border-color: rgba(242, 100, 187, 0.58);
  box-shadow: 0 0 0 4px rgba(242, 100, 187, 0.12);
}

.admin-auth-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #7b8495;
  font-size: 12px;
  font-weight: 700;
}

.admin-auth-toggle:hover {
  border: none;
  background: rgba(255, 255, 255, 0.82);
  color: var(--admin-text);
}

.admin-auth-legal {
  color: #737b8c;
  font-size: 12px;
  line-height: 1.65;
}

.admin-auth-legal a {
  color: #f264bb;
  font-weight: 700;
  text-decoration: none;
}

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

.admin-auth-actions {
  margin-top: 4px;
}

.admin-auth-submit {
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #141821 0%, #111827 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.02em;
  box-shadow: 0 14px 32px rgba(17, 24, 39, 0.16);
}

.admin-auth-submit:hover {
  border: none;
  background: linear-gradient(135deg, #1a2130 0%, #111827 100%);
}

@media (max-width: 980px) {
  .admin-auth-topbar {
    padding-top: 0;
  }

  .admin-auth-main {
    padding-top: 24px;
  }

  .admin-auth-panel {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .admin-auth-page {
    padding: 16px;
  }

  .admin-auth-topbar {
    align-items: flex-start;
  }

  .admin-auth-brandmark {
    gap: 12px;
  }

  .admin-auth-brand-line {
    font-size: 20px;
  }

  .admin-auth-main {
    padding: 18px 0 24px;
  }

  .admin-auth-panel {
    border-radius: 28px;
    padding: 28px 22px 22px;
  }

  .admin-auth-copy h1 {
    font-size: 34px;
  }
}

/* Top header bar - 与 studio 一致 h-18 (72px) */
.admin-header {
  flex-shrink: 0;
  min-height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--admin-border);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header-brand .brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  margin: 0;
}

.admin-header-brand .brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-header-brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--admin-text);
}

.admin-header-brand-text h1 .brand-ai {
  color: var(--admin-primary);
}

.admin-header-brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--admin-muted);
}

.admin-header a {
  text-decoration: none;
  font-size: 14px;
  color: var(--admin-muted);
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.admin-header a:hover {
  color: var(--admin-primary-hover);
  background: var(--admin-primary-soft);
}

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

.admin-user-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--admin-border);
}

.admin-user-meta strong {
  font-size: 13px;
}

.admin-user-meta small {
  font-size: 11px;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-task-center-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--admin-border);
  background: #fff;
  color: var(--admin-text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}

.admin-task-center-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--admin-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  padding: 0 6px;
}

/* Body: sidebar + main */
.admin-body {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 0;
}

.sidebar {
  background: #FAFAFC;
  border-right: 1px solid var(--admin-border);
  padding: 22px 16px 20px;
  overflow-y: auto;
}


.nav-group {
  margin-bottom: 20px;
}

.nav-group:not(:first-child) {
  padding-top: 14px;
  border-top: 1px solid rgba(28, 28, 30, 0.06);
}


.nav-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-muted);
  padding: 0 14px 10px;
}

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

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
  white-space: nowrap;
}

.nav a .nav-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.72;
}

.nav a.active .nav-icon {
  opacity: 1;
}

.nav a.active {
  background: linear-gradient(180deg, #ffffff 0%, #fff8fc 100%);
  color: var(--admin-primary);
  font-weight: 600;
  border-color: rgba(255, 106, 193, 0.14);
  box-shadow: 0 10px 24px rgba(255, 106, 193, 0.08);
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--admin-primary);
  border-radius: 0 2px 2px 0;
}

.nav a:hover:not(.active) {
  background: rgba(255, 255, 255, 0.88);
  color: var(--admin-text);
  border-color: rgba(28, 28, 30, 0.06);
}

.nav-count-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 106, 193, 0.14);
  color: var(--admin-primary-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.back-links {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--admin-muted);
}

.back-links-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-muted);
  padding: 0 14px 8px;
}

.back-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  transition: background 0.15s, color 0.15s;
}

.back-links a:hover {
  background: rgba(255, 255, 255, 0.8);
  color: var(--admin-text);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  display: block;
}

.main {
  background: #FFFFFF;
  padding: 24px;
  overflow-y: auto;
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.head p {
  margin: 6px 0 0;
  color: var(--admin-muted);
  font-size: 14px;
}

.badge {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F0F0F4;
  color: var(--admin-muted);
  font-weight: 500;
}

.banner {
  margin: 0 0 16px;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--admin-muted);
  background: #F8F8FA;
  border: 1px solid var(--admin-border);
}

.banner.success {
  color: var(--admin-ok);
  border-color: rgba(13, 148, 136, 0.3);
  background: rgba(13, 148, 136, 0.08);
}

.banner.warn {
  color: var(--admin-warn);
  border-color: rgba(217, 119, 6, 0.3);
  background: rgba(217, 119, 6, 0.08);
}

.banner.error {
  color: var(--admin-error);
  border-color: rgba(225, 29, 72, 0.3);
  background: rgba(225, 29, 72, 0.08);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: var(--admin-panel);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 600;
}

.card h4 {
  margin: 4px 0 8px;
  font-size: 15px;
}

.stack {
  display: grid;
  gap: 10px;
}

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

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

.field .field-help {
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.45;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--admin-text);
  background: var(--admin-panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-muted);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

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

button,
.button-link {
  border: 1px solid var(--admin-border);
  background: var(--admin-panel);
  color: var(--admin-text);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

button.primary,
.button-link.primary {
  background: var(--admin-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

button:hover,
.button-link:hover {
  border-color: #B0B0B8;
  background: var(--admin-panel-hover);
}

button.primary:hover,
.button-link.primary:hover {
  background: var(--admin-primary-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

button.danger,
.button-link.danger {
  background: var(--admin-error);
  color: #fff;
  border-color: transparent;
}

button.danger:hover,
.button-link.danger:hover {
  background: #b83558;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.table-wrap {
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: auto;
  background: var(--admin-panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

th {
  position: sticky;
  top: 0;
  background: #F8F8FA;
  font-weight: 600;
  color: var(--admin-text);
}

tbody tr:hover {
  background: #FAFAFC;
}

td small {
  color: var(--admin-muted);
}

td.status-ok {
  color: var(--admin-ok);
  font-weight: 600;
}

td.status-failed {
  color: var(--admin-error);
  font-weight: 600;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.status-ok {
  background: rgba(13, 148, 136, 0.12);
  color: var(--admin-ok);
}

.status-badge.status-disabled {
  background: rgba(107, 107, 112, 0.12);
  color: var(--admin-muted);
}

.status-badge.status-pending {
  background: rgba(217, 119, 6, 0.12);
  color: var(--admin-warn);
}

/* Empty state */
.empty-state {
  padding: 32px 16px !important;
  text-align: center;
}

.empty-state .empty-text {
  display: block;
  color: var(--admin-muted);
  margin-bottom: 12px;
}

.empty-state .link-btn {
  background: none;
  border: none;
  color: var(--admin-primary);
  cursor: pointer;
  font-size: 14px;
  text-decoration: underline;
}

.empty-state .link-btn:hover {
  color: var(--admin-text);
}

/* Loading state */
.loading-state {
  padding: 24px !important;
  text-align: center;
  color: var(--admin-muted);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--admin-border);
  border-top-color: var(--admin-primary);
  border-radius: 50%;
  animation: admin-spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* Tab bar */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 16px;
}

.admin-tabs a {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--admin-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-tabs a:hover {
  color: var(--admin-text);
}

.admin-tabs a.active {
  color: var(--admin-primary);
  font-weight: 600;
  border-bottom-color: var(--admin-primary);
}

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

/* Coin delta colors */
.coin-delta-positive {
  color: var(--admin-ok);
  font-weight: 600;
}

.coin-delta-negative {
  color: var(--admin-error);
  font-weight: 600;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi .item {
  border-radius: 12px;
  background: var(--admin-panel);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--admin-border);
}

.kpi .label {
  color: var(--admin-muted);
  font-size: 12px;
}

.kpi .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: end;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 106, 193, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(253, 242, 248, 0.95));
}

.admin-dashboard-kicker {
  margin: 0 0 12px;
  color: var(--admin-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.admin-dashboard-hero-copy h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.admin-dashboard-hero-copy p:last-child {
  margin: 12px 0 0;
  max-width: 640px;
  color: #52525b;
  font-size: 15px;
  line-height: 1.7;
}

.admin-dashboard-hero-side {
  display: grid;
  gap: 14px;
  justify-items: end;
}

.admin-dashboard-quick-actions {
  justify-content: flex-end;
}

.admin-dashboard-kpi-item {
  position: relative;
  overflow: hidden;
}

.admin-dashboard-kpi-item::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--admin-primary-muted);
}

.admin-dashboard-kpi-meta {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.5;
}

.admin-dashboard-section {
  margin-top: 16px;
}

.admin-dashboard-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-dashboard-section-head h3 {
  margin: 0;
}

.admin-dashboard-section-head p {
  margin: 8px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-dashboard-attention-list {
  display: grid;
  gap: 12px;
}

.admin-dashboard-attention-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  background: #fff;
}

.admin-dashboard-attention-card.warn {
  background: rgba(217, 119, 6, 0.05);
  border-color: rgba(217, 119, 6, 0.16);
}

.admin-dashboard-attention-card.error {
  background: rgba(225, 29, 72, 0.05);
  border-color: rgba(225, 29, 72, 0.16);
}

.admin-dashboard-attention-main {
  display: grid;
  gap: 8px;
}

.admin-dashboard-attention-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-dashboard-attention-main p {
  margin: 0;
  color: #575761;
  font-size: 13px;
  line-height: 1.6;
}

.admin-dashboard-attention-side {
  display: grid;
  gap: 10px;
  align-content: center;
  justify-items: end;
}

.admin-dashboard-attention-count {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.admin-dashboard-trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--admin-muted);
  font-size: 12px;
}

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

.admin-dashboard-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.admin-dashboard-legend-dot.success {
  background: var(--admin-ok);
}

.admin-dashboard-legend-dot.failed {
  background: var(--admin-error);
}

.admin-dashboard-trend-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 260px;
}

.admin-dashboard-trend-col {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.admin-dashboard-trend-total {
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
}

.admin-dashboard-trend-bar-shell {
  display: flex;
  align-items: flex-end;
  height: 150px;
}

.admin-dashboard-trend-bar {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  width: 42px;
  min-height: 10px;
  border-radius: 16px 16px 12px 12px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(28, 28, 30, 0.04), rgba(28, 28, 30, 0.08));
  box-shadow: inset 0 0 0 1px rgba(28, 28, 30, 0.04);
}

.admin-dashboard-trend-segment {
  display: block;
  width: 100%;
}

.admin-dashboard-trend-segment.success {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.68), rgba(13, 148, 136, 0.98));
}

.admin-dashboard-trend-segment.failed {
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.54), rgba(225, 29, 72, 0.9));
}

.admin-dashboard-trend-rate {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-dashboard-trend-label {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard-bottom {
  margin-top: 16px;
}

.admin-dashboard-task-list,
.admin-dashboard-system-list {
  display: grid;
  gap: 12px;
}

.admin-dashboard-task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(28, 28, 30, 0.06);
}

.admin-dashboard-task-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.admin-dashboard-task-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-dashboard-task-main p {
  margin: 8px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard-system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-dashboard-mini-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(28, 28, 30, 0.06);
  background: #fafafc;
  display: grid;
  gap: 6px;
}

.admin-dashboard-mini-card span {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-dashboard-mini-card strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.admin-dashboard-mini-card small {
  color: #60606b;
  font-size: 12px;
  line-height: 1.5;
}

.admin-dashboard-system-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(28, 28, 30, 0.06);
}

.admin-dashboard-system-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.admin-dashboard-system-row span {
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-dashboard-system-row strong {
  text-align: right;
  font-size: 13px;
  line-height: 1.6;
}

.admin-dashboard-empty,
.admin-dashboard-error {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px dashed var(--admin-border);
  background: #fafafc;
}

.admin-dashboard-empty strong,
.admin-dashboard-error strong {
  font-size: 14px;
}

.admin-dashboard-empty p,
.admin-dashboard-error p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-dashboard-error {
  background: rgba(225, 29, 72, 0.04);
  border-color: rgba(225, 29, 72, 0.18);
}

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

.admin-dashboard-skeleton-card,
.admin-dashboard-skeleton-row,
.admin-dashboard-skeleton-chart {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(28, 28, 30, 0.06);
}

.admin-dashboard-skeleton-card::after,
.admin-dashboard-skeleton-row::after,
.admin-dashboard-skeleton-chart::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  animation: admin-dashboard-shimmer 1.4s infinite;
}

.admin-dashboard-skeleton-card {
  min-height: 108px;
}

.admin-dashboard-skeleton-row {
  min-height: 58px;
}

.admin-dashboard-skeleton-chart {
  min-height: 220px;
}

.admin-dashboard-skeleton-list {
  display: grid;
  gap: 12px;
}

@keyframes admin-dashboard-shimmer {
  100% {
    transform: translateX(100%);
  }
}

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

.preset-row button {
  min-width: 160px;
}

.tips-list {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

details.card > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
}

/* Admin ops card with tabs */
.admin-ops-card .admin-ops-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-ops-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--admin-muted);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

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

.admin-ops-tab.active {
  color: var(--admin-primary);
  font-weight: 600;
  border-bottom-color: var(--admin-primary);
}

.admin-ops-panel {
  display: none;
}

.admin-ops-panel.active {
  display: block;
}

/* Invite table action buttons - compact group */
.admin-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

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

.admin-task-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-task-preview {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: #fafafc;
  padding: 12px;
}

.admin-task-preview img,
.admin-task-preview video {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 10px;
}

.account-identity,
.account-drawer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 106, 193, 0.18), rgba(99, 102, 241, 0.14));
  color: var(--admin-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.account-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 20px;
}

.account-meta {
  display: grid;
  gap: 3px;
}

.account-meta strong {
  font-size: 14px;
}

.account-meta small {
  color: var(--admin-muted);
  font-size: 12px;
}

.account-detail-card {
  min-height: 112px;
}

.account-detail-card h4 {
  color: var(--admin-muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.account-detail-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-task-timeline {
  display: grid;
  gap: 10px;
}

.admin-task-timeline-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #fafafc;
  padding: 10px 12px;
}

.admin-task-timeline-item small {
  color: var(--admin-muted);
}

.admin-more-dropdown {
  position: relative;
  display: inline-block;
}

.admin-more-dropdown summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-panel);
  color: var(--admin-muted);
  transition: background 0.15s, color 0.15s;
}

.admin-more-dropdown summary::-webkit-details-marker {
  display: none;
}

.admin-more-dropdown summary:hover {
  background: var(--admin-panel-hover);
  color: var(--admin-text);
}

.admin-more-dropdown[open] summary {
  border-color: var(--admin-primary);
  color: var(--admin-text);
}

.admin-more-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 120px;
  padding: 6px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-more-menu button {
  padding: 8px 12px;
  font-size: 13px;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
}

.admin-more-menu button.danger {
  color: var(--admin-error);
}

.admin-more-menu button:hover {
  background: var(--admin-primary-soft);
}

.admin-more-menu button.danger:hover {
  background: rgba(209, 63, 103, 0.12);
  color: var(--admin-error);
}

/* Admin modal */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.admin-modal-overlay[hidden] {
  display: none;
}

.admin-modal {
  background: var(--admin-panel);
  border-radius: 14px;
  padding: 24px;
  min-width: 360px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.admin-modal h3 {
  margin: 0 0 8px;
}

.admin-modal-sub {
  color: var(--admin-muted);
  font-size: 13px;
  margin: 0 0 16px;
}

/* Admin modal large - 模板商城等需要更多展示空间的弹窗 */
.admin-modal-lg {
  min-width: 560px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.admin-modal-lg .field textarea {
  min-height: 140px;
  resize: vertical;
}

.admin-modal-xl {
  min-width: 840px;
  max-width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
}

/* Admin drawer */
.admin-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  transition: opacity 0.2s;
}

.admin-drawer-overlay[hidden] {
  display: none;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: var(--admin-panel);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.admin-drawer[hidden] {
  display: none;
}

.admin-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-drawer-header h3 {
  margin: 0;
}

.admin-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--admin-muted);
  cursor: pointer;
  line-height: 1;
  border-radius: 8px;
}

.admin-drawer-close:hover {
  background: var(--admin-primary-soft);
  color: var(--admin-text);
}

.admin-drawer-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}

.admin-drawer-body .risk-row {
  margin-bottom: 12px;
}

.admin-drawer-body .risk-label {
  color: var(--admin-muted);
  font-size: 12px;
}

/* Toast */
.admin-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.admin-toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  animation: admin-toast-in 0.2s ease;
}

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

.admin-toast.success {
  background: var(--admin-ok);
  color: #fff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.admin-toast.warn {
  background: var(--admin-warn);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

.admin-toast.error {
  background: var(--admin-error);
  color: #fff;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35);
}

/* Collapsible filter panel */
.admin-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--admin-panel);
  color: var(--admin-text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.admin-filter-toggle:hover {
  background: var(--admin-panel-hover);
  border-color: #B0B0B8;
}

.admin-filter-toggle .chevron {
  font-size: 10px;
  transition: transform 0.2s;
}

.admin-filter-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.admin-filter-panel {
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.admin-filter-panel.collapsed {
  max-height: 0 !important;
  overflow: hidden;
  margin-top: 0 !important;
}

/* Template collection list - collapsible rows */
.collection-card {
  padding: 0;
  overflow: hidden;
}

.collection-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.collection-row:hover {
  background: var(--admin-panel-hover);
}

.collection-cover {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collection-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collection-cover-placeholder {
  font-size: 12px;
  color: var(--admin-muted);
}

.collection-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.collection-info strong {
  font-size: 15px;
}

.collection-meta {
  font-size: 12px;
  color: var(--admin-muted);
}

.collection-updated {
  font-size: 12px;
  color: var(--admin-muted);
}

.collection-chevron {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--admin-muted);
  transition: transform 0.2s;
}

.collection-row[aria-expanded="true"] .collection-chevron {
  transform: rotate(180deg);
}

.collection-expand-panel {
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 3000px;
}

.collection-expand-panel.collapsed {
  max-height: 0;
}

.collection-expand-inner {
  padding: 0 16px 16px;
  border-top: 1px solid var(--admin-border);
}

.collection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

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

/* Admin section toolbar (templates, etc.) */
.admin-section-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-section-toolbar button:not(.admin-help-icon) {
  padding: 10px 14px;
  font-size: 14px;
}

/* Section without card (模板商城风格) */
.admin-section {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Head with full-width border below */
.head-with-border {
  margin-left: -24px;
  margin-right: -24px;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--admin-border);
}

/* Help icon + tooltip */
.admin-help-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  border-radius: 50%;
  border: 1px solid var(--admin-border);
  background: var(--admin-panel);
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.admin-help-icon:hover {
  color: var(--admin-primary);
  border-color: var(--admin-primary);
  background: var(--admin-primary-soft);
}

.admin-help-tooltip {
  position: fixed;
  z-index: 1100;
  max-width: 320px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--admin-text);
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  line-height: 1.5;
}

.admin-help-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 12px;
  width: 10px;
  height: 10px;
  background: var(--admin-panel);
  border-left: 1px solid var(--admin-border);
  border-top: 1px solid var(--admin-border);
  transform: rotate(45deg);
}

.head-with-help {
  display: flex;
  align-items: center;
  gap: 8px;
}

.head-with-help .admin-help-icon {
  flex-shrink: 0;
}

/* Data tabs (invite list vs coin log) */
.admin-data-tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 4px;
  background: #F0F0F4;
  border-radius: 10px;
}

.admin-data-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--admin-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

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

.admin-data-tab.active {
  background: #fff;
  color: var(--admin-text);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-data-panel {
  display: none;
}

.admin-data-panel.active {
  display: block;
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-border);
  font-size: 13px;
  color: var(--admin-muted);
}

.admin-pagination-btns {
  display: flex;
  gap: 6px;
}

.admin-pagination-btns button {
  padding: 6px 12px;
  font-size: 13px;
}

/* Admin inline filter bar (no labels) - shared by logs, invites, etc. */
.admin-filter-bar {
  margin-top: 12px;
}

.admin-filter-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-filter-input {
  width: 320px;
  min-width: 240px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--admin-text);
  background: var(--admin-panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-filter-input:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-muted);
}

.admin-filter-input::placeholder {
  color: var(--admin-muted);
}

.admin-filter-select {
  min-width: 160px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--admin-text);
  background: var(--admin-panel);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-filter-select:focus {
  outline: none;
  border-color: var(--admin-primary);
}

.admin-filter-actions {
  display: flex;
  gap: 8px;
}

.admin-filter-actions button {
  padding: 10px 14px;
  font-size: 14px;
}

/* Admin compact KPI footer below list - shared */
.admin-kpi-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-border);
  font-size: 12px;
  color: var(--admin-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.admin-kpi-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-kpi-footer strong {
  color: var(--admin-text);
  font-weight: 600;
}

.status-badge.status-running {
  background: rgba(217, 119, 6, 0.12);
  color: var(--admin-warn);
}

.status-badge.status-error {
  background: rgba(220, 38, 38, 0.12);
  color: var(--admin-error);
}

.status-badge.status-warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--admin-warn);
}

.status-badge.status-danger {
  background: rgba(225, 29, 72, 0.12);
  color: var(--admin-error);
}

.table-row-active {
  background: rgba(236, 72, 153, 0.05);
}

.template-collection-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-collection-cell span {
  font-size: 12px;
  color: var(--admin-muted);
}

.template-draft-count-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.admin-section-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-lab-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 8px 24px 0;
  margin-bottom: 16px;
}

.template-lab-toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.compact-field {
  min-width: 220px;
}

.compact-field select {
  min-width: 220px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--admin-text);
}

.section-subtitle {
  margin-top: 6px;
  color: var(--admin-muted);
  font-size: 13px;
}

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

.template-lab-meta-card {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-lab-meta-label {
  color: var(--admin-muted);
  font-size: 12px;
}

.template-lab-copy {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}

.template-lab-copy-label {
  font-size: 12px;
  color: var(--admin-muted);
  margin-bottom: 6px;
}

.template-lab-copy-body {
  margin: 0;
  line-height: 1.6;
  color: var(--admin-text);
}

.template-lab-prompt-block {
  margin: 0;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 12px;
  background: #f8f8fc;
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.template-lab-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.template-lab-panel {
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 20px;
  background: #fff;
}

.template-lab-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.template-lab-panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.template-lab-panel-head p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--admin-muted);
}

.breadcrumb a {
  color: var(--admin-primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--admin-muted);
}

/* Collection detail header + stats row */
.collection-overview {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 20px 24px;
  margin-bottom: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--admin-border);
}

.collection-overview-info {
  flex: 1;
  min-width: 0;
}

.collection-overview-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--admin-text);
}

.collection-overview-desc {
  margin: 0;
  font-size: 14px;
  color: var(--admin-muted);
  line-height: 1.5;
}

.collection-overview-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.collection-overview-status {
  font-size: 14px;
  padding: 6px 14px;
}

.collection-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--admin-border);
}

.collection-actions-bar .button-link,
.collection-actions-bar button {
  padding: 10px 16px;
  font-size: 14px;
}

.collection-detail-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

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

.collection-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--admin-muted);
  background: #F0F0F4;
  border: 1px solid transparent;
}

.collection-stat-pill .collection-stat-value {
  font-weight: 700;
  color: var(--admin-text);
}

.collection-stat-pill.collection-stat-status {
  padding: 4px 10px;
  background: transparent;
}

.collection-stat-pill.collection-stat-status .status-badge {
  margin: 0;
}

/* Legacy collection-stats-inline for backward compat */
.collection-stats-inline {
  margin-top: 6px;
  font-size: 13px;
  color: var(--admin-muted);
}

.collection-stats-inline .status-badge {
  margin-left: 2px;
}

/* Unified template card */
.template-card-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-card-status-row strong {
  flex: 1;
  min-width: 0;
}

/* Draft card detail collapse */
.template-draft-detail-toggle,
.template-draft-copy-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.template-draft-collapse-btn {
  align-self: flex-start;
  font-size: 12px;
}

.template-draft-copy-collapsed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Source template card grid */
.source-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.source-template-card {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  overflow: visible;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 已下架模板样式 */
.source-template-card.template-card-disabled {
  opacity: 0.6;
  background: #f8f8f8;
}

.source-template-card.template-card-disabled .source-template-card-image img {
  filter: grayscale(30%);
}

.source-template-card .source-template-card-image {
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  position: relative;
}

.source-template-card-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fafafc;
}

.source-template-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0) 55%, rgba(17, 24, 39, 0.18) 100%);
  pointer-events: none;
}

.source-template-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.source-template-card-image.is-empty::after {
  display: none;
}

.template-card-thumb-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--admin-muted);
  font-size: 12px;
  background: linear-gradient(135deg, #f7f7fb 0%, #f0f1f7 100%);
}

.template-card-thumb-empty strong {
  color: var(--admin-text);
  font-size: 13px;
}

.source-template-card-body {
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-template-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--admin-muted);
  min-height: 18px;
}

.source-template-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-card-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-card-status-row strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.template-card-status-row .status-badge {
  flex-shrink: 0;
}

.template-card-helper {
  margin: 0;
  font-size: 12px;
  color: var(--admin-muted);
  line-height: 1.5;
  min-height: 18px;
}

.template-card-helper.is-error {
  color: var(--admin-error);
}

.template-card-overlay {
  position: absolute;
  inset: 10px 10px auto 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  pointer-events: none;
}

.template-card-overlay-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.66);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  backdrop-filter: blur(6px);
}

.template-card-overlay-note.error {
  background: rgba(185, 28, 28, 0.86);
}

.template-card-overlay-note.warning {
  background: rgba(180, 83, 9, 0.86);
}

.template-card-spinner {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: template-card-spin 0.8s linear infinite;
}

@keyframes template-card-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Card action bar - compact, consistent style */
.template-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  padding-bottom: 4px;
  border-top: 1px solid var(--admin-border);
}

.template-card-actions .card-action-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-panel);
  color: var(--admin-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.template-card-actions .card-action-btn:hover {
  background: var(--admin-panel-hover);
  border-color: #B0B0B8;
}

.template-card-actions .card-action-btn.primary {
  background: var(--admin-primary);
  color: #fff;
  border-color: transparent;
}

.template-card-actions .card-action-btn.primary:hover {
  background: var(--admin-primary-hover);
}

.template-card-actions .card-action-btn.danger {
  color: var(--admin-error);
  border-color: rgba(225, 29, 72, 0.3);
}

.template-card-actions .card-action-btn.danger:hover {
  background: rgba(225, 29, 72, 0.08);
}

.template-card-actions .card-action-dropdown {
  position: relative;
  display: inline-block;
}

.template-card-actions .card-action-dropdown summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-panel);
  color: var(--admin-text);
  transition: background 0.15s, border-color 0.15s;
}

.template-card-actions .card-action-dropdown summary::-webkit-details-marker {
  display: none;
}

.template-card-actions .card-action-dropdown summary:hover {
  background: var(--admin-panel-hover);
  border-color: #B0B0B8;
}

.template-card-actions .card-action-dropdown[open] summary {
  border-color: var(--admin-primary);
  background: var(--admin-primary-soft);
}

.template-card-actions .card-action-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 100px;
  padding: 4px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.template-card-actions .card-action-dropdown-menu button {
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--admin-text);
}

.template-card-actions .card-action-dropdown-menu button:hover {
  background: var(--admin-primary-soft);
}

.template-card-actions .card-action-dropdown-menu button.approve {
  color: var(--admin-ok);
}

.template-card-actions .card-action-dropdown-menu button.reject,
.template-card-actions .card-action-dropdown-menu button.danger {
  color: var(--admin-error);
}

.template-card-actions .card-action-dropdown-menu button.danger:hover {
  background: rgba(225, 29, 72, 0.12);
}

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

.template-draft-card {
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-draft-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.template-draft-card-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--admin-muted);
}

.template-draft-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.template-draft-image-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-draft-image-slot span {
  font-size: 12px;
  color: var(--admin-muted);
}

.template-draft-image-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-draft-image-slot img,
.template-reference-body img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  background: #fff;
}

.template-draft-image-empty,
.template-reference-image-empty {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px dashed var(--admin-border);
  display: grid;
  place-items: center;
  color: var(--admin-muted);
  font-size: 12px;
  background: #fafafc;
}

.template-draft-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-draft-copy-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-draft-copy-block label {
  color: var(--admin-muted);
  font-size: 12px;
}

.template-draft-copy-block pre {
  margin: 0;
  white-space: pre-wrap;
  border-radius: 12px;
  background: #f8f8fc;
  border: 1px solid var(--admin-border);
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 12px;
  font-family: inherit;
}

.template-draft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Regenerate modal styles */
.regenerate-current-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.regenerate-current-preview label {
  font-size: 13px;
  color: var(--admin-muted);
}

.regenerate-current-preview img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: #f8f8fc;
}

.regenerate-compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 16px 0;
}

.regenerate-compare-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.regenerate-compare-item label {
  font-size: 13px;
  color: var(--admin-muted);
}

.regenerate-compare-item img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  background: #f8f8fc;
}

.regenerate-compare-arrow {
  font-size: 24px;
  color: var(--admin-muted);
}

.regenerate-prompt-preview {
  margin-top: 12px;
}

.regenerate-prompt-preview label {
  display: block;
  font-size: 12px;
  color: var(--admin-muted);
  margin-bottom: 6px;
}

.regenerate-prompt-preview pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8f8fc;
  border: 1px solid var(--admin-border);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
}

.template-image-preview-stage {
  width: 100%;
  max-height: min(72vh, 960px);
  overflow: auto;
  border: 1px solid var(--admin-border);
  border-radius: 18px;
  background: #f8f8fc;
  padding: 12px;
}

.template-image-preview-stage img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #fff;
}

.template-task-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.template-task-error {
  color: var(--admin-error);
  font-size: 12px;
  font-weight: 600;
}

.admin-task-center-sections {
  display: grid;
  gap: 18px;
}

.admin-task-center-section h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

a.button-link[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.template-draft-form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
}

.template-draft-form-head p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.template-draft-form-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.template-draft-form-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

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

.template-reference-item {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
}

.template-reference-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.template-reference-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-reference-copy span {
  color: var(--admin-muted);
  font-size: 12px;
}

@media (max-width: 1080px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-hero,
  .grid.cols-2,
  .grid.cols-3,
  .kpi {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-hero-side {
    justify-items: start;
  }

  .admin-dashboard-quick-actions {
    justify-content: flex-start;
  }

  .admin-dashboard-system-grid,
  .admin-dashboard-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .template-lab-meta-grid,
  .template-lab-copy,
  .template-draft-grid,
  .template-reference-list {
    grid-template-columns: 1fr;
  }

  .template-draft-form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {

  .head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .head-actions {
    flex-wrap: wrap;
  }

  .main {
    padding: 16px;
  }

  .head-with-border {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .kpi {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-dashboard-hero {
    padding: 22px 20px;
  }

  .admin-dashboard-hero-copy h2 {
    font-size: 28px;
  }

  .admin-dashboard-section-head,
  .admin-dashboard-attention-card,
  .admin-dashboard-task-item,
  .admin-dashboard-system-row {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-section-head,
  .admin-dashboard-task-item,
  .admin-dashboard-system-row {
    display: grid;
  }

  .admin-dashboard-attention-side,
  .admin-dashboard-task-item .button-link {
    justify-items: start;
  }

  .admin-dashboard-trend-chart {
    gap: 8px;
  }

  .admin-dashboard-trend-bar {
    width: 30px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 640px;
  }

  th:first-child {
    position: sticky;
    left: 0;
    background: #F8F8FA;
    z-index: 2;
  }

  td:first-child {
    position: sticky;
    left: 0;
    background: var(--admin-panel);
    z-index: 1;
  }

  tbody tr:hover td:first-child {
    background: #FAFAFC;
  }

  .admin-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .template-lab-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .template-lab-toolbar-actions {
    width: 100%;
  }

  .compact-field,
  .compact-field select {
    min-width: 0;
    width: 100%;
  }

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

  .template-draft-image-pair {
    grid-template-columns: 1fr;
  }
}

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

  .admin-dashboard-trend-chart {
    min-height: 220px;
    gap: 6px;
  }

  .admin-dashboard-trend-total,
  .admin-dashboard-trend-rate,
  .admin-dashboard-trend-label {
    font-size: 11px;
  }
}
