/* =============================================================
   企业级文件站 · 设计系统
   现代、克制、专业。支持亮/暗双主题，玻璃拟态 + 柔和阴影。
   ============================================================= */
:root {
  --brand: #4f7cff;
  --brand-rgb: 79, 124, 255;
  --brand-600: #3b63e0;
  --brand-700: #2f4fc4;
  --brand-soft: rgba(79, 124, 255, 0.12);
  --brand-soft-2: rgba(79, 124, 255, 0.2);

  --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .14);
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .15);
  --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .14);
  --info: #0ea5e9;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 18px;
  --radius-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, .08);
  --shadow: 0 8px 28px rgba(16, 24, 40, .10);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18);

  --t-fast: .15s cubic-bezier(.4, 0, .2, 1);
  --t: .25s cubic-bezier(.4, 0, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}

:root[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(79,124,255,.10), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(34,197,94,.08), transparent 55%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --sidebar: rgba(255, 255, 255, .72);
  --topbar: rgba(255, 255, 255, .72);
  --border: #e6eaf2;
  --border-strong: #d4dbe8;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --hover: #f1f5fb;
  --active: var(--brand-soft);
  --input-bg: #ffffff;
  --scrim: rgba(15, 23, 42, .45);
}

:root[data-theme='dark'] {
  --bg: #0b1020;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(79,124,255,.18), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(34,197,94,.10), transparent 55%);
  --surface: #141b2e;
  --surface-2: #1a2238;
  --surface-3: #212b45;
  --sidebar: rgba(20, 27, 46, .72);
  --topbar: rgba(20, 27, 46, .7);
  --border: #273150;
  --border-strong: #35426a;
  --text: #eef2fb;
  --text-2: #a9b4cc;
  --text-3: #6b7794;
  --hover: #1d2740;
  --active: var(--brand-soft-2);
  --input-bg: #0f1627;
  --scrim: rgba(2, 6, 20, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brand-soft-2); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* =================== 通用控件 =================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: all var(--t-fast); box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(var(--brand-rgb), .35); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(var(--brand-rgb), .45); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); box-shadow: none; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.success { background: var(--ok); color: #fff; border-color: transparent; }
.btn:disabled { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--radius-s); border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: all var(--t-fast);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 17px; height: 17px; }

.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  font-size: 14px; font-family: inherit; transition: all var(--t-fast); outline: none;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder { color: var(--text-3); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: var(--t); }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: var(--t); box-shadow: var(--shadow-xs); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }

.badge-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; }

.spinner { width: 18px; height: 18px; border: 2.5px solid var(--brand-soft-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== 布局 =================== */
.app-shell { display: grid; grid-template-columns: 248px 1fr; height: 100vh; overflow: hidden; }
/* 遮罩层默认不参与布局（宽屏下必须 display:none，否则会抢走网格列） */
.sidebar-scrim { display: none; }

.sidebar {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 12px;
  background: var(--sidebar); backdrop-filter: blur(18px) saturate(1.4);
  border-right: 1px solid var(--border); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff;
  font-weight: 800; font-size: 15px; box-shadow: 0 6px 16px rgba(var(--brand-rgb), .4); flex: none;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }

.nav-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-s);
  color: var(--text-2); font-weight: 600; font-size: 13.5px; transition: all var(--t-fast); position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--brand); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; background: var(--brand); border-radius: 0 3px 3px 0; }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 700; }

