/* ============================================================
   MyCloud — 苹果风格设计系统
   ============================================================ */

:root {
  --blue: #007aff;
  --blue-hover: #0071e8;
  --red: #ff3b30;
  --green: #34c759;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --sidebar-bg: rgba(255, 255, 255, 0.72);
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --hover: rgba(0, 0, 0, 0.045);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.14);
  --overlay: rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 232px;
  --topbar-h: 58px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0f0f11;
  --bg-elev: #1c1c1e;
  --sidebar-bg: rgba(28, 28, 30, 0.72);
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --text-2: #98989d;
  --text-3: #6b6b70;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --overlay: rgba(0, 0, 0, 0.82);
}

* { box-sizing: border-box; }

/* hidden 属性必须能覆盖组件自身的 display:flex/grid，否则隐藏的浮层仍会拦截点击 */
[hidden] { display: none !important; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
::selection { background: rgba(0, 122, 255, 0.22); }

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

/* ============================================================
   登录页
   ============================================================ */
.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 620px at 12% 8%, #dbeafe 0%, transparent 58%),
    radial-gradient(900px 560px at 88% 12%, #e0e7ff 0%, transparent 55%),
    radial-gradient(1000px 640px at 78% 92%, #dcfce7 0%, transparent 55%),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%);
  z-index: 100;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  padding: 44px 36px 34px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(20, 30, 60, 0.16);
  animation: rise 0.55s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 15px;
  background: linear-gradient(160deg, #3b9bff, #007aff);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.32);
}
.login-logo svg { width: 30px; height: 30px; }

.login-title {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-sub {
  margin: 0 0 26px;
  color: var(--text-2);
  font-size: 13px;
}

.login-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.login-input::placeholder { color: var(--text-3); }
.login-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0, 122, 255, 0.18);
}

.login-btn {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s var(--ease), transform 0.12s var(--ease);
}
.login-btn:hover { background: var(--blue-hover); }
.login-btn:active { transform: scale(0.985); }
.login-btn:disabled { opacity: 0.6; cursor: default; }

.login-error {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--red);
}

/* ============================================================
   布局
   ============================================================ */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 30;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--topbar-h);
  padding: 0 8px;
  flex: 0 0 auto;
}
.brand-logo {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: linear-gradient(160deg, #3b9bff, #007aff);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
  flex: 0 0 auto;
}
.brand-logo svg { width: 17px; height: 17px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.side-close { display: none; margin-left: auto; color: var(--text-2); padding: 6px; border-radius: 8px; }
.side-close svg { width: 20px; height: 20px; display: block; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 450;
  text-align: left;
  transition: background 0.15s var(--ease);
}
.nav-item:hover { background: var(--hover); }
.nav-item.is-active {
  background: var(--blue);
  color: #fff;
  font-weight: 550;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.28);
}
.nav-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-count { color: rgba(255, 255, 255, 0.85); }
.nav-toggle { font-size: 11.5px; color: var(--text-2); }

.side-section { margin-top: 18px; flex: 0 0 auto; }
.side-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 0 10px 6px;
  letter-spacing: 0.03em;
}
.loc-list { display: flex; flex-direction: column; gap: 1px; }
.loc-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background 0.15s var(--ease);
}
.loc-item:hover { background: var(--hover); }
.loc-item.is-active { background: var(--hover); font-weight: 550; }
.loc-item svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--blue); }
.loc-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot {
  margin-top: auto;
  padding: 12px 0 10px;
  flex: 0 0 auto;
}
.usage {
  border-top: 1px solid var(--border);
  padding: 12px 10px 10px;
  margin-bottom: 4px;
}
.usage-line { font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.usage-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

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

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--sidebar-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.topbar .menu-btn { display: none; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
}
.crumb {
  padding: 3px 7px;
  border-radius: 7px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.crumb:hover { background: var(--hover); }
.crumb.is-last { font-weight: 700; }
.crumb-sep { color: var(--text-3); flex: 0 0 auto; font-weight: 400; }
.crumb.is-clickable { cursor: pointer; }

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

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  width: 190px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), width 0.22s var(--ease);
}
.search:focus-within { border-color: var(--blue); background: var(--surface); }
.search svg { width: 14px; height: 14px; color: var(--text-2); flex: 0 0 auto; }
.search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.search input::-webkit-search-cancel-button { display: none; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  transition: background 0.15s var(--ease);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.is-on { background: var(--surface-2); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.26);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary svg { width: 15px; height: 15px; }

/* ============================================================
   多选操作条
   ============================================================ */
.selbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 8px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 25;
  animation: rise 0.24s var(--ease) both;
}
.selbar-x {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-2);
}
.selbar-x:hover { background: var(--hover); }
.selbar-x svg { width: 15px; height: 15px; }
.selbar-count { font-size: 13px; font-weight: 600; padding: 0 8px; white-space: nowrap; }
.selbar-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  transition: background 0.15s var(--ease);
}
.selbar-act:hover { background: var(--hover); }
.selbar-act.danger { color: var(--red); }
.selbar-act.danger:hover { background: rgba(255, 59, 48, 0.1); }
.selbar-act svg { width: 15px; height: 15px; }

