/* 白底高级感 · 管理后台 / 代理中心 */
:root {
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --card-foreground: #1a1a1a;
  --muted: #f5f5f3;
  --muted-foreground: #737373;
  --border: rgba(0, 0, 0, 0.06);
  --input: #e8e8e6;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --ring: #171717;
  --radius: 0.75rem;
  --sidebar-w: 15.5rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body.admin-body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--foreground);
  background: #f7f7f5;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 侧边栏 ========== */
.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--background);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 20;
}

.admin-sidebar .logo {
  height: 3.5rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-bottom: 1px solid var(--border);
}

.admin-sidebar .logo-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 10px;
  background: linear-gradient(145deg, #1a1a1a 0%, #404040 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.admin-sidebar .logo-text {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.admin-sidebar .logo-sub {
  display: block;
  font-size: 11px;
  color: var(--muted-foreground);
  font-weight: 400;
}

.admin-sidebar nav {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
}

.nav-group-label {
  padding: 0.75rem 0.75rem 0.375rem;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
  letter-spacing: 0.02em;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-sidebar nav a svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  opacity: 0.7;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-sidebar nav a:hover {
  background: var(--muted);
}

.admin-sidebar nav a.active {
  background: var(--muted);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}

.admin-sidebar nav a.active svg { opacity: 1; }

.admin-sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted-foreground);
}

/* ========== 主区域 ========== */
.admin-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.admin-header {
  height: 3.75rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--muted-foreground);
}

.admin-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.btn-logout {
  padding: 0.375rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.btn-logout:hover { background: var(--muted); }

.admin-content {
  padding: 1.75rem;
  flex: 1;
  max-width: 1400px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 0.375rem;
}

.stat-card strong {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

/* ========== 工具栏 & 按钮 ========== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn, .toolbar .btn, .form-inline .btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.btn:hover:not(.btn-ghost):not(.btn-outline):not(.btn-accent):not(.btn-danger):not(.btn-warn):not(.btn-teal) {
  opacity: 0.92;
}

/* 变体需高于 button.btn，否则 <button class="btn btn-ghost"> 会继承 primary 黑底白字 */
.btn.btn-ghost,
button.btn.btn-ghost,
a.btn.btn-ghost,
.toolbar .btn.btn-ghost {
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.btn-ghost:hover,
button.btn.btn-ghost:hover,
a.btn.btn-ghost:hover,
.toolbar .btn.btn-ghost:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--border);
  opacity: 1;
}

.btn.btn-ghost.active,
button.btn.btn-ghost.active,
a.btn.btn-ghost.active,
.toolbar .btn.btn-ghost.active {
  background: var(--muted);
  color: var(--foreground);
  border-color: hsl(221 83% 53% / 0.35);
}

.btn.btn-accent,
button.btn.btn-accent,
a.btn.btn-accent {
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.btn.btn-accent:hover,
button.btn.btn-accent:hover,
a.btn.btn-accent:hover {
  background: #2a2a2a;
  color: #fff;
  opacity: 1;
}

.btn.btn-danger,
button.btn.btn-danger,
a.btn.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border: none;
}

.btn.btn-danger:hover,
button.btn.btn-danger:hover,
a.btn.btn-danger:hover {
  background: hsl(0 72% 46%);
  color: #fff;
  opacity: 1;
}

.btn.btn-outline,
button.btn.btn-outline,
a.btn.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn.btn-outline:hover,
button.btn.btn-outline:hover,
a.btn.btn-outline:hover {
  background: var(--muted);
  color: var(--foreground);
  opacity: 1;
}

.btn.btn-warn,
button.btn.btn-warn,
a.btn.btn-warn {
  background: hsl(25 95% 53%);
  color: #fff;
  border: none;
}

.btn.btn-warn:hover,
button.btn.btn-warn:hover,
a.btn.btn-warn:hover {
  background: hsl(25 95% 48%);
  color: #fff;
  opacity: 1;
}

.btn.btn-teal,
button.btn.btn-teal,
a.btn.btn-teal {
  background: hsl(199 89% 48%);
  color: #fff;
  border: none;
}

.btn.btn-teal:hover,
button.btn.btn-teal:hover,
a.btn.btn-teal:hover {
  background: hsl(199 89% 42%);
  color: #fff;
  opacity: 1;
}

.btn-sm { height: 1.875rem; padding: 0 0.625rem; font-size: 12px; }

/* 表格内按钮不受链接色影响 */
.data-table a.btn {
  margin-right: 0;
  font-weight: 500;
}

.data-table a.btn:hover {
  color: inherit;
}

/* ========== 卡片 & 表格 ========== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.card-body { padding: 0; }

.card-flush .card-body {
  padding: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  height: 2.5rem;
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 12px;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: hsl(240 4.8% 97%); }

.data-table a {
  color: hsl(221 83% 45%);
  text-decoration: none;
  font-weight: 500;
  margin-right: 0.75rem;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.data-table a:hover {
  color: hsl(221 83% 38%);
  opacity: 1;
}

.data-table input[readonly] {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 4px);
  background: var(--muted);
  font-size: 12px;
  color: var(--foreground);
}

.data-table code {
  font-size: 12px;
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

/* ========== 空态 ========== */
.ui-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.ui-state-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--muted-foreground);
}

.ui-state-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.ui-state-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.ui-state-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  max-width: 24rem;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

.ui-state-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* ========== 提示 ========== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 1rem;
  font-size: 13px;
  border: 1px solid var(--border);
}

.alert-error {
  background: hsl(0 86% 97%);
  color: hsl(0 72% 38%);
  border-color: hsl(0 86% 90%);
}

.alert-success {
  background: hsl(142 76% 96%);
  color: hsl(142 72% 29%);
  border-color: hsl(142 76% 88%);
}