.quota-card { margin-top: auto; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.quota-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.quota-bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.quota-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-600)); transition: width .6s; }
.quota-bar.warn i { background: linear-gradient(90deg, var(--warn), #fb923c); }
.quota-bar.danger i { background: linear-gradient(90deg, var(--danger), #f87171); }
.quota-text { font-size: 11.5px; color: var(--text-3); margin-top: 7px; }

/* 主区 */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 22px; height: 62px; flex: none;
  background: var(--topbar); backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border); z-index: 20;
}
.topbar .mobile-menu { display: none; }
.search-box { position: relative; flex: 1; max-width: 520px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 18px; height: 18px; }
.search-box input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 13.5px; transition: all var(--t-fast); }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.user-menu { display: flex; align-items: center; gap: 9px; padding: 5px 7px 5px 5px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); transition: all var(--t-fast); }
.user-menu:hover { background: var(--hover); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.user-menu .u-name { font-size: 13px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { flex: 1; overflow-y: auto; padding: 24px; }
.page { max-width: 1360px; margin: 0 auto; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 750; letter-spacing: -.3px; }
.page-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 卡片 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-xs); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { position: relative; padding: 20px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-xs); transition: all var(--t); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; margin-bottom: 14px; }
.stat-card .ic svg { width: 23px; height: 23px; }
.stat-card .v { font-size: 27px; font-weight: 780; letter-spacing: -.5px; line-height: 1.1; }
.stat-card .l { color: var(--text-3); font-size: 12.5px; margin-top: 4px; font-weight: 600; }
.stat-card .trend { position: absolute; top: 20px; right: 20px; font-size: 12px; font-weight: 700; }
.ic.blue { background: var(--brand-soft); color: var(--brand); }
.ic.green { background: var(--ok-soft); color: var(--ok); }
.ic.orange { background: var(--warn-soft); color: var(--warn); }
.ic.red { background: var(--danger-soft); color: var(--danger); }
.ic.purple { background: rgba(139,92,246,.14); color: #8b5cf6; }
.ic.cyan { background: rgba(14,165,233,.14); color: var(--info); }

/* =================== 工具条 =================== */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.breadcrumb { display: flex; align-items: center; gap: 2px; font-size: 13.5px; flex-wrap: wrap; }
.breadcrumb a { padding: 4px 9px; border-radius: 6px; color: var(--text-2); font-weight: 600; transition: all var(--t-fast); }
.breadcrumb a:hover { background: var(--hover); color: var(--text); }
.breadcrumb a.current { color: var(--text); cursor: default; }
.breadcrumb .sep { width: auto; height: auto; background: none; color: var(--text-3); }
.view-toggle { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 3px; }
.view-toggle button { width: 30px; height: 28px; display: grid; place-items: center; border: none; background: transparent; border-radius: 6px; color: var(--text-3); }
.view-toggle button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* =================== 文件网格 =================== */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
.file-card {
  position: relative; padding: 16px 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; transition: all var(--t-fast); text-align: center;
  user-select: none;
}
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-soft-2); }
.file-card.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.file-card .thumb { width: 100%; height: 92px; display: grid; place-items: center; margin-bottom: 10px; border-radius: var(--radius-s); overflow: hidden; }
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb svg { width: 46px; height: 46px; stroke-width: 1.5; }
.file-card .fname { font-size: 12.5px; font-weight: 600; line-height: 1.4; max-height: 2.8em; overflow: hidden; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.file-card .fmeta { font-size: 11px; color: var(--text-3); margin-top: 5px; }
.file-card .pick { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); background: var(--surface); opacity: 0; transition: var(--t-fast); display: grid; place-items: center; }
.file-card:hover .pick, .file-card.selected .pick { opacity: 1; }
.file-card.selected .pick { background: var(--brand); border-color: var(--brand); }
.file-card.selected .pick svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; }
.file-card .star { position: absolute; top: 8px; right: 8px; color: var(--warn); opacity: 0; }
.file-card .star.on { opacity: 1; }
.file-card.folder .thumb svg { color: var(--brand); fill: var(--brand-soft); }

