/* ============================================================
   设计系统 - 深色现代风（v1）
   颜色 / 字体 / 间距 / 阴影 / 组件 / 动效
   所有页面统一引入：<link rel="stylesheet" href="/assets/design.css?v=1">
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-deep: #0d1117;
  --bg-base: #161b22;
  --bg-raised: #1c2230;
  --bg-elevated: #232b3d;
  --bg-hover: #2a3346;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(124, 156, 224, 0.4);

  --text-primary: #e6edf3;
  --text-secondary: #9aa3ae;
  --text-muted: #6e7681;
  --text-inverse: #0d1117;

  --accent: #7c9ce0;
  --accent-strong: #5b7fd1;
  --accent-soft: rgba(124, 156, 224, 0.12);
  --accent-glow: 0 0 0 3px rgba(124, 156, 224, 0.18);

  --success: #4ec9b0;
  --success-soft: rgba(78, 201, 176, 0.12);
  --warning: #e8c97a;
  --warning-soft: rgba(232, 201, 122, 0.14);
  --danger: #f47174;
  --danger-soft: rgba(244, 113, 116, 0.12);
  --info: #79c0ff;
  --info-soft: rgba(121, 192, 255, 0.12);

  --gradient-cta: linear-gradient(135deg, #7c9ce0 0%, #5b7fd1 100%);
  --gradient-bg: radial-gradient(ellipse at top left, rgba(124, 156, 224, 0.08), transparent 50%),
                 radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.06), transparent 50%),
                 linear-gradient(180deg, #0d1117 0%, #161b22 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 8px 32px rgba(124, 156, 224, 0.18);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --font-sans: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 320ms;

  --header-h: 60px;
  --container-max: 1280px;

  /* 主题相关运行时变量（被 [data-theme] 覆盖） */
  --topbar-bg: rgba(13, 17, 23, 0.85);
  --modal-backdrop: rgba(13, 17, 23, 0.6);
  --scroll-thumb: rgba(255, 255, 255, 0.08);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.14);
  --shimmer: rgba(255, 255, 255, 0.25);
  --input-border-hover: rgba(255, 255, 255, 0.24);
  --shadow-cta: 0 4px 12px rgba(124, 156, 224, 0.25);
  --shadow-cta-hover: 0 8px 20px rgba(124, 156, 224, 0.35);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa3ae' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");

  color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="yellow"] { color-scheme: light; }

html { transition: background-color var(--dur-base) var(--ease); }
body { transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease); }

/* ---------- 基础重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-deep);
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--accent-strong); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* ---------- 字号阶梯 ---------- */
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-md { font-size: 15px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; line-height: 1.2; }
.text-4xl { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- 容器 / 布局 ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  display: flex;
  align-items: center;
}
.topbar-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--gradient-cta);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.topbar-spacer { flex: 1; }
.topbar-nav {
  display: flex;
  gap: var(--space-1);
}
.topbar-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease);
}
.topbar-nav a:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-nav a.active { background: var(--accent-soft); color: var(--accent); }

/* 用户菜单 */
.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--dur-fast) var(--ease);
}
.user-trigger:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gradient-cta);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all var(--dur-fast) var(--ease);
  z-index: 100;
}
.user-menu.open .user-dropdown {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.user-dropdown a, .user-dropdown button {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--bg-hover); }
.user-dropdown .danger { color: var(--danger); }