.alert a { font-weight: 600; color: inherit; }

/* ========== 表单 ========== */
.form-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.form-inline label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--muted-foreground);
}

.form-inline input,
.form-inline select {
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-family: inherit;
  background: var(--background);
}

.form-inline input:focus,
.form-inline select:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

/* 区块标题 + 查看全部 */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 1.5rem 0 0.75rem;
}

.section-header-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.section-header-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, hsl(221 83% 53%), hsl(221 83% 45%));
  flex-shrink: 0;
}

.section-more-link {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.section-more-link::after {
  content: "→";
  font-size: 12px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.section-more-link:hover {
  color: hsl(221 83% 45%);
  background: var(--accent-soft);
  border-color: hsl(221 83% 90%);
}

.section-more-link:hover::after {
  transform: translateX(2px);
}

.section-header--tight {
  margin-top: 1.25rem;
}

.section-header--page {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.section-header--page .section-header-title {
  font-size: 1.125rem;
}

.section-header--sub {
  margin-top: 1.25rem;
}

.card-desc--tight {
  margin-top: -0.375rem;
  margin-bottom: 1rem;
}

.hint--tight {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.info-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: hsl(214 95% 97%);
  border: 1px solid hsl(214 80% 90%);
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  color: hsl(221 45% 28%);
  line-height: 1.65;
}

.info-tip strong {
  color: hsl(221 83% 40%);
}

.table-scroll {
  overflow-x: auto;
}

.table-action-link {
  color: hsl(221 83% 45%);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.table-action-link:hover {
  color: hsl(221 83% 38%);
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 8px;
}

.actions-cell {
  white-space: nowrap;
}

.code-sm {
  font-size: 11px;
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
}

.text-link {
  color: hsl(221 83% 45%);
  text-decoration: none;
  font-weight: 500;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-inline--plain {
  margin: 0;
  border: none;
  padding: 0;
  background: none;
}

.form-inline--wrap {
  flex-wrap: wrap;
}

.input-narrow {
  width: 100px;
}

.input-grow {
  min-width: 160px;
  flex: 1;
}

.filter-panel--inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.filter-input-grow {
  flex: 1;
  max-width: 240px;
  height: 2.25rem;
  padding: 0 0.625rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-family: inherit;
  background: var(--background);
}

.toolbar--wrap {
  margin: 0;
  flex-wrap: wrap;
}

.config-card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 0.75rem;
  padding-left: 10px;
  border-left: 2px solid hsl(221 83% 53%);
  letter-spacing: -0.01em;
}

.config-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted-foreground);
}

.config-card-desc a {
  color: hsl(221 83% 53%);
  text-decoration: none;
}

.config-card-desc a:hover { text-decoration: underline; }

.config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.75rem;
}

.config-card-head .config-card-title {
  margin-bottom: 0;
}

.card-form {
  max-width: 560px;
}

.card-form-body {
  padding: 1.25rem;
}

.stat-grid--mb {
  margin-bottom: 1.25rem;
}

.config-card--mb {
  margin-bottom: 1rem;
}

.card--mb {
  margin-bottom: 1.25rem;
}

.card-body-padded {
  padding: 1.25rem;
}

.btn-mt {
  margin-top: 1rem;
}

.toolbar--mt {
  margin-top: 1.25rem;
}

.form-field--mb {
  margin-bottom: 1rem;
}

.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: 1rem;
}

.filter-panel.is-hidden {
  display: none;
}

.filter-panel.is-visible {
  display: block;
}

.filter-panel.is-visible.is-animated-in {
  animation: panelSlideIn 0.38s var(--ease-out-expo);
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.filter-panel.is-focused {
  box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.12);
  border-color: hsl(221 83% 53% / 0.25);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.text-muted {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
}

.col-w-180 {
  width: 180px;
}

.col-w-200 {
  width: 200px;
  min-width: 160px;
}

.badge-danger {
  background: hsl(0 93% 97%);
  color: hsl(0 72% 42%);
  border-color: hsl(0 93% 90%);
}

.order-fail-reason {
  max-width: 240px;
}

.order-fail-reason-text {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: hsl(0 72% 42%);
  word-break: break-word;
}

html[data-theme="dark"] .info-tip {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.22);
  color: #cbd5e1;
}

html[data-theme="dark"] .info-tip strong {
  color: #93c5fd;
}

html[data-theme="dark"] .text-link,
html[data-theme="dark"] .table-action-link {
  color: #93c5fd;
}

.card-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.65;
  margin: 0 0 1rem;
}

/* 公告列表（工作台等） */
.announce-list {
  display: flex;
  flex-direction: column;
}

.announce-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.875rem 1.125rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.announce-item:last-child {
  border-bottom: none;
}

.announce-item:hover {
  background: hsl(221 83% 53% / 0.04);
}

.announce-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.announce-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announce-item:hover .announce-item-title {
  color: hsl(221 83% 45%);
}

