/* ==========================================================================
   file-vault · 共享样式
   设计语言参考 web-demo/assets/style.css：暖白底、青绿主色、16px 圆角、系统字体。
   纯原生 CSS，无第三方依赖、无外部字体/图标；支持 prefers-color-scheme: dark
   与 ≤720px 单列布局（表格自动转卡片）。
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #f7f6f2;
  --bg-alt: #efece4;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --text: #12151a;
  --muted: #5b6673;
  --line: #e2ded4;
  --line-strong: #d5cfc2;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-bright: #14b8a6;
  --accent-soft: rgba(15, 118, 110, 0.10);
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.12);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.13);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.11);
  --info: #1d4ed8;
  --info-soft: rgba(29, 78, 216, 0.10);
  --shadow: 0 1px 2px rgba(18, 21, 26, 0.04), 0 10px 30px rgba(18, 21, 26, 0.06);
  --shadow-lg: 0 2px 6px rgba(18, 21, 26, 0.05), 0 26px 64px -20px rgba(18, 21, 26, 0.25);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1116;
    --bg-alt: #131c24;
    --surface: #131b23;
    --surface-2: #17212a;
    --text: #e9eef3;
    --muted: #93a1ae;
    --line: #22303b;
    --line-strong: #2e4050;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-bright: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.12);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.13);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.13);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.13);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 30px 70px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open { overflow: hidden; }

/* 文件页 / 管理后台的暖色顶部氛围光 */
.app-page {
  background:
    radial-gradient(1100px 480px at 16% -190px, var(--accent-soft), transparent 68%),
    radial-gradient(900px 420px at 94% -160px, rgba(122, 92, 250, 0.06), transparent 72%),
    var(--bg);
}

.tab-panel { animation: fade-in 0.18s ease; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }

button, input, select, textarea { font: inherit; }

svg { flex: none; }

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

::selection { background: var(--accent-soft); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }

/* ---------- 品牌 ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: none;
}
.brand:hover { color: var(--text); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-bright));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(15, 118, 110, 0.65);
}
.brand-mark svg { width: 21px; height: 21px; }

.brand-text { display: grid; line-height: 1.15; }
.brand-text small {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--muted);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 68px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.topnav a:hover { color: var(--text); background: var(--accent-soft); }
.topnav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.topnav .nav-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* 配额小组件 */
.quota {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 200px;
  margin-left: auto;
}
.quota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.2;
}
.quota-head b { color: var(--text); font-weight: 600; }
.quota-head .quota-pct { font-variant-numeric: tabular-nums; }
.quota-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
}
.quota-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.3, 1), background 0.3s ease;
}
.quota.is-warn .quota-bar > span { background: linear-gradient(90deg, #d97706, #f59e0b); }
.quota.is-danger .quota-bar > span { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.quota.is-warn .quota-pct { color: var(--warn); font-weight: 600; }
.quota.is-danger .quota-pct { color: var(--danger); font-weight: 600; }

/* 用户菜单 */
.user-menu { position: relative; flex: none; }
/* 没有配额组件时（管理后台），用户菜单靠右 */
.topnav + .user-menu { margin-left: auto; }
.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.user-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.user-btn .chevron { width: 16px; height: 16px; color: var(--muted); transition: transform 0.18s ease; }
.user-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.user-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 600;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-bright));
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}
.avatar--sm { width: 30px; height: 30px; border-radius: 9px; font-size: 0.75rem; }
.avatar--lg { width: 40px; height: 40px; border-radius: 12px; font-size: 0.9375rem; }

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 236px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s ease;
}
.dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.dropdown-head .who { display: grid; min-width: 0; line-height: 1.3; }
.dropdown-head .who strong {
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-head .who span {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
}
.dropdown-item:hover { background: var(--bg-alt); }
.dropdown-item.is-danger { color: var(--danger); }
.dropdown-item.is-danger:hover { background: var(--danger-soft); }
.dropdown-item svg { width: 17px; height: 17px; color: var(--muted); }
.dropdown-item.is-danger svg { color: var(--danger); }
.dropdown-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---------- 页面容器 ---------- */
.page {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px 24px 28px;
}
.page--wide { max-width: 1320px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 4px 0 6px;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.page-sub { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card-body { padding: 20px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card-title svg { width: 18px; height: 18px; color: var(--accent); }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.8125rem; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
              box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(15, 118, 110, 0.8);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); color: #fff; }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(185, 28, 28, 0.8);
}
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }

.btn-block { width: 100%; }
.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 0.875rem;
}
.btn-sm svg { width: 16px; height: 16px; }
.btn-icon { padding: 0; width: 42px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; color: var(--muted); }
.icon-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

/* 按钮 loading */
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.spinner--sm { width: 13px; height: 13px; border-width: 2px; }

/* ---------- 表单 ---------- */
.form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
}
.field-hint { margin: 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.5; }
.field-error { margin: 0; color: var(--danger); font-size: 0.8125rem; }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input::placeholder,
.textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

