/* ============================================================
   Studio Cloud 设计系统
   深色高端风 · 玻璃拟态 · 渐变点缀 · 完整响应式
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', Roboto, sans-serif;

  --grad-a: #6e7ff3;
  --grad-b: #a855f7;
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --green: #34d399;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme='dark'] {
  --bg: #0b0d14;
  --bg-soft: #0e111a;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --surface-solid: #131725;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8eaf2;
  --text-2: #9aa0b4;
  --text-3: #5c6275;
  --input-bg: rgba(255, 255, 255, 0.05);
  --glow: radial-gradient(60% 50% at 20% 0%, rgba(110, 127, 243, 0.14), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, rgba(168, 85, 247, 0.1), transparent 70%);
}

[data-theme='light'] {
  --bg: #f4f5fa;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-hover: #f6f7fc;
  --surface-solid: #ffffff;
  --border: rgba(20, 25, 45, 0.08);
  --border-strong: rgba(20, 25, 45, 0.16);
  --text: #1a1e2e;
  --text-2: #5a6076;
  --text-3: #9298ad;
  --input-bg: #f2f3f9;
  --glow: radial-gradient(60% 50% at 20% 0%, rgba(110, 127, 243, 0.08), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, rgba(168, 85, 247, 0.06), transparent 70%);
  --shadow: 0 8px 32px rgba(30, 35, 60, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--glow);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

::selection { background: rgba(110, 127, 243, 0.35); }

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

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  user-select: none;
  text-decoration: none;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }

.btn.primary {
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  border: none;
  color: #fff;
  box-shadow: 0 4px 18px rgba(110, 127, 243, 0.35);
}
.btn.primary:hover { box-shadow: 0 6px 26px rgba(140, 100, 247, 0.5); filter: brightness(1.08); }

.btn.danger { color: var(--rose); }
.btn.danger:hover { background: rgba(244, 63, 94, 0.1); border-color: rgba(244, 63, 94, 0.3); }

.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.mini-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  border-radius: 8px;
  padding: 2px 9px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

/* ---------------- 输入 ---------------- */
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: all 0.2s var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--grad-a);
  box-shadow: 0 0 0 3px rgba(110, 127, 243, 0.18);
}
input::placeholder { color: var(--text-3); }

/* ============================================================
   登录页
   ============================================================ */
.auth-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: float 12s ease-in-out infinite;
}
.blob-a { width: 480px; height: 480px; background: rgba(110, 127, 243, 0.35); top: -140px; left: -120px; }
.blob-b { width: 420px; height: 420px; background: rgba(168, 85, 247, 0.28); bottom: -120px; right: -100px; animation-delay: -6s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(30px, -30px) scale(1.06); } }
.auth-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: 0.5;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 44px 40px 32px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: riseIn 0.6s var(--ease);
  text-align: center;
}
@keyframes riseIn { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }

.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; filter: drop-shadow(0 6px 20px rgba(110, 127, 243, 0.45)); }
.auth-title { font-size: 24px; font-weight: 700; letter-spacing: 0.5px; }
.auth-sub { color: var(--text-2); font-size: 13.5px; margin: 8px 0 28px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 12.5px; color: var(--text-2); font-weight: 500; margin-left: 2px; }
.field input { width: 100%; padding: 11px 14px; }

.auth-error { color: var(--rose); font-size: 12.5px; min-height: 18px; text-align: center; }

.auth-switch { margin-top: 20px; font-size: 13.5px; color: var(--text-2); }
.auth-switch a { color: var(--grad-a); font-weight: 600; text-decoration: none; margin-left: 6px; }
.auth-switch a:hover { text-decoration: underline; }
.auth-note { margin-top: 14px; font-size: 12px; color: var(--text-3); }

/* ============================================================
   主应用布局
   ============================================================ */
.app-view { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-solid) 60%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 20px 16px;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-name { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-close { display: none; }

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-align: left;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(110, 127, 243, 0.18), rgba(168, 85, 247, 0.14));
  color: var(--text);
  border: 1px solid rgba(110, 127, 243, 0.25);
}
.nav-count { font-style: normal; font-size: 11.5px; color: var(--text-3); background: var(--surface); padding: 1px 7px; border-radius: 20px; }