/* ============================================================
   内容区
   ============================================================ */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  position: relative;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
  user-select: none;
  animation: pop 0.32s var(--ease) both;
  aspect-ratio: 6 / 7;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card.is-selected { box-shadow: 0 0 0 3px var(--blue), var(--shadow-md); }

.card-thumb {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #f3f4f7, #dfe3ea);
  display: grid;
  place-items: center;
  overflow: hidden;
}
[data-theme="dark"] .card-thumb { background: linear-gradient(160deg, #2c2c2e, #1c1c1e); }
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: fade 0.3s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.card-thumb .ph-ico { width: 46px; height: 46px; color: var(--blue); opacity: 0.9; }
.card-thumb .ph-ico.video { color: #8e8e93; }
.card-thumb .ph-ico.doc { color: #8e8e93; }
.card-thumb .ph-ext {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-2);
  opacity: 0.7;
}

.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(120, 120, 128, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-transform: uppercase;
}

.card-check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.16s var(--ease), background 0.16s var(--ease);
  z-index: 2;
}
.card:hover .card-check { opacity: 1; }
.card.is-selected .card-check {
  opacity: 1;
  background: var(--blue);
  border-color: var(--blue);
}
.card-check svg { width: 13px; height: 13px; color: #fff; opacity: 0; transition: opacity 0.14s var(--ease); }
.card.is-selected .card-check svg { opacity: 1; }

.card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px 12px 11px;
  background: linear-gradient(to top,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.72) 46%,
    rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}
.card.is-img .card-info {
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.76) 0%,
    rgba(0, 0, 0, 0.40) 46%,
    rgba(0, 0, 0, 0) 100%);
}
.card-name {
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
  color: var(--text);
}
.card-sub {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.card.is-img .card-name { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.card.is-img .card-sub { color: rgba(255, 255, 255, 0.86); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); }

/* 深色模式下，文件夹/文档卡片的底部渐变也要压暗 */
[data-theme="dark"] .card-info {
  background: linear-gradient(to top,
    rgba(20, 20, 22, 0.94) 0%,
    rgba(20, 20, 22, 0.66) 46%,
    rgba(20, 20, 22, 0) 100%);
}

/* 列表视图 */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.14s var(--ease);
  user-select: none;
  animation: pop 0.3s var(--ease) both;
}
.list-row:hover { background: var(--hover); }
.list-row.is-selected { background: rgba(0, 122, 255, 0.1); }
.list-ico {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.list-ico img { width: 100%; height: 100%; object-fit: cover; }
.list-ico svg { width: 22px; height: 22px; color: var(--blue); }
.list-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-size {
  flex: 0 0 100px;
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.list-date {
  flex: 0 0 110px;
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.list-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 90px 20px;
  text-align: center;
  color: var(--text-2);
}
.empty-ico { width: 62px; height: 62px; color: var(--text-3); opacity: 0.6; margin-bottom: 14px; }
.empty-ico svg { width: 100%; height: 100%; }
.empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--text); }
.empty-sub { margin: 0; font-size: 13px; }

/* ============================================================
   灯箱
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade 0.2s var(--ease) both;
}
.lb-btn {
  position: absolute;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(48, 48, 51, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}
.lb-btn:hover { background: rgba(72, 72, 76, 0.9); }
.lb-btn:active { transform: scale(0.94); }
.lb-btn svg { width: 20px; height: 20px; }
.lb-close { top: 16px; left: 16px; }
.lb-dl { top: 16px; right: 16px; }
.lb-nav { top: 50%; margin-top: -19px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-title {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  font-weight: 550;
  z-index: 3;
  max-width: 50%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-stage {
  max-width: calc(100% - 160px);
  max-height: calc(100% - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  border-radius: 6px;
  animation: fade 0.22s var(--ease) both;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lb-strip {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  gap: 7px;
  justify-content: center;
  overflow-x: auto;
  padding: 4px 20px;
  scrollbar-width: none;
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-thumb {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  overflow: hidden;
  flex: 0 0 auto;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: opacity 0.15s var(--ease), border-color 0.15s var(--ease);
  background: var(--surface-2);
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb:hover { opacity: 0.85; }
.lb-thumb.is-active { opacity: 1; border-color: #fff; }

/* ============================================================
   拖放遮罩
   ============================================================ */
