/* ==========================================================================
   CloudDrive · 样式表
   1. 主题变量      2. 基础        3. 通用控件     4. 登录页
   5. 布局骨架      6. 侧边栏      7. 顶栏         8. 内容区
   9. 文件列表      10. 右键菜单   11. 详情抽屉    12. 上传面板
   13. 模态框       14. Toast      15. 动效        16. 响应式
   ========================================================================== */

/* ============================== 1. 主题变量 ============================== */
:root {
  color-scheme: light;

  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-light: #818cf8;
  --brand-soft: #eef0ff;
  --violet: #8b5cf6;
  --pink: #ec4899;

  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10b981;
  --warning: #f59e0b;

  --bg: #f4f5fb;
  --bg-deco-1: rgba(99, 102, 241, .16);
  --bg-deco-2: rgba(236, 72, 153, .12);

  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --surface-3: #f2f3f9;
  --glass: rgba(255, 255, 255, .78);

  --text: #1e213a;
  --text-2: #6b7280;
  --text-3: #9aa1b1;
  --text-inverse: #ffffff;

  --line: #e8eaf2;
  --line-2: #f0f1f7;
  --line-strong: #d9dcec;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(24, 28, 60, .06);
  --shadow: 0 10px 30px rgba(24, 28, 60, .09);
  --shadow-lg: 0 24px 60px rgba(24, 28, 60, .18);
  --shadow-glow: 0 10px 26px rgba(99, 102, 241, .32);

  --sidebar-w: 252px;
  --sidebar-bg: linear-gradient(180deg, #202350 0%, #171a38 100%);
  --sidebar-text: #c3c9e6;
  --sidebar-muted: #8b93bd;

  --ease: cubic-bezier(.22, .85, .34, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand: #818cf8;
  --brand-dark: #a5b4fc;
  --brand-light: #6366f1;
  --brand-soft: rgba(99, 102, 241, .18);

  --danger-soft: rgba(239, 68, 68, .14);

  --bg: #0d0f1c;
  --bg-deco-1: rgba(99, 102, 241, .22);
  --bg-deco-2: rgba(236, 72, 153, .14);

  --surface: #171a2c;
  --surface-2: #1c2035;
  --surface-3: #232741;
  --glass: rgba(23, 26, 44, .82);

  --text: #eaecf7;
  --text-2: #a2a9c4;
  --text-3: #767ea3;
  --text-inverse: #0d0f1c;

  --line: #2a2f4a;
  --line-2: #232741;
  --line-strong: #3a4067;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 26px 64px rgba(0, 0, 0, .6);
  --shadow-glow: 0 10px 26px rgba(99, 102, 241, .45);

  --sidebar-bg: linear-gradient(180deg, #14172b 0%, #0f1120 100%);
  --sidebar-text: #b6bcd8;
  --sidebar-muted: #7d85ab;
}

/* ================================ 2. 基础 ================================ */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  transition: background .3s var(--ease), color .3s var(--ease);
}

/* 背景光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 520px at 8% -8%, var(--bg-deco-1), transparent 62%),
    radial-gradient(620px 480px at 102% 6%, var(--bg-deco-2), transparent 60%);
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }
svg { display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: var(--brand); color: #fff; }

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

/* ============================== 3. 通用控件 ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  transition: transform .16s var(--ease), background .16s, border-color .16s, box-shadow .16s, color .16s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--violet) 100%);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }

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

.btn--danger { background: var(--surface); border-color: rgba(239, 68, 68, .35); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn--block { width: 100%; }
.btn--lg { padding: 13px; border-radius: var(--radius-sm); font-size: 15px; letter-spacing: 1px; }
.btn--sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn--icon-text { padding: 9px 13px; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  width: 34px; height: 34px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

/* 菜单（下拉） */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  animation: menuIn .16s var(--ease);
}
.menu__label {
  margin: 0;
  padding: 8px 10px 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .4px;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: .14s;
}
.menu__item:hover { background: var(--surface-3); }
.menu__item.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.menu__sep { display: block; height: 1px; background: var(--line-2); margin: 5px 6px; }

/* 复选框 */
.check { display: inline-grid; place-items: center; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check span {
  width: 19px; height: 19px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: .16s var(--ease);
}
.check:hover span { border-color: var(--brand-light); }
.check input:checked + span {
  background: linear-gradient(135deg, var(--brand), var(--violet));
  border-color: transparent;
}
.check input:checked + span::after {
  content: "";
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check input:indeterminate + span {
  background: linear-gradient(135deg, var(--brand), var(--violet));
  border-color: transparent;
}
.check input:indeterminate + span::after {
  content: "";
  width: 9px; height: 2px;
  background: #fff;
  border-radius: 2px;
}

/* ============================== 4. 登录页 ============================== */
.auth {
  position: fixed;
  inset: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 28px 22px;
  z-index: 5;
}
.auth__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, #4f46e5 0%, #7c3aed 42%, #db2777 100%);
  overflow: hidden;
}
.auth__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  animation: float 16s ease-in-out infinite;
}
.auth__blob--1 { width: 460px; height: 460px; background: #22d3ee; top: -140px; left: -100px; }
.auth__blob--2 { width: 400px; height: 400px; background: #f472b6; bottom: -120px; right: -80px; animation-delay: -5s; }
.auth__blob--3 { width: 320px; height: 320px; background: #818cf8; top: 40%; left: 45%; animation-delay: -9s; }

.auth__stage {
  position: relative;
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 34px;
  align-items: center;
}
.auth__intro { color: #fff; padding: 10px 6px; }
.auth__intro-brand { display: flex; align-items: center; gap: 11px; font-size: 19px; margin-bottom: 26px; }
.auth__intro h2 { font-size: 34px; line-height: 1.28; margin: 0 0 24px; letter-spacing: -.5px; }
.auth__features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth__features li { display: flex; gap: 12px; align-items: flex-start; }
.auth__features i {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .24);
  font-style: normal;
  font-size: 15px;
}
.auth__features span { font-size: 13.5px; line-height: 1.6; color: rgba(255, 255, 255, .84); }
.auth__features b { display: block; font-size: 14.5px; color: #fff; }

.auth__card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-lg);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
  animation: pop .44s var(--ease);
}
.auth__brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.auth__brand h1 { margin: 0; font-size: 21px; letter-spacing: .2px; }
.auth__brand p { margin: 3px 0 0; color: var(--text-2); font-size: 12.5px; }
.auth__logo {
  width: 52px; height: 52px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  box-shadow: 0 10px 24px rgba(99, 102, 241, .4);
}
.auth__logo--mobile { width: 46px; height: 46px; border-radius: 14px; }

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-3);
  border-radius: 13px;
  padding: 4px;
  margin-bottom: 20px;
}
.tabs__item {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-2);
  transition: color .2s;
}
.tabs__item.is-active { color: var(--brand-dark); }
.tabs__ink {
  position: absolute;
  z-index: 1;
  top: 4px; left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease);
}
.tabs[data-active="register"] .tabs__ink { transform: translateX(100%); }