.announce-item-time {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.stat-card strong.stat-value-text {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0;
}

.hint {
  margin-top: 1rem;
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.hint code {
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
}

.badge-success {
  background: hsl(142 76% 96%);
  color: hsl(142 72% 29%);
  border-color: hsl(142 76% 88%);
}

.badge-muted {
  background: var(--muted);
  color: var(--muted-foreground);
}

.badge-warning {
  background: hsl(48 96% 95%);
  color: hsl(32 95% 35%);
  border-color: hsl(48 96% 88%);
}

/* ========== 顶部加载条 ========== */
.admin-topbar-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  background: var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.admin-topbar-loader.is-visible { opacity: 1; }

.admin-topbar-loader::after {
  content: "";
  display: block;
  height: 100%;
  width: 30%;
  background: var(--primary);
  animation: topbarSlide 0.8s ease-in-out infinite;
}

@keyframes topbarSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(240 4.8% 95.9%);
  padding: 1.5rem;
  font-family: var(--font);
}

.login-wrap {
  width: 100%;
  max-width: 24rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0.375rem 0 0;
  font-size: 13px;
  color: var(--muted-foreground);
}

.login-box {
  background: var(--background);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-box label {
  display: block;
  margin-bottom: 1rem;
  font-size: 13px;
  font-weight: 500;
}

.login-box input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  margin-top: 0.375rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  font-family: inherit;
  background: var(--background);
}

.login-box input:focus {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.login-box button[type="submit"] {
  width: 100%;
  height: 2.5rem;
  margin-top: 0.25rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.login-box button[type="submit"]:hover { opacity: 0.9; }

.login-hint {
  text-align: center;
  margin-top: 1rem;
  font-size: 12px;
  color: var(--muted-foreground);
}

@media (max-width: 768px) {
  body.admin-body {
    flex-direction: row;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .admin-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .admin-content { padding: 1rem; }
  .admin-header { padding: 0 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-topbar-loader::after { animation: none; width: 100%; }
}

/* ========== 参考竞品后台扩展 ========== */
.page-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-left: 10px;
  border-left: 3px solid hsl(221 83% 53%);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.filter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  height: 2.25rem;
  padding: 0 0.625rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-family: inherit;
  background: var(--background);
}

.filter-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* btn-accent/warn/teal 主定义见上方 .btn.btn-accent 等 */

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-grid-7 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-mini {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-mini .label {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.stat-mini .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-mini.highlight {
  background: #fafafa;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-md);
}

.stat-mini.highlight .value {
  color: var(--foreground);
}

.product-thumb-cell {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  overflow: hidden;
}

.product-thumb-cell img { width: 100%; height: 100%; object-fit: cover; }

.product-thumb-fallback {
  font-size: 11px;
  color: var(--muted-foreground);
}

.commission-inline-form {
  min-width: 140px;
}

.commission-inline-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.commission-inline-row input[type="number"] {
  width: 72px;
  padding: 4px 6px;
  font-size: 13px;
}

.commission-unit {
  font-size: 12px;
  color: var(--muted-foreground);
}

.commission-reset-btn {
  margin-top: 4px;
  padding: 0;
  font-size: 12px;
}

.product-info-cell .name { font-weight: 600; color: hsl(221 83% 53%); text-decoration: none; }
.product-info-cell .meta { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; line-height: 1.5; }

.amount-red { color: hsl(0 72% 51%); font-weight: 600; }

.tag-settle {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: hsl(199 89% 94%);
  color: hsl(199 89% 38%);
  margin-top: 4px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.28s var(--ease-out-expo), border-color 0.28s ease;
  border: 1px solid var(--border);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.32s var(--ease-spring), box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.toggle-switch input:checked + .toggle-slider { background: hsl(221 83% 53%); border-color: hsl(221 83% 53%); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); box-shadow: 0 2px 6px hsl(221 83% 53% / 0.35); }
.toggle-switch input:focus-visible + .toggle-slider { box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.2); }

.toggle-label { font-size: 12px; color: var(--muted-foreground); margin-top: 4px; }

.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tabs-bar a, .tabs-bar button {
  padding: 0.625rem 1.125rem;
  font-size: 14px;
  font-family: inherit;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  text-decoration: none;
  margin-bottom: -1px;
}

.tabs-bar a.active, .tabs-bar button.active {
  color: hsl(221 83% 53%);
  border-bottom-color: hsl(221 83% 53%);
  font-weight: 600;
}

.config-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) { .config-grid-2 { grid-template-columns: 1fr; } }

.config-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.config-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-left: 10px;
  border-left: 2px solid #171717;
  letter-spacing: -0.01em;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-field label {
  display: block;
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}

.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-family: inherit;
  background: var(--muted);
}

.info-banner {
  background: linear-gradient(90deg, hsl(214 95% 97%), hsl(214 95% 99%));
  border: 1px solid hsl(214 80% 90%);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
  font-size: 13px;
  color: hsl(221 50% 30%);
  line-height: 1.7;
}

.info-banner ol { margin: 0; padding-left: 1.25rem; }

.chart-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 1rem;
}

.chart-bar-wrap { flex: 1; text-align: center; min-width: 0; }
.chart-bar {
  background: hsl(221 83% 53%);
  border-radius: 4px 4px 0 0;
  margin: 0 auto;
  max-width: 32px;
  min-height: 2px;
  opacity: 0.85;
}
.chart-bar-wrap span { display: block; font-size: 10px; color: var(--muted-foreground); margin-top: 6px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 0;
  font-size: 13px;
  color: var(--muted-foreground);
}

.pagination a, .pagination span {
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
}

.pagination a.active { background: hsl(221 83% 53%); color: #fff; border-color: hsl(221 83% 53%); }

/* Element 风格分页条 */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 4px;
  font-size: 13px;
  color: var(--muted-foreground);
}

.pagination-total { white-space: nowrap; }

.pagination-sizes select {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--input);
  border-radius: 4px;
  background: var(--background);
  color: var(--foreground);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23737373' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.pagination-sizes select:focus {
  outline: none;
  border-color: hsl(221 83% 53%);
  box-shadow: 0 0 0 2px hsl(221 83% 53% / 0.15);
}

.pagination-pager {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager-btn,
.pager-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--input);
  border-radius: 4px;
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}

.pager-btn:hover,
.pager-num:hover {
  color: hsl(221 83% 53%);
  border-color: hsl(221 83% 53%);
}

.pager-num.is-active {
  background: hsl(221 83% 53%);
  border-color: hsl(221 83% 53%);
  color: #fff;
  font-weight: 500;
}