.nav-sep {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 6px 8px;
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.nav-sep .mini-btn { font-size: 14px; line-height: 1.4; padding: 0 8px; }

.cat-list { display: flex; flex-direction: column; gap: 3px; }
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
  position: relative;
}
.cat-item:hover { background: var(--surface-hover); color: var(--text); }
.cat-item.active { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.cat-name { flex: 1; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 11px; color: var(--text-3); }
.cat-edit {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  display: flex;
}
.cat-item:hover .cat-edit { opacity: 1; }
.cat-edit:hover { color: var(--text); background: var(--surface-hover); }
.cat-edit svg { width: 14px; height: 14px; }

.sidebar-footer { display: flex; flex-direction: column; gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.storage-box { padding: 0 4px; }
.storage-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); margin-bottom: 7px; }
.storage-top b { color: var(--text); font-weight: 600; }
.storage-bar { height: 6px; border-radius: 6px; background: var(--surface); overflow: hidden; }
.storage-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  transition: width 0.8s var(--ease);
}

.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: var(--surface); }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { display: block; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 主区 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }

.search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  transition: all 0.2s var(--ease);
}
.search:focus-within { border-color: var(--grad-a); box-shadow: 0 0 0 3px rgba(110, 127, 243, 0.15); }
.search svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.search input { flex: 1; border: none; background: transparent; padding: 9px 0; box-shadow: none !important; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------------- 统计卡片 ---------------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 28px 8px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.25s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.c-blue { background: rgba(110, 127, 243, 0.15); color: var(--grad-a); }
.c-violet { background: rgba(168, 85, 247, 0.14); color: #b472f5; }
.c-cyan { background: rgba(34, 211, 238, 0.13); color: var(--cyan); }
.c-amber { background: rgba(245, 158, 11, 0.14); color: var(--amber); }
.c-rose { background: rgba(244, 63, 94, 0.13); color: var(--rose); }
.c-green { background: rgba(52, 211, 153, 0.13); color: var(--green); }
.stat-meta span { display: block; font-size: 12px; color: var(--text-2); }
.stat-meta b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- 文件区 ---------------- */
.files-section { padding: 16px 28px 60px; }
.files-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 18px; }
.files-toolbar h2 { font-size: 17px; font-weight: 700; }
.sort-box select { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.files-grid.list-mode { grid-template-columns: 1fr; gap: 8px; }

.file-card {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px 16px 13px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  animation: cardIn 0.4s var(--ease) both;
  overflow: hidden;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.file-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); background: var(--surface-hover); }

.file-card .file-more {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
}
.file-card:hover .file-more { opacity: 1; }
.file-more:hover { background: var(--surface); color: var(--text); }
.file-more svg { width: 16px; height: 16px; }

.file-thumb {
  height: 110px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.file-thumb .type-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.type-icon svg { width: 22px; height: 22px; }

.file-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  padding-right: 26px;
}
.file-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.file-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  padding: 1px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  max-width: 100px;
  overflow: hidden;
  white-space: nowrap;
}
.file-tag i { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* 列表视图 */
.files-grid.list-mode .file-card { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.files-grid.list-mode .file-thumb { height: 44px; width: 44px; margin: 0; border-radius: 10px; flex-shrink: 0; }
.files-grid.list-mode .file-thumb .type-icon { width: 44px; height: 44px; border-radius: 10px; }
.files-grid.list-mode .file-thumb .type-icon svg { width: 20px; height: 20px; }
.files-grid.list-mode .file-name { flex: 1; margin: 0; padding: 0; }
.files-grid.list-mode .file-meta { margin-left: auto; flex-shrink: 0; }
.files-grid.list-mode .file-card:hover .file-more { opacity: 1; }

/* 空状态 */
.empty-state { text-align: center; padding: 70px 20px; animation: riseIn 0.5s var(--ease); }
.empty-art {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(110, 127, 243, 0.14), rgba(168, 85, 247, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grad-a);
}
.empty-art svg { width: 38px; height: 38px; }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { color: var(--text-2); font-size: 13.5px; }

.load-more { text-align: center; margin-top: 24px; }

/* 骨架屏 */
.skeleton {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  height: 210px;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ============================================================
   拖拽上传遮罩
   ============================================================ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.drop-box {
  border: 2px dashed var(--grad-a);
  border-radius: 24px;
  padding: 60px 80px;
  text-align: center;
  color: var(--grad-a);
  animation: riseIn 0.3s var(--ease);
}
.drop-box svg { width: 54px; height: 54px; margin-bottom: 12px; }
.drop-box p { color: var(--text); font-size: 16px; font-weight: 600; }

/* ============================================================
   上传进度面板
   ============================================================ */
.upload-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  width: 340px;
  max-width: calc(100vw - 40px);
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: riseIn 0.35s var(--ease);
}
.upload-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
}
.upload-panel-actions { display: flex; gap: 6px; }
.upload-panel-body { max-height: 260px; overflow-y: auto; padding: 6px 0; }
.upload-panel-body.collapsed { display: none; }

.upload-item { padding: 10px 16px; display: flex; flex-direction: column; gap: 6px; }
.upload-item-top { display: flex; justify-content: space-between; font-size: 12.5px; gap: 10px; }
.upload-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.upload-item-status { color: var(--text-3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.upload-item-status.done { color: var(--green); }
.upload-item-status.error { color: var(--rose); }
.upload-progress { height: 4px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.upload-progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--grad-a), var(--grad-b)); transition: width 0.25s; border-radius: 4px; }
.upload-progress i.indeterminate {
  width: 40% !important;
  animation: indet 1.2s ease-in-out infinite;
  background: linear-gradient(90deg, var(--grad-a), var(--cyan));
}
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* ============================================================
   模态框
   ============================================================ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 7, 14, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 26px;
  animation: riseIn 0.3s var(--ease);
}
.modal.wide { max-width: 900px; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.modal .field textarea { min-height: 80px; resize: vertical; }
.modal-hint { font-size: 12px; color: var(--text-3); }

/* 下拉菜单 */
.ctx-menu {
  position: fixed;
  z-index: 400;
  min-width: 170px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  animation: menuIn 0.18s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: scale(0.95) translateY(-4px); } }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.ctx-item:hover { background: var(--surface-hover); }
