/* ============================================================
   云盘 WebDisk UI (web-v2)
   风格:清爽网盘 · 中文习惯 · 渐变点缀
   支持主题:浅色 / 深色 / 自动跟随系统
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- 浅色主题(默认) ---------- */
:root {
  --bg: #f3f5fa;
  --bg-2: #f4f6fb;        /* 悬停背景 */
  --bg-3: #fafbfe;        /* 次级背景(表头等) */
  --bg-4: #f7f9ff;        /* 行悬停 */
  --panel: #ffffff;
  --panel-2: #fbfcfe;     /* 卡片次级 */
  --border: #e7eaf3;
  --border-soft: #eef1f8;
  --text: #23262f;
  --text-2: #4b5263;
  --muted: #98a0b3;
  --primary: #4e6ef2;
  --primary-2: #3a55d6;
  --primary-soft: #eef2ff;
  --grad: linear-gradient(135deg, #4e6ef2 0%, #7c6cf0 55%, #a06cf0 100%);
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --ok: #1fa66e;
  --ok-soft: #e7f7ef;
  --warn: #f59e0b;
  --warn-soft: #fdf3e0;
  --radius: 12px;
  --radius-s: 8px;
  --shadow-sm: 0 1px 2px rgba(24,32,64,.05), 0 2px 8px rgba(24,32,64,.05);
  --shadow-md: 0 6px 24px rgba(24,32,64,.10);
  --shadow-lg: 0 18px 48px rgba(24,32,64,.16);
  --input-bg: #fbfcfe;
  --input-focus-bg: #fff;
  --focus-ring: rgba(78,110,242,.14);
  --tile-bg: radial-gradient(120% 120% at 20% 10%, #eef2ff 0%, #e6ebfa 60%, #dde4f7 100%);
  --tile-dir-bg: radial-gradient(120% 120% at 20% 10%, #fff8ec 0%, #fdf0da 60%, #fbecd0 100%);
  --tile-music-bg: radial-gradient(120% 120% at 20% 10%, #f0faff 0%, #e4f4fd 60%, #d9eefa 100%);
  --tile-video-bg: radial-gradient(120% 120% at 20% 10%, #f6f0ff 0%, #efe4fd 60%, #e6d9fb 100%);
  --tile-archive-bg: radial-gradient(120% 120% at 20% 10%, #fff8f0 0%, #fdeedd 60%, #fbe6cd 100%);
  --tile-doc-bg: radial-gradient(120% 120% at 20% 10%, #f0f9ff 0%, #e2f2fd 60%, #d4eaf7 100%);
  --login-bg:
    radial-gradient(880px 420px at 12% -8%, rgba(124,108,240,.22), transparent 60%),
    radial-gradient(760px 420px at 108% 12%, rgba(78,110,242,.18), transparent 60%),
    radial-gradient(640px 460px at 50% 118%, rgba(79,141,255,.16), transparent 60%),
    #f4f6fc;
  --login-card-bg: rgba(255,255,255,.92);
  --login-card-border: rgba(255,255,255,.85);
  --login-hero-bg:
    radial-gradient(900px 520px at 20% 0%, rgba(124,108,240,.35), transparent 65%),
    radial-gradient(720px 460px at 90% 30%, rgba(78,110,242,.28), transparent 65%),
    radial-gradient(680px 520px at 50% 110%, rgba(160,108,240,.22), transparent 65%),
    linear-gradient(135deg, #4e6ef2 0%, #6a6cf0 50%, #8a6cf0 100%);
  --code-bg: #0d1226;
  --code-fg: #e6e9f5;
  --mask-bg: rgba(16,19,34,.66);
  --pv-meta-bg: rgba(12,16,32,.55);
  --pv-textarea-bg: #0d1226;
}

/* ---------- 深色主题 ---------- */
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1a1f29;
  --bg-4: #1c2230;
  --panel: #161b22;
  --panel-2: #1a1f29;
  --border: #2a313c;
  --border-soft: #21262d;
  --text: #e6edf3;
  --text-2: #adbac7;
  --muted: #768390;
  --primary: #6b8df8;
  --primary-2: #5a7be9;
  --primary-soft: rgba(107,141,248,.14);
  --grad: linear-gradient(135deg, #6b8df8 0%, #8a78f0 55%, #a878f0 100%);
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,.12);
  --ok: #4ade80;
  --ok-soft: rgba(74,222,128,.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.2);
  --shadow-md: 0 6px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.55);
  --input-bg: #1a1f29;
  --input-focus-bg: #1c2230;
  --tile-bg: radial-gradient(120% 120% at 20% 10%, #1a2240 0%, #161e36 60%, #131a30 100%);
  --tile-dir-bg: radial-gradient(120% 120% at 20% 10%, #2a2418 0%, #241e14 60%, #1f1a10 100%);
  --tile-music-bg: radial-gradient(120% 120% at 20% 10%, #0f2830 0%, #0e2228 60%, #0c1e24 100%);
  --tile-video-bg: radial-gradient(120% 120% at 20% 10%, #1f1830 0%, #1a1430 60%, #151028 100%);
  --tile-archive-bg: radial-gradient(120% 120% at 20% 10%, #2a2014 0%, #241c10 60%, #1f180c 100%);
  --tile-doc-bg: radial-gradient(120% 120% at 20% 10%, #0f2230 0%, #0c1e2a 60%, #0a1a26 100%);
  --login-bg:
    radial-gradient(880px 420px at 12% -8%, rgba(124,108,240,.18), transparent 60%),
    radial-gradient(760px 420px at 108% 12%, rgba(78,110,242,.14), transparent 60%),
    radial-gradient(640px 460px at 50% 118%, rgba(79,141,255,.12), transparent 60%),
    #0a0e14;
  --login-card-bg: rgba(22,27,34,.92);
  --login-card-border: rgba(255,255,255,.06);
  --login-hero-bg:
    radial-gradient(900px 520px at 20% 0%, rgba(124,108,240,.45), transparent 65%),
    radial-gradient(720px 460px at 90% 30%, rgba(78,110,242,.35), transparent 65%),
    radial-gradient(680px 520px at 50% 110%, rgba(160,108,240,.28), transparent 65%),
    linear-gradient(135deg, #2a3a8e 0%, #3a3a8e 50%, #4a2a8e 100%);
  --code-bg: #050810;
  --code-fg: #d8def0;
  --mask-bg: rgba(0,0,0,.72);
  --pv-meta-bg: rgba(0,0,0,.65);
  --pv-textarea-bg: #050810;
  --focus-ring: rgba(107,141,248,.22);
  color-scheme: dark;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--muted); opacity: .8; }

[data-theme="dark"] ::selection { background: rgba(107,141,248,.32); }

/* 滚动条深色 */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2f3845; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background-color: #3a4555; }

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: inherit; }
a { color: var(--primary); text-decoration: none; }
#app { height: 100%; display: flex; flex-direction: column; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring, rgba(78,110,242,.12)); }
::selection { background: rgba(78,110,242,.18); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-s);
  padding: 9px 18px; font-size: 14px; font-weight: 500;
  transition: all .15s ease; box-shadow: 0 2px 8px rgba(78,110,242,.28);
}
.btn:hover { background: var(--primary-2); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(78,110,242,.34); }
.btn:active { transform: translateY(0); }
.btn.full { width: 100%; margin-top: 22px; }
.btn.ghost { background: var(--panel); color: var(--primary); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn.danger { background: var(--danger); box-shadow: 0 2px 8px rgba(229,72,77,.25); }
.btn.danger:hover { background: #d13b40; box-shadow: 0 4px 14px rgba(229,72,77,.32); }
.btn.mini { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ---------- 通用 UI 图标(线性,继承 currentColor) ---------- */
.ui-ico { width: 16px; height: 16px; display: inline-block; vertical-align: middle; flex: none; }
.btn .ui-ico { width: 14px; height: 14px; }
.btn.mini .ui-ico { width: 13px; height: 13px; }
.ctx-ico .ui-ico { width: 15px; height: 15px; }
.share-item .ico { display: inline-flex; align-items: center; justify-content: center; width: 22px; flex: none; }
.share-item .ico .ui-ico { width: 17px; height: 17px; }
.login-card .f-ico .ui-ico { width: 16px; height: 16px; }
.admin-nav .nav-item .ui-ico { width: 15px; height: 15px; }
.brand .ui-ico { width: 18px; height: 18px; }
.empty .empty-ico { display: inline-flex; align-items: center; justify-content: center; opacity: .55; color: var(--muted); }
.empty .empty-ico .ui-ico { width: 54px; height: 54px; }
.modal .close { display: inline-flex; align-items: center; justify-content: center; }
.modal .close .ui-ico { width: 18px; height: 18px; }
.pv-nav .btn .ui-ico { width: 14px; height: 14px; }
.up-head .ui-ico { width: 15px; height: 15px; }
.hb-list .ui-ico { width: 15px; height: 15px; flex: none; }
.tile-act .ui-ico { width: 14px; height: 14px; }
.foot-btns .btn { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- 登录页(分屏:左品牌 + 右表单) ---------- */
.login-page {
  flex: 1; display: flex; min-height: 100vh; position: relative; overflow: hidden;
  background: var(--login-bg);
}
.login-page .bg-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; z-index: 0; }
.login-page .bg-orb.o1 { width: 380px; height: 380px; background: rgba(124,108,240,.32); top: -120px; left: -80px; }
.login-page .bg-orb.o2 { width: 320px; height: 320px; background: rgba(78,110,242,.28); bottom: -100px; right: 12%; }
.login-page .bg-orb.o3 { width: 280px; height: 280px; background: rgba(160,108,240,.22); top: 30%; right: -60px; }

/* 左侧品牌区 */
.login-hero {
  flex: 1.05; position: relative; padding: 56px 64px; display: flex; flex-direction: column;
  justify-content: space-between; color: #fff; z-index: 1;
  background: var(--login-hero-bg); overflow: hidden;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 10c-16 0-30 12-30 28 0 4 1 8 2 11l-3 9 9-3c4 1 8 2 12 1-2-3-3-7-3-11 0-9 7-16 16-16s16 7 16 16-7 16-16 16c-3 0-6-1-9-2 1 4 0 8-2 11 4 1 8 2 12 2 16 0 30-12 30-28S56 10 40 10z' fill='%23ffffff' opacity='.04'/%3E%3C/svg%3E");
  background-size: 80px 80px; opacity: .8;
}
.login-hero .hero-top { display: flex; align-items: center; gap: 12px; }
.login-hero .hero-mark {
  width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.16); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.login-hero .hero-brand { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.login-hero .hero-mid { position: relative; }
.login-hero .hero-title { font-size: 36px; font-weight: 800; line-height: 1.25; margin-bottom: 14px; letter-spacing: 1px; }
.login-hero .hero-title .accent {
  background: linear-gradient(135deg, #fff 0%, #c8d4ff 100%); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
}
.login-hero .hero-sub { font-size: 15px; color: rgba(255,255,255,.78); line-height: 1.7; max-width: 460px; margin-bottom: 36px; }
.login-hero .features { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.login-hero .feature { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,.92); }
.login-hero .feature .fic {
  width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.14); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; flex: none;
}
.login-hero .feature .fic .ui-ico { width: 18px; height: 18px; color: #fff; }
.login-hero .feature b { font-weight: 600; }
.login-hero .feature .fdesc { color: rgba(255,255,255,.65); font-size: 13px; margin-left: 4px; }
.login-hero .hero-foot { font-size: 12px; color: rgba(255,255,255,.55); }

/* 右侧表单区 */
.login-side {
  flex: 1; display: flex; flex-direction: column; padding: 32px 56px; position: relative; z-index: 1;
  background: transparent;
}
.login-side .side-top { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: auto; }
.login-side .side-mid { display: flex; align-items: center; justify-content: center; flex: 1; padding: 20px 0; }
.login-card {
  width: 380px; max-width: 100%;
  background: var(--login-card-bg); backdrop-filter: blur(14px);
  border: 1px solid var(--login-card-border);
  border-radius: 18px; padding: 38px 34px 30px;
  box-shadow: var(--shadow-lg);
  animation: rise .4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 54px; height: 54px; margin: 0 0 18px; border-radius: 16px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff;
  box-shadow: 0 8px 20px rgba(94,102,240,.35);
}
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .fld { position: relative; margin-bottom: 14px; }
.login-card .fld .f-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: inline-flex; }
.login-card label { display: block; font-size: 12.5px; color: var(--text-2); margin: 12px 0 6px; font-weight: 500; }
.login-card .fld input {
  width: 100%; padding: 11px 12px 11px 40px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 14px;
  background: var(--input-bg); color: var(--text); transition: all .15s;
}
.login-card .fld input:focus { background: var(--input-focus-bg); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,141,248,.12); }
.captcha-row { display: flex; align-items: center; gap: 10px; }
.captcha-row img { height: 42px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; background: #fff; }
.login-card .login-actions { margin-top: 22px; }
.login-card .btn.full { width: 100%; margin-top: 0; padding: 11px; font-size: 14.5px; font-weight: 600; }
.login-card .divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.login-card .divider::before, .login-card .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-card .guest-link {
  display: block; text-align: center; font-size: 13px; color: var(--text-2); padding: 9px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .15s; background: transparent;
}
.login-card .guest-link:hover { background: var(--bg-2); color: var(--primary); border-color: var(--primary); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 12px; text-align: center; }

/* ---------- 主题切换器 ---------- */
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px;
  box-shadow: var(--shadow-sm);
}
.theme-switch .ts-btn {
  width: 30px; height: 28px; border: none; background: transparent; color: var(--muted);
  border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.theme-switch .ts-btn:hover { color: var(--text-2); background: var(--bg-2); }
.theme-switch .ts-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(107,141,248,.35); }
.theme-switch .ts-btn .ui-ico { width: 15px; height: 15px; }
.theme-switch .ts-label { font-size: 12px; color: var(--muted); padding: 0 8px 0 6px; user-select: none; }
.captcha-row .btn { flex-shrink: 0; }

/* ---------- 外壳 ---------- */
.shell { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 232px; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 5;
}
.sidebar .brand {
  padding: 18px 16px 14px; display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: var(--text);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(94,102,240,.35);
}
.brand-name { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar .brand .me {
  margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400;
  background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; -webkit-text-fill-color: currentColor;
}
.side-title { padding: 14px 16px 6px; font-size: 12px; color: var(--muted); }
.share-list { flex: 1; overflow-y: auto; padding: 2px 10px 10px; }
.share-item {
  padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14px; color: var(--text-2);
  transition: all .13s ease; margin-bottom: 2px; position: relative;
}
.share-item:hover { background: var(--bg-2); }
.share-item.active { background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }
.share-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--primary); border-radius: 3px;
}
.share-item .ico { font-size: 16px; width: 22px; text-align: center; }
.share-badge {
  margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 6px;
  background: var(--bg-2); color: var(--muted); flex: none;
}
.sidebar .foot {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.sidebar .foot .who {
  font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  width: 100%; margin-bottom: 4px;
}
.who-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--grad);
  color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.foot-btns { display: flex; gap: 8px; width: 100%; }
.foot-btns .btn { flex: 1; }
.foot-theme { margin-top: 8px; display: flex; justify-content: center; }
.foot-theme .theme-switch { width: 100%; justify-content: space-between; }
.foot-theme .ts-btn { flex: 1; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; background: var(--panel);
  border-bottom: 1px solid var(--border); padding: 12px 18px; flex-wrap: wrap;
  box-shadow: 0 1px 0 rgba(24,32,64,.02);
}
.toolbar .crumb { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.toolbar .crumb a { color: var(--primary); cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.toolbar .crumb a:hover { background: var(--primary-soft); }
.toolbar .crumb .sp { color: var(--muted); font-size: 12px; }
.toolbar .spacer { flex: 1; }
.search-box {
  width: 200px; padding: 8px 12px 8px 34px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; color: var(--text); background: var(--input-bg) no-repeat 10px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2398a0b3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.4-4.4'/%3E%3C/svg%3E");
  transition: all .15s;
}
.search-box:focus { width: 240px; background-color: var(--input-focus-bg); }
.btn-upload {
  background: var(--grad); border: none; color: #fff; font-weight: 600;
  padding: 9px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 14px rgba(94,102,240,.35); transition: all .15s ease;
}
.btn-upload:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(94,102,240,.44); }

/* ---------- 视图切换 + 排序 ---------- */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--input-bg); }
.view-switch .btn { border: 0; border-radius: 0; background: transparent; color: var(--muted); box-shadow: none; padding: 6px 12px; }
.view-switch .btn:hover { background: var(--primary-soft); color: var(--primary); transform: none; }
.view-switch .btn.active { background: var(--primary); color: #fff; }
.sort-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 12px; background: var(--panel); color: var(--text); }

/* ---------- 选中操作栏 ---------- */
.selbar {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel-2); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(78,110,242,.10);
}
.selbar.hidden { display: none; }
.sb-count { font-size: 13px; color: var(--text-2); }
.sb-count b { color: var(--primary); margin: 0 3px; font-size: 15px; }
.sb-sep { width: 1px; height: 20px; background: var(--border); }

/* ---------- 文件区 ---------- */
.files { flex: 1; overflow-y: auto; padding: 18px 20px 60px; }
.files.drag-over { outline: 2px dashed var(--primary); outline-offset: -8px; background: rgba(107,141,248,.06); border-radius: 14px; }
.files .empty {
  padding: 70px 20px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.files .center { padding: 60px; display: flex; justify-content: center; }
.filtered-empty { color: var(--primary) !important; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px;
}
.tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; position: relative; user-select: none; overflow: hidden;
  aspect-ratio: 1 / 1;
  transition: all .18s ease; box-shadow: var(--shadow-sm);
}
.tile:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--primary); }
.tile .thumb {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  background: var(--tile-bg);
}
.tile.dir .thumb { background: var(--tile-dir-bg); }
.tile.music .thumb { background: var(--tile-music-bg); }
.tile.video .thumb { background: var(--tile-video-bg); }
.tile.archive .thumb { background: var(--tile-archive-bg); }
.tile.doc .thumb { background: var(--tile-doc-bg); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .tfb { display: none; font-size: 44px; }
.tile .thumb.fail img { display: none; }
.tile .thumb.fail .tfb { display: block; }
.tile .tname {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 26px 10px 7px; font-size: 12.5px; color: #fff; text-align: center;
  background: linear-gradient(to top, rgba(12,16,32,.82), rgba(12,16,32,.35) 55%, transparent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile .tmeta {
  position: absolute; top: 9px; left: 9px; z-index: 1;
  font-size: 10px; color: #fff;
  background: rgba(12,16,32,.42); padding: 2px 8px; border-radius: 9px;
  backdrop-filter: blur(4px);
}
.tile-actions {
  position: absolute; right: 10px; top: 46%; z-index: 3;
  display: flex; flex-direction: column; gap: 6px; opacity: 0; transform: translateY(4px);
  transition: all .18s ease;
}
.tile:hover .tile-actions { opacity: 1; transform: none; }
.tile-act {
  width: 30px; height: 30px; border-radius: 50%; border: none; font-size: 14px;
  background: var(--panel); color: var(--text-2);
  box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tile-act:hover { background: var(--primary); color: #fff; }

/* 选中高亮 */
.tile.sel, .ftr.sel { outline: 2px solid var(--primary); outline-offset: -2px; border-color: var(--primary); }
.ftr.sel td { background: var(--primary-soft); }
.ftr.sel td.fname { color: var(--primary); }

/* 复选框 */
.sel-cb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin: 0; cursor: pointer; flex: none;
  background: var(--panel); border: 1.5px solid var(--border); border-radius: 6px;
  transition: all .12s; position: relative; box-shadow: var(--shadow-sm);
}
.sel-cb:hover { border-color: var(--primary); }
.sel-cb input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.tile.sel .sel-cb, .files-table .ftr.sel .sel-cb, .sel-cb.checked { background: var(--primary); border-color: var(--primary); }
.tile.sel .sel-cb::after, .ftr.sel .sel-cb::after, .sel-cb.checked::after { content: "✓"; font-size: 12px; color: #fff; line-height: 1; }
.tile .sel-cb { position: absolute; top: 10px; right: 10px; z-index: 2; }
.files-table .sel-cb { margin-right: 12px; }

/* 列表视图 */
.files-view-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.list-caption {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  font-size: 12px; color: var(--muted); background: var(--bg-3); border-bottom: 1px solid var(--border-soft);
}
table.files-table { width: 100%; border-collapse: collapse; }
table.files-table th, table.files-table td { padding: 11px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
table.files-table th { background: var(--bg-3); color: var(--muted); font-weight: 600; font-size: 12px; }
table.files-table tr { transition: background .12s; }
table.files-table tr:last-child td { border-bottom: none; }
table.files-table tr:hover td { background: var(--bg-4); }
table.files-table .fname { cursor: pointer; display: flex; align-items: center; gap: 10px; }
.files-table .fdate { color: var(--muted); font-size: 12px; }
.files-table .f-ico { font-size: 17px; width: 24px; text-align: center; }
.files-table .f-ico .fico { width: 21px; height: 21px; vertical-align: middle; }
.tile .thumb .fico { width: 92px; height: 92px; filter: drop-shadow(0 6px 10px rgba(24,32,64,.16)); }
.tile .thumb.fail .fico { display: none; }
.tile .thumb.fail .tfb { line-height: 0; }
.files-table .ftr { cursor: pointer; }
.ftr-acts { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
tr.ftr:hover .ftr-acts { opacity: 1; }

/* 服务器目录选择器 */
.hb-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: 4px; background: var(--panel-2); }
.hb-dir, .hb-file { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 13px; cursor: pointer; text-align: left; border-radius: 6px; color: var(--text); }
.hb-dir:hover, .hb-file:hover { background: var(--primary-soft); }
.hb-file:hover { color: var(--primary); font-weight: 600; }
.hb-cur { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 10px; word-break: break-all; color: var(--text); }
.hb-cur b { color: var(--primary); }

/* ---------- HTTPS 证书面板 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.tab.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ---------- 上传面板(右下角浮动) ---------- */
.upload-panel {
  position: fixed; right: 18px; bottom: 18px; width: 380px; max-width: calc(100vw - 36px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); z-index: 80;
  display: flex; flex-direction: column; max-height: 44vh; overflow: hidden;
  animation: rise .25s ease both;
}
.upload-panel.hidden { display: none; }
.up-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); background: var(--bg-3);
}
.up-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text); }
.up-count-badge { background: var(--primary); color: #fff; font-size: 11px; border-radius: 9px; padding: 1px 8px; }
.up-list { overflow-y: auto; padding: 6px 16px 12px; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 7px 0; color: var(--text); }
.up-item .up-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.up-item .up-bar { flex: 1; height: 7px; background: var(--bg-2); border-radius: 4px; overflow: hidden; max-width: 150px; }
.up-item .up-fill { height: 100%; width: 0; background: var(--grad); transition: width .2s; border-radius: 4px; }
.up-item .up-pct { width: 52px; text-align: right; font-size: 12px; color: var(--muted); }
.up-item .up-retry { flex: none; }
.up-item.done .up-fill { background: var(--ok); }

/* ---------- 提示条 ---------- */
#toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: rgba(28,32,48,.92); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-md); backdrop-filter: blur(6px);
  animation: drop .25s ease both; max-width: 76vw;
}
.toast.ok { background: rgba(31,166,110,.94); }
.toast.err { background: rgba(229,72,77,.94); }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 右键菜单 ---------- */
.ctx-menu {
  position: fixed; z-index: 300; min-width: 172px; padding: 6px;
  background: var(--panel); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); animation: rise .12s ease both;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: none; background: none; text-align: left;
  font-size: 13px; color: var(--text-2); border-radius: 8px; transition: all .12s;
}
.ctx-item:hover { background: var(--primary-soft); color: var(--primary-2); }
.ctx-ico { width: 18px; text-align: center; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.ctx-sep { height: 1px; background: var(--border-soft); margin: 5px 8px; }

/* ---------- 预览弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: var(--mask-bg);
  backdrop-filter: blur(4px); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadein .15s ease both;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border-radius: 18px; max-width: 1080px; width: 96%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: rise .2s ease both;
}
.modal.pv {
  background: transparent; border: none; box-shadow: none; border-radius: 0;
  max-width: calc(100vw - 48px); width: auto; max-height: none;
}
.modal.pv .mhead { border-bottom: none; padding: 4px 8px; }
.modal.pv .mhead .mt { color: rgba(255,255,255,.9); }
.modal.pv .mbody { color: #fff; max-width: calc(100vw - 48px); }
.modal.pv .meta {
  border-top: none; background: var(--pv-meta-bg); border-radius: 12px;
  padding: 9px 16px; color: rgba(255,255,255,.94); margin: 0 8px 8px;
  backdrop-filter: blur(8px);
}
.modal.pv .meta .btn.mini { background: rgba(255,255,255,.95); color: #1a2230; }
.modal.pv .meta .pv-nav { display: inline-flex; gap: 6px; margin-right: 10px; }
.modal.pv .meta .pv-nav .btn { min-width: 30px; padding: 3px 0; font-size: 15px; line-height: 1.2; }
.modal.pv .pv-dl-only { padding: 40px; text-align: center; color: var(--muted); }

/* 文档 / 表格预览 */
.modal.pv .mbody.pv-fill {
  display: flex; flex-direction: column; align-items: stretch;
  background: var(--pv-meta-bg); border-radius: 12px;
  max-width: calc(100vw - 48px); min-height: 60vh; padding: 10px !important;
}
.modal.pv .mbody.pv-fill > iframe.pv-pdf {
  width: 100%; flex: 1; min-height: 60vh; border: none; border-radius: 8px;
  background: #525659; color-scheme: light;
}
.modal.pv .pv-textarea {
  flex: 1; width: 100%; min-height: 60vh; resize: none; border: none;
  border-radius: 8px; padding: 14px; background: var(--pv-textarea-bg); color: var(--code-fg);
  font: 13px/1.7 "SF Mono", Menlo, Consolas, "Courier New", monospace;
  outline: none; overflow: auto; white-space: pre; word-wrap: normal;
}
.modal.pv .pv-textarea.editable { border: 1px solid rgba(107,141,248,.5); }
.modal.pv .pv-textarea.editable:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,141,248,.25); }
.modal.pv .pv-edit-bar {
  display: flex; align-items: center; gap: 12px; padding: 2px 2px 10px;
}
.modal.pv .pv-edit-bar .pv-save-msg { font-size: 12px; color: #7fe0a5; }
.modal.pv .pv-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: rgba(255,255,255,.7); font-size: 13px; min-height: 200px;
}
.modal.pv .pv-msg { padding: 40px; text-align: center; color: var(--muted); }
.modal.pv .pv-docx {
  width: 100%; background: #525659; border-radius: 8px; overflow: auto;
  padding: 14px 0; flex: 1;
}
.modal.pv .pv-docx .docx-wrapper { display: flex; justify-content: center; }
.modal.pv .pv-docx .docx-wrapper > section { background: #fff; color: #1a2230; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.modal.pv .pv-sheet-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 2px 8px;
}
.modal.pv .pv-sheet-tabs .btn.mini { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); color: #fff; }
.modal.pv .pv-sheet-tabs .btn.mini.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.modal.pv .pv-grid-wrap { flex: 1; overflow: auto; border-radius: 8px; }
.modal.pv .pv-grid {
  border-collapse: collapse; width: 100%; background: var(--code-bg);
  font: 12px/1.5 -apple-system, "Segoe UI", sans-serif;
}
.modal.pv .pv-grid th,
.modal.pv .pv-grid td {
  border: 1px solid rgba(255,255,255,.14); padding: 4px 10px; min-width: 70px;
  color: #dfe4f3; white-space: nowrap;
}
.modal.pv .pv-grid th.corner, .modal.pv .pv-grid th.colhead, .modal.pv .pv-grid td.rowhead {
  background: #1a2140; color: #8ea0d6; position: sticky; text-align: center; font-weight: 600;
}
.modal.pv .pv-grid th.colhead { top: 0; }
.modal.pv .pv-grid td.rowhead { left: 0; }
.modal.pv .pv-grid td[contenteditable="true"] { background: #111a33; }
.modal.pv .pv-grid td[contenteditable="true"]:focus { outline: 2px solid var(--primary); background: #162450; }
.modal .mhead {
  padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px;
}
.modal .mhead .mt { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.modal .mhead .close { margin-left: auto; cursor: pointer; color: var(--muted); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.modal .mhead .close:hover { background: var(--bg-2); color: var(--text); }
.modal .mbody { flex: 1; overflow: auto; }
.modal .meta {
  padding: 12px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}

/* 输入弹窗 */
.pf { padding: 10px 6px; min-width: 320px; color: var(--text); }
.pf-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pf-row label { font-size: 13px; color: var(--muted); min-width: 76px; }
.pf-row input, .pf-row select { flex: 1; min-width: 140px; }
.pf-hint { font-size: 12px; color: var(--muted); line-height: 1.7; background: var(--primary-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.pf-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 2px; }

/* ---------- 表单通用 ---------- */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px;
  background: var(--input-bg); color: var(--text); transition: all .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: var(--input-focus-bg); box-shadow: 0 0 0 3px rgba(107,141,248,.12); }
.lbl { font-size: 13px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; margin-right: 14px; cursor: pointer; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ---------- 管理后台 ---------- */
.admin-wrap { flex: 1; display: flex; min-height: 0; }
.admin-nav {
  width: 190px; border-right: 1px solid var(--border); background: var(--panel); padding: 14px 10px;
}
.admin-nav .nav-item {
  padding: 11px 16px; border-radius: 10px; cursor: pointer; font-size: 14px;
  color: var(--text-2); margin-bottom: 2px; transition: all .13s; display: flex; align-items: center; gap: 8px;
}
.admin-nav .nav-item:hover { background: var(--bg-2); }
.admin-nav .nav-item.active { background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }
.admin-pane { flex: 1; overflow-y: auto; padding: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: var(--grad); }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
table.admin-table th, table.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; }
table.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg-3); }
.admin-table tr:last-child td { border-bottom: none; }
.rule-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 6px 10px; background: var(--bg-3); border-radius: 8px; }
.rule-access { padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 500; }
.rule-access.guest { background: var(--ok-soft); color: var(--ok); }
.rule-access.login { background: var(--primary-soft); color: var(--primary-2); }
.rule-access.admin { background: var(--danger-soft); color: var(--danger); }

/* ---------- 杂项 ---------- */
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

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

/* ---------- 登录页响应式(移动端隐藏左侧品牌区) ---------- */
@media (max-width: 880px) {
  .login-hero { display: none; }
  .login-side { padding: 24px 20px; }
  .login-card { width: 100%; max-width: 380px; }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; }
  .sidebar .brand-name, .sidebar .share-badge, .sidebar .share-item span:not(.ico) { display: none; }
  .sidebar .foot .who { display: none; }
  .search-box { width: 140px; }
  .toolbar { padding: 10px 12px; }
}