.pager-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 32px;
  letter-spacing: 1px;
}

.pagination-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pagination-jump input {
  width: 48px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--input);
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
  color: var(--foreground);
  background: var(--background);
}

.pagination-jump input:focus {
  outline: none;
  border-color: hsl(221 83% 53%);
  box-shadow: 0 0 0 2px hsl(221 83% 53% / 0.15);
}

.product-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.product-spec-table th,
.product-spec-table td {
  border: 1px solid var(--input);
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
  line-height: 1.6;
}

.product-spec-table th {
  width: 108px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 500;
  white-space: nowrap;
}

.product-spec-table td {
  color: var(--foreground);
  word-break: break-word;
}

.product-spec-html {
  font-size: 13px;
  line-height: 1.65;
  color: var(--foreground);
}

.product-spec-html img {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--radius) - 4px);
}

.product-spec-image-wrap {
  text-align: center;
  background: var(--muted);
  border-radius: var(--radius);
  padding: 8px;
}

.product-spec-image-wrap img {
  max-width: 100%;
  max-height: 420px;
  border-radius: calc(var(--radius) - 4px);
}

.product-detail-modal .admin-modal-body {
  max-height: min(72vh, 720px);
  overflow-y: auto;
}

.product-thumb-cell img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: var(--muted);
}

.upload-preview {
  width: 80px;
  height: 80px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted-foreground);
  overflow: hidden;
  margin-top: 8px;
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview.wide { width: 200px; height: 80px; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.link-actions a { margin-right: 0.75rem; white-space: nowrap; }

.product-row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 88px;
}

.product-row-actions .btn {
  justify-content: center;
  text-decoration: none;
}

.monthly-fee-cell {
  white-space: nowrap;
  font-weight: 600;
}

.product-list-table .package-detail-btn {
  white-space: nowrap;
}

@media (min-width: 1280px) {
  .product-row-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
  }
}

/* ========== 根域名登录 / 注册页 ========== */
.portal-login-page {
  min-height: 100vh;
  margin: 0;
  background: #eef1f5;
  font-family: var(--font);
  color: #1f2937;
  position: relative;
  overflow-x: hidden;
}

.portal-login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(29, 78, 216, 0.06), transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 80%, rgba(99, 102, 241, 0.05), transparent 50%);
  z-index: 0;
}

.portal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.portal-layout {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(40px, 7vw, 80px);
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.portal-layout--wide {
  max-width: 980px;
}

.portal-aside {
  flex: 1;
  max-width: 400px;
}

.portal-aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.portal-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.28);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.portal-login-page.page-ready .portal-mark {
  transform: scale(1);
}

.portal-aside-name {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  letter-spacing: -0.01em;
}

.portal-aside-title {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.2vw, 32px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.03em;
  color: #111827;
}

.portal-aside-desc {
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.75;
  color: #6b7280;
}

.portal-features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-features li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.65;
  color: #4b5563;
}

.portal-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1d4ed8;
  opacity: 0.35;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-login-page.page-ready .portal-features li::before {
  opacity: 1;
}

.portal-features li:hover::before {
  transform: scale(1.2);
}

.portal-aside-link a,
.portal-auth-link {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.portal-aside-link a:hover,
.portal-auth-link:hover {
  color: #1e40af;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-auth-link {
  border: none;
  background: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
}

.portal-auth-panel.is-switching {
  animation: portalAuthSwap 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes portalAuthSwap {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: none; }
}

.portal-aside-link {
  margin: 32px 0 0;
  font-size: 13px;
}

.portal-card {
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 32px 28px 28px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 28px rgba(15, 23, 42, 0.07);
  transition:
    box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s ease;
}

.portal-card:focus-within {
  border-color: rgba(29, 78, 216, 0.15);
  box-shadow:
    0 4px 16px rgba(29, 78, 216, 0.08),
    0 16px 40px rgba(15, 23, 42, 0.1);
}

.portal-card--wide {
  max-width: 440px;
}

.portal-card-title {
  margin: 0 0 22px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #111827;
}

.portal-tabs {
  position: relative;
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-bottom: 1px solid #e5e7eb;
}

.portal-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  width: 0;
  background: #1d4ed8;
  border-radius: 2px 2px 0 0;
  transition:
    left 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.portal-tabs a,
.portal-tab-btn {
  flex: 1;
  text-align: center;
  padding: 0 8px 12px;
  margin-bottom: -1px;
  text-decoration: none;
  font-size: 14px;
  color: #6b7280;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.25s ease;
}

.portal-tabs a:hover,
.portal-tab-btn:hover {
  color: #374151;
}

.portal-tabs a.is-active,
.portal-tab-btn.is-active {
  color: #1d4ed8;
  font-weight: 500;
}

.portal-field.is-switching {
  animation: portalFieldSwap 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes portalFieldSwap {
  0% { opacity: 1; transform: translateY(0); }
  45% { opacity: 0.45; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.portal-input-wrap--count input {
  padding-right: 52px;
}

.portal-char-count {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #9ca3af;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.portal-field.is-filled .portal-char-count {
  color: #6b7280;
}

.portal-sms-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.portal-sms-input {
  flex: 1;
  min-width: 0;
}

.portal-sms-btn {
  flex-shrink: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  background: #fff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease;
}

.portal-sms-btn:hover:not(:disabled) {
  background: #eff6ff;
}

.portal-sms-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: #d1d5db;
  color: #9ca3af;
  background: #f9fafb;
}

.portal-login-mode {
  transition: opacity 0.28s ease;
}

.portal-login-mode[hidden] {
  display: none;
}

.portal-alert {
  margin-bottom: 18px;
}

.portal-shake {
  animation: portalShake 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes portalShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-6px); }
  36% { transform: translateX(5px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
}

.portal-form {
  display: block;
}

.portal-field {
  margin-bottom: 18px;
}

.portal-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  transition: color 0.25s ease;
}

.portal-field.is-focused label,
.portal-field.is-filled label {
  color: #1d4ed8;
}

.portal-optional {
  font-weight: 400;
  color: #9ca3af;
}

.portal-input-wrap {
  position: relative;
}

.portal-field input:not([type="checkbox"]) {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fafafa;
  color: #111827;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-field input[type="password"],
.portal-field input[type="text"][id*="pass"] {
  padding-right: 44px;
}

.portal-field input::placeholder {
  color: #9ca3af;
  transition: opacity 0.2s ease;
}

.portal-field.is-focused input::placeholder {
  opacity: 0.65;
}

.portal-field.is-focused input:not([type="checkbox"]) {
  background: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
  transform: translateY(-1px);
}

.portal-pwd-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.portal-pwd-toggle:hover {
  color: #6b7280;
  background: rgba(0, 0, 0, 0.04);
}

.portal-pwd-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-pwd-toggle .icon-eye-off {
  display: none;
}

.portal-pwd-toggle.is-visible .icon-eye {
  display: none;
}

.portal-pwd-toggle.is-visible .icon-eye-off {
  display: block;
}

.portal-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.portal-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}

.portal-check-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.portal-check-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-check-box::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-check-input:checked + .portal-check-box {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.portal-check-input:checked + .portal-check-box::after {
  transform: rotate(45deg) scale(1);
}

.portal-check-input:focus-visible + .portal-check-box {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.2);
}

.portal-check:hover .portal-check-box {
  border-color: #93c5fd;
}

.portal-submit {
  position: relative;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  overflow: hidden;
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease,
    opacity 0.2s ease;
}

.portal-submit:hover {
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.38);
  transform: translateY(-1px);
}

.portal-submit:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.portal-submit.is-loading {
  pointer-events: none;
  opacity: 0.92;
}

.portal-submit-text {
  transition: opacity 0.2s ease;
}

.portal-submit.is-loading .portal-submit-text {
  opacity: 0;
}

.portal-submit-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.65s linear infinite;
}