/* 文件列表 */
.file-table { width: 100%; border-collapse: collapse; }
.file-table th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 700; color: var(--text-3); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; cursor: pointer; white-space: nowrap; }
.file-table th:hover { color: var(--text); }
.file-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.file-table tr { transition: background var(--t-fast); }
.file-table tbody tr:hover { background: var(--hover); }
.file-table tr.selected { background: var(--brand-soft); }
.file-row-name { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.file-row-name . fico, .file-row-name svg { width: 22px; height: 22px; flex: none; stroke-width: 1.6; }
.file-row-name .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.row-actions { display: flex; gap: 2px; opacity: 0; transition: var(--t-fast); }
tr:hover .row-actions { opacity: 1; }

/* 文件类型配色 */
.ft-image { color: #10b981; } .ft-video { color: #8b5cf6; } .ft-audio { color: #ec4899; }
.ft-pdf { color: #ef4444; } .ft-office { color: var(--brand); } .ft-text { color: #0ea5e9; }
.ft-archive { color: #f59e0b; } .ft-other { color: #94a3b8; } .ft-folder { color: var(--brand); }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty svg { width: 72px; height: 72px; stroke-width: 1.2; opacity: .5; margin-bottom: 16px; }
.empty h4 { margin: 0 0 6px; font-size: 16px; color: var(--text-2); font-weight: 650; }
.empty p { margin: 0; font-size: 13px; }

/* =================== 模态框 =================== */
.modal-root { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.modal-scrim { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); opacity: 0; transition: opacity var(--t); pointer-events: auto; }
.modal-scrim.show { opacity: 1; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%); opacity: 0;
  width: min(540px, calc(100vw - 40px)); max-height: 88vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); transition: all var(--t); pointer-events: auto;
}
.modal.show { opacity: 1; transform: translate(-50%, -50%); }
.modal.wide { width: min(820px, calc(100vw - 40px)); }
.modal.full { width: min(1100px, calc(100vw - 40px)); height: 88vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex: none; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
/* 弹窗主体必须能伸缩（flex:1 + min-height:0），
   否则内部依赖 flex:1 的区域（如全屏预览）高度会被内容无限撑开 */
.modal-body { flex: 1 1 auto; min-height: 0; padding: 22px; overflow-y: auto; }
/* 全屏预览：主体不留内边距，改由内容自己管理滚动 */
.modal.full .modal-body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); flex: none; }

/* Toast */
.toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; animation: toastIn .3s cubic-bezier(.4,0,.2,1); max-width: 90vw; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--danger); } .toast.info svg { color: var(--info); }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px); } }

/* 右键菜单 */
.ctx-menu { position: fixed; z-index: 1500; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: fade .12s; }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.ctx-item:hover { background: var(--hover); }
.ctx-item svg { width: 16px; height: 16px; color: var(--text-2); }
.ctx-item.danger { color: var(--danger); } .ctx-item.danger svg { color: var(--danger); }
.ctx-item.is-disabled { color: var(--text-3); cursor: not-allowed; opacity: .72; }
.ctx-item.is-disabled:hover { background: transparent; }
.ctx-item.is-disabled svg { color: var(--text-3); }

/* 登录密码框：显示/隐藏密码按钮 */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap .input { padding-right: 42px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; color: var(--text-3); background: transparent;
  transition: all var(--t-fast);
}
.pw-eye:hover { background: var(--hover); color: var(--text); }
.pw-eye.on { color: var(--brand); }
.pw-eye svg { width: 16px; height: 16px; }

