/* ============================================
   shadcn/ui 风格 · 极简设计 token
   全部颜色使用 HSL，方便后期主题化
   ============================================ */

:root {
  /* 基础语义色（亮色） */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;

  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;

  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;

  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;

  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;

  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;

  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;

  --success: 142 71% 45%;
  --success-foreground: 0 0% 98%;

  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;

  /* 字体：shadcn 默认 Inter */
  --font-sans: "Inter", "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;

  /* 圆角 */
  --radius: 0.5rem;  /* 8px，shadcn 默认 */

  /* 阴影：shadcn 风格细腻 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* 暗色模式 */
[data-theme="dark"],
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;

    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;

    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;

    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;

    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;

    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;

    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;

    --success: 142 71% 45%;
    --success-foreground: 0 0% 98%;

    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 240 4.9% 83.9%;
  }
}

[data-theme="dark"] {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
}

/* ============== Reset ============== */
*, *::before, *::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "rlig" 1, "calt" 1;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  line-height: 1.5;
}

::selection {
  background-color: hsl(var(--primary) / 0.15);
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============== 排版 ============== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.3;
  color: hsl(var(--foreground));
}

/* ============== 通用工具类 ============== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============== 滚动条 ============== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 5px;
  border: 2px solid hsl(var(--background));
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.4);
}

/* ============== 焦点环（shadcn 风格） ============== */
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* ============== 页面背景：细微网格 ============== */
body {
  background-image:
    radial-gradient(at 100% 0%, hsl(var(--muted) / 0.4) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsl(var(--muted) / 0.3) 0px, transparent 50%);
  background-attachment: fixed;
}

[data-theme="dark"] body,
@media (prefers-color-scheme: dark) {
  body {
    background-image:
      radial-gradient(at 100% 0%, hsl(var(--muted) / 0.3) 0px, transparent 50%),
      radial-gradient(at 0% 100%, hsl(var(--muted) / 0.2) 0px, transparent 50%);
  }
}

/* ============== 过渡 ============== */
* {
  transition-property: color, background-color, border-color, fill, stroke, opacity, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

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

/* ============== 布局 ============== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--background) / 0.8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.site-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: calc(var(--radius) - 2px);
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 700;
  font-size: 0.875rem;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============== Button（shadcn 兼容） ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.25rem;
  padding: 0 0.875rem;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  background-color: transparent;
  color: hsl(var(--foreground));
  text-decoration: none;
}
.btn:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn:active { transform: scale(0.98); }
.btn[data-variant="default"] {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.btn[data-variant="default"]:hover {
  background-color: hsl(var(--primary) / 0.9);
}
.btn[data-variant="outline"] {
  border-color: hsl(var(--input));
  background-color: hsl(var(--background));
}
.btn[data-variant="outline"]:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.btn[data-variant="ghost"] { background-color: transparent; }
.btn[data-variant="ghost"]:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.btn[data-variant="destructive"] {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}
.btn[data-variant="destructive"]:hover {
  background-color: hsl(var(--destructive) / 0.9);
}
.btn[data-size="sm"] { height: 2rem; padding: 0 0.625rem; font-size: 0.8125rem; }
.btn[data-size="icon"] { width: 2.25rem; height: 2.25rem; padding: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  background-color: transparent;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--input));
  cursor: pointer;
}
.icon-btn:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* ============== Dropdown Menu（shadcn 兼容） ============== */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.375rem);
  right: 0;
  z-index: 50;
  min-width: 10rem;
  max-height: 24rem;
  overflow: hidden;
  padding: 0.25rem;
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px hsl(var(--foreground) / 0.1), 0 2px 4px -2px hsl(var(--foreground) / 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  transform-origin: top right;
  animation: dropdown-in 120ms ease-out;
}
.dropdown-menu[hidden] { display: none; }

@keyframes dropdown-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.dropdown-label {
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  user-select: none;
}

.dropdown-separator {
  height: 1px;
  background-color: hsl(var(--border));
  margin: 0.25rem -0.25rem;
}

.dropdown-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 0.125rem);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  user-select: none;
  outline: none;
}
.dropdown-item[data-highlighted],
.dropdown-item:focus-visible {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.dropdown-item[data-disabled] {
  pointer-events: none;
  opacity: 0.5;
}
.dropdown-item[data-variant="destructive"] {
  color: hsl(var(--destructive));
}
.dropdown-item[data-variant="destructive"][data-highlighted],
.dropdown-item[data-variant="destructive"]:focus-visible {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.dropdown-item > svg {
  flex-shrink: 0;
  color: currentColor;
}

/* ============== Dialog（shadcn 兼容） ============== */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: hsl(var(--foreground) / 0.5);
  animation: overlay-in 150ms ease-out;
}
.dialog-overlay[hidden] { display: none; }
@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.dialog-content {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 61;
  transform: translate(-50%, -50%);
  width: min(calc(100vw - 2rem), 32rem);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 30px hsl(var(--foreground) / 0.18), 0 4px 10px hsl(var(--foreground) / 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: dialog-in 150ms ease-out;
}
.dialog-content[hidden] { display: none; }
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.dialog-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
  margin: 0;
}
.dialog-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}
.dialog-footer {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.dialog-close:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.dialog-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.dialog-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}
.dialog-field .input { width: 100%; }