.portal-submit.is-loading .portal-submit-spinner {
  opacity: 1;
}

.portal-card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #f3f4f6;
  font-size: 13px;
  color: #6b7280;
}

.portal-card-foot a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.portal-card-foot a:hover {
  color: #1e40af;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-page-foot {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  padding: 20px 24px 28px;
}

/* 登录页 · 分层入场 */
.portal-reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--portal-i, 0) * 70ms + 80ms);
}

.portal-login-page.page-ready .portal-reveal-item {
  opacity: 1;
  transform: none;
}

.portal-card.portal-reveal-item {
  transform: translateY(22px) scale(0.98);
  transition-delay: calc(var(--portal-i, 0) * 70ms + 120ms);
}

.portal-login-page.page-ready .portal-card.portal-reveal-item {
  transform: none;
}

@media (max-width: 768px) {
  .portal-layout {
    flex-direction: column;
    align-items: stretch;
    padding: 28px 16px 20px;
    gap: 28px;
  }

  .portal-aside {
    max-width: none;
    text-align: center;
  }

  .portal-aside-brand {
    justify-content: center;
    margin-bottom: 18px;
  }

  .portal-aside-title {
    font-size: 24px;
  }

  .portal-features {
    display: none;
  }

  .portal-aside-link {
    margin-top: 18px;
  }

  .portal-card,
  .portal-card--wide {
    max-width: none;
    padding: 28px 20px 24px;
  }

  .portal-field-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-reveal-item,
  .portal-shake {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .portal-field.is-focused input:not([type="checkbox"]) {
    transform: none;
  }

  .portal-submit:hover {
    transform: none;
  }
}

/* 后台弹窗 */
.admin-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s var(--ease-out-expo);
}

.admin-modal-mask.is-open,
.admin-modal-mask.is-leaving {
  display: flex;
}

.admin-modal-mask.is-open {
  opacity: 1;
}

.admin-modal-mask.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.admin-modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: scale(0.92) translateY(18px);
  opacity: 0;
  transition:
    transform 0.34s var(--ease-spring),
    opacity 0.28s var(--ease-out-expo);
}

.admin-modal-mask.is-open .admin-modal {
  transform: none;
  opacity: 1;
}

.admin-modal-mask.is-leaving .admin-modal {
  transform: scale(0.96) translateY(10px);
  opacity: 0;
}

.admin-modal-wide {
  max-width: 720px;
}

.admin-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.admin-modal-close {
  flex-shrink: 0;
  border: none;
  background: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-spring),
    background 0.2s ease,
    color 0.2s ease;
}

.admin-modal-close:hover {
  color: var(--foreground);
  background: hsl(240 4.8% 92%);
  transform: rotate(90deg);
}

.admin-modal-meta {
  padding: 0 1.25rem 0.75rem;
  font-size: 12px;
  color: var(--muted-foreground);
}

.admin-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
  font-size: 14px;
  line-height: 1.65;
  color: var(--foreground);
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-modal-foot {
  padding: 0 1.25rem 1.25rem;
  text-align: right;
}

.data-table tbody tr.is-clickable { cursor: pointer; transition: background 0.15s ease; }
.data-table tbody tr.is-clickable:hover td { background: var(--muted); }
.data-table tbody tr.is-clickable:active td { background: hsl(221 83% 53% / 0.1); }
.data-table tbody tr.is-clickable td:first-child { color: var(--foreground); }

/* ========== UI 深度优化 · 动画与细节 ========== */