/* 使用自定义的搜索清除按钮，隐藏浏览器原生图标 */
.input[type="search"]::-webkit-search-cancel-button,
.input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--line-strong); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled,
.select:disabled { opacity: 0.6; cursor: not-allowed; }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .input-icon {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.input-wrap .input { padding-left: 40px; }
.input-wrap.has-action .input { padding-right: 48px; }
.input-action {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.input-action:hover { background: var(--accent-soft); color: var(--accent); }
.input-action svg { width: 19px; height: 19px; }

.select-wrap { position: relative; display: inline-flex; min-width: 0; }
.select-wrap .select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  border-radius: 1px;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
  line-height: 1.55;
  animation: shake 0.34s ease;
}
.form-error svg { width: 18px; height: 18px; margin-top: 1px; flex: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .field--full { grid-column: 1 / -1; }

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.55;
  white-space: nowrap;
}
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--admin { background: var(--accent-soft); color: var(--accent); }
.badge--admin::before { content: "◆"; font-size: 0.5rem; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- 进度条 ---------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}
.progress.is-warn > span { background: var(--warn); }
.progress.is-danger > span { background: var(--danger); }
.progress.is-ok > span { background: var(--success); }
.progress--thin { height: 6px; }

/* ---------- 工具栏 / 搜索 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.toolbar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; flex-wrap: wrap; }

.search-wrap { position: relative; display: flex; align-items: center; flex: 1 1 220px; max-width: 360px; }
.search-wrap .input-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search-wrap .input { min-height: 42px; padding-left: 37px; padding-right: 38px; }
.search-clear {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.search-clear:hover { background: var(--accent-soft); color: var(--accent); }
.search-clear svg { width: 14px; height: 14px; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap--flush { padding: 4px 6px 8px; }

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.data thead th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr { transition: background 0.14s ease; }
.data tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.data .th-actions,
.data .cell-actions { text-align: right; }
.data .cell-nowrap { white-space: nowrap; }
.data .cell-num { font-variant-numeric: tabular-nums; }
.data .actions-col { width: 1%; }

/* 文件单元格 */
.file-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.file-icon svg { width: 21px; height: 21px; }
.file-icon[data-type="image"] { background: rgba(147, 51, 234, 0.12); color: #9333ea; }
.file-icon[data-type="pdf"] { background: rgba(220, 38, 38, 0.11); color: #dc2626; }
.file-icon[data-type="doc"] { background: rgba(37, 99, 235, 0.11); color: #2563eb; }
.file-icon[data-type="sheet"] { background: rgba(21, 128, 61, 0.12); color: #15803d; }
.file-icon[data-type="slide"] { background: rgba(234, 88, 12, 0.12); color: #ea580c; }
.file-icon[data-type="archive"] { background: rgba(180, 83, 9, 0.12); color: #b45309; }
.file-icon[data-type="audio"] { background: rgba(219, 39, 119, 0.11); color: #db2777; }
.file-icon[data-type="video"] { background: rgba(79, 70, 229, 0.11); color: #4f46e5; }
.file-icon[data-type="code"] { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.file-icon[data-type="text"] { background: var(--bg-alt); color: var(--muted); }

@media (prefers-color-scheme: dark) {
  .file-icon[data-type="image"] { color: #c084fc; }
  .file-icon[data-type="pdf"] { color: #f87171; }
  .file-icon[data-type="doc"] { color: #93c5fd; }
  .file-icon[data-type="sheet"] { color: #4ade80; }
  .file-icon[data-type="slide"] { color: #fb923c; }
  .file-icon[data-type="archive"] { color: #fbbf24; }
  .file-icon[data-type="audio"] { color: #f472b6; }
  .file-icon[data-type="video"] { color: #a5b4fc; }
  .file-icon[data-type="code"] { color: #2dd4bf; }
}

.file-meta { display: grid; gap: 2px; min-width: 0; line-height: 1.3; }
.file-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name:hover { color: var(--accent); }
.file-sub { display: flex; align-items: center; gap: 7px; font-size: 0.75rem; color: var(--muted); }
.file-sub .dot-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* 用户单元格 */
.user-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.user-meta { display: grid; gap: 1px; min-width: 0; line-height: 1.3; }
.user-title { display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.user-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sub { color: var(--muted); font-size: 0.75rem; font-family: var(--mono); }

.quota-mini { display: grid; gap: 5px; min-width: 148px; }
.quota-mini .progress { width: 148px; max-width: 100%; }
.quota-mini span { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }

.time-cell { display: grid; gap: 1px; line-height: 1.35; }
.time-cell .t-main { font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.time-cell .t-sub { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.audit-detail {
  display: block;
  max-width: 340px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 空状态 / 错误 / 骨架 ---------- */
.empty,
.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 54px 22px;
  text-align: center;
}
.state-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 6px;
  border-radius: 19px;
  background: var(--accent-soft);
  color: var(--accent);
}
.state-icon svg { width: 30px; height: 30px; }
.state-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.state-title { margin: 0; font-size: 1rem; font-weight: 700; }
.state-text { margin: 0; max-width: 40ch; color: var(--muted); font-size: 0.875rem; line-height: 1.6; }
.state-block .btn { margin-top: 10px; }

.skeleton-list { display: grid; gap: 4px; padding: 10px 14px 16px; }
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.skeleton-row:last-child { border-bottom: 0; }
.sk {
  height: 13px;
  border-radius: 7px;
  background: linear-gradient(
    90deg,
    var(--bg-alt) 25%,
    color-mix(in srgb, var(--bg-alt) 55%, var(--surface)) 50%,
    var(--bg-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk--icon { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.sk--name { flex: 1; max-width: 320px; }
.sk--short { width: 90px; }
.sk--mid { width: 140px; }
.sk--end { margin-left: auto; width: 100px; }

/* ---------- 上传区 ---------- */
.upload-card { padding: 18px; }
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 30px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(80% 120% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background:
    radial-gradient(80% 120% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface-2);
}
.dropzone.is-drag {
  border-color: var(--accent);
  border-style: solid;
  background: color-mix(in srgb, var(--accent-soft) 80%, var(--surface));
  transform: scale(1.006);
}
.dropzone.is-drag .dropzone-icon { transform: translateY(-3px) scale(1.05); }
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 7px;
  border-radius: 17px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
.dropzone-icon svg { width: 26px; height: 26px; }
.dropzone-title { margin: 0; font-size: 0.9875rem; font-weight: 600; }
.dropzone-title .link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dropzone-hint { margin: 0; color: var(--muted); font-size: 0.8125rem; }

.upload-list { display: grid; gap: 10px; margin-top: 16px; }
.upload-item {
  display: grid;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  animation: rise-in 0.2s ease;
}
.upload-item.is-done { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); }
.upload-item.is-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.upload-item.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity 0.2s ease, transform 0.2s ease; }
.upload-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.875rem;
}
.upload-name {
  flex: 1;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-state { flex: none; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.upload-state.is-ok { color: var(--success); }
.upload-state.is-err { color: var(--danger); }
.upload-err { margin: 0; color: var(--danger); font-size: 0.8125rem; line-height: 1.5; }
.upload-actions { display: flex; justify-content: flex-end; gap: 8px; }
.upload-list:empty { display: none; }

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-alt);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(18, 21, 26, 0.12);
}
.tab svg { width: 17px; height: 17px; }
.tab-count { padding: 0 7px; border-radius: 999px; background: var(--bg-alt); color: var(--muted); font-size: 0.6875rem; font-weight: 700; line-height: 1.7; }
.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 15px;
}
.stat {
  --stat-accent: var(--accent);
  position: relative;
  display: grid;
  gap: 9px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--stat-accent) 35%, var(--line)); }
.stat::after {
  content: "";
  position: absolute;
  inset: auto -30% -70% auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--stat-accent) 14%, transparent), transparent 68%);
  pointer-events: none;
}
.stat--blue { --stat-accent: #2563eb; }
.stat--violet { --stat-accent: #7c3aed; }
.stat--amber { --stat-accent: #d97706; }
.stat--green { --stat-accent: #15803d; }
.stat--rose { --stat-accent: #db2777; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--stat-accent) 13%, transparent);
  color: var(--stat-accent);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.75rem; line-height: 1.4; }
.stat-sub b { color: var(--text); font-weight: 600; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px 26px;
  margin: 0;
}
.info-item { display: grid; gap: 2px; min-width: 0; }
.info-item dt {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.info-item dd { margin: 0; font-size: 0.9375rem; font-weight: 600; overflow-wrap: anywhere; }
.info-item dd.mono { font-weight: 500; font-size: 0.875rem; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 16px 40px -16px rgba(18, 21, 26, 0.3);
  font-size: 0.9rem;
  line-height: 1.5;
  cursor: pointer;
  pointer-events: auto;
  animation: toast-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.is-out { animation: toast-out 0.2s ease forwards; }
.toast-icon { margin-top: 1px; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-msg { flex: 1; overflow-wrap: anywhere; }
.toast--success .toast-icon { color: var(--success); }
.toast--error .toast-icon { color: var(--danger); }
.toast--warn .toast-icon { color: var(--warn); }
.toast--info .toast-icon { color: var(--info); }
.toast--error { border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 15, 18, 0.46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  animation: fade-in 0.16s ease;
}
.modal {
  width: 100%;
  max-width: 460px;
  max-height: min(88vh, 820px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.4);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.85, 0.3, 1.05);
}
.modal--wide { max-width: 560px; }
.modal--confirm { max-width: 420px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 0;
}
.modal-head .modal-titles { flex: 1; min-width: 0; }
.modal-title { margin: 0; font-size: 1.0625rem; font-weight: 700; line-height: 1.4; }
.modal-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; line-height: 1.55; }
.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 0;
  flex: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.modal-close:hover { background: var(--bg-alt); color: var(--text); }
.modal-close svg { width: 17px; height: 17px; }
.modal-body { display: grid; gap: 15px; padding: 18px 20px; }
.modal-body .form-error { margin: 0; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 20px 20px;
}
.modal-foot--between { justify-content: space-between; }
.modal-msg { margin: 0; color: var(--muted); font-size: 0.9375rem; line-height: 1.65; }
.modal-msg strong { color: var(--text); }
.modal-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.modal-icon svg { width: 23px; height: 23px; }
.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.is-warn { background: var(--warn-soft); color: var(--warn); }

/* 一次性密码展示 */
.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 12px;
  background: var(--accent-soft);
}
.secret-box code {
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.secret-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.secret-meta div { display: grid; gap: 1px; min-width: 0; }
.secret-meta dt { color: var(--muted); font-size: 0.75rem; }
.secret-meta dd { margin: 0; font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }

/* ---------- 登录页 ---------- */
.auth-page { background: var(--bg); }
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  min-height: 100vh;
}
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 44px;
  padding: clamp(28px, 4vw, 52px) clamp(28px, 4.5vw, 68px);
  overflow: hidden;
  background: linear-gradient(152deg, #06342f 0%, #0b5d57 40%, #0f766e 70%, #109e8f 100%);
  color: #f2fdfa;
}
.auth-visual::before {
  content: "";
  position: absolute;
  inset: -25% -15% auto -15%;
  height: 80%;
  background: radial-gradient(48% 58% at 32% 22%, rgba(94, 234, 212, 0.3), transparent 68%);
  pointer-events: none;
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}
.auth-orb--1 {
  right: -110px;
  bottom: -80px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle at 38% 35%, rgba(45, 212, 191, 0.4), transparent 66%);
}
.auth-orb--2 {
  top: 16%;
  right: 12%;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.14), transparent 70%);
}
.auth-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.auth-brand:hover { color: #fff; }
.auth-brand .brand-mark {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.auth-brand .brand-text small { color: rgba(255, 255, 255, 0.58); }
.auth-hero { position: relative; max-width: 520px; }
.auth-hero .eyebrow { color: #99f6e4; }
.auth-hero .eyebrow .dot { box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16); }
.auth-hero h1 {
  margin: 18px 0 16px;
  color: #fff;
  font-size: clamp(1.95rem, 3.1vw, 2.9rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
}
.auth-hero .lede {
  max-width: 42ch;
  margin-bottom: 32px;
  color: rgba(234, 253, 249, 0.76);
  font-size: 1rem;
  line-height: 1.75;
}
.auth-features { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.auth-features li { display: flex; align-items: flex-start; gap: 12px; }
.auth-features .feature-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  margin-top: 1px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #5eead4;
}
.auth-features .feature-icon svg { width: 15px; height: 15px; }
.auth-features strong { display: block; color: #fff; font-size: 0.9375rem; line-height: 1.4; }
.auth-features span {
  display: block;
  color: rgba(234, 253, 249, 0.64);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.auth-visual-foot {
  position: relative;
  color: rgba(234, 253, 249, 0.5);
  font-size: 0.8125rem;
}
.auth-form-side {
  display: grid;
  place-items: center;
  padding: clamp(26px, 5vw, 64px) clamp(20px, 4vw, 48px);
  background:
    radial-gradient(55% 45% at 85% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 424px;
  padding: clamp(24px, 3.2vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 12px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.auth-kicker .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.auth-title { margin: 0 0 6px; font-size: clamp(1.45rem, 2.4vw, 1.7rem); }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.9rem; }
.auth-card .form { gap: 16px; }
.auth-card .btn-block { min-height: 46px; margin-top: 2px; }
.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.auth-note svg { width: 16px; height: 16px; margin-top: 2px; flex: none; color: var(--accent); }
.auth-foot {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(14px); }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .quota { width: 170px; }
  .audit-detail { max-width: 240px; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { gap: 22px; padding: 26px 24px 30px; }
  .auth-hero h1 { margin: 12px 0 6px; font-size: 1.6rem; }
  .auth-hero .lede,
  .auth-features,
  .auth-visual-foot { display: none; }
  .auth-form-side { padding: 24px 20px 44px; place-items: start center; }
  .auth-card { max-width: 460px; }
}

@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; padding: 11px 18px; row-gap: 9px; min-height: 0; }
  .brand { order: 1; }
  .user-menu { order: 2; margin-left: auto; }
  .topnav { order: 3; flex: 1 1 auto; margin-left: -8px; }
  .quota { order: 4; flex: 1 1 100%; width: auto; margin-left: 0; }
  .topbar-inner { padding-bottom: 12px; }
}

@media (max-width: 720px) {
  .page { padding: 24px 16px 24px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 1.5rem; }
  .head-actions { width: 100%; }
  .topnav a { padding: 7px 11px; font-size: 0.875rem; }
  .user-name { display: none; }
  .user-btn { padding-right: 5px; }
  .modal-backdrop { padding: 12px; place-items: end center; }
  .modal { max-height: 92vh; border-radius: 18px; }
  .toast-stack { top: auto; bottom: 14px; left: 12px; right: 12px; width: auto; }
  .toast { box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.35); }
  .tabs { width: 100%; }
  .tab { flex: 1 0 auto; justify-content: center; }
  .toolbar { padding: 12px 14px; }
  .search-wrap { max-width: none; flex-basis: 100%; }
  .toolbar-right { width: 100%; margin-left: 0; }
  .toolbar-right .select-wrap { flex: 1; }
  .toolbar-right .select-wrap .select { width: 100%; }
  .card-head { padding: 14px 16px; }
  .upload-card { padding: 14px; }
  .dropzone { padding: 26px 16px; }
  .icon-btn { width: 40px; height: 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .secret-meta { grid-template-columns: 1fr; }

  /* 表格转卡片 */
  .data { display: block; }
  .data thead { display: none; }
  .data tbody { display: grid; gap: 10px; padding: 12px; }
  .data tbody tr {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .data tbody tr:hover { background: var(--surface); }
  .data tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.875rem;
    text-align: left !important;
  }
  .data tbody td:last-child { border-bottom: 0; }
  .data tbody td::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 0.8125rem;
  }
  .data tbody td.cell-main { display: block; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
  .data tbody td.cell-main::before { display: none; }
  .data tbody td.cell-actions {
    justify-content: flex-end;
    padding-top: 9px;
    border-bottom: 0;
  }
  .data tbody td.cell-actions::before { display: none; }
  .data tbody td.cell-main .file-cell,
  .data tbody td.cell-main .user-cell { align-items: center; }
  .quota-mini { min-width: 0; width: 100%; }
  .quota-mini .progress { width: 100%; }
  .audit-detail { max-width: 190px; }
  .skeleton-list { padding: 12px; }
  .sk--end { display: none; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; gap: 6px; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.75rem; }
  .stat-icon { width: 28px; height: 28px; }
  .stat-icon svg { width: 15px; height: 15px; }
  .stat-sub { font-size: 0.6875rem; }
  .topnav .nav-badge { display: none; }
}

/* ==========================================================================
   v2 · 资料库（共享空间）
   ========================================================================== */

/* 没有配额组件时（普通用户），用户菜单靠右 */
body:not(.is-admin) .topbar-inner .user-menu { margin-left: auto; }

.view { animation: fade-in 0.18s ease; }
.badge--soft { background: var(--bg-alt); color: var(--muted); }

/* ---------- 资料库列表 ---------- */
.space-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.space-card {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.space-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: var(--shadow-lg);
}
.space-card-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px;
  color: var(--text);
  text-decoration: none;
}
.space-card-link:hover { color: var(--text); }

.space-card-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--mark-a, #0b5d57), var(--mark-b, #14b8a6));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(15, 118, 110, 0.8);
}
.space-card-mark svg { width: 26px; height: 26px; }
.space-card-mark--violet { --mark-a: #5b21b6; --mark-b: #a78bfa; }
.space-card-mark--amber { --mark-a: #b45309; --mark-b: #f59e0b; }
.space-card-mark--blue { --mark-a: #1e40af; --mark-b: #60a5fa; }

.space-card-body { display: grid; gap: 4px; min-width: 0; }
.space-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.space-card-name {
  overflow: hidden;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-card-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.space-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}
.space-card-stats span { display: inline-flex; align-items: center; gap: 5px; }
.space-card-stats svg { width: 14px; height: 14px; color: var(--accent); opacity: 0.85; }
.space-card-stats b { color: var(--text); font-weight: 600; }
.space-card-arrow { color: var(--muted); transition: transform 0.18s ease, color 0.18s ease; }
.space-card-arrow svg { width: 18px; height: 18px; }
.space-card:hover .space-card-arrow { color: var(--accent); transform: translateX(2px); }

.space-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 14px 14px;
}
.space-card-actions .btn { min-height: 34px; font-size: 0.8125rem; }
.space-danger:hover {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.space-card--skeleton {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 106px;
  padding: 18px;
  box-shadow: none;
}
.space-skeleton-body { display: grid; flex: 1; gap: 9px; }

/* ---------- 资料库头部 / 面包屑 ---------- */
.space-hero {
  margin-bottom: 18px;
  padding: 20px;
  background:
    radial-gradient(90% 160% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface);
}
.space-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.space-hero-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-bright));
  color: #fff;
  box-shadow: 0 12px 24px -14px rgba(15, 118, 110, 0.9);
}
.space-hero-mark svg { width: 27px; height: 27px; }
.space-hero-text { flex: 1 1 240px; min-width: 0; }
.space-hero-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 3px 0 2px;
}
.space-hero-title-row h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
}
.space-hero-desc {
  margin: 4px 0 3px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.space-hero-desc:empty { display: none; }
.space-hero-meta { margin: 0; color: var(--muted); font-size: 0.8125rem; }
.space-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  min-height: 24px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.breadcrumb a,
.breadcrumb-current {
  display: inline-flex;
  align-items: center;
  max-width: 16ch;
  overflow: hidden;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb a:hover { background: var(--accent-soft); color: var(--accent); }
.breadcrumb-current { color: var(--text); font-weight: 600; }
.breadcrumb-sep { color: var(--line-strong); font-size: 0.75rem; user-select: none; }

/* ---------- 上传（资料库内） ---------- */
.space-upload-card { margin-bottom: 18px; }
.dropzone--compact { padding: 18px 16px; }
.dropzone--compact .dropzone-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  border-radius: 13px;
}
.dropzone--compact .dropzone-icon svg { width: 21px; height: 21px; }
.dropzone--compact .dropzone-title { font-size: 0.9375rem; }

/* ---------- 文件夹网格 ---------- */
.space-section { margin-bottom: 18px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.section-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 172px), 1fr));
  gap: 12px;
}
.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.folder-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}
.folder-card-link {
  display: grid;
  gap: 3px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.folder-card-link:hover { color: var(--text); }
.folder-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 5px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.folder-card-icon svg { width: 22px; height: 22px; }
.folder-card-name {
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-card-meta { color: var(--muted); font-size: 0.75rem; }
.folder-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 8px 8px;
}
.folder-card-actions .icon-btn { width: 32px; height: 32px; }
.folder-card-actions .icon-btn svg { width: 16px; height: 16px; }

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

/* ---------- 成员管理弹窗 ---------- */
.modal--xl { max-width: 840px; }
.members-body { gap: 14px; }
.members-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px 20px;
  color: var(--muted);
  font-size: 0.875rem;
}
.members-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: stretch;
}
.members-pane {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.members-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}
.members-pane-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
}
.members-pane-head b { color: var(--text); }
.member-list {
  display: grid;
  gap: 2px;
  align-content: start;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.member-list::-webkit-scrollbar { width: 6px; }
.member-list::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-strong); }
.member-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 10px;
}
.member-row:hover { background: var(--bg); }
.member-row-info { display: grid; flex: 1; gap: 1px; min-width: 0; line-height: 1.35; }
.member-row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
}
.member-row-name .badge { font-size: 0.6875rem; padding: 1px 7px; }
.member-row-sub {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-candidate {
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.member-candidates { gap: 1px; }
.member-candidate:hover { border-color: var(--line); background: var(--bg); }
.member-check {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.member-candidate input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.member-candidate:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}
.members-search { margin: 0; }
.members-search .input { min-height: 38px; padding-left: 34px; font-size: 0.875rem; }
.members-search .input-icon { width: 16px; height: 16px; left: 11px; }
.members-add-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.members-pane-empty {
  margin: 0;
  padding: 18px 10px;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}
.members-hint { margin-top: -2px; }

/* 弹窗打开状态（由 api.js 切换，配合 .modal 的入场动画） */
.modal-backdrop.is-open { opacity: 1; }

/* ---------- v2 响应式 ---------- */
@media (max-width: 900px) {
  .members-layout { grid-template-columns: 1fr; }
  .member-list { max-height: 240px; }
  .space-hero-actions { justify-content: flex-start; margin-left: 0; }
}

@media (max-width: 720px) {
  .space-grid { grid-template-columns: 1fr; gap: 12px; }
  .space-card-link { grid-template-columns: auto minmax(0, 1fr); padding: 15px; gap: 12px; }
  .space-card-arrow { display: none; }
  .space-card-mark { width: 46px; height: 46px; border-radius: 13px; }
  .space-card-mark svg { width: 23px; height: 23px; }
  .space-card-actions { padding: 0 12px 12px; }
  .space-hero { padding: 15px; }
  .space-hero-mark { width: 46px; height: 46px; border-radius: 13px; }
  .space-hero-mark svg { width: 23px; height: 23px; }
  .space-hero-actions { width: 100%; }
  .space-hero-actions .btn { flex: 1 1 auto; }
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .folder-card-link { padding: 12px; }
  .folder-card-icon { width: 38px; height: 38px; border-radius: 11px; }
  .folder-card-icon svg { width: 20px; height: 20px; }
  .folder-card-actions .icon-btn { width: 36px; height: 36px; }
  .breadcrumb a,
  .breadcrumb-current { max-width: 11ch; }
  .members-pane { padding: 10px; }
  .member-list { max-height: 220px; }
  .modal--xl { max-width: 100%; }
}

@media (max-width: 420px) {
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .space-card-name { font-size: 1rem; }
}

/* ---------- 管理后台：所属资料库多选 / 徽章列表 ---------- */
.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 230px;
}
.badge-list .badge { padding: 1px 8px; font-size: 0.6875rem; }

.space-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
}
.space-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.space-check:hover { border-color: var(--accent); }
.space-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.space-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--accent-soft);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  font-size: 0.875rem;
  line-height: 1.5;
  cursor: pointer;
}
.check-row input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.check-row small { display: block; font-size: 0.75rem; }

/* ==========================================================================
   v3 · 登录页（简洁版）+ 登录成功欢迎过渡
   ========================================================================== */
.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(70% 55% at 50% -12%, var(--accent-soft), transparent 72%),
    radial-gradient(40% 36% at 100% 100%, rgba(122, 92, 250, 0.055), transparent 72%),
    var(--bg);
}

/* 覆盖旧版左右分栏，改为居中单卡片 */
.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  min-height: 100vh;
  max-width: 460px;
  margin: 0 auto;
  padding: 52px 22px 36px;
  grid-template-columns: none;
}

.auth-head { display: inline-flex; align-items: center; gap: 11px; }
.auth-head .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
.auth-head-text { display: grid; line-height: 1.15; }
.auth-head-name { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; }
.auth-head-tag {
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.auth-card {
  width: 100%;
  max-width: 384px;
  padding: clamp(24px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.auth-title { margin: 0 0 6px; font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.9rem; }
.auth-card .form { gap: 15px; }
.auth-card .btn-block { min-height: 46px; margin-top: 4px; }
.auth-note {
  display: block;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.65;
}
.auth-note svg { display: none; }
.auth-foot { margin: 0; color: var(--muted); font-size: 0.75rem; text-align: center; }

/* 欢迎过渡页 */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background: linear-gradient(155deg, #06342f 0%, #0b5d57 46%, #0f766e 78%, #10a394 100%);
  color: #f2fdfa;
  animation: welcome-in 0.45s ease both;
}
.welcome[hidden] { display: none; }
.welcome-glow { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(4px); }
.welcome-glow--1 {
  top: -18%;
  right: -12%;
  width: min(560px, 90vw);
  height: min(560px, 90vw);
  background: radial-gradient(circle at 40% 40%, rgba(45, 212, 191, 0.38), transparent 65%);
}
.welcome-glow--2 {
  bottom: -16%;
  left: -10%;
  width: min(420px, 80vw);
  height: min(420px, 80vw);
  background: radial-gradient(circle at 50% 50%, rgba(94, 234, 212, 0.22), transparent 68%);
}
.welcome-inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  max-width: 560px;
  text-align: center;
  animation: welcome-rise 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.welcome-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.welcome-mark svg { width: 28px; height: 28px; }
.welcome-eyebrow {
  margin: 0;
  color: #99f6e4;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.welcome-title {
  margin: 4px 0 0;
  color: #fff;
  font-size: clamp(1.9rem, 5.5vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.welcome-sub { margin: 4px 0 0; color: rgba(236, 253, 250, 0.78); font-size: clamp(0.95rem, 2vw, 1.1rem); }
.welcome-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.welcome-chip {
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f0fdfa;
  font-size: 0.8125rem;
}
.welcome-hint { margin: 26px 0 0; color: rgba(234, 253, 249, 0.5); font-size: 0.8125rem; }
.welcome-progress {
  width: 148px;
  height: 3px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
.welcome-progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: rgba(153, 246, 228, 0.85);
  animation: welcome-progress 1.8s linear forwards;
}
body.is-welcoming { overflow: hidden; }
body.is-welcoming .auth-shell { pointer-events: none; }

@keyframes welcome-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes welcome-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes welcome-progress { from { width: 0; } to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .welcome,
  .welcome-inner,
  .welcome-progress > span { animation: none; }
  .welcome-progress > span { width: 100%; }
}

@media (max-width: 520px) {
  .auth-shell { padding: 11vh 18px 28px; }
  .auth-card { max-width: 100%; padding: 22px 20px; border-radius: 18px; }
  .auth-title { font-size: 1.35rem; }
  .auth-note { margin-top: 18px; }
  .welcome-hint { margin-top: 22px; }
}

/* ==========================================================================
   v3 · 资料库内搜索 / 我的提交 / 审核操作
   ========================================================================== */
.space-search-card { margin-bottom: 18px; padding: 12px 14px; }
.space-search-row { display: flex; align-items: center; gap: 10px; }
.space-search-wrap { flex: 1; max-width: none; }
.space-search-wrap .input { min-height: 42px; }
.space-search-row .btn { flex: none; min-height: 42px; }

.search-result-list { display: grid; }
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background 0.14s ease;
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); color: var(--text); }
.search-result-body { display: grid; flex: 1; gap: 4px; min-width: 0; }
.search-result-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.search-result-title-row .file-name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-size { margin-left: auto; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.search-result-path {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.search-result-path svg { width: 14px; height: 14px; flex: none; color: var(--accent); }
.search-result-path span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-snippet {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.search-snippet mark {
  padding: 0 1px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--warn) 26%, transparent);
  color: var(--text);
}
.search-result-download {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  color: var(--muted);
}
.search-result:hover .search-result-download { background: var(--accent-soft); color: var(--accent); }
.search-result-download svg { width: 17px; height: 17px; }

/* 我的提交弹窗 */
.modal--lg { max-width: 620px; }
.modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 0.875rem;
}
.my-uploads-body { gap: 12px; }
.my-uploads-list {
  display: grid;
  gap: 10px;
  max-height: min(52vh, 460px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.my-uploads-list::-webkit-scrollbar { width: 6px; }
.my-uploads-list::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-strong); }
.my-upload-item {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.my-upload-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.my-upload-title { display: grid; flex: 1; gap: 4px; min-width: 0; }
.my-upload-title .file-name { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.my-upload-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.75rem;
}
.my-upload-note {
  margin: 0 0 0 51px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* 审核队列操作 */
.review-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.review-actions .btn { min-height: 32px; padding: 0 12px; border-radius: 8px; font-size: 0.8125rem; }

/* 我的提交行操作（预览 + 撤回/删除） */
.my-upload-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.my-upload-actions .icon-btn { width: 34px; height: 34px; }

/* ==========================================================================
   v4 · 文件在线预览弹窗
   ========================================================================== */
.modal--preview {
  display: flex;
  flex-direction: column;
  width: min(1040px, 96vw);
  max-width: min(1040px, 96vw);
  max-height: 92vh;
  overflow: hidden;
}
.preview-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.preview-head-text { flex: 1; min-width: 0; }
.preview-title {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.preview-kind {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
}
.preview-size { color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.preview-head-actions .btn span { display: inline; }

.preview-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--surface-2);
}
.preview-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 40px 20px;
}
.preview-skeleton { display: grid; gap: 10px; width: min(420px, 82%); }
.preview-skeleton .sk { height: 14px; }
.preview-loading-text { margin: 0; color: var(--muted); font-size: 0.8125rem; }

.preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.preview-media { display: flex; justify-content: center; width: 100%; }
.preview-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}
.preview-pdf-wrap {
  width: 100%;
  height: 70vh;
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.preview-pdf { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.preview-video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  background: #000;
  box-shadow: var(--shadow-lg);
}
.preview-audio {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  padding: 40px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.preview-audio-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
}
.preview-audio-icon svg { width: 28px; height: 28px; }
.preview-audio-name { margin: 0; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.preview-audio-player { width: 100%; max-width: 460px; }

.preview-text-wrap { display: grid; gap: 8px; width: 100%; align-self: stretch; }
.preview-hint { margin: 0; color: var(--muted); font-size: 0.8125rem; }
.preview-hint--warn { color: var(--warn); }
.preview-text {
  max-height: 70vh;
  margin: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-fallback {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 46px 24px;
  text-align: center;
}
.preview-fallback-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
}
.preview-fallback-icon svg { width: 26px; height: 26px; }
.preview-fallback-title { margin: 0; font-size: 1rem; font-weight: 700; }
.preview-fallback-text { max-width: 42ch; margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.6; }
.preview-fallback .btn { margin-top: 10px; }

.preview-error {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 42px 22px;
  text-align: center;
}
.preview-error-icon { color: var(--danger); }
.preview-error-icon svg { width: 38px; height: 38px; }
.preview-error-title { margin: 0; font-size: 1rem; font-weight: 700; }
.preview-error-text { max-width: 44ch; margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.6; }
.preview-error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

@media (max-width: 720px) {
  .modal-backdrop--preview { padding: 0; place-items: stretch; }
  .modal--preview {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .preview-head { padding: 12px 14px; gap: 10px; }
  .preview-title { font-size: 0.9375rem; }
  .preview-head-actions { gap: 6px; }
  .preview-head-actions .btn { width: 40px; min-height: 40px; padding: 0; }
  .preview-head-actions .btn span { display: none; }
  .preview-body { padding: 12px; justify-content: flex-start; }
  .preview-pdf-wrap { height: calc(100dvh - 128px); min-height: 0; }
  .preview-image { max-height: calc(100dvh - 150px); }
  .preview-video { max-height: calc(100dvh - 150px); }
  .preview-text { max-height: calc(100dvh - 190px); padding: 12px; }
  .preview-audio { padding: 28px 18px; }
  .my-upload-actions { width: 100%; justify-content: flex-end; margin-top: 4px; }
}

@media (max-width: 720px) {
  .space-search-card { padding: 10px 12px; }
  .space-search-row { gap: 8px; }
  .space-search-row .btn { padding: 0 14px; }
  .search-result { padding: 12px 14px; }
  .search-result-size { display: none; }
  .search-result-title-row .file-name { font-size: 0.9375rem; }
  .my-upload-note { margin-left: 0; }
  .my-upload-head { flex-wrap: wrap; }
  .my-upload-head .file-icon { width: 36px; height: 36px; }
  .my-uploads-list { max-height: none; }
  .review-actions { width: 100%; justify-content: flex-end; }
}