/* =================== 文件访问权限弹窗 =================== */
.acl-file-head { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.acl-file-head .li-title { font-weight: 700; font-size: 14px; }
.acl-file-head .li-desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.acl-grid-head, .acl-row {
  display: grid; grid-template-columns: 1fr 66px 66px 66px 34px;
  align-items: center; gap: 4px;
}
.acl-grid-head {
  font-size: 11.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 10px 6px; text-align: center;
}
.acl-grid-head span:first-child { text-align: left; }
.acl-row { padding: 7px 10px; border-radius: 8px; }
.acl-row:hover { background: var(--hover); }
.acl-row .acl-who { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; min-width: 0; }
.acl-row .switch { justify-self: center; }

/* 小号开关 */
/* 小号开关：缩小轨道与滑块（滑块位移 = 34 - 3 - 3 - 13 = 15） */
.switch.sm { width: 34px; height: 19px; }
.switch.sm i::after { width: 13px; height: 13px; top: 3px; left: 3px; }
.switch.sm input:checked + i::after { transform: translateX(15px); }

/* 卡片 / 列表上的“已加密权限”标识 */
.file-card .lock {
  position: absolute; top: 8px; left: 8px; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(0,0,0,.12));
}
.file-card .lock svg { width: 12px; height: 12px; }
.lock-inline { display: inline-flex; align-items: center; color: var(--text-3); }
.lock-inline svg { width: 13px; height: 13px; }

/* =================== 全屏水印 =================== */
.wm-layer {
  position: fixed; inset: 0; z-index: 1900;
  pointer-events: none;            /* 不拦截任何点击 */
  user-select: none;
  background-repeat: repeat;
  background-position: 0 0;
}
@media print {
  /* 打印时加强水印，防止离线留存 */
  .wm-layer { opacity: 1 !important; }
}

/* =================== 设置页：保存交互 =================== */
/* 顶部保存栏吸顶，滚动到任何位置都能点到 */
.settings-head {
  position: sticky; top: 0; z-index: 30;
  margin: -4px -4px 12px; padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
}
.save-state {
  font-size: 12px; font-weight: 600; color: var(--warn);
  display: inline-flex; align-items: center; gap: 5px; margin-right: 10px;
}
.save-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }

/* 卡片内的行内保存条 */
.inline-save {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.page-foot-save {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin: 20px 0 8px;
}

/* 水印实时预览 */
.wm-preview {
  height: 120px; border-radius: var(--radius); border: 1px solid var(--border);
  background-color: var(--surface-2);
  background-repeat: repeat;
  overflow: hidden;
  display: grid; place-items: center;
}
.wm-preview-off { color: var(--text-3); font-size: 12.5px; }

/* 代码 / 文本预览与编辑（长行换行 + 内部滚动，绝不撑破容器） */
.code-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; overflow: hidden; }
.preview-code {
  flex: 1; min-height: 0; overflow: auto;
  margin: 0; padding: 18px 20px; background: var(--surface);
  font-family: ui-monospace, Menlo, Consolas, 'Courier New', monospace;
  font-size: 12.8px; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; tab-size: 2;
}
.code-edit {
  flex: 1; min-height: 0; display: block; width: 100%; padding: 18px 20px; border: none; outline: none;
  resize: none; background: var(--surface); color: var(--text);
  font-family: ui-monospace, Menlo, Consolas, 'Courier New', monospace; font-size: 12.8px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; tab-size: 2;
}
.code-edit:focus { box-shadow: inset 0 0 0 2px var(--brand-soft-2); }

/* 音频预览 */
.audio-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 48px 20px; text-align: center; }
.audio-ic { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 24px;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-soft-2)); color: var(--brand); }
.audio-ic svg { width: 46px; height: 46px; }
.audio-name { font-size: 15px; font-weight: 600; word-break: break-all; max-width: 70%; }
.audio-stage audio { width: 460px; max-width: 92%; }
.audio-meta { font-size: 12.5px; color: var(--text-3); }