:root {
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --surface-gradient: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.06), transparent 70%);
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.admin-body {
  background: #f7f7f5;
  background-image: var(--surface-gradient);
}

body.admin-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(37, 99, 235, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 45%);
}

.admin-sidebar,
.admin-main {
  position: relative;
  z-index: 1;
}

/* 侧边栏 · 激活指示条 */
.admin-sidebar nav a {
  position: relative;
  overflow: hidden;
  transition: background 0.2s var(--ease-out-expo), color 0.2s ease, transform 0.15s ease;
}

.admin-sidebar nav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--accent-gradient);
  transition: transform 0.25s var(--ease-spring);
}

.admin-sidebar nav a.active::before {
  transform: translateY(-50%) scaleY(1);
}

.admin-sidebar nav a.active {
  background: var(--accent-soft);
  color: hsl(221 83% 40%);
  box-shadow: none;
}

.admin-sidebar nav a:hover {
  transform: translateX(2px);
}

.admin-sidebar .logo-mark {
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}

.admin-sidebar .logo:hover .logo-mark {
  transform: scale(1.05) rotate(-2deg);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.25);
}

/* 顶栏 */
.admin-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.admin-header-left h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  cursor: pointer;
  transition: background 0.15s ease;
}

.admin-menu-toggle span {
  display: block;
  width: 14px;
  height: 2px;
  margin: 0 auto;
  background: var(--foreground);
  border-radius: 1px;
  transition: transform 0.25s var(--ease-out-expo), opacity 0.2s ease;
}

body.sidebar-open .admin-menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.sidebar-open .admin-menu-toggle span:nth-child(2) {
  opacity: 0;
}

body.sidebar-open .admin-menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.admin-sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-out-expo), visibility 0.28s;
}

body.sidebar-open .admin-sidebar-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.admin-avatar {
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
}

.admin-user:hover .admin-avatar {
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 页面入场 */
.reveal-item {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s var(--ease-out-expo),
    transform 0.5s var(--ease-out-expo);
  transition-delay: calc(var(--reveal-i, 0) * 48ms);
}

body.page-ready .reveal-item {
  opacity: 1;
  transform: none;
}

/* 统计卡片增强 */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  transition: background 0.3s ease;
}