.dropzone {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 122, 255, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.dropzone-inner {
  text-align: center;
  color: var(--blue);
  border: 2.5px dashed var(--blue);
  border-radius: 22px;
  padding: 42px 66px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.dropzone-inner svg { width: 46px; height: 46px; }
.dropzone-inner p { margin: 12px 0 0; font-size: 15px; font-weight: 600; }

/* ============================================================
   Toast
   ============================================================ */
.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  animation: rise 0.26s var(--ease) both;
  max-width: 80vw;
  text-align: center;
}
.toast.err { background: rgba(255, 59, 48, 0.94); }
.toast.ok { background: rgba(52, 199, 89, 0.94); }

/* ============================================================
   移动端
   ============================================================ */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 25;
  animation: fade 0.2s var(--ease) both;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease);
    background: var(--bg-elev);
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.is-open { transform: none; }
  .side-close { display: block; }
  .topbar .menu-btn { display: grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .crumb { max-width: 110px; }
  .search { width: 34px; padding: 0 9px; }
  .search:focus-within { width: 150px; }
  .search input { display: none; }
  .search:focus-within input { display: block; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 0 10px; }
  .content { padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .card { border-radius: 14px; }
  .card-info { padding: 22px 9px 8px; }
  .card-name { font-size: 11.5px; }
  .card-sub { font-size: 10px; }
  .card-badge { font-size: 9px; padding: 1.5px 5px; top: 6px; right: 6px; }
  .card-check { width: 20px; height: 20px; top: 6px; left: 6px; }
  .list-size, .list-date { display: none; }
  .lb-stage { max-width: 100%; }
  .lb-stage img, .lb-stage video { max-height: calc(100vh - 130px); }
  .lb-thumb { width: 42px; height: 42px; }
  .selbar { top: 8px; }
  .selbar-act { padding: 0 9px; font-size: 12.5px; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .crumbs { font-size: 13.5px; }
}

/* ================================================================
   多用户：当前用户 + 用户管理
   ================================================================ */

.whoami {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: var(--hover);
}
.whoami-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}
.whoami-name {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whoami-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 159, 10, 0.16);
  color: #b76e00;
  font-weight: 600;
  flex: none;
}
[data-theme="dark"] .whoami-badge {
  background: rgba(255, 159, 10, 0.2);
  color: #ffb340;
}

/* ---------------- 管理面板 ---------------- */
.admin-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--bg);
  overflow: auto;
  padding: 28px 20px 60px;
  animation: fadeIn 0.22s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.admin-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
}
.admin-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-title { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.admin-sub { margin: 5px 0 0; font-size: 13px; color: var(--text-2); }

.admin-create {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.admin-input {
  flex: 1 1 150px;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.admin-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}
.admin-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.admin-check input { accent-color: var(--blue); width: 15px; height: 15px; }

.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-empty { color: var(--text-2); font-size: 13px; text-align: center; padding: 24px 0; }
.admin-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}
.admin-info { flex: 1; min-width: 0; }
.admin-uname {
  font-size: 14px;
  font-weight: 560;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-role {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 159, 10, 0.16);
  color: #b76e00;
  font-weight: 600;
  flex: none;
}
[data-theme="dark"] .admin-role {
  background: rgba(255, 159, 10, 0.2);
  color: #ffb340;
}
.admin-meta { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.admin-ops { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.btn-ghost {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}
.btn-ghost:hover { background: var(--hover); }
.btn-ghost.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost.danger { color: var(--red); }
.btn-ghost.danger:hover { background: rgba(255, 59, 48, 0.1); }

.admin-tip {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ---------------- 改密码弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.18s var(--ease);
}
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.modal-title { margin: 0; font-size: 17px; font-weight: 640; }
.modal-sub { margin: -6px 0 0; font-size: 13px; color: var(--text-2); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

@media (max-width: 640px) {
  .admin-card { padding: 18px 15px; }
  .admin-row { flex-wrap: wrap; }
  .admin-ops { width: 100%; justify-content: flex-start; }
}