/* =================== 分享页：分享者信息 =================== */
.sharer {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sharer-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.sharer-avatar.fallback {
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-600));
}
.sharer-main { min-width: 0; }
.sharer-name { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.sharer-tag {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  color: var(--brand); background: var(--brand-soft);
}
.sharer-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 上传前配置面板里的文件清单 */
.pre-upload-list {
  max-height: 190px; overflow-y: auto; margin-top: 12px;
  padding: 6px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
}

/* =================== 个人资料 =================== */
.profile-avatar-row { display: flex; align-items: center; gap: 16px; }
.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border); background: var(--surface-2);
  display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff;
  background-image: linear-gradient(135deg, var(--brand), var(--brand-600));
}
.profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.field-locked { position: relative; }
.field-locked .input { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; padding-right: 78px; }
.field-locked .lock-tag {
  position: absolute; right: 10px; bottom: 10px; font-size: 11.5px; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 4px;
}
.field-locked .lock-tag svg { width: 12px; height: 12px; }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* 上传面板 */
.upload-dock { position: fixed; right: 24px; bottom: 24px; width: 380px; max-width: calc(100vw - 48px); z-index: 900; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-lg); overflow: hidden; animation: dockIn .3s; }
@keyframes dockIn { from { opacity: 0; transform: translateY(20px); } }
.upload-dock-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.upload-dock-head h4 { margin: 0; font-size: 13.5px; font-weight: 700; }
.upload-list { max-height: 320px; overflow-y: auto; }
.upload-item { padding: 11px 16px; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: none; }
.upload-item .ui-top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.upload-item .ui-name { font-size: 12.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .ui-pct { font-size: 11.5px; color: var(--text-3); font-weight: 700; }
.up-bar { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.up-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-600)); border-radius: 999px; transition: width .3s; }
.up-bar.done i { background: var(--ok); }
.up-bar.err i { background: var(--danger); }
.up-status { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* 拖拽覆盖层 */
.drop-overlay { position: fixed; inset: 0; z-index: 1800; background: rgba(var(--brand-rgb), .1); backdrop-filter: blur(4px); border: 3px dashed var(--brand); display: none; place-items: center; }
.drop-overlay.show { display: grid; }
.drop-inner { text-align: center; color: var(--brand); font-weight: 700; font-size: 20px; }
.drop-inner svg { width: 64px; height: 64px; margin-bottom: 14px; }

/* 预览
   关键：轨道必须用 minmax(0, 1fr) —— 否则网格项会被内容撑破
   （默认 auto 轨道 + 项 min-width/min-height:auto，长文本会把容器拉到几万像素）。 */
.preview-stage {
  flex: 1; display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0; min-width: 0;
  background: var(--surface-2);
  overflow: hidden;
}
.preview-stage.center { place-items: center; }
/* 媒体：用 100% + object-fit 保证「绝不超出容器」，同时保持比例不变形
   （max-height:100% 在网格轨道里不一定会解析，故直接给确定性尺寸） */
.preview-stage.center > video { width: 100%; height: 100%; object-fit: contain; }
.preview-stage.center > iframe { width: 100%; height: 100%; }
.preview-stage.center > img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-stage img { border-radius: var(--radius-s); box-shadow: var(--shadow); }
.preview-stage iframe { border: none; background: #fff; }

/* 数据表 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 11px 14px; font-size: 12px; font-weight: 700; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tbody tr:hover { background: var(--hover); }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.pager button { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; }
.pager button:hover:not(:disabled) { background: var(--hover); }
.pager button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; }

/* 树 */
.tree-node { user-select: none; }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); }
.tree-row:hover { background: var(--hover); color: var(--text); }
.tree-row.active { background: var(--active); color: var(--brand); font-weight: 600; }
.tree-row .caret { width: 16px; height: 16px; display: grid; place-items: center; transition: transform var(--t-fast); color: var(--text-3); }
.tree-row .caret.open { transform: rotate(90deg); }
.tree-row svg.fi { width: 17px; height: 17px; color: var(--brand); flex: none; }
.tree-children { margin-left: 16px; overflow: hidden; }