/* ============== Card ============== */
.card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.card-description {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}
.card-content { padding: 1.25rem 1.5rem; }
.card-footer {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

/* ============== Input ============== */
.input, .textarea {
  display: flex;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  outline: none;
  font-family: var(--font-sans);
  height: 2.25rem;
}
.textarea { height: auto; padding: 0.5rem 0.75rem; min-height: 5rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.input:focus-visible, .textarea:focus-visible {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

/* ============== Badge ============== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.badge[data-variant="secondary"] {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.badge[data-variant="outline"] {
  background-color: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.badge[data-variant="muted"] {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* ============== Page header ============== */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-description {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* ============== 集合卡片 ============== */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.collection-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.collection-card:hover {
  box-shadow: var(--shadow-md);
  border-color: hsl(var(--ring) / 0.3);
}
.collection-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.collection-card-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.collection-card-desc {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.collection-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ============== Empty state ============== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsl(var(--card));
}
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
}
.empty-title { font-size: 1rem; font-weight: 600; }
.empty-description {
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  max-width: 24rem;
}

/* ============== 树形结构 ============== */
.tree {
  font-size: 0.875rem;
  user-select: none;
}
.tree-node {
  display: block;
  position: relative;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  color: hsl(var(--foreground));
  text-decoration: none;
}
.tree-row:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.tree-row.is-active {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  font-weight: 600;
}
.tree-toggle {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
  transition: transform 150ms;
}
.tree-toggle.is-open { transform: rotate(90deg); }
.tree-toggle.is-empty { visibility: hidden; }
.tree-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
}
.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-children {
  margin-left: 0.75rem;
  padding-left: 0.625rem;
  border-left: 1px solid hsl(var(--border));
  display: none;
}
.tree-children.is-open { display: block; }

.tree-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 100ms ease-out;
}
/* 目录树操作按钮: 默认淡显, 悬停时完全可见 (与 .doc-item-actions 保持一致) */
.tree-row:hover .tree-actions,
.tree-row:focus-within .tree-actions {
  opacity: 1;
}
@media (hover: none) {
  .tree-actions { opacity: 1; }
}
.tree-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: background-color 100ms, color 100ms;
  /* button 重置, 让 <button> 与 <a> 视觉一致 */
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.tree-action:hover,
.tree-action:focus-visible {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* ============== 集合首页布局 ============== */
.collection-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .collection-layout { grid-template-columns: 1fr; }
}
.tree-card .card-content {
  padding: 0.75rem;
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
}
.tree-card .card-footer {
  border-top: 1px solid hsl(var(--border));
  padding: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

/* ============== 文档列表 ============== */
.doc-list { display: flex; flex-direction: column; gap: 0.5rem; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background-color: hsl(var(--card));
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.doc-item:hover {
  border-color: hsl(var(--border));
  box-shadow: var(--shadow-sm);
}
.doc-item-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
}
.doc-item-body { flex: 1; min-width: 0; }
.doc-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-item-path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}
/* 文档项操作按钮: 默认淡显, 悬停时完全可见 */
.doc-item:hover .doc-item-actions,
.doc-item:focus-within .doc-item-actions { opacity: 1; }
@media (hover: none) {
  .doc-item-actions { opacity: 1; }
}

/* ============== 表单 ============== */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}
.form-hint {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ============== Alert ============== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted));
  font-size: 0.875rem;
  color: hsl(var(--foreground));
}
.alert[data-variant="warning"] {
  background-color: hsl(38 92% 50% / 0.1);
  border-color: hsl(38 92% 50% / 0.3);
  color: hsl(38 92% 30%);
}
.alert[data-variant="destructive"] {
  background-color: hsl(0 84% 60% / 0.1);
  border-color: hsl(0 84% 60% / 0.3);
  color: hsl(0 72% 40%);
}

/* ============== 移动端 ============== */
@media (max-width: 640px) {
  .container { padding: 1.5rem 1rem; }
  .site-header-inner { padding: 0 1rem; }
  .page-title { font-size: 1.5rem; }
}
