/* ============================================================================
   AI Work · 旧页覆盖层  __theme.css
   只做「把 Tailwind 生成的字面量拉回设计系统令牌」这件事。
   令牌本身来自 __design.css（先加载），这里不再重复定义 :root。
   ========================================================================= */

body {
  font-family: var(--font);
  background-color: var(--canvas) !important;
  color: var(--text);
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

#root, #admin-root, main { background: transparent; }

/* ---------------- 排版 ---------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font);
  letter-spacing: -.022em;
  font-weight: 700;
  line-height: 1.32;
}
h1 { font-size: 1.5em; }
h2 { font-size: 1.12em; }
h3 { font-size: 1em; font-weight: 650; }

.tabular-nums, table td, table th, td, th { font-variant-numeric: tabular-nums; }

code, kbd, pre, .font-mono, [class*="font-mono"] {
  font-family: var(--mono) !important;
}
code:not(pre code) {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .1em .42em;
  font-size: .88em;
  color: var(--text-2);
}

::selection { background: rgba(139, 92, 246, .26); }

/* ---------------- 滚动条 ---------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 99px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 7px; }

/* ---------------- 按钮 ---------------- */
button, .btn, .btn-outline {
  font-family: var(--font) !important;
  font-weight: 600;
  line-height: 1.25;
  transition: background-color .16s, border-color .16s, color .16s,
              transform .12s cubic-bezier(.2,.8,.3,1), box-shadow .18s, filter .16s;
}
button:not([class*="rounded-full"]) { border-radius: var(--radius-sm); }
[class*="rounded-full"] { border-radius: 999px; }
button:active { transform: scale(.972); }
button:disabled, [aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: saturate(.5); }

[class*="bg-indigo-6"], [class*="bg-indigo-5"],
[class*="bg-violet-6"], [class*="bg-violet-5"],
.btn-primary {
  background-image: var(--grad) !important;
  background-color: transparent !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(91, 91, 240, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
}
[class*="bg-indigo-6"]:hover, [class*="bg-indigo-5"]:hover,
[class*="bg-violet-6"]:hover, [class*="bg-violet-5"]:hover,
.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(91, 91, 240, .38), inset 0 1px 0 rgba(255, 255, 255, .22);
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1px solid var(--line-2) !important;
  color: var(--text-2) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  color: var(--text) !important;
  background: var(--surface-2) !important;
  box-shadow: var(--shadow-sm);
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-xs) !important;
  transition: transform .2s cubic-bezier(.2,.8,.3,1), box-shadow .22s, border-color .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow) !important;
  border-color: var(--line-2) !important;
}
[class*="rounded-xl"]:not([class*="rounded-full"]),
[class*="rounded-2xl"]:not([class*="rounded-full"]) {
  border-radius: var(--radius) !important;
}

/* ---------------- 表单 ---------------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select, textarea {
  font-family: var(--font) !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--line-2) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  line-height: 1.3;
  box-shadow: var(--shadow-xs);
  transition: border-color .16s, box-shadow .16s;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus, textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: var(--ring) !important;
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--text-3) !important; }

/* ---------------- 表格 ---------------- */
thead th {
  color: var(--text-3) !important;
  font-weight: 650 !important;
  font-size: 11.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
tbody tr { transition: background-color .14s; }
tbody tr:hover { background: var(--surface-2) !important; }
tbody td { border-color: var(--line) !important; }

hr { border-color: var(--line) !important; }
[class*="divide-"] > :not([hidden]) ~ :not([hidden]) { border-color: var(--line) !important; }

/* ---------------- 深色下压平浅色字面量 ---------------- */
html.dark .bg-white,
html.dark .bg-slate-50 { background-color: var(--surface) !important; }
html.dark .bg-slate-100 { background-color: var(--surface-2) !important; }
html.dark .bg-slate-200 { background-color: var(--surface-3) !important; }
html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-slate-50:hover { background-color: var(--surface-2) !important; }
html.dark .border-slate-200 { border-color: var(--line) !important; }
html.dark .border-slate-300 { border-color: var(--line-2) !important; }
html.dark .text-slate-800, html.dark .text-slate-900,
html.dark .text-slate-700 { color: var(--text) !important; }
html.dark .text-slate-600, html.dark .text-slate-500 { color: var(--text-2) !important; }
html.dark .text-slate-400, html.dark .text-slate-300 { color: var(--text-3) !important; }
html.dark .dark\:bg-zinc-950 { background-color: var(--canvas) !important; }
html.dark .dark\:bg-zinc-900 { background-color: var(--surface) !important; }
html.dark .dark\:bg-zinc-800 { background-color: var(--surface-2) !important; }
html.dark .dark\:border-zinc-800 { border-color: var(--line) !important; }

/* ---------------- 注入侧栏 ---------------- */
#yk-side-bar {
  background: var(--surface) !important;
  border-right: 1px solid var(--line) !important;
  box-shadow: var(--shadow-xs);
}
#yk-side-bar a {
  color: var(--text-2) !important;
  border-radius: 9px !important;
  transition: background-color .15s, color .15s, transform .12s;
}
#yk-side-bar a:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