/* 登录 / 安装页 */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; animation: fade .4s; }
.auth-hero { padding: 34px 34px 24px; text-align: center; background: linear-gradient(135deg, var(--brand-soft), transparent); }
.auth-hero .brand-mark { width: 54px; height: 54px; font-size: 22px; margin: 0 auto 14px; border-radius: 15px; }
.auth-hero h1 { margin: 0; font-size: 21px; font-weight: 760; }
.auth-hero p { margin: 6px 0 0; color: var(--text-3); font-size: 13px; }
.auth-form { padding: 10px 34px 32px; }
.pw-meter { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; display: flex; gap: 3px; }
.pw-meter i { flex: 1; border-radius: 999px; background: var(--surface-3); transition: var(--t); }
.pw-meter i.on1 { background: var(--danger); } .pw-meter i.on2 { background: var(--warn); } .pw-meter i.on3 { background: var(--ok); }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row .input { flex: 1; }
.captcha-img { height: 40px; border-radius: var(--radius-s); border: 1px solid var(--border); cursor: pointer; background: var(--surface-2); }
.auth-foot { text-align: center; font-size: 12.5px; color: var(--text-3); padding: 0 34px 26px; }
.auth-foot a { color: var(--brand); font-weight: 600; cursor: pointer; }

/* 分享页 */
.share-body { min-height: 100vh; display: flex; flex-direction: column; }
.share-wrap { flex: 1; display: flex; flex-direction: column; max-width: 1000px; width: 100%; margin: 0 auto; padding: 20px; }
.share-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 24px; }
.share-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.share-foot { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 20px; }
.share-loading { flex: 1; display: grid; place-items: center; color: var(--text-3); gap: 14px; }
.share-hero { padding: 40px; text-align: center; }
.share-hero .big-ic { width: 86px; height: 86px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 22px; background: var(--brand-soft); }
.share-hero .big-ic svg { width: 44px; height: 44px; }
.share-hero h2 { margin: 0 0 6px; font-size: 22px; word-break: break-all; }
.share-hero .meta { color: var(--text-3); font-size: 13px; }
.share-lock { max-width: 340px; margin: 20px auto 0; }

/* 主题图标切换 */
.i-sun { display: none; } .i-moon { display: block; }
:root[data-theme='dark'] .i-sun { display: block; } :root[data-theme='dark'] .i-moon { display: none; }

/* 分段控制 */
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 3px; gap: 2px; }
.segment button { padding: 6px 14px; border: none; background: transparent; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.segment button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* 进度环 */
.ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; }
.ring::after { content: ''; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); }
.ring span { position: absolute; font-size: 12px; font-weight: 700; }

/* 简单条形图 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.bars .bar i { width: 100%; max-width: 30px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--brand), var(--brand-soft-2)); min-height: 3px; transition: height .5s; }
.bars .bar small { font-size: 10px; color: var(--text-3); }

/* 分割线 / 工具 */
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb16 { margin-bottom: 16px; }

/* 列表项（设置等） */
.list-item { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; }
.list-item .li-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* =================== 文件页双栏布局 =================== */
.files-layout { display: grid; grid-template-columns: 236px 1fr; gap: 18px; align-items: start; }
.tree-panel { position: sticky; top: 0; max-height: calc(100vh - 130px); display: flex; flex-direction: column; overflow: hidden; }
.tree-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.tree-scroll { overflow-y: auto; padding: 8px 6px 12px; flex: 1; }
.files-main { min-width: 0; }
.pick-check { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--brand); }
.pick-check svg { width: 15px; height: 15px; stroke-width: 3; }

@media (max-width: 1080px) {
  .files-layout { grid-template-columns: 1fr; }
  .tree-panel { position: static; max-height: 260px; }
}
@media (max-width: 820px) {
  .dash-2col { grid-template-columns: 1fr !important; }
}

/* =================== 响应式 =================== */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 268px; z-index: 100; transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .topbar .mobile-menu { display: inline-grid; }
  .sidebar-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 99; display: none; }
  .sidebar-scrim.show { display: block; }
  .search-box { max-width: none; }
  .user-menu .u-name { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .page-title { font-size: 19px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card .v { font-size: 22px; }
  .hide-sm { display: none !important; }
  .upload-dock { right: 12px; left: 12px; width: auto; bottom: 12px; }
}