.auth__form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__wrap { position: relative; display: flex; align-items: center; }
.field__icon {
  position: absolute;
  left: 13px;
  color: var(--text-3);
  pointer-events: none;
  transition: color .16s;
}
.field__wrap:focus-within .field__icon { color: var(--brand); }
.field__eye {
  position: absolute;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.field__eye:hover { color: var(--text); background: var(--surface-3); }

.field input,
.field select {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  width: 100%;
  transition: .16s;
  color: var(--text);
}
.field__wrap input { padding-left: 40px; }
.field__wrap input[type="password"],
.field__wrap input:has(+ .field__eye) { padding-right: 42px; }
.field input::placeholder { color: var(--text-3); }
.field input:focus,
.field select:focus {
  border-color: var(--brand-light);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.auth__hint { text-align: center; color: var(--text-2); font-size: 12.5px; margin: 2px 0 0; }
.auth__hint a { font-weight: 600; }
.auth__note {
  margin: 0;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

/* 一键生成强密码 */
.pwd-gen { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: -5px; }
.pwd-gen__btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px dashed var(--brand-light);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .16s;
}
.pwd-gen__btn:hover { border-style: solid; background: var(--surface); box-shadow: var(--shadow-sm); }
.pwd-gen__btn:active { transform: translateY(1px); }
.pwd-gen__tip { font-size: 11.5px; color: var(--text-3); }

/* ============================== 私信（用户 ⇄ 管理员） ============================== */
.chat {
  display: flex;
  flex-direction: column;
  height: min(68vh, 640px);
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.chat__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  color: var(--text-2);
}
.chat__empty .empty__art { color: var(--line); }
.chat__empty p { margin: 8px 0 0; font-size: 14px; font-weight: 600; }
.chat__empty small { color: var(--text-3); font-size: 12.5px; }

.bubble { max-width: 78%; align-self: flex-start; }
.bubble--me { align-self: flex-end; }
.bubble__meta { margin: 0 4px 4px; font-size: 11.5px; color: var(--text-3); }
.bubble--me .bubble__meta { text-align: right; }
.bubble__body {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  border-top-left-radius: 4px;
  background: var(--surface-2, #f3f5f9);
  font-size: 14px;
  line-height: 1.66;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble--me .bubble__body {
  background: var(--brand);
  border-color: var(--brand);
  border-radius: 14px;
  border-top-right-radius: 4px;
  color: #fff;
}

.chat__compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2, #f7f8fb);
}
.chat__compose textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat__compose textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.chat__compose .btn { flex: none; height: 40px; }
.chat__compose .btn svg { margin-right: 6px; }
@media (max-width: 640px) {
  .chat { height: calc(100vh - 220px); min-height: 300px; }
  .bubble { max-width: 88%; }
  .chat__scroll { padding: 14px 12px 8px; }
}
.auth__error {
  min-height: 18px;
  margin: 12px 0 0;
  text-align: center;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

/* ============================== 5. 布局骨架 ============================== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ============================== 6. 侧边栏 ============================== */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  overflow: hidden;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 16.5px;
  padding: 2px 6px 20px;
}
.sidebar__logo {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  box-shadow: var(--shadow-glow);
  color: #fff;
}
.sidebar__name { flex: 1; }
.sidebar__close { display: none; color: var(--sidebar-muted); }
.sidebar__close:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.nav { display: grid; gap: 3px; flex: 1; align-content: start; }
.nav__label {
  margin: 4px 0 6px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--sidebar-muted);
  text-transform: uppercase;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 11px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  padding: 11px 12px;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 600;
  text-align: left;
  transition: .16s var(--ease);
}
.nav__item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav__item.is-active {
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.nav__item span { flex: 1; }
.nav__badge {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  border-radius: 20px;
  padding: 2px 8px;
}

.storage {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 13px;
  padding: 13px;
  margin-top: 10px;
}
.storage__head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 9px;
}
.storage__head span:last-child { color: #fff; font-weight: 700; }
.storage__bar {
  height: 7px;
  background: rgba(255, 255, 255, .14);
  border-radius: 6px;
  overflow: hidden;
}
.storage__bar i {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #34d399, #22d3ee);
  transition: width .6s var(--ease);
}
.storage__bar i.is-warn { background: linear-gradient(90deg, #fbbf24, #f97316); }
.storage__bar i.is-full { background: linear-gradient(90deg, #f87171, #ef4444); }
.storage__text { margin-top: 8px; font-size: 11.5px; color: var(--sidebar-muted); }
.storage__legend { margin-top: 6px; font-size: 11px; color: var(--sidebar-muted); }

.sidebar__foot { margin-top: 8px; }
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: .16s;
}
.sidebar__user:hover { background: rgba(255, 255, 255, .07); }
.avatar {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), var(--violet));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.sidebar__user-meta { display: grid; line-height: 1.35; flex: 1; min-width: 0; }
.sidebar__user-meta b { color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-meta small { color: var(--sidebar-muted); font-size: 11px; }
.sidebar__user svg { color: var(--sidebar-muted); flex: none; }

.sidebar-mask {
  position: fixed;
  inset: 0;
  z-index: 79;
  background: rgba(10, 12, 28, .5);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}

/* =============================== 7. 顶栏 =============================== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  flex: none;
  /* 【层级修复】backdrop-filter 会让 topbar 自成一层叠上下文（此时 z-index 是 auto），
     会和内容区文件行的 .row:hover transform 落在同一层；行在 DOM 中更靠后 -> 盖住排序/主题下拉。
     这里显式抬高整条顶栏，让「顶层下拉」稳定浮在「底层列表」之上。
     全局层级约定（同一层叠上下文内，从低到高）：
       内容区 0  <  顶栏及下拉 1000  <  拖拽遮罩 60  <  侧栏遮罩 79  <  侧栏 80
       <  抽屉遮罩/抽屉 84/85  <  弹窗 90  <  右键菜单 130  <  Toast 140
     注意：顶栏 z-index 必须大于网格视图里 .row__actions / .row__check 的 z-index:3 */
  position: relative;
  z-index: 1000;
}
/* 顶栏里的下拉（排序 / 主题）再单独提一层，确保任何主题、任何视图下都压住内容区 */
.topbar .menu { z-index: 10000; }
.topbar__menu { display: none; flex: none; }
.topbar__icon { flex: none; }
.ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: block; }

.search {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 13px;
  transition: .18s var(--ease);
}
.search:focus-within {
  background: var(--surface);
  border-color: var(--brand-light);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.search svg { color: var(--text-3); flex: none; }
.search input { flex: 1; border: none; background: transparent; outline: none; color: var(--text); min-width: 0; }
.search input::placeholder { color: var(--text-3); }
.search__clear {
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 6px;
}
.search__clear:hover { color: var(--text); }

.topbar__actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.only-narrow { display: none !important; }

/* ============================== 8. 内容区 ============================== */
.content {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 70px;
  scroll-behavior: smooth;
}
.content__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 34px;
}
.section-title { font-size: 18px; margin: 0; }
.content__meta { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }

.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; flex: 1; min-width: 0; }
.crumbs__item {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  padding: 5px 9px;
  border-radius: 8px;
  font-weight: 600;
  transition: .15s;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbs__item:hover { background: var(--surface); color: var(--brand-dark); }
.crumbs__item.is-current { color: var(--text); }
.crumbs__sep { color: var(--text-3); user-select: none; }
.crumbs__item.is-drop { background: var(--brand-soft); color: var(--brand-dark); outline: 2px dashed var(--brand); }

.viewToggle { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex: none; }
.viewToggle__btn {
  border: none; background: transparent; color: var(--text-3);
  width: 32px; height: 30px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; transition: .15s;
}
.viewToggle__btn:hover { color: var(--text); }
.viewToggle__btn.is-active { background: var(--brand); color: #fff; }

/* 多选工具条 */
.selbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  animation: slideDown .22s var(--ease);
  flex-wrap: wrap;
}
.selbar b { font-size: 13.5px; }
.selbar__size { color: var(--text-3); font-size: 12.5px; }
.selbar__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* 拖拽提示 */
.dropzone {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(20, 22, 48, .58);
  backdrop-filter: blur(5px);
}
.dropzone.is-drag { display: grid; }
.dropzone__inner {
  background: var(--surface);
  border: 3px dashed var(--brand-light);
  border-radius: var(--radius-lg);
  padding: 46px 64px;
  text-align: center;
  color: var(--brand-dark);
  box-shadow: var(--shadow-lg);
  animation: pop .3s var(--ease);
}
.dropzone__inner svg { color: var(--brand); margin: 0 auto; }
.dropzone__inner p { margin: 14px 0 6px; font-size: 19px; font-weight: 700; }
.dropzone__inner small { color: var(--text-2); }

/* ============================= 9. 文件列表 ============================= */
.list { display: flex; flex-direction: column; gap: 6px; }
.list.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s, background .16s;
  position: relative;
  user-select: none;
}
.row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.row.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.row.is-dragging { opacity: .45; }
.row.is-drop-target { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

.row__check { flex: none; opacity: 0; transition: opacity .16s; }
.row:hover .row__check,
.row.is-selected .row__check,
.list.is-selecting .row__check { opacity: 1; }

.row__icon { flex: none; position: relative; }
.file-badge {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .4px;
  color: #fff;
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
}
.file-badge--folder { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.file-badge--img { background: linear-gradient(135deg, #34d399, #10b981); }
.file-badge--video { background: linear-gradient(135deg, #fb7185, #e11d48); }
.file-badge--audio { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.file-badge--pdf { background: linear-gradient(135deg, #f87171, #dc2626); }
.file-badge--doc { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.file-badge--zip { background: linear-gradient(135deg, #fbbf24, #d97706); }
.file-badge--code { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.file-badge--text { background: linear-gradient(135deg, #94a3b8, #64748b); }
.file-badge--file { background: linear-gradient(135deg, #a3a3c2, #6b7280); }

/* 缩略图 */
.file-badge--thumb { background: var(--surface-3); padding: 0; }
.file-badge--thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.file-badge--thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  border-radius: inherit;
}
.file-badge__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(9, 11, 24, .38);
  color: #fff;
}

.row__main { flex: 1; min-width: 0; }
.row__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.row__name mark {
  background: rgba(250, 204, 21, .4);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.row__tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 1px 6px;
  flex: none;
}
.row__tag--danger { color: var(--danger); background: var(--danger-soft); }
.row__sub { color: var(--text-3); font-size: 12px; margin-top: 3px; }

.row__actions { display: flex; gap: 3px; opacity: 0; transition: opacity .16s; flex: none; }
.row:hover .row__actions { opacity: 1; }
.row__actions .icon-btn { width: 32px; height: 32px; font-size: 15px; }

/* 网格卡片 */
.list.is-grid .row {
  flex-direction: column;
  align-items: stretch;
  padding: 14px;
  text-align: center;
  gap: 10px;
  border-radius: var(--radius);
}
.list.is-grid .row__check { position: absolute; top: 10px; left: 10px; z-index: 3; }
.list.is-grid .row__icon { display: flex; justify-content: center; }
.list.is-grid .file-badge { width: 100%; height: 108px; border-radius: 13px; font-size: 17px; }
.list.is-grid .file-badge--thumb img { border-radius: 13px; }
.list.is-grid .row__name { justify-content: center; font-size: 13px; }
.list.is-grid .row__sub { text-align: center; }
.list.is-grid .row__actions {
  position: absolute; top: 8px; right: 8px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 2px;
  box-shadow: var(--shadow-sm);
  z-index: 3;
}

.empty { text-align: center; padding: 64px 20px; color: var(--text-3); }
.empty__art {
  width: 120px; height: 120px;
  margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 34px;
  background: linear-gradient(135deg, var(--brand-soft), transparent);
  color: var(--brand-light);
  animation: float 6s ease-in-out infinite;
}
.empty__art svg { opacity: .75; }
.empty p { margin: 18px 0 6px; font-size: 16px; font-weight: 700; color: var(--text-2); }
.empty small { color: var(--text-3); }

/* 骨架屏 */
.skeleton {
  height: 62px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

/* ============================ 10. 右键菜单 ============================ */
.ctxmenu {
  position: fixed;
  z-index: 130;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: menuIn .14s var(--ease);
}
.ctxmenu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 500;
  transition: .13s;
}
.ctxmenu__item:hover { background: var(--surface-3); }
.ctxmenu__item svg { color: var(--text-3); flex: none; }
.ctxmenu__item--danger { color: var(--danger); }
.ctxmenu__item--danger svg { color: var(--danger); }
.ctxmenu__item--danger:hover { background: var(--danger-soft); }
.ctxmenu__sep { display: block; height: 1px; background: var(--line-2); margin: 5px 8px; }
.ctxmenu__head {
  padding: 8px 11px 7px;
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 230px;
}

/* ============================ 11. 详情抽屉 ============================ */
.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 84;
  background: rgba(10, 12, 28, .38);
  backdrop-filter: blur(2px);
  animation: fade .2s ease;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 92vw);
  z-index: 85;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight .26s var(--ease);
}
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.drawer__head h3 { margin: 0; font-size: 15.5px; }
.drawer__body { padding: 18px; overflow: auto; flex: 1; }
.drawer__preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-3);
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  min-height: 150px;
}
.drawer__preview img,
.drawer__preview video { max-width: 100%; max-height: 280px; display: block; }
.drawer__preview audio { width: 100%; padding: 20px; }
.drawer__big {
  width: 100%; height: 150px;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800; color: #fff;
  letter-spacing: 1px;
}
.drawer__list { display: grid; gap: 2px; }
.drawer__item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.drawer__item:last-child { border-bottom: none; }
.drawer__item dt { color: var(--text-3); flex: none; }
.drawer__item dd { margin: 0; text-align: right; word-break: break-all; font-weight: 500; }
.drawer__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer__foot .btn { flex: 1; }

/* ============================ 12. 上传面板 ============================ */
.upload-panel {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 362px;
  max-height: 48vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 70;
  animation: slideUp .3s var(--ease);
}
.upload-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 12px 16px;
  border-bottom: 1px solid var(--line-2);
}
.upload-panel__title { flex: 1; min-width: 0; }
.upload-panel__title b { font-size: 14px; }
.upload-panel__title small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.upload-panel__tools { display: flex; align-items: center; gap: 4px; }
.upload-panel__list { overflow: auto; padding: 8px; }

.upload-item { padding: 9px 10px; border-radius: 11px; transition: background .15s; }
.upload-item:hover { background: var(--surface-2); }
.upload-item + .upload-item { margin-top: 2px; }
.upload-item__top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; align-items: center; }
.upload-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload-item__stat { color: var(--text-3); flex: none; font-size: 12px; }
.upload-item__btns { display: flex; gap: 2px; flex: none; }
.upload-item__btns .icon-btn { width: 26px; height: 26px; font-size: 14px; }
.upload-item__bar { height: 5px; background: var(--surface-3); border-radius: 4px; margin-top: 7px; overflow: hidden; }
.upload-item__bar i {
  display: block; height: 100%; width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand), var(--violet));
  transition: width .2s var(--ease);
}
.upload-item.is-done .upload-item__bar i { background: var(--success); }
.upload-item.is-done .upload-item__stat { color: var(--success); font-weight: 600; }
.upload-item.is-error .upload-item__bar i { background: var(--danger); }
.upload-item.is-error .upload-item__stat { color: var(--danger); font-weight: 600; }

/* ============================= 13. 模态框 ============================= */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal__mask { position: absolute; inset: 0; background: rgba(14, 16, 36, .55); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal__box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  animation: pop .3s var(--ease);
}
.modal__box.is-wide { width: min(940px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line-2);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.modal-note { color: var(--text-2); font-size: 12.5px; line-height: 1.65; margin: 0; }

.share-link {
  display: flex;
  gap: 9px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.share-link input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  min-width: 0;
}

.preview-wrap { display: grid; place-items: center; background: #0b0d1c; min-height: 260px; max-height: 68vh; overflow: auto; }
.preview-wrap img, .preview-wrap video { max-width: 100%; max-height: 68vh; display: block; }
.preview-wrap audio { width: min(520px, 90%); margin: 26px; }
.preview-wrap iframe { width: 100%; height: 68vh; border: none; background: #fff; }
.preview-text {
  margin: 0;
  padding: 18px 20px;
  background: var(--surface);
  width: 100%;
  max-height: 66vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.preview-note { text-align: center; padding: 56px 24px; color: var(--text-2); line-height: 2; }

/* 移动目标列表 */
.picker { display: grid; gap: 4px; max-height: 300px; overflow: auto; }
.picker__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  transition: .15s;
}
.picker__item:hover { border-color: var(--brand-light); background: var(--brand-soft); }
.picker__item svg { color: var(--brand); flex: none; }
.picker__item.is-disabled { opacity: .45; cursor: not-allowed; }

/* 快捷键表 */
.kbd-list { display: grid; gap: 2px; }
.kbd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.kbd-row:last-child { border-bottom: none; }
.kbd-row span { color: var(--text-2); }
kbd {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  padding: 3px 8px;
  color: var(--text);
}

/* ============================== 14. Toast ============================== */
.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 140;
  background: #1c1f3d;
  color: #fff;
  padding: 11px 20px;
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 13.5px;
  animation: toastIn .26s var(--ease);
  max-width: 90vw;
  text-align: center;
}
[data-theme="dark"] .toast { background: #2c3157; }
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--success); }

/* ============================== 15. 动效 ============================== */
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -14px); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(14px, -18px) scale(1.06); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

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

/* ============================= 16. 响应式 ============================= */
@media (max-width: 1080px) {
  .auth__stage { max-width: 460px; grid-template-columns: 1fr; }
  .auth__intro { display: none; }
  .auth__logo--mobile { display: grid; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 auto 0 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
  }
  .sidebar.is-open { transform: none; }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }
  .search { max-width: none; }
  .only-narrow:not(.hidden) { display: grid !important; }
  .hide-narrow { display: none !important; }
  .topbar__actions .btn--ghost span { display: none; }
}

@media (max-width: 620px) {
  .content { padding: 14px 12px 70px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar__actions .btn { padding: 9px 12px; }
  .upload-panel { left: 12px; right: 12px; width: auto; }
  .auth__card { padding: 26px 20px; border-radius: 20px; }
  .list.is-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .list.is-grid .file-badge { height: 92px; }
  .content__meta { display: none; }
  .row__actions .icon-btn:nth-child(n+4) { display: none; }
  .drawer { width: 100%; }
  .modal { padding: 0; align-items: end; }
  .modal__box { border-radius: 20px 20px 0 0; max-height: 92vh; width: 100%; }
}

/* ==========================================================================
   17. 手机竖屏专项优化
   只做「覆盖」，不改上面任何原有规则，随时可整段删除回退。
   要解决的四个真问题：
     ① 整套操作依赖鼠标 hover，而手机没有 hover —— 文件操作按钮/勾选框永远隐形
     ② 输入框字号 < 16px，iOS 一聚焦就强制放大整页
     ③ 底部按钮被 iPhone 底部横条压住，点不到
     ④ 100vh 会随地址栏伸缩跳动，弹层/聊天框高度乱窜
   ========================================================================== */

/* ---- ① 触摸设备：没有 hover，操作按钮和勾选框必须常显 ---- */
@media (hover: none) {
  .row__actions { opacity: 1; }
  .row__check { opacity: 1; }
  /* 触摸屏的 :hover 会「粘」住，取消位移动效，避免列表残留悬浮态 */
  .row:hover { transform: none; box-shadow: none; }
  .btn--primary:hover:not(:disabled) { transform: none; }
}

/* 窄屏触摸设备（平板竖屏等）同样常显 */
@media (max-width: 900px) and (hover: none) {
  .row__actions { opacity: 1; }
  .row__check { opacity: 1; }
}

/* ---- ② 手机：文件行拆成两行，操作按钮全部保留并放大到能点 ---- */
@media (max-width: 620px) {
  .row__actions { opacity: 1; }
  .row__check { opacity: 1; }

  /* 原来把第 4 个之后的按钮藏了（重命名/删除在手机上直接消失），全部恢复 */
  .row__actions .icon-btn:nth-child(n+4) { display: grid; }

  /* 列表视图：第一行图标 + 文件名，第二行操作按钮，避免文件名被挤成一条缝 */
  .list:not(.is-grid) .row {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 11px 12px;
  }
  .list:not(.is-grid) .row__main { flex: 1 1 120px; }
  .list:not(.is-grid) .row__actions {
    flex: 1 1 100%;
    justify-content: flex-end;
    gap: 2px;
    margin-top: 2px;
    padding-top: 7px;
    border-top: 1px dashed var(--line-2);
  }
  /* 手指点得准（原来 32px 偏小） */
  .row__actions .icon-btn { width: 38px; height: 38px; font-size: 17px; }

  /* 网格视图：操作区从「绝对定位浮在封面上」改为排到卡片底部 */
  .list.is-grid .row__actions {
    position: static;
    width: 100%;
    flex: none;
    flex-wrap: wrap;
    row-gap: 0;
    justify-content: center;
    padding: 0;
    border-top: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .list.is-grid .row__actions .icon-btn { width: 34px; height: 34px; font-size: 16px; }
  .list.is-grid .file-badge { height: 100px; }

  /* ---- ③ iOS 输入框字号 < 16px 会触发整页放大，统一提到 16px ---- */
  .field input,
  .field select,
  .search input,
  .chat__compose textarea,
  .share-link input { font-size: 16px; }

  /* ---- 顶栏：手机上「快捷键」没有意义，把宽度让给搜索框 ---- */
  #helpBtn { display: none; }
  .topbar { gap: 6px; padding: 10px; }
  .topbar__actions { gap: 4px; }
  .topbar__icon,
  .topbar__menu { width: 32px; height: 32px; }
  .topbar__actions .btn { padding: 8px 11px; }
  .search { padding: 8px 10px; }
  .search input::placeholder { font-size: 13px; }

  /* ---- 私信：跟着可视高度走，发送键收成图标把宽度留给输入框 ---- */
  .chat { height: auto; min-height: 0; }
  .chat__scroll {
    max-height: 50vh;
    max-height: 50dvh;
    min-height: 220px;
    padding: 14px 12px 8px;
  }
  .chat__empty { padding: 26px 12px; }
  .chat__compose {
    gap: 8px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .chat__compose .btn { padding: 10px 13px; }
  .chat__compose .btn span { display: none; }
  .chat__compose .btn svg { margin-right: 0; }

  /* ---- ④ 底部弹层：不要被 iPhone 底部横条压住 ---- */
  .modal { padding: 0; align-items: end; }
  .modal__box {
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    max-height: 88dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-head,
  .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-body { padding: 16px; }
  .modal-foot .btn { flex: 1; }

  /* ---- 内容区：给底部上传面板 + 底部横条留出空间 ---- */
  .content { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
  .upload-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    max-height: 42vh;
    max-height: 42dvh;
  }
  .dropzone__inner { padding: 30px 22px; }
  .btn--lg { padding: 14px; }          /* 登录/注册主按钮更好点 */

  /* ---- 详情抽屉：整屏 + 底部按钮抬起 ---- */
  .drawer { width: 100%; }
  .drawer__body { padding: 16px; }
  .drawer__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* ---- 多选工具条：排成两行，按钮均分好点 ---- */
  .selbar { padding: 9px 11px; gap: 8px; }
  .selbar__actions { width: 100%; margin-left: 0; }
  .selbar__actions .btn { flex: 1; }
}

/* ---- 侧边栏抽屉：小屏手机上内容放不下时要能滚，别把「退出登录」裁掉 ---- */
@media (max-width: 900px) {
  .sidebar { overflow-y: auto; overflow-x: hidden; }
  .sidebar { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { top: calc(14px + env(safe-area-inset-top)); }
}

/* ---- 刘海/灵动岛机型：顶栏往下让一点，别被遮住 ---- */
@supports (padding: max(0px)) {
  .topbar { padding-top: max(14px, env(safe-area-inset-top)); }

  @media (max-width: 620px) {
    .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  }
}
/* ==========================================================================
   移动端悬浮上传按钮（FAB）
   ========================================================================== */
.fab {
  display: none;                       /* 桌面端隐藏 */
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 55;                          /* 高于内容区、低于上传面板(70) */
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  box-shadow: 0 10px 24px rgba(99, 102, 241, .42), 0 2px 6px rgba(24, 28, 60, .12);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: transform .18s var(--ease), box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.fab:active  { transform: scale(.92); }
.fab:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 3px; }
.fab.hidden  { display: none !important; }

/* 移动端才显示 FAB；同时隐藏顶栏的上传按钮，把空间让给搜索框 */
@media (max-width: 620px) {
  .fab       { display: flex; }
  #uploadBtn { display: none !important; }
}

/* ==========================================================================
   副 FAB：新建文件夹（放在主 FAB 上方）
   ========================================================================== */
.fab--sub {
  right: 21px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  width: 46px;
  height: 46px;
  background: var(--surface);
  color: var(--brand-dark);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(24, 28, 60, .14), 0 2px 4px rgba(24, 28, 60, .08);
}
.fab--sub:active { transform: scale(.92); }

/* 手机竖屏才显示副按钮 */
@media (max-width: 620px) {
  .fab--sub { display: flex; }
}
/* ==========================================================================
   移动端专项：注销账户
   ========================================================================== */
@media (max-width: 900px) {
  /* ---- 侧边栏里的注销按钮：加大点击区域，字号提上去 ---- */
  .sidebar__actions {
    gap: 8px;
    margin-top: 10px;
  }
  .sidebar__act {
    padding: 12px 10px;          /* 8px 6px → 12px 10px，手指能稳稳点到 */
    font-size: 12.5px;            /* 11.5px → 12.5px */
    border-radius: 12px;
    min-height: 42px;             /* 接近 iOS 推荐的 44px 触摸目标 */
  }

  /* ---- 注销弹窗里的风险说明：字大行宽，眼睛不累 ---- */
  .danger-list {
    font-size: 13px;
    line-height: 2;
    padding: 14px 16px 14px 32px;
  }
  .danger-list li::marker { color: var(--danger); }
}

@media (max-width: 620px) {
  /* ---- 弹窗里的输入框：再确认一遍（防止被别的样式覆盖） ---- */
  #modalBox .field input {
    font-size: 16px;              /* iOS 聚焦时不会强制放大整页 */
    padding: 13px 14px;
  }

  /* ---- "我已阅读"复选框：放大到能看见、能点中 ---- */
  #delAgree {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    accent-color: var(--danger);
  }
  /* 复选框那一行整体多留一点垂直间距，避免贴着密码框 */
  #modalBox .field[style*="row"] {
    padding: 6px 0;
  }

  /* ---- 弹窗里的按钮并排占满宽度，好点 ---- */
  #modalBox .modal-foot {
    display: flex;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  #modalBox .modal-foot .btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 14px;
  }

  /* ---- 风险清单和输入框之间留一口气 ---- */
  .danger-list { margin-bottom: 14px; }
}
/* ==========================================================================
   注销按钮 · 灵动效果
   ========================================================================== */
.sidebar__actions {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.sidebar__act {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  color: var(--sidebar-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform .18s cubic-bezier(.22, .85, .34, 1),
    background .18s,
    color .18s,
    border-color .18s,
    box-shadow .28s;
}

/* ---------- 危险色：注销 ---------- */
.sidebar__act--danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, .18);
  /* 呼吸的边框：暗示"这里随时可以点" */
  animation: actBreathe 3.2s ease-in-out infinite;
}
.sidebar__act--danger:hover {
  transform: translateY(-1px) scale(1.015);
  background: linear-gradient(135deg, rgba(239, 68, 68, .22), rgba(220, 38, 38, .14));
  border-color: rgba(239, 68, 68, .55);
  color: #fff;
  box-shadow:
    0 8px 18px rgba(239, 68, 68, .28),
    0 0 0 3px rgba(239, 68, 68, .08),
    inset 0 0 0 1px rgba(255, 255, 255, .06);
  animation-play-state: paused;
}
.sidebar__act--danger:active {
  transform: translateY(0) scale(.97);
  box-shadow: 0 2px 6px rgba(239, 68, 68, .32);
  background: linear-gradient(135deg, rgba(239, 68, 68, .32), rgba(220, 38, 38, .2));
  transition-duration: .08s;
}
.sidebar__act--danger:focus-visible {
  outline: 2px solid rgba(239, 68, 68, .6);
  outline-offset: 2px;
}

/* ---------- 图标：悬停时左右摇两下 ---------- */
.sidebar__act--danger svg {
  transition: transform .2s;
}
.sidebar__act--danger:hover svg {
  animation: actIconShake .5s ease-in-out;
}

/* ---------- 光晕扫过：从左滑到右 ---------- */
.sidebar__act--danger::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, .22) 45%,
    rgba(255, 255, 255, .04) 55%,
    transparent 100%
  );
  pointer-events: none;
  transition: left .55s ease;
}
.sidebar__act--danger:hover::before {
  left: 120%;
}

/* ---------- 呼吸动画 ---------- */
@keyframes actBreathe {
  0%, 100% { border-color: rgba(239, 68, 68, .18); }
  50% { border-color: rgba(239, 68, 68, .42); }
}
@keyframes actIconShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-2px) rotate(-8deg); }
  75% { transform: translateX(2px) rotate(8deg); }
}

/* ---------- 用户级"减少动画"偏好：尊重系统设置 ---------- */
@media (prefers-reduced-motion: reduce) {
  .sidebar__act--danger,
  .sidebar__act--danger::before,
  .sidebar__act--danger svg {
    animation: none !important;
    transition: background .15s, color .15s, border-color .15s;
  }
  .sidebar__act--danger:hover { transform: none; }
}

/* ==========================================================================
   注销弹窗 · 风险清单
   ========================================================================== */
.danger-list {
  margin: 0 0 14px;
  padding: 12px 14px 12px 30px;
  background: rgba(239, 68, 68, .06);
  border: 1px solid rgba(239, 68, 68, .18);
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--text-2);
}
.danger-list li::marker { color: var(--danger); }

/* ==========================================================================
   移动端：注销按钮更好点 + 弹窗更顺手
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar__actions {
    gap: 8px;
    margin-top: 10px;
  }
  .sidebar__act {
    padding: 12px 10px;
    font-size: 12.5px;
    border-radius: 12px;
    min-height: 44px;  /* iOS 推荐的最小触摸目标 */
  }

  .danger-list {
    font-size: 13px;
    line-height: 2;
    padding: 14px 16px 14px 32px;
  }
}

@media (max-width: 620px) {
  #modalBox .field input {
    font-size: 16px;  /* 防止 iOS 聚焦放大整页 */
    padding: 13px 14px;
  }
  #delAgree {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    accent-color: var(--danger);
  }
  #modalBox .field[style*="row"] { padding: 6px 0; }
  #modalBox .modal-foot {
    display: flex;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  #modalBox .modal-foot .btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 14px;
  }
}
/* ==========================================================================
   文本编辑器
   ========================================================================== */
.text-editor {
  width: 100%;
  min-height: 280px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  transition: .16s;
}
.text-editor:focus {
  border-color: var(--brand-light);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

@media (max-width: 620px) {
  .text-editor {
    font-size: 16px;
    min-height: 220px;
  }
}

/* ==========================================================================
   长文件名完整显示（桌面 2 行截断，手机完全展开）
   ========================================================================== */
.row__name {
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
  line-height: 1.4;
  white-space: normal !important;
  text-overflow: clip !important;
}
.row__sub {
  word-break: break-all;
}
.upload-item__name {
  word-break: break-all;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

@media (max-width: 900px) {
  .row__name {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
    word-break: break-all;
  }
}