.stat-card-accent::after { background: var(--accent-gradient); }
.stat-card-money::after { background: linear-gradient(90deg, #16a34a, #22c55e); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card strong,
.stat-mini .value {
  font-variant-numeric: tabular-nums;
}

.stat-card-text strong,
.stat-value-text {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-card strong,
.stat-mini .value {
  transition: color 0.2s ease;
}

.stat-mini {
  transition: box-shadow 0.2s ease, transform 0.2s var(--ease-out-expo), border-color 0.2s ease;
}

.stat-mini:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-mini-money .value {
  color: hsl(142 72% 29%);
}

.stat-mini.highlight {
  background: linear-gradient(135deg, #fafafa 0%, #f0f7ff 100%);
  border-color: hsl(214 80% 90%);
}

/* 按钮微交互 */
.btn, .toolbar .btn, button.btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.15s var(--ease-out-expo),
    box-shadow 0.2s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover:not(.btn-ghost):not(.btn-outline):not(.btn-accent):not(.btn-danger):not(.btn-warn):not(.btn-teal) {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn.btn-ghost:hover,
button.btn.btn-ghost:hover,
a.btn.btn-ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  color: var(--foreground);
}

.btn.btn-accent:hover,
button.btn.btn-accent:hover,
a.btn.btn-accent:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn.is-success {
  animation: btnPulse 0.5s var(--ease-out-expo);
}

@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 卡片 */
.card, .config-card, .filter-panel {
  transition: box-shadow 0.25s ease, transform 0.25s var(--ease-out-expo);
}

.card:hover, .config-card:hover {
  box-shadow: var(--shadow-md);
}

.config-card h3 {
  border-left-color: hsl(221 83% 53%);
}

/* 表格 */
.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr {
  animation: rowFadeIn 0.35s var(--ease-out-expo) backwards;
  animation-delay: calc(var(--row-i, 0) * 25ms);
}

@keyframes rowFadeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: none; }
}

/* 提示条 */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  animation: alertIn 0.4s var(--ease-out-expo);
}

.alert.is-leaving {
  animation: alertOut 0.32s var(--ease-out-expo) forwards;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes alertOut {
  to { opacity: 0; transform: translateY(-6px); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

.alert-danger, .alert-error {
  background: hsl(0 86% 97%);
  color: hsl(0 72% 38%);
  border-color: hsl(0 86% 90%);
}

.alert-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
}

.alert-success .alert-icon {
  background: hsl(142 76% 88%);
  color: hsl(142 72% 29%);
}

.alert-danger .alert-icon, .alert-error .alert-icon {
  background: hsl(0 86% 90%);
}

.alert-body { flex: 1; min-width: 0; }

.alert-close {
  flex-shrink: 0;
  border: none;
  background: none;
  padding: 0 0 0 8px;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.alert-close:hover { opacity: 1; }

/* 复制行 & Toast */
.copy-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.copy-label + .copy-row,
.copy-row + .copy-label {
  margin-top: 1rem;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.copy-row-inline {
  margin-bottom: 0;
}

.copy-input {
  flex: 1 1 200px;
  min-width: 0;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  font-size: 12px;
  background: var(--muted);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: text;
}

.copy-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.copy-row .btn-copy {
  min-width: 4.5rem;
}

.copy-row .btn-copy.is-copied {
  background: hsl(142 72% 36%);
  color: #fff;
  border-color: hsl(142 72% 36%);
}

.copy-row .btn-sm {
  height: 2.25rem;
  padding: 0 0.875rem;
}

.copy-input:focus {
  outline: none;
  border-color: hsl(221 83% 53%);
  box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.12);
}

.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.35s var(--ease-spring);
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 空态动画 */
.ui-state-animated .ui-state-icon {
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.ui-state-animated {
  animation: alertIn 0.5s var(--ease-out-expo);
}

/* 弹窗（与上方 .admin-modal-mask 定义合并，此处仅保留 body 锁定） */
body.modal-open { overflow: hidden; }

/* 按钮涟漪 */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  transform: scale(0);
  animation: btnRipple 0.55s var(--ease-out-expo) forwards;
  pointer-events: none;
}

.btn.btn-ghost .btn-ripple,
.btn.btn-outline .btn-ripple {
  background: rgba(0, 0, 0, 0.08);
}

@keyframes btnRipple {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

.admin-modal-close:active {
  transform: scale(0.92);
}

/* 分页 hover */
.pager-btn, .pager-num {
  transition: transform 0.15s var(--ease-out-expo), border-color 0.15s ease, background 0.15s ease;
}

.pager-num:hover, .pager-btn:not(.is-disabled):hover {
  transform: translateY(-1px);
}

.pager-num.is-active {
  box-shadow: 0 4px 12px hsl(221 83% 53% / 0.3);
}

/* 滚动条 */
.admin-sidebar nav::-webkit-scrollbar,
.admin-modal-body::-webkit-scrollbar,
.admin-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.admin-sidebar nav::-webkit-scrollbar-thumb,
.admin-modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

@media (max-width: 768px) {
  .admin-menu-toggle { display: flex; }

  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.32s var(--ease-out-expo);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .reveal-item {
    transition-delay: calc(var(--reveal-i, 0) * 30ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-item,
  .admin-modal,
  .alert,
  .data-table tbody tr,
  .ui-state-animated .ui-state-icon {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body.page-ready .reveal-item {
    opacity: 1;
    transform: none;
  }
}

/* ========== 暗色模式 ========== */
html[data-theme="dark"] {
  color-scheme: dark;
  --background: #161616;
  --foreground: #ededed;
  --card: #1c1c1c;
  --card-foreground: #ededed;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --border: rgba(255, 255, 255, 0.08);
  --input: #333333;
  --primary: #ededed;
  --primary-foreground: #161616;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --destructive: #f87171;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  --surface-gradient: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(96, 165, 250, 0.08), transparent 70%);
}

html[data-theme="dark"] body.admin-body {
  background: #121212;
  background-image: var(--surface-gradient);
}

html[data-theme="dark"] .admin-sidebar nav a.active {
  background: var(--accent-soft);
  color: #93c5fd;
}

html[data-theme="dark"] .admin-header {
  background: rgba(22, 22, 22, 0.9);
}

html[data-theme="dark"] .data-table th {
  background: #222;
}

html[data-theme="dark"] .data-table tbody tr:hover {
  background: #222;
}

html[data-theme="dark"] .btn.btn-ghost,
html[data-theme="dark"] button.btn.btn-ghost,
html[data-theme="dark"] a.btn.btn-ghost {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}

html[data-theme="dark"] .btn.btn-ghost:hover,
html[data-theme="dark"] button.btn.btn-ghost:hover,
html[data-theme="dark"] a.btn.btn-ghost:hover {
  background: var(--muted);
  color: var(--foreground);
}

html[data-theme="dark"] .stat-mini.highlight {
  background: linear-gradient(135deg, #1f1f1f 0%, #1a2332 100%);
  border-color: rgba(96, 165, 250, 0.25);
}

html[data-theme="dark"] .portal-login-page {
  background: #0f1419;
  color: #e5e7eb;
}

html[data-theme="dark"] .portal-login-page::before {
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 80%, rgba(99, 102, 241, 0.08), transparent 50%);
}

html[data-theme="dark"] .portal-aside-name {
  color: #d1d5db;
}

html[data-theme="dark"] .portal-aside-title {
  color: #f3f4f6;
}

html[data-theme="dark"] .portal-aside-desc,
html[data-theme="dark"] .portal-features li {
  color: #9ca3af;
}

html[data-theme="dark"] .portal-card {
  background: #1a1f26;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .portal-card:focus-within {
  border-color: rgba(96, 165, 250, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(96, 165, 250, 0.1);
}

html[data-theme="dark"] .portal-card-title {
  color: #f3f4f6;
}

html[data-theme="dark"] .portal-tabs {
  border-bottom-color: #374151;
}

html[data-theme="dark"] .portal-tab-indicator {
  background: #60a5fa;
}

html[data-theme="dark"] .portal-tabs a,
html[data-theme="dark"] .portal-tab-btn {
  color: #9ca3af;
}

html[data-theme="dark"] .portal-tabs a.is-active,
html[data-theme="dark"] .portal-tab-btn.is-active {
  color: #93c5fd;
}

html[data-theme="dark"] .portal-field label {
  color: #d1d5db;
}

html[data-theme="dark"] .portal-field.is-focused label,
html[data-theme="dark"] .portal-field.is-filled label {
  color: #93c5fd;
}

html[data-theme="dark"] .portal-field input:not([type="checkbox"]) {
  background: #111827;
  border-color: #4b5563;
  color: #f3f4f6;
}

html[data-theme="dark"] .portal-field.is-focused input:not([type="checkbox"]) {
  background: #0f172a;
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

html[data-theme="dark"] .portal-check-box {
  background: #111827;
  border-color: #4b5563;
}

html[data-theme="dark"] .portal-check-input:checked + .portal-check-box {
  background: #2563eb;
  border-color: #2563eb;
}

html[data-theme="dark"] .portal-card-foot {
  border-top-color: #374151;
  color: #9ca3af;
}

html[data-theme="dark"] .portal-card-foot a,
html[data-theme="dark"] .portal-aside-link a,
html[data-theme="dark"] .portal-auth-link {
  color: #93c5fd;
}

html[data-theme="dark"] .portal-mark {
  background: linear-gradient(145deg, #3b82f6 0%, #2563eb 100%);
}

html[data-theme="dark"] .portal-pwd-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .section-more-link:hover {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.25);
  color: #93c5fd;
}

html[data-theme="dark"] .announce-item:hover {
  background: rgba(96, 165, 250, 0.08);
}

html[data-theme="dark"] .announce-item:hover .announce-item-title {
  color: #93c5fd;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover { background: var(--muted); }
.theme-toggle:active { transform: scale(0.96); }

.theme-icon { font-size: 14px; line-height: 1; }
html[data-theme="light"] .theme-icon-dark,
html:not([data-theme]) .theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: none; }

/* ========== UI 深度优化 · 第二轮细节 ========== */

/* 顶栏滚动态 */
.admin-header {
  transition: box-shadow 0.25s var(--ease-out-expo), background 0.25s ease;
}

.admin-header.is-scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .admin-header.is-scrolled {
  background: rgba(22, 22, 22, 0.96);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

/* 统计块 · 色条区分 */
.stat-mini {
  position: relative;
  overflow: hidden;
}

.stat-mini::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--stat-accent, transparent);
  opacity: 0.85;
  transform: scaleX(0.6);
  transform-origin: left center;
  transition: transform 0.35s var(--ease-out-expo);
}

body.page-ready .stat-mini::before,
.portal-login-page.page-ready .stat-mini::before {
  transform: scaleX(1);
}

.stat-mini--warn { --stat-accent: hsl(0 72% 51%); }
.stat-mini--orange { --stat-accent: hsl(25 95% 53%); }
.stat-mini--money { --stat-accent: hsl(142 72% 29%); }
.stat-mini--blue { --stat-accent: hsl(221 83% 53%); }
.stat-mini--purple { --stat-accent: hsl(262 83% 58%); }

.stat-mini--warn.highlight {
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
  border-color: hsl(0 86% 90%);
}

.stat-mini--orange .value { color: hsl(25 95% 40%); }
.stat-mini--blue .value { color: hsl(221 83% 40%); }
.stat-mini--purple .value { color: hsl(262 83% 45%); }

/* 配置卡片交互 */
.config-card--interactive {
  transition:
    box-shadow 0.25s var(--ease-out-expo),
    transform 0.25s var(--ease-out-expo),
    border-color 0.2s ease;
}

.config-card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
  border-color: rgba(37, 99, 235, 0.12);
}

/* 筛选面板聚焦 */
.filter-panel {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.filter-panel.is-focused {
  border-color: hsl(221 83% 85%);
  box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.08);
}

.filter-grid input:focus,
.filter-grid select:focus {
  border-color: hsl(221 83% 53%);
  box-shadow: 0 0 0 3px hsl(221 83% 53% / 0.1);
  outline: none;
}

/* Tab 切换过渡 */
.tabs-bar a,
.tabs-bar button {
  transition:
    color 0.2s ease,
    border-color 0.25s var(--ease-out-expo),
    font-weight 0.15s ease;
}

/* 公告列表 stagger */
.stagger-rows > * {
  animation: rowFadeIn 0.4s var(--ease-out-expo) backwards;
  animation-delay: calc(var(--row-i, 0) * 45ms);
}

.announce-item {
  transition: background 0.18s ease, padding-left 0.2s var(--ease-out-expo);
}

.announce-item:hover {
  padding-left: calc(1.125rem + 4px);
}

.announce-item-title {
  transition: color 0.15s ease;
}

/* 分页条 */
.pagination-bar {
  transition: opacity 0.3s ease;
}

/* 主题切换按钮 */
.theme-toggle {
  position: relative;
  overflow: hidden;
  transition:
    background 0.2s ease,
    transform 0.2s var(--ease-spring),
    border-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: hsl(221 83% 80%);
}

.theme-icon {
  display: inline-block;
  transition: transform 0.35s var(--ease-spring), opacity 0.2s ease;
}

.theme-toggle:active .theme-icon {
  transform: rotate(20deg) scale(0.9);
}

/* 空态 · 更柔和 */
.ui-state-animated .ui-state-icon {
  animation: floatIcon 4s ease-in-out infinite;
}

.ui-state-animated .ui-state-title {
  animation: alertIn 0.5s var(--ease-out-expo) 0.1s backwards;
}

.ui-state-animated .ui-state-desc {
  animation: alertIn 0.5s var(--ease-out-expo) 0.18s backwards;
}

.ui-state-animated .ui-state-actions {
  animation: alertIn 0.5s var(--ease-out-expo) 0.26s backwards;
}

/* 表格行 hover 左侧指示 */
.data-table tbody tr {
  position: relative;
}

.data-table tbody tr::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: hsl(221 83% 53%);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.15s ease, transform 0.2s var(--ease-out-expo);
}

.data-table tbody tr:hover::after {
  opacity: 1;
  transform: scaleY(1);
}

html[data-theme="dark"] .stat-mini--warn.highlight {
  background: linear-gradient(135deg, #1f2937 0%, #2a1f1f 100%);
  border-color: rgba(248, 113, 113, 0.25);
}

html[data-theme="dark"] .config-card--interactive:hover {
  border-color: rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .filter-panel.is-focused {
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .portal-login-page .portal-layout,
  .portal-reveal-item,
  .stagger-rows > *,
  .stat-mini::before {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .portal-login-page.page-ready .portal-page-foot {
    opacity: 1;
  }

  .portal-shake {
    animation: none !important;
  }

  .portal-auth-panel.is-switching {
    animation: none !important;
  }
}