/* 内容区 */
.page {
  flex: 1;
  padding: var(--space-6) 0 var(--space-7);
  animation: fadeUp 0.4s var(--ease) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-header { margin-bottom: var(--space-5); }
.page-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
.card-hover { cursor: pointer; }
.card-hover:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card-section + .card-section { margin-top: var(--space-5); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all var(--dur-fast) var(--ease);
  font-family: inherit;
  line-height: 1.2;
}
.btn:focus-visible { outline: none; box-shadow: var(--accent-glow); }
.btn:disabled, .btn[disabled] { cursor: not-allowed; opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--gradient-cta);
  color: #fff;
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-cta-hover); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(244, 113, 116, 0.2);
}
.btn-danger:hover { background: rgba(244, 113, 116, 0.18); border-color: rgba(244, 113, 116, 0.4); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  top: 50%; left: 50%;
  margin-top: -7px; margin-left: -7px;
  animation: spin 0.7s linear infinite;
  color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 表单 ---------- */
.field { margin-bottom: var(--space-4); }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.input:hover, .select:hover, .textarea:hover {
  border-color: var(--input-border-hover);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-base);
  box-shadow: var(--accent-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.select {
  appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* file input */
input[type="file"] {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
input[type="file"]:hover { border-color: var(--accent); color: var(--text-primary); }
input[type="file"]::file-selector-button {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin-right: 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
input[type="file"]::file-selector-button:hover { background: var(--bg-hover); }

.checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--text-secondary);
}
.checkbox input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  background: var(--bg-deep);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-accent  { background: var(--accent-soft); color: var(--accent); }
.badge-dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- 进度条 ---------- */
.progress {
  height: 8px;
  background: var(--bg-deep);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: var(--gradient-cta);
  border-radius: inherit;
  width: 0%;
  transition: width var(--dur-slow) var(--ease);
  position: relative;
  overflow: hidden;
}
.progress-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--bg-hover); }
.table-compact thead th, .table-compact tbody td { padding: 6px 10px; }

/* 空状态 */
.empty-state {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.4; margin: 0 auto var(--space-3); }

/* ---------- Toast ---------- */
#toast-host {
  position: fixed;
  top: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 3px solid var(--accent);
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .icon { flex-shrink: 0; padding-top: 1px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.96);
  transition: transform var(--dur-base) var(--ease-spring);
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.modal-body { color: var(--text-secondary); font-size: 13px; margin-bottom: var(--space-5); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--space-4);
  overflow-x: auto;
}
.tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-family: inherit;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.tab.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 24px; } .gap-6 { gap: 32px; }
.flex-1 { flex: 1; } .flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; } .mb-6 { margin-bottom: 32px; }
.p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-5 { padding: 24px; }
.font-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { padding: 0 var(--space-3); }
  .topbar-inner { padding: 0 var(--space-3); gap: var(--space-2); }
  .topbar-nav { display: none; }
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .text-3xl { font-size: 22px; }
  .text-4xl { font-size: 26px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   主题：浅色（白）
   ============================================================ */
:root[data-theme="light"] {
  --bg-deep:        #f4f6fb;
  --bg-base:        #ffffff;
  --bg-raised:      #ffffff;
  --bg-elevated:    #f1f4fa;
  --bg-hover:       #e6ebf3;

  --border:         rgba(15, 23, 42, 0.08);
  --border-strong:  rgba(15, 23, 42, 0.18);
  --border-accent:  rgba(37, 99, 235, 0.40);

  --text-primary:   #1a1f2e;
  --text-secondary: #4b5565;
  --text-muted:     #6b7280;
  --text-inverse:   #ffffff;

  --accent:         #2563eb;
  --accent-strong:  #1d4ed8;
  --accent-soft:    rgba(37, 99, 235, 0.10);
  --accent-glow:    0 0 0 3px rgba(37, 99, 235, 0.18);

  --success:        #059669;
  --success-soft:   rgba(5, 150, 105, 0.12);
  --warning:        #d97706;
  --warning-soft:   rgba(217, 119, 6, 0.14);
  --danger:         #dc2626;
  --danger-soft:    rgba(220, 38, 38, 0.10);
  --info:           #0284c7;
  --info-soft:      rgba(2, 132, 199, 0.12);

  --gradient-cta:   linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --gradient-bg:    radial-gradient(ellipse at top left, rgba(37, 99, 235, 0.06), transparent 50%),
                    radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.05), transparent 50%),
                    linear-gradient(180deg, #f4f6fb 0%, #eef1f7 100%);

  --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md:      0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:      0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-xl:      0 24px 64px rgba(15, 23, 42, 0.16);
  --shadow-glow:    0 8px 32px rgba(37, 99, 235, 0.18);

  --topbar-bg:      rgba(255, 255, 255, 0.85);
  --modal-backdrop: rgba(15, 23, 42, 0.36);
  --scroll-thumb:   rgba(15, 23, 42, 0.16);
  --scroll-thumb-hover: rgba(15, 23, 42, 0.28);
  --shimmer:        rgba(255, 255, 255, 0.55);
  --input-border-hover: rgba(15, 23, 42, 0.32);
  --shadow-cta:     0 4px 12px rgba(37, 99, 235, 0.22);
  --shadow-cta-hover: 0 8px 20px rgba(37, 99, 235, 0.32);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234b5565' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* ============================================================
   主题：暖黄
   ============================================================ */
:root[data-theme="yellow"] {
  --bg-deep:        #fff7d6;
  --bg-base:        #fffceb;
  --bg-raised:      #fffceb;
  --bg-elevated:    #fff3c0;
  --bg-hover:       #ffe999;

  --border:         rgba(133, 95, 0, 0.15);
  --border-strong:  rgba(133, 95, 0, 0.30);
  --border-accent:  rgba(217, 119, 6, 0.45);

  --text-primary:   #2d2200;
  --text-secondary: #6d560f;
  --text-muted:     #8a7330;
  --text-inverse:   #ffffff;

  --accent:         #d97706;
  --accent-strong:  #b45309;
  --accent-soft:    rgba(217, 119, 6, 0.14);
  --accent-glow:    0 0 0 3px rgba(217, 119, 6, 0.22);

  --success:        #047857;
  --success-soft:   rgba(4, 120, 87, 0.14);
  --warning:        #ca8a04;
  --warning-soft:   rgba(202, 138, 4, 0.16);
  --danger:         #b91c1c;
  --danger-soft:    rgba(185, 28, 28, 0.12);
  --info:           #b45309;
  --info-soft:      rgba(180, 83, 9, 0.12);

  --gradient-cta:   linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-bg:    radial-gradient(ellipse at top left, rgba(245, 158, 11, 0.18), transparent 55%),
                    radial-gradient(ellipse at bottom right, rgba(217, 119, 6, 0.10), transparent 55%),
                    linear-gradient(180deg, #fff7d6 0%, #fff0b0 100%);

  --shadow-sm:      0 1px 2px rgba(133, 95, 0, 0.10);
  --shadow-md:      0 4px 12px rgba(133, 95, 0, 0.12);
  --shadow-lg:      0 12px 32px rgba(133, 95, 0, 0.16);
  --shadow-xl:      0 24px 64px rgba(133, 95, 0, 0.22);
  --shadow-glow:    0 8px 32px rgba(217, 119, 6, 0.25);

  --topbar-bg:      rgba(255, 247, 214, 0.85);
  --modal-backdrop: rgba(63, 41, 0, 0.36);
  --scroll-thumb:   rgba(133, 95, 0, 0.20);
  --scroll-thumb-hover: rgba(133, 95, 0, 0.34);
  --shimmer:        rgba(255, 255, 255, 0.55);
  --input-border-hover: rgba(133, 95, 0, 0.45);
  --shadow-cta:     0 4px 12px rgba(217, 119, 6, 0.25);
  --shadow-cta-hover: 0 8px 20px rgba(217, 119, 6, 0.40);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236d560f' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
}

/* ============================================================
   主题切换器组件
   ============================================================ */
.theme-menu { position: relative; }
.theme-trigger {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
  font-family: inherit;
}
.theme-trigger:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.theme-trigger:focus-visible {
  outline: none;
  box-shadow: var(--accent-glow);
}
.theme-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  z-index: 100;
}
.theme-menu.open .theme-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.theme-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background var(--dur-fast) var(--ease);
}
.theme-option:hover { background: var(--bg-hover); }
.theme-option.active { background: var(--accent-soft); color: var(--accent); }
.theme-option.active .theme-swatch { border-color: var(--accent); }
.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.theme-swatch.dark   { background: linear-gradient(135deg, #161b22 0%, #2a3346 100%); }
.theme-swatch.light  { background: linear-gradient(135deg, #f5f7fb 0%, #dee4ee 100%); }
.theme-swatch.yellow { background: linear-gradient(135deg, #fff3c0 0%, #f59e0b 100%); }
.theme-swatch.sepia  { background: linear-gradient(135deg, #f5efe1 0%, #d6c8a6 100%); }

/* ============================================================
   主题：米白（暖纸色，护眼）
   ============================================================ */
:root[data-theme="sepia"] {
  --bg-deep:        #ebe3d0;
  --bg-base:        #f5efe1;
  --bg-raised:      #f5efe1;
  --bg-elevated:    #efe7d2;
  --bg-hover:       #e3d8be;

  --border:         rgba(89, 67, 30, 0.14);
  --border-strong:  rgba(89, 67, 30, 0.26);
  --border-accent:  rgba(180, 83, 9, 0.42);

  --text-primary:   #3a2f1d;
  --text-secondary: #6a5a3d;
  --text-muted:     #8a7a5d;
  --text-inverse:   #ffffff;

  --accent:         #b45309;
  --accent-strong:  #92400e;
  --accent-soft:    rgba(180, 83, 9, 0.12);
  --accent-glow:    0 0 0 3px rgba(180, 83, 9, 0.20);

  --success:        #15803d;
  --success-soft:   rgba(21, 128, 61, 0.12);
  --warning:        #b45309;
  --warning-soft:   rgba(180, 83, 9, 0.14);
  --danger:         #b91c1c;
  --danger-soft:    rgba(185, 28, 28, 0.10);
  --info:           #1d4ed8;
  --info-soft:      rgba(29, 78, 216, 0.12);

  --gradient-cta:   linear-gradient(135deg, #b45309 0%, #92400e 100%);
  --gradient-bg:    radial-gradient(ellipse at top left, rgba(180, 83, 9, 0.06), transparent 55%),
                    radial-gradient(ellipse at bottom right, rgba(120, 90, 40, 0.05), transparent 55%),
                    linear-gradient(180deg, #ebe3d0 0%, #e2d8bf 100%);

  --shadow-sm:      0 1px 2px rgba(89, 67, 30, 0.10);
  --shadow-md:      0 4px 12px rgba(89, 67, 30, 0.10);
  --shadow-lg:      0 12px 32px rgba(89, 67, 30, 0.14);
  --shadow-xl:      0 24px 64px rgba(89, 67, 30, 0.18);
  --shadow-glow:    0 8px 32px rgba(180, 83, 9, 0.18);

  --topbar-bg:      rgba(245, 239, 225, 0.85);
  --modal-backdrop: rgba(63, 47, 20, 0.36);
  --scroll-thumb:   rgba(89, 67, 30, 0.22);
  --scroll-thumb-hover: rgba(89, 67, 30, 0.36);
  --shimmer:        rgba(255, 252, 240, 0.55);
  --input-border-hover: rgba(89, 67, 30, 0.40);
  --shadow-cta:     0 4px 12px rgba(180, 83, 9, 0.22);
  --shadow-cta-hover: 0 8px 20px rgba(180, 83, 9, 0.32);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236a5a3d' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
}

:root[data-theme="sepia"] { color-scheme: light; }