.ctx-item.danger { color: var(--rose); }
.ctx-item.danger:hover { background: rgba(244, 63, 94, 0.1); }
.ctx-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }

/* 分享链接盒 */
.share-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 14px;
}
.share-box span { flex: 1; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--surface-hover);
  border: 1px solid var(--border-strong);
  transition: all 0.25s var(--ease);
}
.switch i::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--text-2);
  transition: all 0.25s var(--ease);
}
.switch input:checked + i { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); border-color: transparent; }
.switch input:checked + i::before { transform: translateX(18px); background: #fff; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--input-bg); border-radius: var(--radius-sm); }
.switch-row .switch-text b { display: block; font-size: 13.5px; font-weight: 600; }
.switch-row .switch-text span { font-size: 12px; color: var(--text-3); }

/* 选择卡片（有效期） */
.option-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.option-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  padding: 9px 4px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s var(--ease);
}
.option-card:hover { border-color: var(--border-strong); color: var(--text); }
.option-card.active {
  border-color: var(--grad-a);
  background: linear-gradient(135deg, rgba(110, 127, 243, 0.16), rgba(168, 85, 247, 0.12));
  color: var(--text);
  font-weight: 600;
}

/* 预览模态 */
.preview-modal { max-width: min(960px, 96vw); height: min(86vh, 800px); padding: 0; display: flex; flex-direction: column; }
.preview-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.preview-head .p-name { flex: 1; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-body video, .preview-body audio { max-width: 88%; max-height: 88%; }
.preview-body iframe { width: 100%; height: 100%; border: none; background: #fff; }
.preview-body .text-view {
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 24px 30px;
  font-family: 'SF Mono', 'Cascadia Code', Consolas, 'Noto Sans SC', monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  color: #d8dcea;
  background: transparent;
}

/* ============================================================
   Toast
   ============================================================ */
.toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 11px 18px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s var(--ease);
  max-width: min(480px, 90vw);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.96); } }
.toast i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.success i { background: var(--green); box-shadow: 0 0 10px var(--green); }
.toast.error i { background: var(--rose); box-shadow: 0 0 10px var(--rose); }
.toast.info i { background: var(--grad-a); box-shadow: 0 0 10px var(--grad-a); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s;
  }
  .sidebar-close { display: inline-flex; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 8px; }
  .files-section { padding: 14px 14px 90px; }
  .stats-row { padding: 18px 14px 4px; gap: 10px; }
  .upload-btn-text { display: none; }
  #uploadBtn span { display: none; }
  #uploadBtn { padding: 10px 12px; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

@media (max-width: 560px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat-icon svg { width: 16px; height: 16px; }
  .stat-meta b { font-size: 15px; }
  .search { display: none; }
  .files-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-panel { right: 12px; bottom: 12px; }
  .modal { padding: 20px; }
  .files-grid.list-mode .file-meta { display: none; }
}
